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

arshad pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/seatunnel-web.git


The following commit(s) were added to refs/heads/main by this push:
     new f8b9d91e [Improvement] [Seatunnel-web] Add support to provide reason 
for job failure: UI change (#231)
f8b9d91e is described below

commit f8b9d91eb6985927c4fbb0a401bfd53613813653
Author: BilwaST <[email protected]>
AuthorDate: Thu Oct 17 22:19:01 2024 +0530

    [Improvement] [Seatunnel-web] Add support to provide reason for job 
failure: UI change (#231)
    
    Signed-off-by: Mohammad Arshad <[email protected]>
---
 seatunnel-ui/src/common/column-width-config.ts     |  4 +-
 seatunnel-ui/src/locales/en_US/project.ts          |  1 +
 seatunnel-ui/src/locales/en_US/tasks.ts            |  3 +-
 seatunnel-ui/src/service/task-instances/types.ts   |  1 +
 .../error-message-highlight.module.scss}           | 41 ++++++----------
 .../error-message-highlight.tsx}                   | 57 ++++++++++++----------
 .../task/synchronization-instance/use-sync-task.ts | 28 ++++++++++-
 7 files changed, 78 insertions(+), 57 deletions(-)

diff --git a/seatunnel-ui/src/common/column-width-config.ts 
b/seatunnel-ui/src/common/column-width-config.ts
index 4a0efdef..5c71b96f 100644
--- a/seatunnel-ui/src/common/column-width-config.ts
+++ b/seatunnel-ui/src/common/column-width-config.ts
@@ -35,10 +35,10 @@ export const COLUMN_WIDTH_CONFIG = {
     }
   },
   link_name: {
-    width: 240
+    width: 180
   },
   state: {
-    width: 120
+    width: 80
   },
   type: {
     width: 130
diff --git a/seatunnel-ui/src/locales/en_US/project.ts 
b/seatunnel-ui/src/locales/en_US/project.ts
index 18e6c552..6327cb0f 100644
--- a/seatunnel-ui/src/locales/en_US/project.ts
+++ b/seatunnel-ui/src/locales/en_US/project.ts
@@ -1144,6 +1144,7 @@ export default {
     cancel: 'Cancel',
     delete: 'Delete',
     delete_confirm: 'Delete?',
+    error_message: 'Error'
   },
   menu: {
     fav: 'Favorites',
diff --git a/seatunnel-ui/src/locales/en_US/tasks.ts 
b/seatunnel-ui/src/locales/en_US/tasks.ts
index ac3b7c99..dc333cd4 100644
--- a/seatunnel-ui/src/locales/en_US/tasks.ts
+++ b/seatunnel-ui/src/locales/en_US/tasks.ts
@@ -40,5 +40,6 @@ export default {
   kill: 'Kill',
   operation: 'Operation',
   view_log: 'View Log',
-  log: 'Log'
+  log: 'Log',
+  view: 'View',
 }
diff --git a/seatunnel-ui/src/service/task-instances/types.ts 
b/seatunnel-ui/src/service/task-instances/types.ts
index 0328e001..600172b7 100644
--- a/seatunnel-ui/src/service/task-instances/types.ts
+++ b/seatunnel-ui/src/service/task-instances/types.ts
@@ -105,6 +105,7 @@ interface TotalList {
   delayTime: number
   retryInterval: number
   endTime: string
+  errorMessage: string
 }
 
 interface TaskInstancesRes {
diff --git a/seatunnel-ui/src/locales/en_US/tasks.ts 
b/seatunnel-ui/src/views/task/synchronization-instance/error-message-highlight.module.scss
similarity index 56%
copy from seatunnel-ui/src/locales/en_US/tasks.ts
copy to 
seatunnel-ui/src/views/task/synchronization-instance/error-message-highlight.module.scss
index ac3b7c99..01760b0c 100644
--- a/seatunnel-ui/src/locales/en_US/tasks.ts
+++ 
b/seatunnel-ui/src/views/task/synchronization-instance/error-message-highlight.module.scss
@@ -15,30 +15,17 @@
  * limitations under the License.
  */
 
-export default {
-  instance_id: 'Instance Id',
-  job_id: 'Job Id',
-  tasks: 'Tasks',
-  search: 'Search',
-  success: 'Success',
-  fail: 'Fail',
-  stop: 'Stop',
-  running: 'Running',
-  unknown: 'Unknown',
-  unpublished: 'Unpublished',
-  published: 'Published',
-  task_name: 'Task Name',
-  state: 'State',
-  run_frequency: 'Run Frequency',
-  once: 'Once',
-  crontab: 'Crontab',
-  start_time: 'Start Time',
-  end_time: 'End Time',
-  last_total_bytes: 'Last Total Bytes',
-  last_total_records: 'Last Total Records',
-  rerun: 'Rerun',
-  kill: 'Kill',
-  operation: 'Operation',
-  view_log: 'View Log',
-  log: 'Log'
-}
+ .errorMessageContainer {
+   max-height: 400px;
+   overflow-y: auto;
+   white-space: pre-wrap; /* Preserver formatting */
+   background-color: #f4f4f4;
+   padding: 10px;
+   border: 1px solid #ccc;
+   border-radius: 4px;
+   font-family: monospace;
+   text-align: left;
+   margin: 0 auto;
+   width: 1000px;
+   max-width: 100%;
+ }
\ No newline at end of file
diff --git a/seatunnel-ui/src/locales/en_US/tasks.ts 
b/seatunnel-ui/src/views/task/synchronization-instance/error-message-highlight.tsx
similarity index 52%
copy from seatunnel-ui/src/locales/en_US/tasks.ts
copy to 
seatunnel-ui/src/views/task/synchronization-instance/error-message-highlight.tsx
index ac3b7c99..c3c380a8 100644
--- a/seatunnel-ui/src/locales/en_US/tasks.ts
+++ 
b/seatunnel-ui/src/views/task/synchronization-instance/error-message-highlight.tsx
@@ -15,30 +15,35 @@
  * limitations under the License.
  */
 
-export default {
-  instance_id: 'Instance Id',
-  job_id: 'Job Id',
-  tasks: 'Tasks',
-  search: 'Search',
-  success: 'Success',
-  fail: 'Fail',
-  stop: 'Stop',
-  running: 'Running',
-  unknown: 'Unknown',
-  unpublished: 'Unpublished',
-  published: 'Published',
-  task_name: 'Task Name',
-  state: 'State',
-  run_frequency: 'Run Frequency',
-  once: 'Once',
-  crontab: 'Crontab',
-  start_time: 'Start Time',
-  end_time: 'End Time',
-  last_total_bytes: 'Last Total Bytes',
-  last_total_records: 'Last Total Records',
-  rerun: 'Rerun',
-  kill: 'Kill',
-  operation: 'Operation',
-  view_log: 'View Log',
-  log: 'Log'
+import { defineComponent, PropType, h } from 'vue'
+import { NText } from 'naive-ui'
+import { isBoolean, isNumber, isPlainObject } from 'lodash'
+import styles from './error-message-highlight.module.scss'
+
+const props = {
+  params: {
+    type: String as PropType<string>,
+    default: ''
+  }
 }
+
+const ErrorMessageHighlight = defineComponent({
+  name: 'ErrorMessageHighlight',
+  props,
+  render(props: { params: string }) {
+    return (
+      <pre class={styles['json-highlight']}>
+        {syntaxHighlight(props.params)}
+      </pre>
+    )
+  }
+})
+
+const syntaxHighlight = (message: string) => {
+   return h('div', {
+       class: styles.errorMessageContainer,
+       innerHTML: message
+   });
+}
+
+export default ErrorMessageHighlight
diff --git 
a/seatunnel-ui/src/views/task/synchronization-instance/use-sync-task.ts 
b/seatunnel-ui/src/views/task/synchronization-instance/use-sync-task.ts
index f1488a90..f57c6ba3 100644
--- a/seatunnel-ui/src/views/task/synchronization-instance/use-sync-task.ts
+++ b/seatunnel-ui/src/views/task/synchronization-instance/use-sync-task.ts
@@ -38,7 +38,7 @@ import {
 import { useRoute, useRouter } from 'vue-router'
 import { ITaskState } from '@/common/types'
 import { tasksState } from '@/common/common'
-import { NIcon, NSpin, NTooltip } from 'naive-ui'
+import { NButton, NIcon, NPopover, NSpin, NTooltip } from 'naive-ui'
 import { useMessage } from 'naive-ui'
 import {
   querySyncTaskInstancePaging,
@@ -53,6 +53,7 @@ import {
   forcedSuccessByIds
 } from '@/service/sync-task-instance'
 import { getRemainTime } from '@/utils/time'
+import ErrorMessageHighlight from './error-message-highlight'
 
 export function useSyncTask(syncTaskType = 'BATCH') {
   const { t } = useI18n()
@@ -77,6 +78,7 @@ export function useSyncTask(syncTaskType = 'BATCH') {
     limit: ref(1000),
     taskName: ref(''),
     executeUser: ref(''),
+    errorMessage: ref(''),
     host: ref(''),
     stateType: null as null | string,
     syncTaskType,
@@ -144,6 +146,30 @@ export function useSyncTask(syncTaskType = 'BATCH') {
         key: 'jobStatus',
         ...COLUMN_WIDTH_CONFIG['state']
       },
+      {
+        title: t('project.synchronization_instance.error_message'),
+        key: 'parameter',
+        ...COLUMN_WIDTH_CONFIG['state'],
+        render: (row: any) => {
+          return row.errorMessage
+            ? h(
+                NPopover,
+                { trigger: 'click' },
+                {
+                  trigger: () =>
+                    h(NButton, { text: true }, {
+                      default: () => t('tasks.view')
+                    }),
+                    default: () =>
+                      h(ErrorMessageHighlight, {
+                        params:
+                          row.errorMessage
+                      })
+                }
+                )
+            : '--'
+          }
+      },
       {
         title: t('project.synchronization_instance.start_time'),
         key: 'createTime',

Reply via email to