forked from JointCloud/JCC-RIP
是否有边缘节点页面和是否有概览页面
This commit is contained in:
parent
4655fe2d03
commit
6c628bdd42
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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 }})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 => {
|
||||
|
|
|
@ -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(() => {
|
||||
|
|
|
@ -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')
|
||||
|
|
Loading…
Reference in New Issue