Skip to content

Commit a1b0bc9

Browse files
Merge pull request #96 from containerum/69-add-alert-of-successful-project-deletion-from-project-page
69-add-alert-of-successful-project-deletion-from-project-page: Fixed
2 parents 2e0c00d + 766286c commit a1b0bc9

1 file changed

Lines changed: 17 additions & 6 deletions

File tree

src/containers/Namespace/index.js

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ type Props = {
6161
getProfileReducer: Object,
6262
deleteNamespaceReducer: NamespaceType,
6363
fetchGetNamespacesIfNeeded: () => void,
64-
fetchDeleteNamespaceIfNeeded: (idName: string) => void
64+
fetchDeleteNamespaceIfNeeded: (idName: string, idLabel: string) => void
6565
};
6666

6767
export class Namespace extends PureComponent<Props> {
@@ -100,7 +100,7 @@ export class Namespace extends PureComponent<Props> {
100100
nextProps.deleteNamespaceReducer.readyStatus &&
101101
nextProps.deleteNamespaceReducer.readyStatus === DELETE_NAMESPACE_SUCCESS
102102
) {
103-
this.props.history.push('/');
103+
this.props.history.push(routerLinks.namespaces);
104104
}
105105
}
106106

@@ -126,8 +126,14 @@ export class Namespace extends PureComponent<Props> {
126126
});
127127
};
128128
handleDelete = () => {
129-
const { match, fetchDeleteNamespaceIfNeeded } = this.props;
130-
fetchDeleteNamespaceIfNeeded(match.params.idName);
129+
const { match, getNamespacesReducer } = this.props;
130+
const currentNamespace = getNamespacesReducer.data.find(
131+
namespace => namespace.id === match.params.idName
132+
);
133+
this.props.fetchDeleteNamespaceIfNeeded(
134+
match.params.idName,
135+
currentNamespace.label
136+
);
131137
};
132138

133139
renderNamespaceInfo = () => {
@@ -244,7 +250,7 @@ export class Namespace extends PureComponent<Props> {
244250
} else if (isSecretsPathname) {
245251
additionalPath = secretsPathname;
246252
}
247-
const { status, idLabel, err } = deleteNamespaceReducer;
253+
const { status, idLabel, err, method: methodDel } = deleteNamespaceReducer;
248254
const { inputName, isOpened, role } = this.state;
249255
let currentNamespace;
250256
if (getNamespacesReducer.readyStatus === GET_NAMESPACES_SUCCESS) {
@@ -258,7 +264,12 @@ export class Namespace extends PureComponent<Props> {
258264
{currentNamespace && (
259265
<Helmet title={`Project - ${currentNamespace.label}`} />
260266
)}
261-
<Notification status={status} name={idLabel} errorMessage={err} />
267+
<Notification
268+
status={status}
269+
name={idLabel}
270+
errorMessage={err}
271+
method={methodDel}
272+
/>
262273
{currentNamespace && (
263274
<DeleteModal
264275
type="Project"

0 commit comments

Comments
 (0)