mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
combine left menu icons
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
parent
e8e79955ad
commit
e94cf372e7
@ -27,14 +27,16 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
> .add-cluster {
|
> .WorkspaceOverview {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
margin-bottom: $margin;
|
||||||
|
|
||||||
.Icon {
|
.Icon {
|
||||||
|
margin-bottom: $margin * 1.5;
|
||||||
border-radius: $radius;
|
border-radius: $radius;
|
||||||
padding: $padding / 3;
|
padding: $padding / 3;
|
||||||
color: $addClusterIconColor;
|
color: #ffffff66;
|
||||||
background: #ffffff66;
|
background: unset;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
&.active {
|
&.active {
|
||||||
@ -43,28 +45,10 @@
|
|||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
background: #ffffff;
|
color: #ffffff;
|
||||||
|
background-color: unset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.Badge {
|
|
||||||
$boxSize: 17px;
|
|
||||||
|
|
||||||
position: absolute;
|
|
||||||
bottom: 0px;
|
|
||||||
transform: translateX(-50%) translateY(50%);
|
|
||||||
font-size: $font-size-small;
|
|
||||||
line-height: $boxSize;
|
|
||||||
min-width: $boxSize;
|
|
||||||
min-height: $boxSize;
|
|
||||||
text-align: center;
|
|
||||||
color: white;
|
|
||||||
background: $colorSuccess;
|
|
||||||
font-weight: normal;
|
|
||||||
border-radius: $radius;
|
|
||||||
padding: 0;
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
> .extensions {
|
> .extensions {
|
||||||
|
|||||||
@ -6,18 +6,15 @@ import { requestMain } from "../../../common/ipc";
|
|||||||
import type { Cluster } from "../../../main/cluster";
|
import type { Cluster } from "../../../main/cluster";
|
||||||
import { DragDropContext, Draggable, DraggableProvided, Droppable, DroppableProvided, DropResult } from "react-beautiful-dnd";
|
import { DragDropContext, Draggable, DraggableProvided, Droppable, DroppableProvided, DropResult } from "react-beautiful-dnd";
|
||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
import { userStore } from "../../../common/user-store";
|
|
||||||
import { ClusterId, clusterStore } from "../../../common/cluster-store";
|
import { ClusterId, clusterStore } from "../../../common/cluster-store";
|
||||||
import { workspaceStore } from "../../../common/workspace-store";
|
import { workspaceStore } from "../../../common/workspace-store";
|
||||||
import { ClusterIcon } from "../cluster-icon";
|
import { ClusterIcon } from "../cluster-icon";
|
||||||
import { Icon } from "../icon";
|
import { Icon } from "../icon";
|
||||||
import { autobind, cssNames, IClassName } from "../../utils";
|
import { autobind, cssNames, IClassName } from "../../utils";
|
||||||
import { Badge } from "../badge";
|
|
||||||
import { isActiveRoute, navigate } from "../../navigation";
|
import { isActiveRoute, navigate } from "../../navigation";
|
||||||
import { addClusterURL } from "../+add-cluster";
|
import { addClusterURL } from "../+add-cluster";
|
||||||
import { clusterSettingsURL } from "../+cluster-settings";
|
import { clusterSettingsURL } from "../+cluster-settings";
|
||||||
import { landingURL } from "../+landing-page";
|
import { landingURL } from "../+landing-page";
|
||||||
import { Tooltip } from "../tooltip";
|
|
||||||
import { ConfirmDialog } from "../confirm-dialog";
|
import { ConfirmDialog } from "../confirm-dialog";
|
||||||
import { clusterViewURL } from "./cluster-view.route";
|
import { clusterViewURL } from "./cluster-view.route";
|
||||||
import { getExtensionPageUrl, globalPageMenuRegistry, globalPageRegistry } from "../../../extensions/registries";
|
import { getExtensionPageUrl, globalPageMenuRegistry, globalPageRegistry } from "../../../extensions/registries";
|
||||||
@ -37,10 +34,6 @@ export class ClustersMenu extends React.Component<Props> {
|
|||||||
navigate(clusterViewURL({ params: { clusterId } }));
|
navigate(clusterViewURL({ params: { clusterId } }));
|
||||||
};
|
};
|
||||||
|
|
||||||
addCluster = () => {
|
|
||||||
navigate(addClusterURL());
|
|
||||||
};
|
|
||||||
|
|
||||||
showContextMenu = (cluster: Cluster) => {
|
showContextMenu = (cluster: Cluster) => {
|
||||||
const { Menu, MenuItem } = remote;
|
const { Menu, MenuItem } = remote;
|
||||||
const menu = new Menu();
|
const menu = new Menu();
|
||||||
@ -96,6 +89,32 @@ export class ClustersMenu extends React.Component<Props> {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
showWorkspaceContextMenu() {
|
||||||
|
const { Menu, MenuItem } = remote;
|
||||||
|
const menu = new Menu();
|
||||||
|
const workspace = workspaceStore.getById(workspaceStore.currentWorkspaceId);
|
||||||
|
|
||||||
|
if (!workspace.isManaged) {
|
||||||
|
menu.append(new MenuItem({
|
||||||
|
label: `Add cluster`,
|
||||||
|
click: () => {
|
||||||
|
navigate(addClusterURL());
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
menu.append(new MenuItem({
|
||||||
|
label: `Workspace Overview`,
|
||||||
|
click: () => {
|
||||||
|
navigate(landingURL());
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
menu.popup({
|
||||||
|
window: remote.getCurrentWindow()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@autobind()
|
@autobind()
|
||||||
swapClusterIconOrder(result: DropResult) {
|
swapClusterIconOrder(result: DropResult) {
|
||||||
if (result.reason === "DROP") {
|
if (result.reason === "DROP") {
|
||||||
@ -111,7 +130,6 @@ export class ClustersMenu extends React.Component<Props> {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { className } = this.props;
|
const { className } = this.props;
|
||||||
const { newContexts } = userStore;
|
|
||||||
const workspace = workspaceStore.getById(workspaceStore.currentWorkspaceId);
|
const workspace = workspaceStore.getById(workspaceStore.currentWorkspaceId);
|
||||||
const clusters = clusterStore.getByWorkspaceId(workspace.id).filter(cluster => cluster.enabled);
|
const clusters = clusterStore.getByWorkspaceId(workspace.id).filter(cluster => cluster.enabled);
|
||||||
const activeClusterId = clusterStore.activeCluster;
|
const activeClusterId = clusterStore.activeCluster;
|
||||||
@ -149,14 +167,9 @@ export class ClustersMenu extends React.Component<Props> {
|
|||||||
</Droppable>
|
</Droppable>
|
||||||
</DragDropContext>
|
</DragDropContext>
|
||||||
</div>
|
</div>
|
||||||
<div className="add-cluster">
|
|
||||||
<Tooltip targetId="add-cluster-icon">
|
<div className="WorkspaceOverview">
|
||||||
Add Cluster
|
<Icon big material="menu" id="workspace-overview-icon" onClick={this.showWorkspaceContextMenu} />
|
||||||
</Tooltip>
|
|
||||||
<Icon big material="add" id="add-cluster-icon" disabled={workspace.isManaged} onClick={this.addCluster}/>
|
|
||||||
{newContexts.size > 0 && (
|
|
||||||
<Badge className="counter" label={newContexts.size} tooltip="new"/>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
<div className="extensions">
|
<div className="extensions">
|
||||||
{globalPageMenuRegistry.getItems().map(({ title, target, components: { Icon } }) => {
|
{globalPageMenuRegistry.getItems().map(({ title, target, components: { Icon } }) => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user