mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Remove icons / checks from RemoveClusterButton
Signed-off-by: alexfront <alex.andreev.email@gmail.com>
This commit is contained in:
parent
0bee7b6c1a
commit
6018bf0c42
@ -16,7 +16,7 @@
|
|||||||
.settings-wrapper {
|
.settings-wrapper {
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
width: 70%;
|
width: 70%;
|
||||||
min-width: 800px;
|
min-width: 690px;
|
||||||
|
|
||||||
> div {
|
> div {
|
||||||
margin-top: $margin * 3;
|
margin-top: $margin * 3;
|
||||||
@ -37,8 +37,10 @@
|
|||||||
border: 1px solid var(--drawerSubtitleBackground);
|
border: 1px solid var(--drawerSubtitleBackground);
|
||||||
border-radius: $radius;
|
border-radius: $radius;
|
||||||
|
|
||||||
.TableCell {
|
.TableRow {
|
||||||
|
&:not(:last-of-type) {
|
||||||
border-bottom: 1px solid var(--drawerSubtitleBackground);
|
border-bottom: 1px solid var(--drawerSubtitleBackground);
|
||||||
|
}
|
||||||
|
|
||||||
&.value {
|
&.value {
|
||||||
color: var(--textColorSecondary);
|
color: var(--textColorSecondary);
|
||||||
|
|||||||
@ -1,16 +1,12 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { Cluster } from "../../../../main/cluster";
|
|
||||||
import { Button } from "../../button";
|
|
||||||
import { autobind } from "../../../utils";
|
|
||||||
import { Spinner } from "../../spinner";
|
|
||||||
import { Icon } from "../../icon";
|
|
||||||
import { ConfirmDialog } from "../../confirm-dialog";
|
|
||||||
import { Trans } from "@lingui/macro";
|
import { Trans } from "@lingui/macro";
|
||||||
|
import { observer } from "mobx-react";
|
||||||
import { clusterIpc } from "../../../../common/cluster-ipc";
|
import { clusterIpc } from "../../../../common/cluster-ipc";
|
||||||
import { clusterStore } from "../../../../common/cluster-store";
|
import { clusterStore } from "../../../../common/cluster-store";
|
||||||
import { observable } from "mobx";
|
import { Cluster } from "../../../../main/cluster";
|
||||||
import { observer } from "mobx-react";
|
import { autobind } from "../../../utils";
|
||||||
import { RemovalStatus } from "./statuses"
|
import { Button } from "../../button";
|
||||||
|
import { ConfirmDialog } from "../../confirm-dialog";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
cluster: Cluster;
|
cluster: Cluster;
|
||||||
@ -18,46 +14,27 @@ interface Props {
|
|||||||
|
|
||||||
@observer
|
@observer
|
||||||
export class RemoveClusterButton extends React.Component<Props> {
|
export class RemoveClusterButton extends React.Component<Props> {
|
||||||
@observable status = RemovalStatus.PRESENT;
|
|
||||||
@observable errorText?: string;
|
|
||||||
|
|
||||||
render() {
|
|
||||||
return (
|
|
||||||
<div className="center">
|
|
||||||
<Button accent onClick={this.confirmRemoveCluster}>Remove Cluster {this.getStatusIcon()}</Button>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
getStatusIcon(): React.ReactNode {
|
|
||||||
switch (this.status) {
|
|
||||||
case RemovalStatus.PRESENT:
|
|
||||||
return null;
|
|
||||||
case RemovalStatus.PROCESSING:
|
|
||||||
return <Spinner />;
|
|
||||||
case RemovalStatus.ERROR:
|
|
||||||
return <Icon size="16px" material="error" title={this.errorText}></Icon>;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@autobind()
|
@autobind()
|
||||||
confirmRemoveCluster() {
|
confirmRemoveCluster() {
|
||||||
const { cluster } = this.props;
|
const { cluster } = this.props;
|
||||||
|
|
||||||
ConfirmDialog.open({
|
ConfirmDialog.open({
|
||||||
message: <p>Are you sure you want to remove <b>{cluster.preferences.clusterName}</b> from Lens?</p>,
|
message: <p>Are you sure you want to remove <b>{cluster.preferences.clusterName}</b> from Lens?</p>,
|
||||||
labelOk: <Trans>Yes</Trans>,
|
labelOk: <Trans>Yes</Trans>,
|
||||||
labelCancel: <Trans>No</Trans>,
|
labelCancel: <Trans>No</Trans>,
|
||||||
ok: async () => {
|
ok: async () => {
|
||||||
try {
|
|
||||||
this.status = RemovalStatus.PROCESSING;
|
|
||||||
await clusterIpc.disconnect.invokeFromRenderer(cluster.id);
|
await clusterIpc.disconnect.invokeFromRenderer(cluster.id);
|
||||||
await clusterStore.removeById(cluster.id);
|
await clusterStore.removeById(cluster.id);
|
||||||
} catch (err) {
|
|
||||||
this.status = RemovalStatus.ERROR;
|
|
||||||
this.errorText = err.toString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<div className="flex gaps align-center">
|
||||||
|
<Button accent onClick={this.confirmRemoveCluster}>
|
||||||
|
Remove Cluster
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -16,9 +16,3 @@ export enum ActionStatus {
|
|||||||
PROCESSING = "processing",
|
PROCESSING = "processing",
|
||||||
ERROR = "error"
|
ERROR = "error"
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum RemovalStatus {
|
|
||||||
PRESENT = "present",
|
|
||||||
PROCESSING = "processing",
|
|
||||||
ERROR = "error",
|
|
||||||
}
|
|
||||||
@ -18,9 +18,11 @@ export class WizardLayout extends React.Component<Props> {
|
|||||||
const { className, contentClass, infoPanelClass, infoPanel, header, headerClass, children: content } = this.props;
|
const { className, contentClass, infoPanelClass, infoPanel, header, headerClass, children: content } = this.props;
|
||||||
return (
|
return (
|
||||||
<div className={cssNames("WizardLayout", className)}>
|
<div className={cssNames("WizardLayout", className)}>
|
||||||
|
{header && (
|
||||||
<div className={cssNames("head-col flex gaps align-center", headerClass)}>
|
<div className={cssNames("head-col flex gaps align-center", headerClass)}>
|
||||||
{header}
|
{header}
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
<div className={cssNames("content-col flex column gaps", contentClass)}>
|
<div className={cssNames("content-col flex column gaps", contentClass)}>
|
||||||
{content}
|
{content}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user