You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by zh...@apache.org on 2022/03/15 12:58:22 UTC

[dolphinscheduler] branch dev updated: [Fix][UI Next][V1.0.0-Alpha] Fix the task instance logs are not automatically updated. (#8912)

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

zhongjiajie pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/dev by this push:
     new bde7d52  [Fix][UI Next][V1.0.0-Alpha] Fix the task instance logs are not automatically updated. (#8912)
bde7d52 is described below

commit bde7d52c5d8322ebc6897771cc10725aefb19e9b
Author: songjianet <17...@qq.com>
AuthorDate: Tue Mar 15 20:58:10 2022 +0800

    [Fix][UI Next][V1.0.0-Alpha] Fix the task instance logs are not automatically updated. (#8912)
---
 .../src/components/modal/index.tsx                 |  4 +--
 .../src/locales/modules/en_US.ts                   |  3 ++-
 .../src/locales/modules/zh_CN.ts                   |  3 ++-
 .../task/instance/components/log-modal.tsx         | 29 +++++++++++++++++++---
 4 files changed, 31 insertions(+), 8 deletions(-)

diff --git a/dolphinscheduler-ui-next/src/components/modal/index.tsx b/dolphinscheduler-ui-next/src/components/modal/index.tsx
index 9666a82..a8ccfdc 100644
--- a/dolphinscheduler-ui-next/src/components/modal/index.tsx
+++ b/dolphinscheduler-ui-next/src/components/modal/index.tsx
@@ -16,11 +16,11 @@
  */
 
 import { defineComponent, PropType, renderSlot, Ref } from 'vue'
+import { useI18n } from 'vue-i18n'
 import { NModal, NCard, NButton, NSpace } from 'naive-ui'
 import ButtonLink from '@/components/button-link'
-import { useI18n } from 'vue-i18n'
 import styles from './index.module.scss'
-import { LinkOption } from '@/components/modal/types'
+import type { LinkOption } from '@/components/modal/types'
 
 const props = {
   show: {
diff --git a/dolphinscheduler-ui-next/src/locales/modules/en_US.ts b/dolphinscheduler-ui-next/src/locales/modules/en_US.ts
index 67512fc..9b37889 100644
--- a/dolphinscheduler-ui-next/src/locales/modules/en_US.ts
+++ b/dolphinscheduler-ui-next/src/locales/modules/en_US.ts
@@ -555,7 +555,8 @@ const project = {
     delay_execution: 'Delay Execution',
     forced_success: 'Forced Success',
     view_log: 'View Log',
-    download_log: 'Download Log'
+    download_log: 'Download Log',
+    refresh: 'Refresh'
   },
   dag: {
     create: 'Create Workflow',
diff --git a/dolphinscheduler-ui-next/src/locales/modules/zh_CN.ts b/dolphinscheduler-ui-next/src/locales/modules/zh_CN.ts
index 3f68bfd..eea192f 100644
--- a/dolphinscheduler-ui-next/src/locales/modules/zh_CN.ts
+++ b/dolphinscheduler-ui-next/src/locales/modules/zh_CN.ts
@@ -552,7 +552,8 @@ const project = {
     delay_execution: '延时执行',
     forced_success: '强制成功',
     view_log: '查看日志',
-    download_log: '下载日志'
+    download_log: '下载日志',
+    refresh: '刷新'
   },
   dag: {
     create: '创建工作流',
diff --git a/dolphinscheduler-ui-next/src/views/projects/task/instance/components/log-modal.tsx b/dolphinscheduler-ui-next/src/views/projects/task/instance/components/log-modal.tsx
index 23a44d3..4c261d4 100644
--- a/dolphinscheduler-ui-next/src/views/projects/task/instance/components/log-modal.tsx
+++ b/dolphinscheduler-ui-next/src/views/projects/task/instance/components/log-modal.tsx
@@ -15,9 +15,10 @@
  * limitations under the License.
  */
 
-import { defineComponent, PropType, toRefs, watch } from 'vue'
+import { defineComponent, h, PropType, ref, toRefs, watch } from 'vue'
 import { useI18n } from 'vue-i18n'
-import { NLog } from 'naive-ui'
+import { NIcon, NLog } from 'naive-ui'
+import { SyncOutlined } from '@vicons/antd'
 import { useModal } from './use-modal'
 import Modal from '@/components/modal'
 
@@ -39,11 +40,23 @@ const LogModal = defineComponent({
   setup(props, ctx) {
     const { t } = useI18n()
     const { variables, getLogs } = useModal()
+    const renderIcon = (icon: any) => {
+      return () => h(NIcon, null, { default: () => h(icon) })
+    }
 
     const confirmModal = () => {
       ctx.emit('confirmModal', props.showModalRef)
     }
 
+    const refreshLogs = () => {
+      variables.logRef = ''
+      variables.loadingRef = true
+      variables.skipLineNum = 0
+      variables.limit = 1000
+
+      getLogs()
+    }
+
     watch(
       () => props.showModalRef,
       () => {
@@ -60,10 +73,10 @@ const LogModal = defineComponent({
       }
     )
 
-    return { t, ...toRefs(variables), confirmModal }
+    return { t, ...toRefs(variables), confirmModal, renderIcon, refreshLogs }
   },
   render() {
-    const { t } = this
+    const { t, renderIcon, refreshLogs } = this
 
     return (
       <Modal
@@ -72,6 +85,14 @@ const LogModal = defineComponent({
         cancelShow={false}
         onConfirm={this.confirmModal}
         style={{ width: '60%' }}
+        headerLinks={ref([
+          {
+            text: t('project.task.refresh'),
+            show: true,
+            action: refreshLogs,
+            icon: renderIcon(SyncOutlined)
+          }
+        ])}
       >
         <NLog rows={30} log={this.logRef} loading={this.loadingRef} />
       </Modal>