是否有边缘节点页面和是否有概览页面

This commit is contained in:
jhnine 2022-11-22 11:12:37 +08:00
parent 4655fe2d03
commit 6c628bdd42
6 changed files with 35 additions and 20 deletions

View File

@ -90,9 +90,14 @@ export default {
return false
},
showMenuByStorage(item) {
const edgeNode = localStorage.getItem('edgeNode')
//
if (item.path === 'edgenodeManagement' && edgeNode === 'false') {
const edgeNodePage = localStorage.getItem('edgeNodePage')
if (item.path === 'edgenodeManagement' && edgeNodePage === 'false') {
return false
}
//
const hasMonitorPage = localStorage.getItem('monitorPage')
if (item.path === 'overview' && hasMonitorPage === 'false') {
return false
}
return true

View File

@ -1,5 +1,9 @@
import { getClusterList } from '@/api/container/cluster'
const state = { clusterName: '', kubeedge: false }
const state = {
clusterName: '',
hasEdge: false,
hasMonitor: false
}
const mutations = {
SET_CLUSTER: (state, clusterName) => {
@ -7,8 +11,12 @@ const mutations = {
localStorage.setItem('clusterName', clusterName)
},
SET_EDGE: (state, hasEdge) => {
state.kubeedge = hasEdge
localStorage.setItem('edgeNode', hasEdge)
state.hasEdge = hasEdge
localStorage.setItem('edgeNodePage', hasEdge)
},
SET_MONITOR: (state, hasMonitor) => {
state.hasMonitor = hasMonitor
localStorage.setItem('monitorPage', hasMonitor)
}
}
const actions = {
@ -18,12 +26,17 @@ const actions = {
getClusterList({ commit }, data) {
return getClusterList().then(response => {
const List = response.data.list.filter(e => e.cluster_name === state.clusterName)
const kubeedge = List.length === 1 ? List[0].edge : false
commit('SET_EDGE', kubeedge)
const hasEdge = List.length === 1 ? List[0].edge : false
commit('SET_EDGE', hasEdge)
const hasMonitor = List.length === 1 ? List[0].monitoring : false
commit('SET_MONITOR', hasMonitor)
})
},
setEdge({ commit }, data) {
commit('SET_EDGE', data)
},
setMonitor({ commit }, data) {
commit('SET_MONITOR', data)
}
}

View File

@ -50,8 +50,10 @@ export default {
// set cluster
this.$store.dispatch('user/setRouteType', 'cluster')
this.$store.dispatch('cluster/setCluster', row.cluster_name)
this.$store.dispatch('cluster/setEdge', row.kubeedge)
this.$router.push({ name: `clusterOverview`, params: { 'clusterName': row.cluster_name }})
this.$store.dispatch('cluster/setEdge', row.edge)
this.$store.dispatch('cluster/setMonitor', row.monitoring)
//
this.$router.push({ name: `${localStorage.getItem('monitorPage') === 'false' ? 'NodeManagement' : 'clusterOverview'}`, params: { 'clusterName': row.cluster_name }})
}
}
}

View File

@ -71,13 +71,6 @@ export default {
getList() {
this.$refs.multipleTable.getList()
},
selectCluster(row) {
// set cluster
this.$store.dispatch('user/setRouteType', 'cluster')
this.$store.dispatch('cluster/setCluster', row.cluster_name)
this.$store.dispatch('cluster/setEdge', false)
this.$router.push({ name: `clusterOverview`, params: { 'clusterName': row.cluster_name }})
},
deleteCluster(row) {
this.$confirm(`您确定要删除吗?`, { type: 'warning' }).then(() => {
deleteCluster({ cluster_name: row.cluster_name, domain_id: row.domain_id }).then(e => {

View File

@ -81,8 +81,9 @@ export default {
// set cluster
this.$store.dispatch('user/setRouteType', 'cluster')
this.$store.dispatch('cluster/setCluster', row.cluster_name)
this.$store.dispatch('cluster/setEdge', false)
this.$router.push({ name: `clusterOverview`, params: { 'clusterName': row.cluster_name }})
this.$store.dispatch('cluster/setEdge', row.edge)
this.$store.dispatch('cluster/setMonitor', row.monitoring)
this.$router.push({ name: `${localStorage.getItem('monitorPage') === 'false' ? 'NodeManagement' : 'clusterOverview'}`, params: { 'clusterName': row.cluster_name }})
},
deleteCluster(row) {
this.$confirm(`您确定要删除吗?`, { type: 'warning' }).then(() => {

View File

@ -168,8 +168,9 @@ export default {
// set cluster
this.$store.dispatch('user/setRouteType', 'cluster')
this.$store.dispatch('cluster/setCluster', row.cluster_name)
this.$store.dispatch('cluster/setEdge', false)
this.$router.push({ name: `clusterOverview`, params: { 'clusterName': row.cluster_name }})
this.$store.dispatch('cluster/setEdge', row.edge)
this.$store.dispatch('cluster/setMonitor', row.monitoring)
this.$router.push({ name: `${localStorage.getItem('monitorPage') === 'false' ? 'NodeManagement' : 'clusterOverview'}`, params: { 'clusterName': row.cluster_name }})
},
getImg(src) {
return require('@/assets/images/' + src + '.png')