@@ -13,14 +13,44 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import type { FieldValidation } from '@rjsf/core';
|
||||
import {
|
||||
createScaffolderFieldExtension,
|
||||
TextValuePicker,
|
||||
FieldExtensionComponentProps,
|
||||
scaffolderPlugin,
|
||||
} from '@backstage/plugin-scaffolder';
|
||||
|
||||
import { TextField } from '@material-ui/core';
|
||||
|
||||
const TextValuePicker = (props: FieldExtensionComponentProps<string>) => {
|
||||
const {
|
||||
onChange,
|
||||
required,
|
||||
schema: { title, description },
|
||||
rawErrors,
|
||||
formData,
|
||||
uiSchema: { 'ui:autofocus': autoFocus },
|
||||
idSchema,
|
||||
placeholder,
|
||||
} = props;
|
||||
|
||||
return (
|
||||
<TextField
|
||||
id={idSchema?.$id}
|
||||
label={title}
|
||||
placeholder={placeholder}
|
||||
helperText={description}
|
||||
required={required}
|
||||
value={formData ?? ''}
|
||||
onChange={({ target: { value } }) => onChange(value)}
|
||||
margin="normal"
|
||||
error={rawErrors?.length > 0 && !formData}
|
||||
inputProps={{ autoFocus }}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export const LowerCaseValuePickerFieldExtension = scaffolderPlugin.provide(
|
||||
createScaffolderFieldExtension({
|
||||
name: 'LowerCaseValuePicker',
|
||||
|
||||
@@ -44,6 +44,7 @@ export const executeShellCommand = async (options: RunCommandOptions) => {
|
||||
options: spawnOptions,
|
||||
logStream = new PassThrough(),
|
||||
} = options;
|
||||
console.log('in exec shell commabnd');
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
const process = spawn(command, args, spawnOptions);
|
||||
|
||||
|
||||
@@ -76,14 +76,20 @@ export interface EntityPickerUiOptions {
|
||||
defaultKind?: string;
|
||||
}
|
||||
|
||||
// Warning: (ae-forgotten-export) The symbol "EntityTagsPickerUiOptions" needs to be exported by the entry point index.d.ts
|
||||
//
|
||||
// @public
|
||||
export const EntityTagsPickerFieldExtension: FieldExtensionComponentProps<
|
||||
string[],
|
||||
EntityTagsPickerUiOptions
|
||||
>;
|
||||
|
||||
// Warning: (ae-missing-release-tag) "EntityTagsPickerUiOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
export interface EntityTagsPickerUiOptions {
|
||||
// (undocumented)
|
||||
kinds?: string[];
|
||||
}
|
||||
|
||||
// Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts
|
||||
// Warning: (ae-missing-release-tag) "FavouriteTemplate" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
|
||||
@@ -14,12 +14,35 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import React from 'react';
|
||||
import { TextValuePicker } from '../TextValuePicker';
|
||||
import { FieldExtensionComponentProps } from '../../../extensions';
|
||||
import { TextField } from '@material-ui/core';
|
||||
|
||||
export const EntityNamePicker = ({
|
||||
schema: { title = 'Name', description = 'Unique name of the component' },
|
||||
...props
|
||||
}: FieldExtensionComponentProps<string>) => (
|
||||
<TextValuePicker schema={{ title, description }} {...props} />
|
||||
);
|
||||
export const EntityNamePicker = (
|
||||
props: FieldExtensionComponentProps<string>,
|
||||
) => {
|
||||
const {
|
||||
onChange,
|
||||
required,
|
||||
schema: { title = 'Name', description = 'Unique name of the component' },
|
||||
rawErrors,
|
||||
formData,
|
||||
uiSchema: { 'ui:autofocus': autoFocus },
|
||||
idSchema,
|
||||
placeholder,
|
||||
} = props;
|
||||
|
||||
return (
|
||||
<TextField
|
||||
id={idSchema?.$id}
|
||||
label={title}
|
||||
placeholder={placeholder}
|
||||
helperText={description}
|
||||
required={required}
|
||||
value={formData ?? ''}
|
||||
onChange={({ target: { value } }) => onChange(value)}
|
||||
margin="normal"
|
||||
error={rawErrors?.length > 0 && !formData}
|
||||
inputProps={{ autoFocus }}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Copyright 2021 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { TextField } from '@material-ui/core';
|
||||
import React from 'react';
|
||||
import { FieldExtensionComponentProps } from '../../../extensions';
|
||||
|
||||
export const TextValuePicker = ({
|
||||
onChange,
|
||||
required,
|
||||
schema: { title, description },
|
||||
rawErrors,
|
||||
formData,
|
||||
uiSchema: { 'ui:autofocus': autoFocus },
|
||||
idSchema,
|
||||
placeholder,
|
||||
}: FieldExtensionComponentProps<string>) => (
|
||||
<TextField
|
||||
id={idSchema?.$id}
|
||||
label={title}
|
||||
placeholder={placeholder}
|
||||
helperText={description}
|
||||
required={required}
|
||||
value={formData ?? ''}
|
||||
onChange={({ target: { value } }) => onChange(value)}
|
||||
margin="normal"
|
||||
error={rawErrors?.length > 0 && !formData}
|
||||
inputProps={{ autoFocus }}
|
||||
/>
|
||||
);
|
||||
@@ -1,16 +0,0 @@
|
||||
/*
|
||||
* Copyright 2021 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export { TextValuePicker } from './TextValuePicker';
|
||||
Reference in New Issue
Block a user