console: fix remove source cascading

[DSF-437]: https://hasurahq.atlassian.net/browse/DSF-437?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9642
GitOrigin-RevId: fc18f90cc328b78124b3254783b44da6cb51022e
This commit is contained in:
Nicolas Inchauspe 2023-06-23 09:42:11 +02:00 committed by hasura-bot
parent 5dc4630b5e
commit 3af0d49dd7
3 changed files with 9 additions and 2 deletions

View File

@ -108,6 +108,8 @@ export const ListConnectedDatabases = (props?: { className?: string }) => {
resourceName: databaseItem.dataSourceName,
resourceType: 'Data Source',
destroyTerm: 'remove',
appendTerm:
'Any metadata dependent objects (relationships, permissions etc.) from other sources will also be dropped as a result.',
onConfirm: async () => {
let success = true;

View File

@ -35,6 +35,7 @@ export const useDropSource = (props?: MetadataMigrationOptions) => {
type: `${driver}_drop_source`,
args: {
name: dataSourceName,
cascade: true,
},
},
},

View File

@ -208,11 +208,13 @@ const useDestructiveConfirm = () => {
resourceName,
resourceType,
destroyTerm = 'remove',
appendTerm = '',
onConfirm,
}: {
resourceName: string;
resourceType: string;
destroyTerm?: 'delete' | 'remove';
appendTerm?: string;
onConfirm: () => Promise<boolean>;
}) => {
if (!onConfirm) throw new Error('onCloseAsync() is required.');
@ -222,7 +224,7 @@ const useDestructiveConfirm = () => {
message: (
<div>
Are you sure you want to {destroyTerm} {resourceType}:{' '}
<strong>{resourceName}</strong>?
<strong>{resourceName}</strong>?{appendTerm ? ` ${appendTerm}` : ''}
</div>
),
confirmText: 'Remove',
@ -255,11 +257,13 @@ const useDestructivePrompt = () => {
resourceName,
resourceType,
destroyTerm = 'remove',
appendTerm = '',
onConfirm,
}: {
resourceName: string;
resourceType: string;
destroyTerm?: 'delete' | 'remove';
appendTerm?: string;
onConfirm: () => Promise<boolean>;
}) => {
if (!onConfirm) throw new Error('onCloseAsync() is required.');
@ -269,7 +273,7 @@ const useDestructivePrompt = () => {
message: (
<div>
Are you sure you want to {destroyTerm} {resourceType}:{' '}
<strong>{resourceName}</strong>?
<strong>{resourceName}</strong>?{appendTerm ? ` ${appendTerm}` : ''}
</div>
),
confirmText: 'Remove',