mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
ClusterWorkspaceSettings refactoring/fixing
Signed-off-by: alexfront <alex.andreev.email@gmail.com>
This commit is contained in:
parent
f91e0e6a63
commit
f533331864
@ -1,36 +1,36 @@
|
||||
import React from "react";
|
||||
import { Cluster } from "../../../../main/cluster";
|
||||
import { clusterStore } from "../../../../common/cluster-store"
|
||||
import { workspaceStore } from "../../../../common/workspace-store"
|
||||
import { Select, SelectOption } from "../../../components/select";
|
||||
import { GeneralInputStatus } from "./statuses"
|
||||
import { observable } from "mobx";
|
||||
import { autobind } from "../../../utils";
|
||||
import { observer } from "mobx-react";
|
||||
import { Link } from "react-router-dom";
|
||||
import { workspacesURL } from "../../+workspaces";
|
||||
import { workspaceStore } from "../../../../common/workspace-store";
|
||||
import { Cluster } from "../../../../main/cluster";
|
||||
import { Select } from "../../../components/select";
|
||||
import { SubTitle } from "../../layout/sub-title";
|
||||
|
||||
interface Props {
|
||||
cluster: Cluster;
|
||||
cluster: Cluster;
|
||||
}
|
||||
|
||||
@observer
|
||||
export class ClusterWorkspaceSetting extends React.Component<Props> {
|
||||
@observable workspace = this.props.cluster.workspace;
|
||||
|
||||
render() {
|
||||
return <>
|
||||
<h4>Cluster Workspace</h4>
|
||||
<p>Change cluster workspace:</p>
|
||||
<Select
|
||||
value={workspaceStore.currentWorkspaceId}
|
||||
options={workspaceStore.workspacesList.map(w => ({value: w.id, label: <span>{w.name}</span>}))}
|
||||
onChange={this.changeWorkspace}
|
||||
/>
|
||||
</>;
|
||||
}
|
||||
|
||||
@autobind()
|
||||
changeWorkspace({ value: workspace }: SelectOption<string>) {
|
||||
this.workspace = workspace;
|
||||
this.props.cluster.workspace = workspace;
|
||||
return (
|
||||
<>
|
||||
<SubTitle title="Cluster Workspace"/>
|
||||
<p>
|
||||
Define cluster{" "}
|
||||
<Link to={workspacesURL()}>
|
||||
workspace
|
||||
</Link>.
|
||||
</p>
|
||||
<Select
|
||||
value={this.props.cluster.workspace}
|
||||
onChange={({value}) => this.props.cluster.workspace = value}
|
||||
options={workspaceStore.workspacesList.map(w =>
|
||||
({value: w.id, label: w.name})
|
||||
)}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -15,8 +15,6 @@ export class General extends React.Component<Props> {
|
||||
render() {
|
||||
return <div>
|
||||
<h2>General</h2>
|
||||
<hr/>
|
||||
|
||||
<ClusterNameSetting cluster={this.props.cluster} />
|
||||
<ClusterWorkspaceSetting cluster={this.props.cluster} />
|
||||
<ClusterIconSetting cluster={this.props.cluster} />
|
||||
|
||||
Loading…
Reference in New Issue
Block a user