diff --git a/src/common/base-store.ts b/src/common/base-store.ts index d9f7d44da7..51610a5d03 100644 --- a/src/common/base-store.ts +++ b/src/common/base-store.ts @@ -92,14 +92,14 @@ export class BaseStore extends Singleton { protected onConfigChange(data: T, oldValue: Partial) { if (!isEqual(this.toJSON(), data)) { - logger.debug(`💿 Store received update from ${this.name}`, { data, oldValue }); + logger.info(`💿 Store received update from ${this.name}`, { data, oldValue }); this.fromStore(data); } } protected onModelChange(model: T) { if (!isEqual(this.storeModel, model)) { - logger.debug(`💿 Store ${this.name} is saving updates from app runtime`, { + logger.info(`💿 Store ${this.name} is saving updates from app runtime`, { data: model, oldValue: this.storeModel }); diff --git a/src/common/cluster-store.ts b/src/common/cluster-store.ts index 1e71cdb398..be58448feb 100644 --- a/src/common/cluster-store.ts +++ b/src/common/cluster-store.ts @@ -14,6 +14,7 @@ export type ClusterId = string; export interface ClusterModel { id: ClusterId; workspace?: string; + contextName?: string; preferences?: ClusterPreferences; kubeConfigPath: string; diff --git a/src/main/cluster.ts b/src/main/cluster.ts index ebce77e52b..9b9c214d70 100644 --- a/src/main/cluster.ts +++ b/src/main/cluster.ts @@ -51,7 +51,7 @@ export class Cluster implements ClusterModel { updateModel(model: ClusterModel) { Object.assign(this, model); this.apiUrl = this.getKubeconfig().getCurrentCluster().server; - this.contextName = this.preferences.clusterName; + this.contextName = this.contextName || this.preferences.clusterName; } @action diff --git a/src/renderer/components/+add-cluster/add-cluster.route.ts b/src/renderer/components/+add-cluster/add-cluster.route.ts new file mode 100644 index 0000000000..21f7522f0f --- /dev/null +++ b/src/renderer/components/+add-cluster/add-cluster.route.ts @@ -0,0 +1,8 @@ +import { RouteProps } from "react-router"; +import { buildURL } from "../../navigation"; + +export const addClusterRoute: RouteProps = { + path: "/add-cluster" +} + +export const addClusterURL = buildURL(addClusterRoute.path) diff --git a/src/renderer/components/+add-cluster/add-cluster.tsx b/src/renderer/components/+add-cluster/add-cluster.tsx index a34e451a0b..899337f696 100644 --- a/src/renderer/components/+add-cluster/add-cluster.tsx +++ b/src/renderer/components/+add-cluster/add-cluster.tsx @@ -1,10 +1,12 @@ import "./add-cluster.scss" import React from "react"; +import { observable } from "mobx"; interface Props { } -export class AddCluster extends React.Component { +@observable +export class AddCluster extends React.Component { render() { return (
diff --git a/src/renderer/components/+add-cluster/index.ts b/src/renderer/components/+add-cluster/index.ts index 98089e0bde..42ab8bf944 100644 --- a/src/renderer/components/+add-cluster/index.ts +++ b/src/renderer/components/+add-cluster/index.ts @@ -1 +1,2 @@ export * from "./add-cluster" +export * from "./add-cluster.route" diff --git a/src/renderer/components/+cluster-settings/cluster-icon.scss b/src/renderer/components/+cluster-settings/cluster-icon.scss index b58d31983a..3d1cc0e6b5 100644 --- a/src/renderer/components/+cluster-settings/cluster-icon.scss +++ b/src/renderer/components/+cluster-settings/cluster-icon.scss @@ -6,12 +6,10 @@ border-radius: $radius; cursor: pointer; - &.interactive { - &:hover { - opacity: 1; - background-color: #fff; - box-shadow: 0 0 0 $radius #fff; - } + &.active, &.interactive:hover { + opacity: 1; + background-color: #fff; + box-shadow: 0 0 0 $radius #fff; } > img { diff --git a/src/renderer/components/+cluster-settings/cluster-icon.tsx b/src/renderer/components/+cluster-settings/cluster-icon.tsx index 981414370b..f1ba44a656 100644 --- a/src/renderer/components/+cluster-settings/cluster-icon.tsx +++ b/src/renderer/components/+cluster-settings/cluster-icon.tsx @@ -14,6 +14,7 @@ interface Props extends DOMAttributes { errorClass?: IClassName; showErrors?: boolean; interactive?: boolean; + isActive?: boolean; options?: HashiconParams; } @@ -26,11 +27,12 @@ export class ClusterIcon extends React.Component { static defaultProps = defaultProps as object; render() { - const { className: cName, cluster, showErrors, errorClass, options, interactive, children, ...elemProps } = this.props; + const { className: cName, cluster, showErrors, errorClass, options, interactive, isActive, children, ...elemProps } = this.props; const { isAdmin, eventCount, preferences } = cluster; const { clusterName, icon } = preferences; const className = cssNames("ClusterIcon flex inline", cName, { interactive: interactive || !!this.props.onClick, + active: isActive, }); return (
diff --git a/src/renderer/components/cluster-manager/clusters-menu.tsx b/src/renderer/components/cluster-manager/clusters-menu.tsx index 68577e3faf..f10c6b39ee 100644 --- a/src/renderer/components/cluster-manager/clusters-menu.tsx +++ b/src/renderer/components/cluster-manager/clusters-menu.tsx @@ -22,9 +22,9 @@ interface Props { @observer export class ClustersMenu extends React.Component { - selectCluster = (cluster: Cluster) => { + showCluster = (cluster: Cluster) => { clusterStore.activeClusterId = cluster.id; - console.log('load lens for cluster:', cluster) + console.log('load lens for cluster:', cluster.id); } addCluster = () => { @@ -59,14 +59,13 @@ export class ClustersMenu extends React.Component { return (
{clusters.map(cluster => { - const isActive = cluster.id === clusterStore.activeClusterId; return ( this.selectCluster(cluster)} + isActive={cluster.id === clusterStore.activeClusterId} + onClick={() => this.showCluster(cluster)} onContextMenu={() => this.showContextMenu(cluster)} /> )