Skip to content

Commit

Permalink
add ns localstorage
Browse files Browse the repository at this point in the history
  • Loading branch information
weibaohui committed Nov 12, 2023
1 parent 5785493 commit 793920e
Show file tree
Hide file tree
Showing 35 changed files with 244 additions and 118 deletions.
9 changes: 5 additions & 4 deletions src/frontend/components/ClusterRole/ClusterRoleListView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { DialogHelper } from '@frontend/service/page/DialogHelper'
import _ from 'lodash'
import type { DataTableColumns } from 'naive-ui'
import { NButton, useDialog } from 'naive-ui'
import { h, ref } from 'vue'
import { h, onMounted, ref } from 'vue'
import { useDrawerService } from '@frontend/service/drawer-service/use-drawer'
import { K8sService } from '@frontend/service/k8s/K8sService'
import { DrawerHelper } from '@frontend/service/page/DrawerHelper'
Expand Down Expand Up @@ -89,9 +89,10 @@ function onTextChanged(text: string) {
if (!_.isEmpty(searchText.value))
itemList.value = itemList.value.filter(r => r.metadata.name.includes(searchText.value))
}
getItemList()
TimerUtils.delayTwoSeconds(() => K8sService.watchService.watchChange(itemList, ResType.ClusterRole))
onMounted(() => {
getItemList()
TimerUtils.delayTwoSeconds(() => K8sService.watchService.watchChange(itemList, ResType.ClusterRole))
})
</script>

<template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { DialogHelper } from '@frontend/service/page/DialogHelper'
import _ from 'lodash'
import type { DataTableColumns } from 'naive-ui'
import { NButton, useDialog } from 'naive-ui'
import { h, ref } from 'vue'
import { h, onMounted, ref } from 'vue'
import { useDrawerService } from '@frontend/service/drawer-service/use-drawer'
import { K8sService } from '@frontend/service/k8s/K8sService'
import { DrawerHelper } from '@frontend/service/page/DrawerHelper'
Expand Down Expand Up @@ -94,9 +94,10 @@ function onTextChanged(text: string) {
if (!_.isEmpty(searchText.value))
itemList.value = itemList.value.filter(r => r.metadata.name.includes(searchText.value))
}
getItemList()
TimerUtils.delayTwoSeconds(() => K8sService.watchService.watchChange(itemList, ResType.ClusterRoleBinding))
onMounted(() => {
getItemList()
TimerUtils.delayTwoSeconds(() => K8sService.watchService.watchChange(itemList, ResType.ClusterRoleBinding))
})
</script>

<template>
Expand Down
10 changes: 7 additions & 3 deletions src/frontend/components/EndpointSlice/EndpointSliceListView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { DialogHelper } from '@frontend/service/page/DialogHelper'
import _ from 'lodash'
import type { DataTableColumns } from 'naive-ui'
import { NButton, useDialog } from 'naive-ui'
import { h, ref } from 'vue'
import { h, onMounted, ref } from 'vue'
import { useDrawerService } from '@frontend/service/drawer-service/use-drawer'
import { K8sService } from '@frontend/service/k8s/K8sService'
import { DrawerHelper } from '@frontend/service/page/DrawerHelper'
Expand Down Expand Up @@ -125,9 +125,13 @@ function onTextChanged(text: string) {
if (!_.isEmpty(searchText.value))
itemList.value = itemList.value.filter(r => r.metadata.name.includes(searchText.value))
}
onMounted(() => {
if (localStorage.selectedNs)
selectedNs.value = localStorage.selectedNs
getItemList()
TimerUtils.delayTwoSeconds(() => K8sService.watchService.watchChange(itemList, ResType.EndpointSlice, selectedNs))
getItemList()
TimerUtils.delayTwoSeconds(() => K8sService.watchService.watchChange(itemList, ResType.EndpointSlice, selectedNs))
})
</script>

