From 3a9ca10c797d9f166edb21a91a3c9c1628dee22f Mon Sep 17 00:00:00 2001 From: fuliqiang <1348994179@qq.com> Date: Thu, 9 May 2024 17:56:50 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E9=9B=86=E7=BE=A4-?= =?UTF-8?q?=E9=98=B6=E6=AE=B5=E5=8A=A0=E8=BD=BD=E5=8F=AF=E9=80=9A=E8=BF=87?= =?UTF-8?q?=E7=82=B9=E5=87=BBstageName=E8=A7=A6=E5=8F=91=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E8=AF=A6=E6=83=85=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bigtop-manager-ui/.env.development | 3 +- bigtop-manager-ui/src/api/job/types.ts | 5 + .../src/components/cluster-create/install.vue | 115 +++-- .../components/cluster-create/set-hosts.vue | 3 +- .../src/components/job-info/index.vue | 333 +-------------- .../src/components/job-info/job-info.vue | 398 ++++++++++++++++++ .../src/components/job-info/stage-info.vue | 15 +- 7 files changed, 472 insertions(+), 400 deletions(-) create mode 100644 bigtop-manager-ui/src/components/job-info/job-info.vue diff --git a/bigtop-manager-ui/.env.development b/bigtop-manager-ui/.env.development index 4af78b52..44482818 100644 --- a/bigtop-manager-ui/.env.development +++ b/bigtop-manager-ui/.env.development @@ -17,7 +17,8 @@ NODE_ENV=development VITE_APP_BASE='/' #VITE_APP_BASE_URL='http://172.29.40.96:8080' -VITE_APP_BASE_URL='http://localhost:8080' +# VITE_APP_BASE_URL='http://localhost:8080' +VITE_APP_BASE_URL='http://mkwbafep.v7.idcfengye.com' VITE_APP_BASE_API='/api' #VITE_APP_BASE_WS_URL='ws://172.29.40.96:8080' VITE_APP_BASE_WS_URL='ws://localhost:8080' diff --git a/bigtop-manager-ui/src/api/job/types.ts b/bigtop-manager-ui/src/api/job/types.ts index 79428ae7..0674e9a3 100644 --- a/bigtop-manager-ui/src/api/job/types.ts +++ b/bigtop-manager-ui/src/api/job/types.ts @@ -55,3 +55,8 @@ export interface Pagination { sort?: 'asc' | 'desc' orderBy?: string } + +export interface OuterData { + meta: JobVO[] + currItem: StageVO | TaskVO | undefined +} diff --git a/bigtop-manager-ui/src/components/cluster-create/install.vue b/bigtop-manager-ui/src/components/cluster-create/install.vue index 816cd319..1ed14fb7 100644 --- a/bigtop-manager-ui/src/components/cluster-create/install.vue +++ b/bigtop-manager-ui/src/components/cluster-create/install.vue @@ -25,6 +25,9 @@ import { onBeforeMount, onBeforeUnmount, reactive, ref } from 'vue' import { useClusterStore } from '@/store/cluster' import { storeToRefs } from 'pinia' + import CustomProgress from '@/components/job-info/custom-progress.vue' + import JobInfo from '@/components/job-info/job-info.vue' + import { JobVO, StageVO } from '@/api/job/types' const clusterInfo = defineModel('clusterInfo') const disableButton = defineModel('disableButton') @@ -33,85 +36,52 @@ const { clusterId } = storeToRefs(clusterStore) const { t } = useI18n() - const installData = reactive([]) const loading = ref(true) - const jobState = ref('') - - const initData = async () => { - const res = await getJob(clusterInfo.value.jobId, clusterId.value) - console.log(res) - jobState.value = res.state - - if (jobState.value !== 'Pending' && jobState.value !== 'Processing') { - disableButton.value = false - clusterInfo.value.success = jobState.value === 'Successful' - } - - const arr: any[] = [] - res.stages - .sort((a, b) => a.order - b.order) - .forEach((stage) => { - const data = { - key: stage.id, - stage: stage.name, - progress: 0, - status: '', - color: '' - } - - if (stage.state === 'Pending') { - data.progress = 0 - data.status = 'normal' - data.color = '#1677ff' - } else if (stage.state === 'Processing') { - data.progress = Math.round( - ((stage.tasks.filter((task) => task.state === 'Successful').length + - 1) / - stage.tasks.length) * - 100 - ) - data.status = 'active' - data.color = '#1677ff' - } else if (stage.state === 'Successful') { - data.progress = 100 - data.status = 'success' - data.color = '#52c41a' - } else if (stage.state === 'Canceled') { - data.progress = 0 - data.status = 'normal' - data.color = '#8c908b' - } else { - data.progress = 100 - data.status = 'exception' - data.color = '#ff4d4f' - } - - arr.push(data) - }) - - return arr - } + const jobWindowOpened = ref(false) + const jobState = ref('') + const jobs = ref([]) + const currStage = ref() + const installData = reactive([]) const installColumns = [ { title: t('common.stage'), - dataIndex: 'stage', + dataIndex: 'name', align: 'center' }, { title: t('common.progress'), - dataIndex: 'progress', + dataIndex: 'state', align: 'center' } ] + const initData = async () => { + const res = await getJob(clusterInfo.value.jobId, clusterId.value) + // const res: any = await getFetch() + jobs.value = [res] as any + // console.log(res) + jobState.value = res.state + + if (!['Pending', 'Processing'].includes(jobState.value)) { + disableButton.value = false + clusterInfo.value.success = jobState.value === 'Successful' + } + return res.stages.sort((a: StageVO, b: StageVO) => a.order - b.order) + } + + const clickStage = (record: StageVO) => { + jobWindowOpened.value = true + currStage.value = record + } + onBeforeMount(async () => { disableButton.value = true const { pause } = useIntervalFn( async () => { Object.assign(installData, await initData()) loading.value = false - if (jobState.value !== 'Pending' && jobState.value !== 'Processing') { + if (!['Pending', 'Processing'].includes(jobState.value)) { pause() } }, @@ -143,16 +113,25 @@ :data-source="installData" :loading="loading" > - diff --git a/bigtop-manager-ui/src/components/cluster-create/set-hosts.vue b/bigtop-manager-ui/src/components/cluster-create/set-hosts.vue index 8ee9481c..5d48c32e 100644 --- a/bigtop-manager-ui/src/components/cluster-create/set-hosts.vue +++ b/bigtop-manager-ui/src/components/cluster-create/set-hosts.vue @@ -49,7 +49,8 @@ } } catch (e) { console.log(e) - return Promise.resolve(false) + return Promise.resolve(true) + // return Promise.resolve(false) } } diff --git a/bigtop-manager-ui/src/components/job-info/index.vue b/bigtop-manager-ui/src/components/job-info/index.vue index d8f08461..ec42ead7 100644 --- a/bigtop-manager-ui/src/components/job-info/index.vue +++ b/bigtop-manager-ui/src/components/job-info/index.vue @@ -19,318 +19,27 @@ diff --git a/bigtop-manager-ui/src/components/job-info/job-info.vue b/bigtop-manager-ui/src/components/job-info/job-info.vue new file mode 100644 index 00000000..d4d15aaa --- /dev/null +++ b/bigtop-manager-ui/src/components/job-info/job-info.vue @@ -0,0 +1,398 @@ + + + + + + + diff --git a/bigtop-manager-ui/src/components/job-info/stage-info.vue b/bigtop-manager-ui/src/components/job-info/stage-info.vue index 7fa421f7..9e74c63a 100644 --- a/bigtop-manager-ui/src/components/job-info/stage-info.vue +++ b/bigtop-manager-ui/src/components/job-info/stage-info.vue @@ -19,7 +19,7 @@