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 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 { 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 {
|
interface Props {
|
||||||
cluster: Cluster;
|
cluster: Cluster;
|
||||||
}
|
}
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
export class ClusterWorkspaceSetting extends React.Component<Props> {
|
export class ClusterWorkspaceSetting extends React.Component<Props> {
|
||||||
@observable workspace = this.props.cluster.workspace;
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return <>
|
return (
|
||||||
<h4>Cluster Workspace</h4>
|
<>
|
||||||
<p>Change cluster workspace:</p>
|
<SubTitle title="Cluster Workspace"/>
|
||||||
<Select
|
<p>
|
||||||
value={workspaceStore.currentWorkspaceId}
|
Define cluster{" "}
|
||||||
options={workspaceStore.workspacesList.map(w => ({value: w.id, label: <span>{w.name}</span>}))}
|
<Link to={workspacesURL()}>
|
||||||
onChange={this.changeWorkspace}
|
workspace
|
||||||
/>
|
</Link>.
|
||||||
</>;
|
</p>
|
||||||
}
|
<Select
|
||||||
|
value={this.props.cluster.workspace}
|
||||||
@autobind()
|
onChange={({value}) => this.props.cluster.workspace = value}
|
||||||
changeWorkspace({ value: workspace }: SelectOption<string>) {
|
options={workspaceStore.workspacesList.map(w =>
|
||||||
this.workspace = workspace;
|
({value: w.id, label: w.name})
|
||||||
this.props.cluster.workspace = workspace;
|
)}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -15,8 +15,6 @@ export class General extends React.Component<Props> {
|
|||||||
render() {
|
render() {
|
||||||
return <div>
|
return <div>
|
||||||
<h2>General</h2>
|
<h2>General</h2>
|
||||||
<hr/>
|
|
||||||
|
|
||||||
<ClusterNameSetting cluster={this.props.cluster} />
|
<ClusterNameSetting cluster={this.props.cluster} />
|
||||||
<ClusterWorkspaceSetting cluster={this.props.cluster} />
|
<ClusterWorkspaceSetting cluster={this.props.cluster} />
|
||||||
<ClusterIconSetting cluster={this.props.cluster} />
|
<ClusterIconSetting cluster={this.props.cluster} />
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user