From 5ecd17faebf2512687ba9b853691b5662e87f68a Mon Sep 17 00:00:00 2001 From: Fdefined <55788435+FU-design@users.noreply.github.com> Date: Thu, 25 Jul 2024 17:32:35 +0800 Subject: [PATCH] BIGTOP-4168: Add log progress messages on the task log page (#25) --- bigtop-manager-ui/src/api/sse/index.ts | 3 +- bigtop-manager-ui/src/api/sse/types.ts | 23 +++ .../src/components/job-info/job.vue | 163 +++++++++++------- .../src/components/job-info/stage.vue | 46 ++--- .../src/components/job-info/task-log.vue | 34 +++- .../src/components/job-info/task.vue | 39 ++--- .../src/composables/use-base-table.ts | 76 ++++++++ bigtop-manager-ui/src/locales/en_US/index.ts | 4 +- bigtop-manager-ui/src/locales/en_US/job.ts | 23 +++ bigtop-manager-ui/src/locales/zh_CN/index.ts | 4 +- bigtop-manager-ui/src/locales/zh_CN/job.ts | 23 +++ bigtop-manager-ui/src/utils/tools.ts | 5 +- 12 files changed, 311 insertions(+), 132 deletions(-) create mode 100644 bigtop-manager-ui/src/api/sse/types.ts create mode 100644 bigtop-manager-ui/src/composables/use-base-table.ts create mode 100644 bigtop-manager-ui/src/locales/en_US/job.ts create mode 100644 bigtop-manager-ui/src/locales/zh_CN/job.ts diff --git a/bigtop-manager-ui/src/api/sse/index.ts b/bigtop-manager-ui/src/api/sse/index.ts index 52ee663e..22975e58 100644 --- a/bigtop-manager-ui/src/api/sse/index.ts +++ b/bigtop-manager-ui/src/api/sse/index.ts @@ -19,12 +19,13 @@ import axios, { type AxiosProgressEvent, type CancelTokenSource } from 'axios' import request from '@/api/request.ts' +import type { LogsRes } from './types' export const getLogs = ( clusterId: number, id: number, func: Function -): { promise: Promise; cancel: () => void } => { +): LogsRes => { const source: CancelTokenSource = axios.CancelToken.source() const promise = request({ diff --git a/bigtop-manager-ui/src/api/sse/types.ts b/bigtop-manager-ui/src/api/sse/types.ts new file mode 100644 index 00000000..6f83d3e5 --- /dev/null +++ b/bigtop-manager-ui/src/api/sse/types.ts @@ -0,0 +1,23 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +export interface LogsRes { + promise: Promise + cancel: () => void +} diff --git a/bigtop-manager-ui/src/components/job-info/job.vue b/bigtop-manager-ui/src/components/job-info/job.vue index d2a2b34a..e645c60a 100644 --- a/bigtop-manager-ui/src/components/job-info/job.vue +++ b/bigtop-manager-ui/src/components/job-info/job.vue @@ -18,9 +18,8 @@ -->