<template>
Expand Down
10 changes: 7 additions & 3 deletions src/frontend/components/HorizontalPodAutoscaler/HpaListView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { DialogHelper } from '@frontend/service/page/DialogHelper'
import _ from 'lodash'
import type { DataTableColumns } from 'naive-ui'
import { NButton, useDialog } from 'naive-ui'
import { h, ref } from 'vue'
import { h, onMounted, ref } from 'vue'
import { useDrawerService } from '@frontend/service/drawer-service/use-drawer'
import { K8sService } from '@frontend/service/k8s/K8sService'
import { DrawerHelper } from '@frontend/service/page/DrawerHelper'
Expand Down Expand Up @@ -145,9 +145,13 @@ function onTextChanged(text: string) {
if (!_.isEmpty(searchText.value))
itemList.value = itemList.value.filter(r => r.metadata.name.includes(searchText.value))
}
onMounted(() => {
if (localStorage.selectedNs)
selectedNs.value = localStorage.selectedNs
getItemList()
TimerUtils.delayTwoSeconds(() => K8sService.watchService.watchChange(itemList, ResType.HorizontalPodAutoscaler, selectedNs))
getItemList()
TimerUtils.delayTwoSeconds(() => K8sService.watchService.watchChange(itemList, ResType.HorizontalPodAutoscaler, selectedNs))
})
</script>

<template>
Expand Down
9 changes: 5 additions & 4 deletions src/frontend/components/IngressClass/IngressClassListView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { DialogHelper } from '@frontend/service/page/DialogHelper'
import _ from 'lodash'
import type { DataTableColumns } from 'naive-ui'
import { NButton, useDialog } from 'naive-ui'
import { h, ref } from 'vue'
import { h, onMounted, ref } from 'vue'
import { TimerUtils } from '@backend/utils/TimerUtils'
import ResourceAgeView from '@frontend/components/common/ResourceAgeView.vue'
import WorkloadListView from '@frontend/components/common/ResourceListView.vue'
Expand Down Expand Up @@ -128,9 +128,10 @@ function onTextChanged(text: string) {
}
itemList.value = itemList.value.filter(r => r.metadata.name.includes(text))
}
getItemList()
TimerUtils.delayTwoSeconds(() => K8sService.watchService.watchChange(itemList, ResType.IngressClass))
onMounted(() => {
getItemList()
TimerUtils.delayTwoSeconds(() => K8sService.watchService.watchChange(itemList, ResType.IngressClass))
})
</script>

<template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { DialogHelper } from '@frontend/service/page/DialogHelper'
import _ from 'lodash'
import type { DataTableColumns } from 'naive-ui'
import { NButton, useDialog } from 'naive-ui'
import { h, ref } from 'vue'
import { h, onMounted, ref } from 'vue'
import { useDrawerService } from '@frontend/service/drawer-service/use-drawer'
import { K8sService } from '@frontend/service/k8s/K8sService'
import { DrawerHelper } from '@frontend/service/page/DrawerHelper'
Expand Down Expand Up @@ -89,9 +89,10 @@ function onTextChanged(text: string) {
if (!_.isEmpty(searchText.value))
itemList.value = itemList.value.filter(r => r.metadata.name.includes(searchText.value))
}
getItemList()
TimerUtils.delayTwoSeconds(() => K8sService.watchService.watchChange(itemList, ResType.MutatingWebhookConfiguration))
onMounted(() => {
getItemList()
TimerUtils.delayTwoSeconds(() => K8sService.watchService.watchChange(itemList, ResType.MutatingWebhookConfiguration))
})
</script>

