Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 1981272: When deleting PVC inside PVC page the status in the heading doesn't match the status field #9569

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 9 additions & 2 deletions frontend/public/components/modals/delete-pvc-modal.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import * as React from 'react';
import { useHistory } from 'react-router-dom';
import { Stack, StackItem } from '@patternfly/react-core';
import { Trans, useTranslation } from 'react-i18next';
import { HandlePromiseProps, withHandlePromise } from '../utils';
import { HandlePromiseProps, withHandlePromise, resourceListPathFromModel } from '../utils';
import { getName, YellowExclamationTriangleIcon } from '@console/shared';
import { useResolvedExtensions } from '@console/dynamic-plugin-sdk/src/api/useResolvedExtensions';
import { isPVCDelete, PVCDelete } from '@console/dynamic-plugin-sdk/src/extensions/pvc';
Expand All @@ -21,6 +22,7 @@ const DeletePVCModal = withHandlePromise<DeletePVCModalProps>((props) => {
const pvcName = getName(pvc);
const { t } = useTranslation();
const pvcMetadata = { metadata: { ...pvc?.metadata } };
const history = useHistory();

const submit = (e) => {
e.preventDefault();
Expand All @@ -30,7 +32,12 @@ const DeletePVCModal = withHandlePromise<DeletePVCModalProps>((props) => {
({ properties: { predicate, onPVCKill } }) =>
predicate(pvcMetadata) && onPVCKill(pvcMetadata),
);
return handlePromise(Promise.all([promise, ...extensionPromises]), close);

handlePromise(Promise.all([promise, ...extensionPromises]), () => {
close();
// Redirect to resourcce list page if the resouce is deleted.
history.push(resourceListPathFromModel(PersistentVolumeClaimModel, pvc.metadata.namespace));
});
};

const alertComponents = pvcDeleteExtensions.map(
Expand Down
8 changes: 5 additions & 3 deletions frontend/public/components/persistent-volume-claim.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ const menuActions = [
ModifyLabels,
ModifyAnnotations,
Edit,
(kind, obj) => ({
(kind, pvc) => ({
label: i18next.t('public~Delete PersistentVolumeClaim'),
callback: () =>
deletePVCModal({
pvc: obj,
pvc,
}),
accessReview: asAccessReview(kind, obj, 'delete'),
accessReview: asAccessReview(kind, pvc, 'delete'),
}),
];

Expand Down Expand Up @@ -431,9 +431,11 @@ export const PersistentVolumeClaimsPage = (props) => {
/>
);
};

export const PersistentVolumeClaimsDetailsPage = (props) => (
<DetailsPage
{...props}
getResourceStatus={(pvc) => (pvc.metadata.deletionTimestamp ? 'Terminating' : pvc.status.phase)}
menuActions={menuActions}
pages={[
navFactory.details(Details),
Expand Down