Skip to content

Commit 26e45e7

Browse files
committed
Refactor delete namespace modal
1 parent 635024b commit 26e45e7

File tree

4 files changed

+20
-5
lines changed

4 files changed

+20
-5
lines changed

frontend/packages/console-app/console-extensions.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,6 +1338,17 @@
13381338
"provider": { "$codeRef": "defaultProvider.useDefaultActionsProvider" }
13391339
}
13401340
},
1341+
{
1342+
"type": "console.action/resource-provider",
1343+
"properties": {
1344+
"model": {
1345+
"group": "project.openshift.io",
1346+
"version": "v1",
1347+
"kind": "Project"
1348+
},
1349+
"provider": { "$codeRef": "projectProvider.useProjectActionsProvider" }
1350+
}
1351+
},
13411352
{
13421353
"type": "console.action/resource-provider",
13431354
"properties": {

frontend/packages/console-app/locales/en/console-app.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@
237237
"Restore as new PVC": "Restore as new PVC",
238238
"Volume Snapshot is not Ready": "Volume Snapshot is not Ready",
239239
"View instances": "View instances",
240+
"Delete {{label}}": "Delete {{label}}",
240241
"Current default StorageClass": "Current default StorageClass",
241242
"Set as default": "Set as default",
242243
"Access mode": "Access mode",

frontend/packages/console-app/src/actions/providers/project-provider.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@ const useDeleteAction = (kindObj: K8sModel, resource: K8sResourceKind) => {
1616
() => ({
1717
delete: () => ({
1818
id: 'delete-project',
19-
label: t('console-app~Delete Project'),
19+
label: t('console-app~Delete {{label}}', { label: t(kindObj.labelKey) }),
2020
cta: launchDeleteModal,
2121
accessReview: asAccessReview(kindObj, resource, 'delete'),
2222
}),
2323
}),
24+
// missing launchDeleteModal dependency, that causes max depth exceeded error
2425
// eslint-disable-next-line react-hooks/exhaustive-deps
2526
[kindObj, resource, t],
2627
);

frontend/public/components/modals/delete-namespace-modal.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ import {
2121
ModalVariant,
2222
ModalBody,
2323
ModalFooter,
24+
Content,
25+
ContentVariants,
2426
} from '@patternfly/react-core';
2527
import { OverlayComponent, useOverlay } from '@console/dynamic-plugin-sdk/src/lib-core';
2628
import { ErrorMessage } from '../utils/button-bar';
@@ -80,19 +82,19 @@ export const DeleteNamespaceModal: OverlayComponent<DeleteNamespaceModalProps> =
8082
titleIconVariant="warning"
8183
/>
8284
<ModalBody>
83-
<p className="pf-v6-u-mb-md">
85+
<Content component={ContentVariants.p}>
8486
<Trans t={t} ns="public">
8587
This action cannot be undone. It will destroy all pods, services and other objects in
8688
the namespace{' '}
8789
<strong className="co-break-word">{{ name: resource.metadata.name }}</strong>.
8890
</Trans>
89-
</p>
90-
<p className="pf-v6-u-mb-md">
91+
</Content>
92+
<Content component={ContentVariants.p}>
9193
<Trans t={t} ns="public">
9294
Confirm deletion by typing{' '}
9395
<strong className="co-break-word">{{ name: resource.metadata.name }}</strong> below:
9496
</Trans>
95-
</p>
97+
</Content>
9698
<span className="pf-v6-c-form-control">
9799
<input
98100
type="text"

0 commit comments

Comments
 (0)