<template>
Expand Down
10 changes: 7 additions & 3 deletions src/frontend/components/NetworkPolicy/NetpolListView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { DialogHelper } from '@frontend/service/page/DialogHelper'
import _ from 'lodash'
import type { DataTableColumns } from 'naive-ui'
import { NButton, useDialog } from 'naive-ui'
import { h, ref } from 'vue'
import { h, onMounted, ref } from 'vue'
import { useDrawerService } from '@frontend/service/drawer-service/use-drawer'
import { K8sService } from '@frontend/service/k8s/K8sService'
import { DrawerHelper } from '@frontend/service/page/DrawerHelper'
Expand Down Expand Up @@ -133,9 +133,13 @@ function onTextChanged(text: string) {
if (!_.isEmpty(searchText.value))
itemList.value = itemList.value.filter(r => r.metadata.name.includes(searchText.value))
}
onMounted(() => {
if (localStorage.selectedNs)
selectedNs.value = localStorage.selectedNs
getItemList()
TimerUtils.delayTwoSeconds(() => K8sService.watchService.watchChange(itemList, ResType.NetworkPolicy, selectedNs))
getItemList()
TimerUtils.delayTwoSeconds(() => K8sService.watchService.watchChange(itemList, ResType.NetworkPolicy, selectedNs))
})
</script>

<template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { DialogHelper } from '@frontend/service/page/DialogHelper'
import _ from 'lodash'
import type { DataTableColumns } from 'naive-ui'
import { NButton, useDialog } from 'naive-ui'
import { h, ref } from 'vue'
import { h, onMounted, ref } from 'vue'
import { TimerUtils } from '@backend/utils/TimerUtils'
import ResourceAgeView from '@frontend/components/common/ResourceAgeView.vue'
import WorkloadListView from '@frontend/components/common/ResourceListView.vue'
Expand Down Expand Up @@ -110,9 +110,10 @@ function onTextChanged(text: string) {
}
itemList.value = itemList.value.filter(r => r.metadata.name.includes(text))
}
getItemList()
TimerUtils.delayTwoSeconds(() => K8sService.watchService.watchChange(itemList, ResType.PersistentVolume))
onMounted(() => {
getItemList()
TimerUtils.delayTwoSeconds(() => K8sService.watchService.watchChange(itemList, ResType.PersistentVolume))
})
</script>

<template>
Expand Down
10 changes: 7 additions & 3 deletions src/frontend/components/PersistentVolumeClaim/PvcListView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { DialogHelper } from '@frontend/service/page/DialogHelper'
import _ from 'lodash'
import type { DataTableColumns } from 'naive-ui'
import { NButton, useDialog } from 'naive-ui'
import { h, ref } from 'vue'
import { h, onMounted, ref } from 'vue'
import { useDrawerService } from '@frontend/service/drawer-service/use-drawer'
import { K8sService } from '@frontend/service/k8s/K8sService'
import { DrawerHelper } from '@frontend/service/page/DrawerHelper'
Expand Down Expand Up @@ -141,9 +141,13 @@ function onTextChanged(text: string) {
if (!_.isEmpty(searchText.value))
itemList.value = itemList.value.filter(r => r.metadata.name.includes(searchText.value))
}
onMounted(() => {
if (localStorage.selectedNs)
selectedNs.value = localStorage.selectedNs
getItemList()
TimerUtils.delayTwoSeconds(() => K8sService.watchService.watchChange(itemList, ResType.PersistentVolumeClaim, selectedNs))
getItemList()
TimerUtils.delayTwoSeconds(() => K8sService.watchService.watchChange(itemList, ResType.PersistentVolumeClaim, selectedNs))
})
</script>

<template>
Expand Down
10 changes: 7 additions & 3 deletions src/frontend/components/PodDisruptionBudget/PdbListView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { DialogHelper } from '@frontend/service/page/DialogHelper'
import _ from 'lodash'
import type { DataTableColumns } from 'naive-ui'
import { NButton, useDialog } from 'naive-ui'
import { h, ref } from 'vue'
import { h, onMounted, ref } from 'vue'
import { useDrawerService } from '@frontend/service/drawer-service/use-drawer'
import { K8sService } from '@frontend/service/k8s/K8sService'
import { DrawerHelper } from '@frontend/service/page/DrawerHelper'
Expand Down Expand Up @@ -113,9 +113,13 @@ function onTextChanged(text: string) {
if (!_.isEmpty(searchText.value))
itemList.value = itemList.value.filter(r => r.metadata.name.includes(searchText.value))
}
onMounted(() => {
if (localStorage.selectedNs)
selectedNs.value = localStorage.selectedNs
getItemList()
TimerUtils.delayTwoSeconds(() => K8sService.watchService.watchChange(itemList, ResType.PodDisruptionBudget, selectedNs))
getItemList()
TimerUtils.delayTwoSeconds(() => K8sService.watchService.watchChange(itemList, ResType.PodDisruptionBudget, selectedNs))
})
</script>

