mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Restart deployment (#1175)
Signed-off-by: Pavel Ashevskii <pashevskii@mirantis.com>
This commit is contained in:
1 parent
f9578ba407
commit
d074e0499f
6 files changed
+79
-7
No files matched your search
@@ -4,11 +4,12 @@ import React from "react";
|
||||
import { observer } from "mobx-react";
|
||||
import { RouteComponentProps } from "react-router";
|
||||
import { t, Trans } from "@lingui/macro";
|
||||
import { Deployment } from "../../api/endpoints";
|
||||
import { Deployment, deploymentApi } from "../../api/endpoints";
|
||||
import { KubeObjectMenuProps } from "../kube-object/kube-object-menu";
|
||||
import { MenuItem } from "../menu";
|
||||
import { Icon } from "../icon";
|
||||
import { DeploymentScaleDialog } from "./deployment-scale-dialog";
|
||||
import { ConfirmDialog } from "../confirm-dialog";
|
||||
import { deploymentStore } from "./deployments.store";
|
||||
import { replicaSetStore } from "../+workloads-replicasets/replicasets.store";
|
||||
import { podsStore } from "../+workloads-pods/pods.store";
|
||||
@@ -22,6 +23,8 @@ import kebabCase from "lodash/kebabCase";
|
||||
import orderBy from "lodash/orderBy";
|
||||
import { KubeEventIcon } from "../+events/kube-event-icon";
|
||||
import { kubeObjectMenuRegistry } from "../../../extensions/registries/kube-object-menu-registry";
|
||||
import { apiManager } from "../../api/api-manager";
|
||||
import { Notifications } from "../notifications";
|
||||
|
||||
enum sortBy {
|
||||
name = "name",
|
||||
@@ -96,10 +99,34 @@ export class Deployments extends React.Component<Props> {
|
||||
export function DeploymentMenu(props: KubeObjectMenuProps<Deployment>) {
|
||||
const { object, toolbar } = props;
|
||||
return (
|
||||
<MenuItem onClick={() => DeploymentScaleDialog.open(object)}>
|
||||
<Icon material="open_with" title={_i18n._(t`Scale`)} interactive={toolbar}/>
|
||||
<span className="title"><Trans>Scale</Trans></span>
|
||||
</MenuItem>
|
||||
<>
|
||||
<MenuItem onClick={() => DeploymentScaleDialog.open(object)}>
|
||||
<Icon material="open_with" title={_i18n._(t`Scale`)} interactive={toolbar}/>
|
||||
<span className="title"><Trans>Scale</Trans></span>
|
||||
</MenuItem>
|
||||
<MenuItem onClick={() => ConfirmDialog.open({
|
||||
ok: async () =>
|
||||
{
|
||||
try {
|
||||
await deploymentApi.restart({
|
||||
namespace: object.getNs(),
|
||||
name: object.getName(),
|
||||
})
|
||||
} catch (err) {
|
||||
Notifications.error(err);
|
||||
}
|
||||
},
|
||||
labelOk: _i18n._(t`Restart`),
|
||||
message: (
|
||||
<p>
|
||||
<Trans>Are you sure you want to restart deployment <b>{object.getName()}</b>?</Trans>
|
||||
</p>
|
||||
),
|
||||
})}>
|
||||
<Icon material="autorenew" title={_i18n._(t`Restart`)} interactive={toolbar}/>
|
||||
<span className="title"><Trans>Restart</Trans></span>
|
||||
</MenuItem>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -110,4 +137,3 @@ kubeObjectMenuRegistry.add({
|
||||
MenuItem: DeploymentMenu
|
||||
}
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user