mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Activate clusters from workspaces page
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
f8841fa0a5
commit
cb13079077
@ -13,6 +13,7 @@ import { Input } from "../input";
|
|||||||
import { cssNames, prevDefault } from "../../utils";
|
import { cssNames, prevDefault } from "../../utils";
|
||||||
import { Button } from "../button";
|
import { Button } from "../button";
|
||||||
import { isRequired, InputValidator } from "../input/input_validators";
|
import { isRequired, InputValidator } from "../input/input_validators";
|
||||||
|
import { clusterStore } from "../../../common/cluster-store";
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
export class Workspaces extends React.Component {
|
export class Workspaces extends React.Component {
|
||||||
@ -70,6 +71,12 @@ export class Workspaces extends React.Component {
|
|||||||
this.editingWorkspaces.set(id, toJS(workspace));
|
this.editingWorkspaces.set(id, toJS(workspace));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
activateWorkspace = (id: WorkspaceId) => {
|
||||||
|
const clusterId = workspaceStore.getById(id).lastActiveClusterId;
|
||||||
|
workspaceStore.setActive(id);
|
||||||
|
clusterStore.setActive(clusterId);
|
||||||
|
}
|
||||||
|
|
||||||
clearEditing = (id: WorkspaceId) => {
|
clearEditing = (id: WorkspaceId) => {
|
||||||
this.editingWorkspaces.delete(id);
|
this.editingWorkspaces.delete(id);
|
||||||
}
|
}
|
||||||
@ -135,7 +142,7 @@ export class Workspaces extends React.Component {
|
|||||||
{!isEditing && (
|
{!isEditing && (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<span className="name flex gaps align-center">
|
<span className="name flex gaps align-center">
|
||||||
<a href="#" onClick={prevDefault(() => workspaceStore.setActive(workspaceId))}>{name}</a>
|
<a href="#" onClick={prevDefault(() => this.activateWorkspace(workspaceId))}>{name}</a>
|
||||||
{isActive && <span> <Trans>(current)</Trans></span>}
|
{isActive && <span> <Trans>(current)</Trans></span>}
|
||||||
</span>
|
</span>
|
||||||
<span className="description">{description}</span>
|
<span className="description">{description}</span>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user