You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2022/09/27 02:26:01 UTC

[GitHub] [dolphinscheduler] Amy0104 commented on a diff in pull request #11226: [Feat][UI] Set up UI setting component in profile page

Amy0104 commented on code in PR #11226:
URL: https://github.com/apache/dolphinscheduler/pull/11226#discussion_r980667103


##########
dolphinscheduler-ui/src/store/logTimer/types.ts:
##########
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+
+type logTimer = number

Review Comment:
   It seems to be no need to define the logTimer type here.



##########
dolphinscheduler-ui/src/views/projects/workflow/components/dag/index.tsx:
##########
@@ -233,23 +237,28 @@ export default defineComponent({
     const handleViewLog = (taskId: number, taskType: string) => {
       taskModalVisible.value = false
       viewLog(taskId, taskType)
-      getLogs()
+      getLogs(logTimer)
     }
 
-    const getLogs = () => {
+    const getLogs = (logTimer: number) => {
       const { state } = useAsyncState(
         queryLog({
           taskInstanceId: nodeVariables.logTaskId,
           limit: nodeVariables.limit,
           skipLineNum: nodeVariables.skipLineNum
         }).then((res: any) => {
-          if (res.message) {
-            nodeVariables.logRef += res.message
+          nodeVariables.logRef += res.message || ''
+          if (res && res.message !== '') {
             nodeVariables.limit += 1000
             nodeVariables.skipLineNum += res.lineNum
-            getLogs()
+            getLogs(logTimer)
           } else {
             nodeVariables.logLoadingRef = false
+            setTimeout(() => {
+              nodeVariables.limit += 1000
+              nodeVariables.skipLineNum += 1000
+              getLogs(logTimer)
+            }, logTimer * 1000)

Review Comment:
   Same as above.



##########
dolphinscheduler-ui/src/views/projects/task/instance/batch-task.tsx:
##########
@@ -74,20 +77,27 @@ const BatchTaskInstance = defineComponent({
       variables.showModalRef = false
     }
 
-    const getLogs = (row: any) => {
+    const getLogs = (row: any, logTimer: number) => {
       const { state } = useAsyncState(
         queryLog({
           taskInstanceId: Number(row.id),
           limit: variables.limit,
           skipLineNum: variables.skipLineNum
         }).then((res: any) => {
-          if (res?.message) {
-            variables.logRef += res.message
+          variables.logRef += res.message || ''
+          if (res && res.message !== '') {
             variables.limit += 1000
             variables.skipLineNum += res.lineNum
-            getLogs(row)
+            getLogs(row, logTimer)
           } else {
             variables.logLoadingRef = false
+            setTimeout(() => {
+              variables.logRef = ''
+              variables.limit = 1000
+              variables.skipLineNum = 0
+              variables.logLoadingRef = true
+              getLogs(row, logTimer)
+            }, logTimer * 1000)

Review Comment:
   It's better to clear the timer before turning it on.



##########
dolphinscheduler-ui/src/views/projects/task/instance/stream-task.tsx:
##########
@@ -62,20 +65,27 @@ const BatchTaskInstance = defineComponent({
       variables.showModalRef = false
     }
 
-    const getLogs = (row: any) => {
+    const getLogs = (row: any, logTimer: number) => {
       const { state } = useAsyncState(
         queryLog({
           taskInstanceId: Number(row.id),
           limit: variables.limit,
           skipLineNum: variables.skipLineNum
         }).then((res: any) => {
-          if (res?.message) {
-            variables.logRef += res.message
+          variables.logRef += res.message || ''
+          if (res && res.message !== '') {
             variables.limit += 1000
             variables.skipLineNum += res.lineNum
-            getLogs(row)
+            getLogs(row, logTimer)
           } else {
             variables.logLoadingRef = false
+            setTimeout(() => {
+              variables.logRef = ''
+              variables.limit = 1000
+              variables.skipLineNum = 0
+              variables.logLoadingRef = true
+              getLogs(row, logTimer)
+            }, logTimer * 1000)

Review Comment:
   Same as above.



##########
dolphinscheduler-ui/src/views/ui-setting/index.tsx:
##########
@@ -0,0 +1,94 @@
+/*
+ * 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 { useI18n } from 'vue-i18n'
+import { NForm, NFormItem, NSelect } from "naive-ui";
+import { defineComponent } from "vue";
+import { useLogTimerStore } from '@/store/logTimer/logTimer'
+import type { logTimer } from '@/store/logTimer/types'
+import cookies from 'js-cookie'
+ 
+// Update LogTimer store when select value is updated
+const handleUpdateValue = (logTimer: logTimer) => {
+    const logTimerStore = useLogTimerStore()
+    logTimerStore.setLogTimer(logTimer)
+    cookies.set('logTimer', String(logTimer), { path: '/' })

Review Comment:
   Why set the logTimer into the cookies? Does the backend side need it?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org