Skip to content

Commit

Permalink
feat: remove cluster confirmation (#7602)
Browse files Browse the repository at this point in the history
feat: remove cluster confirmation (#7602)

Signed-off-by: viktorplakida <plakyda1@gmail.com>
  • Loading branch information
plakyda-codefresh committed Nov 2, 2021
1 parent 8a6b759 commit 6036e9b
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions ui/src/app/settings/components/clusters-list/clusters-list.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {DropDownMenu} from 'argo-ui';
import {DropDownMenu, ErrorNotification, NotificationType} from 'argo-ui';
import * as React from 'react';
import {RouteComponentProps} from 'react-router-dom';
import {clusterName, ConnectionStateIcon, DataLoader, EmptyState, Page} from '../../../shared/components';
Expand Down Expand Up @@ -51,13 +51,27 @@ export const ClustersList = (props: RouteComponentProps<{}>) => {
items={[
{
title: 'Delete',
action: () =>
services.clusters.delete(cluster.server).finally(() => {
ctx.navigation.goto('.', {new: null}, {replace: true});
if (clustersLoaderRef.current) {
clustersLoaderRef.current.reload();
action: async () => {
const confirmed = await ctx.popup.confirm(
'Delete cluster?',
`Are you sure you want to delete cluster: ${cluster.name}`
);
if (confirmed) {
try {
services.clusters.delete(cluster.server).finally(() => {
ctx.navigation.goto('.', {new: null}, {replace: true});
if (clustersLoaderRef.current) {
clustersLoaderRef.current.reload();
}
});
} catch (e) {
ctx.notifications.show({
content: <ErrorNotification title='Unable to delete cluster' e={e} />,
type: NotificationType.Error
});
}
})
}
}
}
]}
/>
Expand Down

0 comments on commit 6036e9b

Please sign in to comment.