diff --git a/frontend/src/components/common/Resource/MainInfoSection/__snapshots__/MainInfoSection.Normal.stories.storyshot b/frontend/src/components/common/Resource/MainInfoSection/__snapshots__/MainInfoSection.Normal.stories.storyshot
index 22e8e5c331b..a273be6f428 100644
--- a/frontend/src/components/common/Resource/MainInfoSection/__snapshots__/MainInfoSection.Normal.stories.storyshot
+++ b/frontend/src/components/common/Resource/MainInfoSection/__snapshots__/MainInfoSection.Normal.stories.storyshot
@@ -48,7 +48,20 @@
>
+ >
+
+
+
diff --git a/frontend/src/components/common/Resource/MainInfoSection/__snapshots__/MainInfoSection.NullBacklink.stories.storyshot b/frontend/src/components/common/Resource/MainInfoSection/__snapshots__/MainInfoSection.NullBacklink.stories.storyshot
index d69fd3d48fc..5b595ca60f8 100644
--- a/frontend/src/components/common/Resource/MainInfoSection/__snapshots__/MainInfoSection.NullBacklink.stories.storyshot
+++ b/frontend/src/components/common/Resource/MainInfoSection/__snapshots__/MainInfoSection.NullBacklink.stories.storyshot
@@ -30,7 +30,20 @@
>
+ >
+
+
+
diff --git a/frontend/src/components/common/Resource/ResourceTableMultiActions.tsx b/frontend/src/components/common/Resource/ResourceTableMultiActions.tsx
index bb3fe5896cc..887db61aae1 100644
--- a/frontend/src/components/common/Resource/ResourceTableMultiActions.tsx
+++ b/frontend/src/components/common/Resource/ResourceTableMultiActions.tsx
@@ -3,6 +3,8 @@ import { MRT_TableInstance } from 'material-react-table';
import { useCallback } from 'react';
import { KubeObject } from '../../../lib/k8s/KubeObject';
import DeleteMultipleButton from './DeleteMultipleButton';
+import { isRestartableResource } from './RestartButton';
+import RestartMultipleButton from './RestartMultipleButton';
export interface ResourceTableMultiActionsProps> {
table: MRT_TableInstance;
@@ -12,16 +14,26 @@ export default function ResourceTableMultiActions
) {
const { table } = props;
+
const items = table.getSelectedRowModel().rows.map(t => t.original as unknown as KubeObject);
+ const restartableItems = items.filter(isRestartableResource);
const afterConfirm = useCallback(() => {
table.resetRowSelection();
}, [table]);
+
return (
-
-
-
-
+
+ {restartableItems.length > 0 && (
+
+
+
+ )}
+ {items.length > 0 && (
+
+
+
+ )}
);
}
diff --git a/frontend/src/components/common/Resource/RestartButton.tsx b/frontend/src/components/common/Resource/RestartButton.tsx
index e8e7b88c0b3..e818363c749 100644
--- a/frontend/src/components/common/Resource/RestartButton.tsx
+++ b/frontend/src/components/common/Resource/RestartButton.tsx
@@ -1,19 +1,12 @@
-import {
- Button,
- Dialog,
- DialogActions,
- DialogContent,
- DialogContentText,
- DialogTitle,
-} from '@mui/material';
import _ from 'lodash';
import { useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useDispatch } from 'react-redux';
+import { useLocation } from 'react-router';
import { apply } from '../../../lib/k8s/apiProxy';
+import DaemonSet from '../../../lib/k8s/daemonSet';
import Deployment from '../../../lib/k8s/deployment';
import { KubeObject } from '../../../lib/k8s/KubeObject';
-import ReplicaSet from '../../../lib/k8s/replicaSet';
import StatefulSet from '../../../lib/k8s/statefulSet';
import { clusterAction } from '../../../redux/clusterActionSlice';
import {
@@ -23,19 +16,30 @@ import {
} from '../../../redux/headlampEventSlice';
import { AppDispatch } from '../../../redux/stores/store';
import ActionButton, { ButtonStyle } from '../ActionButton';
+import ConfirmDialog from '../ConfirmDialog';
import AuthVisible from './AuthVisible';
+export type RestartableResource = Deployment | StatefulSet | DaemonSet;
+
+export function isRestartableResource(item: KubeObject): item is RestartableResource {
+ return item instanceof Deployment || item instanceof StatefulSet || item instanceof DaemonSet;
+}
+
interface RestartButtonProps {
- item: Deployment | StatefulSet | ReplicaSet;
+ item: RestartableResource;
buttonStyle?: ButtonStyle;
+ afterConfirm?: () => void;
}
export function RestartButton(props: RestartButtonProps) {
- const { item, buttonStyle } = props;
- const { t } = useTranslation();
- const [openDialog, setOpenDialog] = useState(false);
const dispatch: AppDispatch = useDispatch();
+ const { item, buttonStyle, afterConfirm } = props;
+ const [openDialog, setOpenDialog] = useState(false);
+ const location = useLocation();
+ const { t } = useTranslation(['translation']);
+ const dispatchRestartEvent = useEventCallback(HeadlampEventType.RESTART_RESOURCE);
+
function applyFunc() {
try {
const clonedItem = _.cloneDeep(item);
@@ -49,33 +53,22 @@ export function RestartButton(props: RestartButtonProps) {
}
}
- function handleClose() {
- setOpenDialog(false);
- }
-
function handleSave() {
- const cancelUrl = location.pathname;
const itemName = item.metadata.name;
- setOpenDialog(false);
-
- // setOpenDialog(false);
dispatch(
clusterAction(() => applyFunc(), {
startMessage: t('Restarting {{ itemName }}…', { itemName }),
cancelledMessage: t('Cancelled restarting {{ itemName }}.', { itemName }),
successMessage: t('Restarted {{ itemName }}.', { itemName }),
errorMessage: t('Failed to restart {{ itemName }}.', { itemName }),
- cancelUrl,
- errorUrl: cancelUrl,
+ cancelUrl: location.pathname,
+ startUrl: item.getListLink(),
+ errorUrl: item.getListLink(),
})
);
}
- if (!item || !['Deployment', 'StatefulSet', 'DaemonSet'].includes(item.kind)) {
- return null;
- }
-
return (
-
+ setOpenDialog(false)}
+ onConfirm={() => {
+ handleSave();
+ dispatchRestartEvent({
+ resource: item,
+ status: EventStatus.CONFIRMED,
+ });
+ if (afterConfirm) {
+ afterConfirm();
+ }
+ }}
+ />
);
}
-
-interface RestartDialogProps {
- resource: KubeObject;
- open: boolean;
- onClose: () => void;
- onSave: () => void;
-}
-
-function RestartDialog(props: RestartDialogProps) {
- const { resource, open, onClose, onSave } = props;
- const { t } = useTranslation();
- const dispatchRestartEvent = useEventCallback(HeadlampEventType.RESTART_RESOURCE);
-
- return (
-
- );
-}
diff --git a/frontend/src/components/common/Resource/RestartMultipleButton.tsx b/frontend/src/components/common/Resource/RestartMultipleButton.tsx
new file mode 100644
index 00000000000..2acff6387c8
--- /dev/null
+++ b/frontend/src/components/common/Resource/RestartMultipleButton.tsx
@@ -0,0 +1,108 @@
+import _ from 'lodash';
+import React from 'react';
+import { useTranslation } from 'react-i18next';
+import { useDispatch } from 'react-redux';
+import { useLocation } from 'react-router-dom';
+import { apply } from '../../../lib/k8s/apiProxy';
+import { clusterAction } from '../../../redux/clusterActionSlice';
+import {
+ EventStatus,
+ HeadlampEventType,
+ useEventCallback,
+} from '../../../redux/headlampEventSlice';
+import { AppDispatch } from '../../../redux/stores/store';
+import ActionButton, { ButtonStyle } from '../ActionButton';
+import ConfirmDialog from '../ConfirmDialog';
+import { RestartableResource } from './RestartButton';
+
+interface RestartMultipleButtonProps {
+ items: RestartableResource[];
+ buttonStyle?: ButtonStyle;
+ afterConfirm?: () => void;
+}
+
+function RestartMultipleButtonDescription(props: Pick) {
+ const { t } = useTranslation(['translation']);
+ return (
+
+ {t('Are you sure you want to restart the following items?')}
+
+ {props.items.map(item => (
+ - {item.metadata.name}
+ ))}
+
+
+ );
+}
+
+export default function RestartMultipleButton(props: RestartMultipleButtonProps) {
+ const dispatch: AppDispatch = useDispatch();
+ const { items, buttonStyle, afterConfirm } = props;
+ const [openDialog, setOpenDialog] = React.useState(false);
+ const { t } = useTranslation(['translation']);
+ const location = useLocation();
+ const dispatchRestartEvent = useEventCallback(HeadlampEventType.RESTART_RESOURCES);
+
+ function applyFunc() {
+ return Promise.all(
+ items.map(item => {
+ try {
+ const clonedItem = _.cloneDeep(item);
+ clonedItem.spec.template.metadata.annotations = {
+ ...clonedItem.spec.template.metadata.annotations,
+ 'kubectl.kubernetes.io/restartedAt': new Date().toISOString(),
+ };
+ return apply(clonedItem.jsonData);
+ } catch (err) {
+ console.error('Error while restarting resource:', err);
+ return Promise.reject(err);
+ }
+ })
+ );
+ }
+
+ const handleSave = () => {
+ const itemsLength = items.length;
+
+ dispatch(
+ clusterAction(() => applyFunc(), {
+ startMessage: t('Restarting {{ itemsLength }} items…', { itemsLength }),
+ cancelledMessage: t('Cancelled restarting {{ itemsLength }} items.', { itemsLength }),
+ successMessage: t('Restarted {{ itemsLength }} items.', { itemsLength }),
+ errorMessage: t('Failed to restart {{ itemsLength }} items.', { itemsLength }),
+ cancelUrl: location.pathname,
+ startUrl: location.pathname,
+ errorUrl: location.pathname,
+ })
+ );
+ };
+
+ return (
+ <>
+ {
+ setOpenDialog(true);
+ }}
+ icon="mdi:restart"
+ />
+ }
+ handleClose={() => setOpenDialog(false)}
+ onConfirm={() => {
+ handleSave();
+ dispatchRestartEvent({
+ resources: items,
+ status: EventStatus.CONFIRMED,
+ });
+ if (afterConfirm) {
+ afterConfirm();
+ }
+ }}
+ />
+ >
+ );
+}
diff --git a/frontend/src/components/common/Resource/index.test.ts b/frontend/src/components/common/Resource/index.test.ts
index c2786f7eba4..8a9de0f0c88 100644
--- a/frontend/src/components/common/Resource/index.test.ts
+++ b/frontend/src/components/common/Resource/index.test.ts
@@ -31,6 +31,7 @@ const checkExports = [
'resourceTableSlice',
'ResourceTableColumnChooser',
'RestartButton',
+ 'RestartMultipleButton',
'ScaleButton',
'SimpleEditor',
'ViewButton',
diff --git a/frontend/src/components/configmap/__snapshots__/Details.Empty.stories.storyshot b/frontend/src/components/configmap/__snapshots__/Details.Empty.stories.storyshot
index 9b7d70afaf6..dc126958684 100644
--- a/frontend/src/components/configmap/__snapshots__/Details.Empty.stories.storyshot
+++ b/frontend/src/components/configmap/__snapshots__/Details.Empty.stories.storyshot
@@ -62,7 +62,20 @@
>
+ >
+
+
+
diff --git a/frontend/src/components/configmap/__snapshots__/Details.WithBase.stories.storyshot b/frontend/src/components/configmap/__snapshots__/Details.WithBase.stories.storyshot
index 6fb2a76c9c3..ee78e1b948f 100644
--- a/frontend/src/components/configmap/__snapshots__/Details.WithBase.stories.storyshot
+++ b/frontend/src/components/configmap/__snapshots__/Details.WithBase.stories.storyshot
@@ -62,7 +62,20 @@
>
+ >
+
+
+
diff --git a/frontend/src/components/crd/__snapshots__/CustomResourceDefinition.Details.stories.storyshot b/frontend/src/components/crd/__snapshots__/CustomResourceDefinition.Details.stories.storyshot
index 711d954cf6c..ee576072a45 100644
--- a/frontend/src/components/crd/__snapshots__/CustomResourceDefinition.Details.stories.storyshot
+++ b/frontend/src/components/crd/__snapshots__/CustomResourceDefinition.Details.stories.storyshot
@@ -57,7 +57,20 @@
>
+ >
+
+
+
diff --git a/frontend/src/components/crd/__snapshots__/CustomResourceDetails.NoError.stories.storyshot b/frontend/src/components/crd/__snapshots__/CustomResourceDetails.NoError.stories.storyshot
index e9ac5f76628..01cdf28bd5a 100644
--- a/frontend/src/components/crd/__snapshots__/CustomResourceDetails.NoError.stories.storyshot
+++ b/frontend/src/components/crd/__snapshots__/CustomResourceDetails.NoError.stories.storyshot
@@ -57,7 +57,20 @@
>
+ >
+
+
+
diff --git a/frontend/src/components/cronjob/__snapshots__/CronJobDetails.EveryAst.stories.storyshot b/frontend/src/components/cronjob/__snapshots__/CronJobDetails.EveryAst.stories.storyshot
index 9b863e2aa09..87c932064d8 100644
--- a/frontend/src/components/cronjob/__snapshots__/CronJobDetails.EveryAst.stories.storyshot
+++ b/frontend/src/components/cronjob/__snapshots__/CronJobDetails.EveryAst.stories.storyshot
@@ -92,7 +92,20 @@
+ >
+
+
+
diff --git a/frontend/src/components/cronjob/__snapshots__/CronJobDetails.EveryMinute.stories.storyshot b/frontend/src/components/cronjob/__snapshots__/CronJobDetails.EveryMinute.stories.storyshot
index 0240bbe4cb9..b4716dc8aad 100644
--- a/frontend/src/components/cronjob/__snapshots__/CronJobDetails.EveryMinute.stories.storyshot
+++ b/frontend/src/components/cronjob/__snapshots__/CronJobDetails.EveryMinute.stories.storyshot
@@ -92,7 +92,20 @@
+ >
+
+
+
diff --git a/frontend/src/components/endpoints/__snapshots__/EndpointDetails.Default.stories.storyshot b/frontend/src/components/endpoints/__snapshots__/EndpointDetails.Default.stories.storyshot
index 8e1b195ed3b..40a885acb53 100644
--- a/frontend/src/components/endpoints/__snapshots__/EndpointDetails.Default.stories.storyshot
+++ b/frontend/src/components/endpoints/__snapshots__/EndpointDetails.Default.stories.storyshot
@@ -62,7 +62,20 @@
>
+ >
+
+
+
diff --git a/frontend/src/components/gateway/__snapshots__/ClassDetails.Basic.stories.storyshot b/frontend/src/components/gateway/__snapshots__/ClassDetails.Basic.stories.storyshot
index af9ce88ae1e..9cc7069816b 100644
--- a/frontend/src/components/gateway/__snapshots__/ClassDetails.Basic.stories.storyshot
+++ b/frontend/src/components/gateway/__snapshots__/ClassDetails.Basic.stories.storyshot
@@ -62,7 +62,20 @@
>
+ >
+
+
+
diff --git a/frontend/src/components/gateway/__snapshots__/GRPCRouteDetails.Basic.stories.storyshot b/frontend/src/components/gateway/__snapshots__/GRPCRouteDetails.Basic.stories.storyshot
index d5f1df43fe2..da047f974cc 100644
--- a/frontend/src/components/gateway/__snapshots__/GRPCRouteDetails.Basic.stories.storyshot
+++ b/frontend/src/components/gateway/__snapshots__/GRPCRouteDetails.Basic.stories.storyshot
@@ -62,7 +62,20 @@
>
+ >
+
+
+
diff --git a/frontend/src/components/gateway/__snapshots__/GatewayDetails.Basic.stories.storyshot b/frontend/src/components/gateway/__snapshots__/GatewayDetails.Basic.stories.storyshot
index 7963e644893..4ffee4fe6c6 100644
--- a/frontend/src/components/gateway/__snapshots__/GatewayDetails.Basic.stories.storyshot
+++ b/frontend/src/components/gateway/__snapshots__/GatewayDetails.Basic.stories.storyshot
@@ -62,7 +62,20 @@
>
+ >
+
+
+
diff --git a/frontend/src/components/gateway/__snapshots__/HTTPRouteDetails.Basic.stories.storyshot b/frontend/src/components/gateway/__snapshots__/HTTPRouteDetails.Basic.stories.storyshot
index 71fccfe6d7d..f98b1e378dd 100644
--- a/frontend/src/components/gateway/__snapshots__/HTTPRouteDetails.Basic.stories.storyshot
+++ b/frontend/src/components/gateway/__snapshots__/HTTPRouteDetails.Basic.stories.storyshot
@@ -62,7 +62,20 @@
>
+ >
+
+
+
diff --git a/frontend/src/components/horizontalPodAutoscaler/__snapshots__/HPADetails.Default.stories.storyshot b/frontend/src/components/horizontalPodAutoscaler/__snapshots__/HPADetails.Default.stories.storyshot
index a026353bb3a..66b02240eac 100644
--- a/frontend/src/components/horizontalPodAutoscaler/__snapshots__/HPADetails.Default.stories.storyshot
+++ b/frontend/src/components/horizontalPodAutoscaler/__snapshots__/HPADetails.Default.stories.storyshot
@@ -62,7 +62,20 @@
>
+ >
+
+
+
diff --git a/frontend/src/components/ingress/__snapshots__/ClassDetails.Basic.stories.storyshot b/frontend/src/components/ingress/__snapshots__/ClassDetails.Basic.stories.storyshot
index 08b4dc333d2..2186e0e3f6c 100644
--- a/frontend/src/components/ingress/__snapshots__/ClassDetails.Basic.stories.storyshot
+++ b/frontend/src/components/ingress/__snapshots__/ClassDetails.Basic.stories.storyshot
@@ -62,7 +62,20 @@
>
+ >
+
+
+
diff --git a/frontend/src/components/ingress/__snapshots__/ClassDetails.WithDefault.stories.storyshot b/frontend/src/components/ingress/__snapshots__/ClassDetails.WithDefault.stories.storyshot
index f7500583880..0956d1ec42e 100644
--- a/frontend/src/components/ingress/__snapshots__/ClassDetails.WithDefault.stories.storyshot
+++ b/frontend/src/components/ingress/__snapshots__/ClassDetails.WithDefault.stories.storyshot
@@ -62,7 +62,20 @@
>
+ >
+
+
+
diff --git a/frontend/src/components/ingress/__snapshots__/Details.WithResource.stories.storyshot b/frontend/src/components/ingress/__snapshots__/Details.WithResource.stories.storyshot
index d23738d23b4..bb40a853a25 100644
--- a/frontend/src/components/ingress/__snapshots__/Details.WithResource.stories.storyshot
+++ b/frontend/src/components/ingress/__snapshots__/Details.WithResource.stories.storyshot
@@ -62,7 +62,20 @@
>
+ >
+
+
+
diff --git a/frontend/src/components/ingress/__snapshots__/Details.WithTLS.stories.storyshot b/frontend/src/components/ingress/__snapshots__/Details.WithTLS.stories.storyshot
index d87018cb281..975f9fa4c24 100644
--- a/frontend/src/components/ingress/__snapshots__/Details.WithTLS.stories.storyshot
+++ b/frontend/src/components/ingress/__snapshots__/Details.WithTLS.stories.storyshot
@@ -62,7 +62,20 @@
>
+ >
+
+
+
diff --git a/frontend/src/components/ingress/__snapshots__/Details.WithWildcardTLS.stories.storyshot b/frontend/src/components/ingress/__snapshots__/Details.WithWildcardTLS.stories.storyshot
index cbe46040f60..8ff695e87f0 100644
--- a/frontend/src/components/ingress/__snapshots__/Details.WithWildcardTLS.stories.storyshot
+++ b/frontend/src/components/ingress/__snapshots__/Details.WithWildcardTLS.stories.storyshot
@@ -62,7 +62,20 @@
>
+ >
+
+
+
diff --git a/frontend/src/components/lease/__snapshots__/Details.LeaseDetail.stories.storyshot b/frontend/src/components/lease/__snapshots__/Details.LeaseDetail.stories.storyshot
index 5c884154497..78746a7f304 100644
--- a/frontend/src/components/lease/__snapshots__/Details.LeaseDetail.stories.storyshot
+++ b/frontend/src/components/lease/__snapshots__/Details.LeaseDetail.stories.storyshot
@@ -62,7 +62,20 @@
>
+ >
+
+
+
diff --git a/frontend/src/components/limitRange/__snapshots__/Details.LimitRangeDetail.stories.storyshot b/frontend/src/components/limitRange/__snapshots__/Details.LimitRangeDetail.stories.storyshot
index 4c934ad3093..51088adbcdd 100644
--- a/frontend/src/components/limitRange/__snapshots__/Details.LimitRangeDetail.stories.storyshot
+++ b/frontend/src/components/limitRange/__snapshots__/Details.LimitRangeDetail.stories.storyshot
@@ -62,7 +62,20 @@
>
+ >
+
+
+
diff --git a/frontend/src/components/namespace/__snapshots__/NamespaceDetails.Active.stories.storyshot b/frontend/src/components/namespace/__snapshots__/NamespaceDetails.Active.stories.storyshot
index 15e3b8b9af7..25eb0e45c10 100644
--- a/frontend/src/components/namespace/__snapshots__/NamespaceDetails.Active.stories.storyshot
+++ b/frontend/src/components/namespace/__snapshots__/NamespaceDetails.Active.stories.storyshot
@@ -62,7 +62,20 @@
>
+ >
+
+
+
diff --git a/frontend/src/components/pod/__snapshots__/PodDetails.Error.stories.storyshot b/frontend/src/components/pod/__snapshots__/PodDetails.Error.stories.storyshot
index 2a7df5c86c9..9b7a14e9831 100644
--- a/frontend/src/components/pod/__snapshots__/PodDetails.Error.stories.storyshot
+++ b/frontend/src/components/pod/__snapshots__/PodDetails.Error.stories.storyshot
@@ -107,7 +107,20 @@
+ >
+
+
+
diff --git a/frontend/src/components/pod/__snapshots__/PodDetails.Initializing.stories.storyshot b/frontend/src/components/pod/__snapshots__/PodDetails.Initializing.stories.storyshot
index cbf3288b920..8ea156b1fdb 100644
--- a/frontend/src/components/pod/__snapshots__/PodDetails.Initializing.stories.storyshot
+++ b/frontend/src/components/pod/__snapshots__/PodDetails.Initializing.stories.storyshot
@@ -107,7 +107,20 @@
+ >
+
+
+
diff --git a/frontend/src/components/pod/__snapshots__/PodDetails.LivenessFailed.stories.storyshot b/frontend/src/components/pod/__snapshots__/PodDetails.LivenessFailed.stories.storyshot
index ba88ddd57bb..af04d5e3650 100644
--- a/frontend/src/components/pod/__snapshots__/PodDetails.LivenessFailed.stories.storyshot
+++ b/frontend/src/components/pod/__snapshots__/PodDetails.LivenessFailed.stories.storyshot
@@ -107,7 +107,20 @@
+ >
+
+
+
diff --git a/frontend/src/components/pod/__snapshots__/PodDetails.PullBackOff.stories.storyshot b/frontend/src/components/pod/__snapshots__/PodDetails.PullBackOff.stories.storyshot
index 10bb00edc62..e025a3e0c1f 100644
--- a/frontend/src/components/pod/__snapshots__/PodDetails.PullBackOff.stories.storyshot
+++ b/frontend/src/components/pod/__snapshots__/PodDetails.PullBackOff.stories.storyshot
@@ -107,7 +107,20 @@
+ >
+
+
+
diff --git a/frontend/src/components/pod/__snapshots__/PodDetails.Running.stories.storyshot b/frontend/src/components/pod/__snapshots__/PodDetails.Running.stories.storyshot
index cacb1d08b65..0d459829bde 100644
--- a/frontend/src/components/pod/__snapshots__/PodDetails.Running.stories.storyshot
+++ b/frontend/src/components/pod/__snapshots__/PodDetails.Running.stories.storyshot
@@ -107,7 +107,20 @@
+ >
+
+
+
diff --git a/frontend/src/components/pod/__snapshots__/PodDetails.Successful.stories.storyshot b/frontend/src/components/pod/__snapshots__/PodDetails.Successful.stories.storyshot
index cc5f7d91dc7..2317eafcefa 100644
--- a/frontend/src/components/pod/__snapshots__/PodDetails.Successful.stories.storyshot
+++ b/frontend/src/components/pod/__snapshots__/PodDetails.Successful.stories.storyshot
@@ -107,7 +107,20 @@
+ >
+
+
+
diff --git a/frontend/src/components/podDisruptionBudget/__snapshots__/pdbDetails.Default.stories.storyshot b/frontend/src/components/podDisruptionBudget/__snapshots__/pdbDetails.Default.stories.storyshot
index b8fc59859cb..9ae63693866 100644
--- a/frontend/src/components/podDisruptionBudget/__snapshots__/pdbDetails.Default.stories.storyshot
+++ b/frontend/src/components/podDisruptionBudget/__snapshots__/pdbDetails.Default.stories.storyshot
@@ -62,7 +62,20 @@
>
+ >
+
+
+
diff --git a/frontend/src/components/priorityClass/__snapshots__/priorityClassDetails.Default.stories.storyshot b/frontend/src/components/priorityClass/__snapshots__/priorityClassDetails.Default.stories.storyshot
index 035b38e7cb9..77b798ff614 100644
--- a/frontend/src/components/priorityClass/__snapshots__/priorityClassDetails.Default.stories.storyshot
+++ b/frontend/src/components/priorityClass/__snapshots__/priorityClassDetails.Default.stories.storyshot
@@ -62,7 +62,20 @@
>
+ >
+
+
+
diff --git a/frontend/src/components/resourceQuota/__snapshots__/resourceQuotaDetails.Default.stories.storyshot b/frontend/src/components/resourceQuota/__snapshots__/resourceQuotaDetails.Default.stories.storyshot
index 9b40540733a..c0fd61d20e1 100644
--- a/frontend/src/components/resourceQuota/__snapshots__/resourceQuotaDetails.Default.stories.storyshot
+++ b/frontend/src/components/resourceQuota/__snapshots__/resourceQuotaDetails.Default.stories.storyshot
@@ -62,7 +62,20 @@
>
+ >
+
+
+
diff --git a/frontend/src/components/runtimeClass/__snapshots__/Details.Base.stories.storyshot b/frontend/src/components/runtimeClass/__snapshots__/Details.Base.stories.storyshot
index cfd9e8a01a9..7439abda10e 100644
--- a/frontend/src/components/runtimeClass/__snapshots__/Details.Base.stories.storyshot
+++ b/frontend/src/components/runtimeClass/__snapshots__/Details.Base.stories.storyshot
@@ -62,7 +62,20 @@
>
+ >
+
+
+
diff --git a/frontend/src/components/secret/__snapshots__/Details.Empty.stories.storyshot b/frontend/src/components/secret/__snapshots__/Details.Empty.stories.storyshot
index c4284210cfa..a17807f8494 100644
--- a/frontend/src/components/secret/__snapshots__/Details.Empty.stories.storyshot
+++ b/frontend/src/components/secret/__snapshots__/Details.Empty.stories.storyshot
@@ -62,7 +62,20 @@
>
+ >
+
+
+
diff --git a/frontend/src/components/secret/__snapshots__/Details.WithBase.stories.storyshot b/frontend/src/components/secret/__snapshots__/Details.WithBase.stories.storyshot
index 3a5f6d126a4..2e16d92d9c1 100644
--- a/frontend/src/components/secret/__snapshots__/Details.WithBase.stories.storyshot
+++ b/frontend/src/components/secret/__snapshots__/Details.WithBase.stories.storyshot
@@ -62,7 +62,20 @@
>
+ >
+
+
+
diff --git a/frontend/src/components/storage/__snapshots__/ClaimDetails.Base.stories.storyshot b/frontend/src/components/storage/__snapshots__/ClaimDetails.Base.stories.storyshot
index 630eedd472d..3637e374a4a 100644
--- a/frontend/src/components/storage/__snapshots__/ClaimDetails.Base.stories.storyshot
+++ b/frontend/src/components/storage/__snapshots__/ClaimDetails.Base.stories.storyshot
@@ -62,7 +62,20 @@
>
+ >
+
+
+
diff --git a/frontend/src/components/storage/__snapshots__/ClassDetails.Base.stories.storyshot b/frontend/src/components/storage/__snapshots__/ClassDetails.Base.stories.storyshot
index 4618009ca39..b0fe25be449 100644
--- a/frontend/src/components/storage/__snapshots__/ClassDetails.Base.stories.storyshot
+++ b/frontend/src/components/storage/__snapshots__/ClassDetails.Base.stories.storyshot
@@ -62,7 +62,20 @@
>
+ >
+
+
+
diff --git a/frontend/src/components/storage/__snapshots__/VolumeDetails.Base.stories.storyshot b/frontend/src/components/storage/__snapshots__/VolumeDetails.Base.stories.storyshot
index e7eb994dfcf..5c4f633601c 100644
--- a/frontend/src/components/storage/__snapshots__/VolumeDetails.Base.stories.storyshot
+++ b/frontend/src/components/storage/__snapshots__/VolumeDetails.Base.stories.storyshot
@@ -62,7 +62,20 @@
>
+ >
+
+
+
diff --git a/frontend/src/components/verticalPodAutoscaler/__snapshots__/VPADetails.Default.stories.storyshot b/frontend/src/components/verticalPodAutoscaler/__snapshots__/VPADetails.Default.stories.storyshot
index fc283ff8141..f83fe329e46 100644
--- a/frontend/src/components/verticalPodAutoscaler/__snapshots__/VPADetails.Default.stories.storyshot
+++ b/frontend/src/components/verticalPodAutoscaler/__snapshots__/VPADetails.Default.stories.storyshot
@@ -62,7 +62,20 @@
>
+ >
+
+
+
diff --git a/frontend/src/components/webhookconfiguration/__snapshots__/MutatingWebhookConfigDetails.WithService.stories.storyshot b/frontend/src/components/webhookconfiguration/__snapshots__/MutatingWebhookConfigDetails.WithService.stories.storyshot
index 28a6311afdb..6ef74403251 100644
--- a/frontend/src/components/webhookconfiguration/__snapshots__/MutatingWebhookConfigDetails.WithService.stories.storyshot
+++ b/frontend/src/components/webhookconfiguration/__snapshots__/MutatingWebhookConfigDetails.WithService.stories.storyshot
@@ -62,7 +62,20 @@
>
+ >
+
+
+
diff --git a/frontend/src/components/webhookconfiguration/__snapshots__/MutatingWebhookConfigDetails.WithURL.stories.storyshot b/frontend/src/components/webhookconfiguration/__snapshots__/MutatingWebhookConfigDetails.WithURL.stories.storyshot
index 04735caf17d..964fb02481e 100644
--- a/frontend/src/components/webhookconfiguration/__snapshots__/MutatingWebhookConfigDetails.WithURL.stories.storyshot
+++ b/frontend/src/components/webhookconfiguration/__snapshots__/MutatingWebhookConfigDetails.WithURL.stories.storyshot
@@ -62,7 +62,20 @@
>
+ >
+
+
+
diff --git a/frontend/src/components/webhookconfiguration/__snapshots__/ValidatingWebhookConfigDetails.WithService.stories.storyshot b/frontend/src/components/webhookconfiguration/__snapshots__/ValidatingWebhookConfigDetails.WithService.stories.storyshot
index f43a4383210..6481e0fce16 100644
--- a/frontend/src/components/webhookconfiguration/__snapshots__/ValidatingWebhookConfigDetails.WithService.stories.storyshot
+++ b/frontend/src/components/webhookconfiguration/__snapshots__/ValidatingWebhookConfigDetails.WithService.stories.storyshot
@@ -62,7 +62,20 @@
>
+ >
+
+
+
diff --git a/frontend/src/components/webhookconfiguration/__snapshots__/ValidatingWebhookConfigDetails.WithURL.stories.storyshot b/frontend/src/components/webhookconfiguration/__snapshots__/ValidatingWebhookConfigDetails.WithURL.stories.storyshot
index 6161bc9ec67..696e838315f 100644
--- a/frontend/src/components/webhookconfiguration/__snapshots__/ValidatingWebhookConfigDetails.WithURL.stories.storyshot
+++ b/frontend/src/components/webhookconfiguration/__snapshots__/ValidatingWebhookConfigDetails.WithURL.stories.storyshot
@@ -62,7 +62,20 @@
>
+ >
+
+
+
diff --git a/frontend/src/plugin/__snapshots__/pluginLib.snapshot b/frontend/src/plugin/__snapshots__/pluginLib.snapshot
index 34032782e12..e37067f9a74 100644
--- a/frontend/src/plugin/__snapshots__/pluginLib.snapshot
+++ b/frontend/src/plugin/__snapshots__/pluginLib.snapshot
@@ -95,6 +95,7 @@
"ViewButton": [Function],
"ViewDialog": [Function],
"addResourceTableColumnsProcessor": [Function],
+ "isRestartableResource": [Function],
"metadataStyles": [Function],
"resourceTableSlice": {
"actions": {
@@ -141,6 +142,7 @@
"ViewButton": [Function],
"ViewDialog": [Function],
"addResourceTableColumnsProcessor": [Function],
+ "isRestartableResource": [Function],
"makeStatusLabel": [Function],
"metadataStyles": [Function],
"resourceTableSlice": {
@@ -197,6 +199,7 @@
"PLUGIN_LOADING_ERROR": "headlamp.plugin-loading-error",
"POD_ATTACH": "headlamp.pod-attach",
"RESTART_RESOURCE": "headlamp.restart-resource",
+ "RESTART_RESOURCES": "headlamp.restart-resources",
"SCALE_RESOURCE": "headlamp.scale-resource",
"TERMINAL": "headlamp.terminal",
},
@@ -16118,4 +16121,4 @@
"registerSidebarEntry": [Function],
"registerSidebarEntryFilter": [Function],
"runCommand": [Function],
-}
+}
\ No newline at end of file
diff --git a/frontend/src/redux/headlampEventSlice.ts b/frontend/src/redux/headlampEventSlice.ts
index e6f9e9edaf9..989974dd130 100644
--- a/frontend/src/redux/headlampEventSlice.ts
+++ b/frontend/src/redux/headlampEventSlice.ts
@@ -29,6 +29,8 @@ export enum HeadlampEventType {
SCALE_RESOURCE = 'headlamp.scale-resource',
/** Events related to restarting a resource. */
RESTART_RESOURCE = 'headlamp.restart-resource',
+ /** Events related to restarting multiple resources. */
+ RESTART_RESOURCES = 'headlamp.restart-resources',
/** Events related to viewing logs. */
LOGS = 'headlamp.logs',
/** Events related to opening a terminal. */
@@ -141,12 +143,25 @@ export interface ScaleResourceEvent {
/**
* Event fired when restarting a resource.
*/
-export interface RestartResourceEvent {
- type: HeadlampEventType.RESTART_RESOURCE;
+export interface RestartResourceEvent extends HeadlampEvent {
data: {
- /** The resource for which the deletion was called. */
+ /** The resource for which restart was called. */
resource: KubeObject;
- /** What exactly this event represents. 'CONFIRMED' when the restart is selected by the user.
+ /** What exactly this event represents. 'CONFIRMED' when restart is selected by the user.
+ * For now only 'CONFIRMED' is sent.
+ */
+ status: EventStatus.CONFIRMED;
+ };
+}
+
+/**
+ * Event fired when restarting multiple resources.
+ */
+export interface RestartResourcesEvent extends HeadlampEvent {
+ data: {
+ /** Resources for which restart was called. */
+ resources: KubeObject[];
+ /** What exactly this event represents. 'CONFIRMED' when the user confirms restart of resources.
* For now only 'CONFIRMED' is sent.
*/
status: EventStatus.CONFIRMED;
@@ -354,6 +369,9 @@ export function useEventCallback(
export function useEventCallback(
eventType: HeadlampEventType.RESTART_RESOURCE
): (data: EventDataType) => void;
+export function useEventCallback(
+ eventType: HeadlampEventType.RESTART_RESOURCES
+): (data: EventDataType) => void;
export function useEventCallback(
eventType: HeadlampEventType.LOGS
): (data: EventDataType) => void;