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, resourceName: databaseItem.dataSourceName,
resourceType: 'Data Source', resourceType: 'Data Source',
destroyTerm: 'remove', destroyTerm: 'remove',
appendTerm:
'Any metadata dependent objects (relationships, permissions etc.) from other sources will also be dropped as a result.',
onConfirm: async () => { onConfirm: async () => {
let success = true; let success = true;

View File

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

View File

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