1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

fix errors

Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
Roman 2020-07-05 20:32:00 +03:00
parent deea97ec5c
commit 387bc07dbc
2 changed files with 5 additions and 4 deletions

View File

@ -1,14 +1,14 @@
export default { export default {
computed: { computed: {
clusters: function() { clusters: function () {
return this.$store.getters.clusters return this.$store.getters.clusters
}, },
newContexts: function() { newContexts: function () {
const seenContexts = this.seenContexts || this.$store.getters.seenContexts const seenContexts = this.seenContexts ? Array.from(this.seenContexts) : this.$store.getters.seenContexts
const contextNamesFromKubeconfig = this.availableContexts.map(item => item.currentContext) const contextNamesFromKubeconfig = this.availableContexts.map(item => item.currentContext)
return contextNamesFromKubeconfig.filter((item) => seenContexts.indexOf(item) < 0) return contextNamesFromKubeconfig.filter((item) => seenContexts.indexOf(item) < 0)
}, },
availableContexts: function() { availableContexts: function () {
// read available kubeconfigs from store on filter out configs already found in added clusters // read available kubeconfigs from store on filter out configs already found in added clusters
return this.$store.getters.availableKubeContexts.filter(item => !this.clusters.find((cluster) => cluster.contextName == item.currentContext)); return this.$store.getters.availableKubeContexts.filter(item => !this.clusters.find((cluster) => cluster.contextName == item.currentContext));
}, },

View File

@ -7,6 +7,7 @@ const state = {
const actions = { const actions = {
reloadAvailableKubeContexts({commit}, file) { reloadAvailableKubeContexts({commit}, file) {
if(!file) return;
let kc = new k8s.KubeConfig(); let kc = new k8s.KubeConfig();
try { try {
kc.loadFromFile(file); kc.loadFromFile(file);