mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
cluster-store refactoring -- part 1
Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
1 parent
d4bbaf4f34
commit
afb54694f4
14 files changed
+168
-461
No files matched your search
@@ -22,7 +22,6 @@
|
||||
import ClusterMenuItem from "@/_vue/components/MainMenu/ClusterMenuItem";
|
||||
import AddClusterMenuItem from "@/_vue/components/MainMenu/AddClusterMenuItem";
|
||||
import draggable from 'vuedraggable'
|
||||
import { clusterStore } from "../../../../common/cluster-store"
|
||||
import { isMac } from "../../../../common/vars"
|
||||
|
||||
const {remote} = require('electron')
|
||||
@@ -47,7 +46,7 @@ export default {
|
||||
},
|
||||
set: function (clusters) {
|
||||
this.$store.commit("updateClusters", clusters);
|
||||
clusterStore.storeClusters(clusters);
|
||||
// clusterStore.storeClusters(clusters);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -10,6 +10,8 @@ import App from './App'
|
||||
import router from './router'
|
||||
import store from './store'
|
||||
import { userStore } from "../../common/user-store"
|
||||
import { workspaceStore } from "../../common/workspace-store"
|
||||
import { clusterStore } from "../../common/cluster-store"
|
||||
|
||||
const promiseIpc = new PromiseIpc({maxTimeoutMs: 6000});
|
||||
|
||||
@@ -29,9 +31,13 @@ Vue.mixin({
|
||||
|
||||
// any initialization we want to do for app state
|
||||
setTimeout(async () => {
|
||||
await userStore.whenLoaded;
|
||||
await store.dispatch('init')
|
||||
await Promise.all([
|
||||
userStore.whenLoaded,
|
||||
workspaceStore.whenLoaded,
|
||||
clusterStore.whenLoaded,
|
||||
]);
|
||||
|
||||
await store.dispatch('init')
|
||||
new Vue({
|
||||
components: {App},
|
||||
store,
|
||||
|
||||
@@ -1,12 +1,29 @@
|
||||
import Vue from "vue"
|
||||
import { ClusterInfo } from "../../../../main/cluster"
|
||||
import { ActionTree, GetterTree, MutationTree } from "vuex"
|
||||
import { PromiseIpc } from 'electron-promise-ipc'
|
||||
import { clusterStore } from "../../../../common/cluster-store"
|
||||
import { ClusterModel } from "../../../../common/cluster-store"
|
||||
import { Workspace } from "../../../../common/workspace-store"
|
||||
import { tracker } from "../../../../common/tracker";
|
||||
import { FeatureStatusMap } from "../../../../main/feature";
|
||||
import { Kubectl } from "../../../../main/kubectl";
|
||||
|
||||
const promiseIpc = new PromiseIpc({ maxTimeoutMs: 120000 });
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
export interface ClusterInfo extends ClusterModel {
|
||||
url: string;
|
||||
apiUrl: string;
|
||||
online?: boolean;
|
||||
accessible?: boolean;
|
||||
failureReason?: string;
|
||||
nodes?: number;
|
||||
version?: string;
|
||||
distribution?: string;
|
||||
isAdmin?: boolean;
|
||||
features?: FeatureStatusMap;
|
||||
kubeCtl?: Kubectl;
|
||||
contextName: string;
|
||||
}
|
||||
|
||||
export interface LensWebview {
|
||||
id: string;
|
||||
@@ -19,6 +36,8 @@ export interface ClusterState {
|
||||
clusters: ClusterInfo[];
|
||||
}
|
||||
|
||||
const promiseIpc = new PromiseIpc({ maxTimeoutMs: 120000 });
|
||||
|
||||
const state: ClusterState = {
|
||||
lenses: [],
|
||||
clusters: []
|
||||
@@ -218,7 +237,7 @@ const actions: ActionTree<ClusterState, any> = {
|
||||
})
|
||||
},
|
||||
storeCluster({ commit }, cluster: ClusterInfo) {
|
||||
clusterStore.saveCluster(cluster);
|
||||
// clusterStore.saveCluster(cluster);
|
||||
commit("updateCluster", cluster)
|
||||
promiseIpc.send("clusterStored", cluster.id)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user