From 504661ab093ad05e68fdc5c04c76f4ba486ad8fa Mon Sep 17 00:00:00 2001 From: blam Date: Fri, 14 Jun 2024 11:07:46 +0200 Subject: [PATCH] chore: show an error for now, do not replace Signed-off-by: blam --- .../PasswordWidget/PasswordWidget.tsx | 53 +++++++++++++++++++ .../src/next/components/Stepper/Stepper.tsx | 3 +- 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 plugins/scaffolder-react/src/next/components/PasswordWidget/PasswordWidget.tsx diff --git a/plugins/scaffolder-react/src/next/components/PasswordWidget/PasswordWidget.tsx b/plugins/scaffolder-react/src/next/components/PasswordWidget/PasswordWidget.tsx new file mode 100644 index 0000000000..6c1c2c176f --- /dev/null +++ b/plugins/scaffolder-react/src/next/components/PasswordWidget/PasswordWidget.tsx @@ -0,0 +1,53 @@ +/* + * Copyright 2024 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 { WidgetProps } from '@rjsf/utils'; +import InputLabel from '@material-ui/core/InputLabel'; +import Input from '@material-ui/core/Input'; +import React from 'react'; +import FormHelperText from '@material-ui/core/FormHelperText'; +import { MarkdownContent } from '@backstage/core-components'; + +export const PasswordWidget = ( + props: Pick, +) => { + const { + value, + onChange, + schema: { title }, + } = props; + + return ( + <> + {title} + { + onChange(e.target.value); + }} + value={value} + autoComplete="off" + /> + + + + + ); +}; diff --git a/plugins/scaffolder-react/src/next/components/Stepper/Stepper.tsx b/plugins/scaffolder-react/src/next/components/Stepper/Stepper.tsx index 00232e2cd7..fb950019ef 100644 --- a/plugins/scaffolder-react/src/next/components/Stepper/Stepper.tsx +++ b/plugins/scaffolder-react/src/next/components/Stepper/Stepper.tsx @@ -50,6 +50,7 @@ import { ReviewStepProps } from '@backstage/plugin-scaffolder-react'; import { ErrorListTemplate } from './ErrorListTemplate'; import { makeStyles } from '@material-ui/core/styles'; import { SecretWidget } from '../SecretWidget'; +import { PasswordWidget } from '../PasswordWidget/PasswordWidget'; const useStyles = makeStyles(theme => ({ backButton: { @@ -233,7 +234,7 @@ export const Stepper = (stepperProps: StepperProps) => { showErrorList="top" templates={{ ErrorListTemplate }} onChange={handleChange} - widgets={{ password: SecretWidget }} + widgets={{ password: PasswordWidget }} experimental_defaultFormStateBehavior={{ allOf: 'populateDefaults', }}