<template>
Expand Down
10 changes: 7 additions & 3 deletions src/frontend/components/Role/RoleListView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { DialogHelper } from '@frontend/service/page/DialogHelper'
import _ from 'lodash'
import type { DataTableColumns } from 'naive-ui'
import { NButton, useDialog } from 'naive-ui'
import { h, ref } from 'vue'
import { h, onMounted, ref } from 'vue'
import { useDrawerService } from '@frontend/service/drawer-service/use-drawer'
import { K8sService } from '@frontend/service/k8s/K8sService'
import { DrawerHelper } from '@frontend/service/page/DrawerHelper'
Expand Down Expand Up @@ -113,9 +113,13 @@ function onTextChanged(text: string) {
if (!_.isEmpty(searchText.value))
itemList.value = itemList.value.filter(r => r.metadata.name.includes(searchText.value))
}
onMounted(() => {
if (localStorage.selectedNs)
selectedNs.value = localStorage.selectedNs
getItemList()
TimerUtils.delayTwoSeconds(() => K8sService.watchService.watchChange(itemList, ResType.Role, selectedNs))
getItemList()
TimerUtils.delayTwoSeconds(() => K8sService.watchService.watchChange(itemList, ResType.Role, selectedNs))
})
</script>

<template>
Expand Down
10 changes: 7 additions & 3 deletions src/frontend/components/RoleBinding/RoleBindingListView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { DialogHelper } from '@frontend/service/page/DialogHelper'
import _ from 'lodash'
import type { DataTableColumns } from 'naive-ui'
import { NButton, useDialog } from 'naive-ui'
import { h, ref } from 'vue'
import { h, onMounted, ref } from 'vue'
import { useDrawerService } from '@frontend/service/drawer-service/use-drawer'
import { K8sService } from '@frontend/service/k8s/K8sService'
import { DrawerHelper } from '@frontend/service/page/DrawerHelper'
Expand Down Expand Up @@ -113,9 +113,13 @@ function onTextChanged(text: string) {
if (!_.isEmpty(searchText.value))
itemList.value = itemList.value.filter(r => r.metadata.name.includes(searchText.value))
}
onMounted(() => {
if (localStorage.selectedNs)
selectedNs.value = localStorage.selectedNs
getItemList()
TimerUtils.delayTwoSeconds(() => K8sService.watchService.watchChange(itemList, ResType.RoleBinding, selectedNs))
getItemList()
TimerUtils.delayTwoSeconds(() => K8sService.watchService.watchChange(itemList, ResType.RoleBinding, selectedNs))
})
</script>

<template>
Expand Down
10 changes: 7 additions & 3 deletions src/frontend/components/ServiceAccount/SaListView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { DialogHelper } from '@frontend/service/page/DialogHelper'
import _ from 'lodash'
import type { DataTableColumns } from 'naive-ui'
import { NButton, useDialog } from 'naive-ui'
import { h, ref } from 'vue'
import { h, onMounted, ref } from 'vue'
import { useDrawerService } from '@frontend/service/drawer-service/use-drawer'
import { K8sService } from '@frontend/service/k8s/K8sService'
import { DrawerHelper } from '@frontend/service/page/DrawerHelper'
Expand Down Expand Up @@ -113,9 +113,13 @@ function onTextChanged(text: string) {
if (!_.isEmpty(searchText.value))
itemList.value = itemList.value.filter(r => r.metadata.name.includes(searchText.value))
}
onMounted(() => {
if (localStorage.selectedNs)
selectedNs.value = localStorage.selectedNs
getItemList()
TimerUtils.delayTwoSeconds(() => K8sService.watchService.watchChange(itemList, ResType.ServiceAccount, selectedNs))
getItemList()
TimerUtils.delayTwoSeconds(() => K8sService.watchService.watchChange(itemList, ResType.ServiceAccount, selectedNs))
})
</script>

