import { Empty } from 'ant-design-vue'
import { useServiceStore } from '@/store/service'
- import { CommonStatus, CommonStatusTexts } from '@/enums/state'
+ import { CommonStatus } from '@/enums/state'
import { useJobProgress } from '@/store/job-progress'
+ import { useTabStore } from '@/store/tab-state'
import { usePngImage } from '@/utils/tools'
+ import { STATUS_COLOR } from '@/utils/constant'
import type { GroupItem } from '@/components/common/button-group/types'
import type { FilterFormItem } from '@/components/common/form-filter/types'
- import type { ServiceStatusType, ServiceVO } from '@/api/service/types'
- import type { ClusterVO } from '@/api/cluster/types'
+ import type { ServiceVO } from '@/api/service/types'
import type { Command, CommandRequest } from '@/api/command/types'
type GroupItemActionType = keyof typeof Command | 'More'
const { t } = useI18n()
const router = useRouter()
- const attrs = useAttrs() as ClusterVO
+ const route = useRoute()
+ const tabStore = useTabStore()
const jobProgressStore = useJobProgress()
const serviceStore = useServiceStore()
- const { services, loading } = toRefs(serviceStore)
+
+ const { services, loading } = storeToRefs(serviceStore)
const filterValue = ref({})
- const statusColors = shallowRef>({
- 1: 'healthy',
- 2: 'unhealthy',
- 3: 'unknown'
- })
+ const clusterId = ref(Number(route.params.id))
const actionGroups = computed((): GroupItem[] => [
{
@@ -118,19 +117,19 @@
if (!['More', 'Remove'].includes(command)) {
const execCommandParams = {
command: command,
- clusterId: attrs.id,
+ clusterId: clusterId.value,
commandLevel: 'service',
serviceCommands: [{ serviceName: service.name, installed: true }]
} as CommandRequest
jobProgressStore.processCommand(execCommandParams, getServices, { displayName: service.displayName })
} else {
- serviceStore.removeService(service, attrs.id!, getServices)
+ serviceStore.removeService(service, clusterId.value!, getServices)
}
}
const getServices = () => {
- if (attrs.id != undefined) {
- serviceStore.getServices(attrs.id, filterValue.value)
+ if (clusterId.value != undefined) {
+ serviceStore.getServices(clusterId.value, filterValue.value)
}
}
@@ -142,6 +141,8 @@
}
onActivated(() => {
+ const currTab = tabStore.getActiveTab(route.path ?? '2')
+ if (currTab != '2') return
getServices()
})
@@ -166,10 +167,10 @@
{{ item.version }}
diff --git a/bigtop-manager-ui/src/pages/cluster-manage/cluster/user.vue b/bigtop-manager-ui/src/pages/cluster-manage/cluster/user.vue
index 5fbfbd9e0..830038dd1 100644
--- a/bigtop-manager-ui/src/pages/cluster-manage/cluster/user.vue
+++ b/bigtop-manager-ui/src/pages/cluster-manage/cluster/user.vue
@@ -21,11 +21,11 @@
import { getUserListOfService } from '@/api/cluster'
import type { TableColumnType } from 'ant-design-vue'
- import type { ClusterVO, ServiceUserVO } from '@/api/cluster/types'
+ import type { ServiceUserVO } from '@/api/cluster/types'
const { t } = useI18n()
- const attrs = useAttrs() as ClusterVO
-
+ const route = useRoute()
+ const clusterId = ref(Number(route.params.id))
const columns = computed((): TableColumnType[] => [
{
title: '#',
@@ -66,12 +66,12 @@
})
const loadUserListOfService = async () => {
- if (attrs.id == undefined || !paginationProps.value) {
+ if (clusterId.value == undefined || !paginationProps.value) {
loading.value = false
return
}
try {
- const data = await getUserListOfService(attrs.id, filtersParams.value)
+ const data = await getUserListOfService(clusterId.value, filtersParams.value)
dataSource.value = data.content
paginationProps.value.total = data.total
} catch (error) {
diff --git a/bigtop-manager-ui/src/pages/cluster-manage/hosts/detail.vue b/bigtop-manager-ui/src/pages/cluster-manage/hosts/detail.vue
index a155ba455..2bf877497 100644
--- a/bigtop-manager-ui/src/pages/cluster-manage/hosts/detail.vue
+++ b/bigtop-manager-ui/src/pages/cluster-manage/hosts/detail.vue
@@ -20,7 +20,8 @@