This is an automated email from the ASF dual-hosted git repository.

imbajin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hugegraph-toolchain.git

commit 32c1789ca60cae4e5bbf313ddae0314b5cb9ab2e
Author: dark <[email protected]>
AuthorDate: Fri Aug 14 12:39:02 2026 +0800

    fix(task): normalize task statuses
---
 .../hubble-fe/src/pages/Task/index.module.scss     | 19 +++++++
 .../hubble-fe/src/pages/Task/status.js             | 63 ++++++++++++++++++++++
 .../hubble-fe/src/pages/Task/status.test.js        | 34 ++++++++++++
 .../hubble-fe/src/pages/Task/task-i18n.test.js     | 27 ++++++++++
 4 files changed, 143 insertions(+)

diff --git a/hugegraph-hubble/hubble-fe/src/pages/Task/index.module.scss 
b/hugegraph-hubble/hubble-fe/src/pages/Task/index.module.scss
index 5bd11b946..3a729213a 100644
--- a/hugegraph-hubble/hubble-fe/src/pages/Task/index.module.scss
+++ b/hugegraph-hubble/hubble-fe/src/pages/Task/index.module.scss
@@ -57,3 +57,22 @@
         color: #fff;
     }
 }
+
+.task_table {
+    :global(.ant-table-cell) {
+        white-space: nowrap;
+    }
+}
+
+.no_wrap {
+    overflow: hidden;
+    white-space: nowrap;
+    text-overflow: ellipsis;
+}
+
+.task_status {
+    min-width: 64px;
+    margin-right: 0;
+    text-align: center;
+    white-space: nowrap;
+}
diff --git a/hugegraph-hubble/hubble-fe/src/pages/Task/status.js 
b/hugegraph-hubble/hubble-fe/src/pages/Task/status.js
new file mode 100644
index 000000000..4cfd93cca
--- /dev/null
+++ b/hugegraph-hubble/hubble-fe/src/pages/Task/status.js
@@ -0,0 +1,63 @@
+/*
+ *
+ * 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
+ *
+ *     http://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.
+ */
+
+import {Tag} from 'antd';
+import {useTranslation} from 'react-i18next';
+import style from './index.module.scss';
+
+const TASK_STATUS_CONFIG = {
+    DEFAULT: {key: 'pending'},
+    NEW: {key: 'pending'},
+    PENDING: {key: 'pending'},
+    WAITING: {key: 'pending'},
+    UPLOADING: {key: 'running', color: 'processing'},
+    MAPPING: {key: 'running', color: 'processing'},
+    SETTING: {key: 'running', color: 'processing'},
+    LOADING: {key: 'running', color: 'processing'},
+    RUNNING: {key: 'running', color: 'processing'},
+    EXECUTING: {key: 'running', color: 'processing'},
+    SUCCEED: {key: 'success', color: 'success'},
+    SUCCESS: {key: 'success', color: 'success'},
+    FAILED: {key: 'failed', color: 'error'},
+    FAILURE: {key: 'failed', color: 'error'},
+    PAUSED: {key: 'paused', color: 'warning'},
+    STOPPED: {key: 'stopped'},
+    INIT: {key: 'initializing'},
+    CANCELLING: {key: 'cancelling', color: 'warning'},
+    CANCELLED: {key: 'cancelled'},
+    CANCELED: {key: 'cancelled'},
+};
+
+const getTaskStatus = status => {
+    const value = status && typeof status === 'object' ? status.status : 
status;
+    const normalized = value ? String(value).toUpperCase() : '';
+    return TASK_STATUS_CONFIG[normalized] ?? {key: 'unknown'};
+};
+
+const TaskStatus = ({status}) => {
+    const {t} = useTranslation();
+    const config = getTaskStatus(status);
+
+    return (
+        <Tag className={style.task_status} color={config.color}>
+            {t(`task.status.${config.key}`)}
+        </Tag>
+    );
+};
+
+export {getTaskStatus, TaskStatus};
diff --git a/hugegraph-hubble/hubble-fe/src/pages/Task/status.test.js 
b/hugegraph-hubble/hubble-fe/src/pages/Task/status.test.js
new file mode 100644
index 000000000..b8273d2c1
--- /dev/null
+++ b/hugegraph-hubble/hubble-fe/src/pages/Task/status.test.js
@@ -0,0 +1,34 @@
+/*
+ * 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
+ *
+ *     http://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.
+ */
+
+import {getTaskStatus} from './status';
+
+jest.mock('react-i18next', () => ({
+    useTranslation: () => ({t: key => key}),
+}));
+
+test.each([
+    ['DEFAULT', 'pending'],
+    ['UPLOADING', 'running'],
+    ['MAPPING', 'running'],
+    ['SETTING', 'running'],
+    ['LOADING', 'running'],
+    ['SUCCESS', 'success'],
+    ['FAILED', 'failed'],
+])('maps hubble-be JobStatus %s to the %s user state', (status, key) => {
+    expect(getTaskStatus(status)).toEqual(expect.objectContaining({key}));
+});
diff --git a/hugegraph-hubble/hubble-fe/src/pages/Task/task-i18n.test.js 
b/hugegraph-hubble/hubble-fe/src/pages/Task/task-i18n.test.js
index fd712cb23..791508e02 100644
--- a/hugegraph-hubble/hubble-fe/src/pages/Task/task-i18n.test.js
+++ b/hugegraph-hubble/hubble-fe/src/pages/Task/task-i18n.test.js
@@ -60,3 +60,30 @@ test('Task translations are symmetric and English values 
contain no Chinese copy
     expect(zhKeys.filter(key => !enKeys.includes(key))).toEqual([]);
     expect(enEntries.filter(([, value]) => 
/[\u3400-\u9fff]/u.test(value))).toEqual([]);
 });
+
+test('Task status labels localize common Loader backend states', () => {
+    expect(zhPages.task.status).toEqual({
+        pending: '待执行',
+        running: '运行中',
+        success: '已完成',
+        failed: '失败',
+        paused: '已暂停',
+        stopped: '已停止',
+        initializing: '初始化中',
+        cancelling: '正在取消',
+        cancelled: '已取消',
+        unknown: '未知状态',
+    });
+    expect(enPages.task.status).toEqual({
+        pending: 'Pending',
+        running: 'Running',
+        success: 'Completed',
+        failed: 'Failed',
+        paused: 'Paused',
+        stopped: 'Stopped',
+        initializing: 'Initializing',
+        cancelling: 'Cancelling',
+        cancelled: 'Cancelled',
+        unknown: 'Unknown',
+    });
+});

Reply via email to