<template>
Expand Down
9 changes: 5 additions & 4 deletions src/frontend/components/StorageClass/StorageClassListView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { DialogHelper } from '@frontend/service/page/DialogHelper'
import _ from 'lodash'
import type { DataTableColumns } from 'naive-ui'
import { NButton, useDialog } from 'naive-ui'
import { h, ref } from 'vue'
import { h, onMounted, ref } from 'vue'
import { TimerUtils } from '@backend/utils/TimerUtils'
import ResourceAgeView from '@frontend/components/common/ResourceAgeView.vue'
import WorkloadListView from '@frontend/components/common/ResourceListView.vue'
Expand Down Expand Up @@ -114,9 +114,10 @@ function onTextChanged(text: string) {
}
itemList.value = itemList.value.filter(r => r.metadata.name.includes(text))
}
getItemList()
TimerUtils.delayTwoSeconds(() => K8sService.watchService.watchChange(itemList, ResType.StorageClass))
onMounted(() => {
getItemList()
TimerUtils.delayTwoSeconds(() => K8sService.watchService.watchChange(itemList, ResType.StorageClass))
})
</script>

<template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { DialogHelper } from '@frontend/service/page/DialogHelper'
import _ from 'lodash'
import type { DataTableColumns } from 'naive-ui'
import { NButton, useDialog } from 'naive-ui'
import { h, ref } from 'vue'
import { h, onMounted, ref } from 'vue'
import { useDrawerService } from '@frontend/service/drawer-service/use-drawer'
import { K8sService } from '@frontend/service/k8s/K8sService'
import { DrawerHelper } from '@frontend/service/page/DrawerHelper'
Expand Down Expand Up @@ -89,9 +89,10 @@ function onTextChanged(text: string) {
if (!_.isEmpty(searchText.value))
itemList.value = itemList.value.filter(r => r.metadata.name.includes(searchText.value))
}
getItemList()
TimerUtils.delayTwoSeconds(() => K8sService.watchService.watchChange(itemList, ResType.ValidatingWebhookConfiguration))
onMounted(() => {
getItemList()
TimerUtils.delayTwoSeconds(() => K8sService.watchService.watchChange(itemList, ResType.ValidatingWebhookConfiguration))
})
</script>

<template>
Expand Down
10 changes: 7 additions & 3 deletions src/frontend/components/configmap/CmListView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { DialogHelper } from '@frontend/service/page/DialogHelper'
import _ from 'lodash'
import type { DataTableColumns } from 'naive-ui'
import { NButton, useDialog } from 'naive-ui'
import { h, ref } from 'vue'
import { h, onMounted, ref } from 'vue'
import { useDrawerService } from '@frontend/service/drawer-service/use-drawer'
import { K8sService } from '@frontend/service/k8s/K8sService'
import { DrawerHelper } from '@frontend/service/page/DrawerHelper'
Expand Down Expand Up @@ -125,9 +125,13 @@ function onTextChanged(text: string) {
if (!_.isEmpty(searchText.value))
itemList.value = itemList.value.filter(r => r.metadata.name.includes(searchText.value))
}
onMounted(() => {
if (localStorage.selectedNs)
selectedNs.value = localStorage.selectedNs
getItemList()
TimerUtils.delayTwoSeconds(() => K8sService.watchService.watchChange(itemList, ResType.ConfigMap, selectedNs))
getItemList()
TimerUtils.delayTwoSeconds(() => K8sService.watchService.watchChange(itemList, ResType.ConfigMap, selectedNs))
})
</script>

<template>
Expand Down
Loading

0 comments on commit 793920e

Please sign in to comment.