Skip to content

Commit

Permalink
Merge pull request #429 from wilhelmguo/feature/add_kubernetes_namesp…
Browse files Browse the repository at this point in the history
…ace_cache

Admin add kubernetes namespace cache
  • Loading branch information
BennieMeng authored Jun 17, 2019
2 parents 0a9ea10 + ba048a0 commit 380a018
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class KubernetesNamespacedResource implements OnInit, OnDestroy {
getCluster() {
const localStorageCluster = localStorage.getItem('cluster');
if (localStorageCluster && this.clusters.indexOf(localStorageCluster.toString()) > -1) {
return localStorageCluster.toString();
return localStorageCluster.toString();
}
return this.clusters[0];
}
Expand Down Expand Up @@ -177,6 +177,7 @@ export class KubernetesNamespacedResource implements OnInit, OnDestroy {
this.pageState = PageState.fromState(state, {totalPage: this.pageState.page.totalPage, totalCount: this.pageState.page.totalCount});
}
if (this.cluster) {
localStorage.setItem('kubeNamespace', this.namespace);
this.kubernetesClient.listPage(this.pageState, this.cluster, this.kubeResource, this.namespace)
.subscribe(
response => {
Expand All @@ -194,7 +195,11 @@ export class KubernetesNamespacedResource implements OnInit, OnDestroy {
this.setCluster(cluster);
this.kubernetesClient.getNames(this.cluster, KubeResourceNamespace).subscribe(
resp => {
this.namespace = '';
let kubeNamespace = localStorage.getItem('kubeNamespace');
if (!kubeNamespace) {
kubeNamespace = '';
}
this.namespace = kubeNamespace;
this.namespaces = Array<string>();
resp.data.map(ns => {
this.namespaces.push(ns.name);
Expand Down

0 comments on commit 380a018

Please sign in to comment.