diff --git a/public/app/percona/add-instance/components/AddInstance/AddInstance.tsx b/public/app/percona/add-instance/components/AddInstance/AddInstance.tsx index 7f87cd7b97d42..19f5d4b9b95e0 100644 --- a/public/app/percona/add-instance/components/AddInstance/AddInstance.tsx +++ b/public/app/percona/add-instance/components/AddInstance/AddInstance.tsx @@ -17,12 +17,7 @@ export const SelectInstance: FC = ({ type, isSelected, icon const styles = useStyles2(getStyles); return ( - + {title} {Messages.titles.addInstance} @@ -36,12 +31,12 @@ export const AddInstance: FC = ({ selectedInstanceType, onSele const styles2 = useStyles2(getStyles); const instanceList = useMemo( () => [ - { type: Databases.postgresql, title: Messages.titles.postgresql, icon: 'percona-database-postgresql' }, + { type: InstanceTypesExtra.rds, title: Messages.titles.rds }, { type: Databases.mysql, title: Messages.titles.mysql, icon: 'percona-database-mysql' }, { type: Databases.mongodb, title: Messages.titles.mongodb, icon: 'percona-database-mongodb' }, + { type: Databases.postgresql, title: Messages.titles.postgresql, icon: 'percona-database-postgresql' }, { type: Databases.proxysql, title: Messages.titles.proxysql, icon: 'percona-database-proxysql' }, { type: Databases.haproxy, title: Messages.titles.haproxy, icon: 'percona-database-haproxy' }, - { type: InstanceTypesExtra.rds, title: Messages.titles.rds }, { type: InstanceTypesExtra.external, title: Messages.titles.external }, { type: InstanceTypesExtra.azure, title: Messages.titles.azure, isHidden: !showAzure }, ], diff --git a/public/app/percona/add-instance/panel.tsx b/public/app/percona/add-instance/panel.tsx index 56914908f7650..7551a91a16b28 100644 --- a/public/app/percona/add-instance/panel.tsx +++ b/public/app/percona/add-instance/panel.tsx @@ -37,7 +37,6 @@ const AddInstancePanel = () => { const [selectedInstance, selectInstance] = useState({ type: availableInstanceTypes.includes(instanceType as AvailableTypes) ? instanceType : '', }); - const [formName, setFormName] = useState(instanceType ? ADD_INSTANCE_FORM_NAME : ''); const [showSelection, setShowSelection] = useState(!instanceType); const [submitting, setSubmitting] = useState(false); const history = useHistory(); @@ -77,7 +76,7 @@ const AddInstancePanel = () => { [showSelection, selectedInstance] ); - const handleCancel: MouseEventHandler = () => { + const handleCancel: MouseEventHandler = (e) => { if (showSelection) { history.push('/inventory/services'); } else { @@ -85,17 +84,12 @@ const AddInstancePanel = () => { } selectInstance({ type: '' }); setShowSelection(true); - setFormName(''); }; - const handleShowConfiguration: MouseEventHandler = (e) => { + const handleSelectInstance = (instance: InstanceAvailable) => { + history.push('/add-instance/' + instance.type); + selectInstance(instance); setShowSelection(false); - history.push('/add-instance/' + selectedInstance.type); - - if (showSelection) { - e.preventDefault(); - setFormName(ADD_INSTANCE_FORM_NAME); - } }; return ( @@ -107,14 +101,11 @@ const AddInstancePanel = () => { {showSelection ? Messages.selectionStep.cancel : Messages.configurationStep.cancel} - - {submitLabel} - + {!showSelection && ( + + {submitLabel} + + )} @@ -122,7 +113,7 @@ const AddInstancePanel = () => { ) : (