Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/pages/project/instances/actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ export const useMakeInstanceActions = (
}),
label: instance.name,
resourceKind: 'instance',
extraContent: 'Any attached disks will be detached but not deleted.',
}),
disabled: !instanceCan.delete(instance) && (
<>Only {fancifyStates(instanceCan.delete.states)} instances can be deleted</>
Expand Down
9 changes: 7 additions & 2 deletions app/stores/confirm-delete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,22 @@ type DeleteConfig = {
*/
label: React.ReactNode
resourceKind?: string
extraContent?: React.ReactNode
}

export const confirmDelete =
({ doDelete, label, resourceKind }: DeleteConfig) =>
({ doDelete, label, resourceKind, extraContent }: DeleteConfig) =>
() => {
const displayLabel = typeof label === 'string' ? <HL>{label}</HL> : label
const modalTitle = resourceKind ? `Confirm delete ${resourceKind}` : 'Confirm delete'
useConfirmAction.setState({
actionConfig: {
doAction: doDelete,
modalContent: <p>Are you sure you want to delete {displayLabel}?</p>,
modalContent: (
<p>
Are you sure you want to delete {displayLabel}? {extraContent}
</p>
),
errorTitle: 'Could not delete resource',
modalTitle,
actionType: 'danger',
Expand Down