This is an automated email from the ASF dual-hosted git repository.
songjian 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 a56e1d2 [Fix][UI Next][V1.0.0-Alpha] Fix the timeout strategy display
error. (#9245)
a56e1d2 is described below
commit a56e1d260dcf73724cc4b041cbaec239f3f55f74
Author: Amy0104 <[email protected]>
AuthorDate: Mon Mar 28 22:59:20 2022 +0800
[Fix][UI Next][V1.0.0-Alpha] Fix the timeout strategy display error. (#9245)
---
.../task/components/node/fields/use-timeout-alarm.ts | 20 +++++++++++---------
.../projects/task/components/node/format-data.ts | 18 ++++++++++++++----
2 files changed, 25 insertions(+), 13 deletions(-)
diff --git
a/dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-timeout-alarm.ts
b/dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-timeout-alarm.ts
index a927152..53b51bc 100644
---
a/dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-timeout-alarm.ts
+++
b/dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-timeout-alarm.ts
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import { computed, watch } from 'vue'
+import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
import type { IJsonItem } from '../types'
@@ -33,19 +33,21 @@ export function useTimeoutAlarm(model: { [field: string]:
any }): IJsonItem[] {
value: 'FAILED'
}
]
- watch(
- () => model.timeoutFlag,
- (timeoutFlag) => {
- model.timeoutNotifyStrategy = timeoutFlag ? ['WARN'] : []
- model.timeout = timeoutFlag ? 30 : null
- }
- )
return [
{
type: 'switch',
field: 'timeoutFlag',
- name: t('project.node.timeout_alarm')
+ name: t('project.node.timeout_alarm'),
+ props: {
+ 'on-update:value': (value: boolean) => {
+ if (value) {
+ if (!model.timeoutNotifyStrategy.length)
+ model.timeoutNotifyStrategy = ['WARN']
+ if (!model.timeout) model.timeout = 30
+ }
+ }
+ }
},
{
type: 'checkbox',
diff --git
a/dolphinscheduler-ui-next/src/views/projects/task/components/node/format-data.ts
b/dolphinscheduler-ui-next/src/views/projects/task/components/node/format-data.ts
index 4c2f770..b84b5d7 100644
---
a/dolphinscheduler-ui-next/src/views/projects/task/components/node/format-data.ts
+++
b/dolphinscheduler-ui-next/src/views/projects/task/components/node/format-data.ts
@@ -303,7 +303,15 @@ export function formatParams(data: INodeData): {
if (data.taskType === 'PIGEON') {
taskParams.targetJobName = data.targetJobName
}
-
+ let timeoutNotifyStrategy = ''
+ if (data.timeoutNotifyStrategy) {
+ if (data.timeoutNotifyStrategy.length === 1) {
+ timeoutNotifyStrategy = data.timeoutNotifyStrategy[0]
+ }
+ if (data.timeoutNotifyStrategy.length === 2) {
+ timeoutNotifyStrategy = 'WARNFAILED'
+ }
+ }
const params = {
processDefinitionCode: data.processName ? String(data.processName) : '',
upstreamCodes: data?.preTasks?.join(','),
@@ -333,9 +341,9 @@ export function formatParams(data: INodeData): {
},
taskPriority: data.taskPriority,
taskType: data.taskType,
- timeout: data.timeout,
+ timeout: data.timeoutFlag ? data.timeout : 0,
timeoutFlag: data.timeoutFlag ? 'OPEN' : 'CLOSE',
- timeoutNotifyStrategy: data.timeoutNotifyStrategy?.join(''),
+ timeoutNotifyStrategy: data.timeoutFlag ? timeoutNotifyStrategy : '',
workerGroup: data.workerGroup
}
} as {
@@ -362,7 +370,9 @@ export function formatModel(data: ITaskData) {
...omit(data.taskParams, ['resourceList', 'mainJar', 'localParams']),
environmentCode: data.environmentCode === -1 ? null : data.environmentCode,
timeoutFlag: data.timeoutFlag === 'OPEN',
- timeoutNotifyStrategy: [data.timeoutNotifyStrategy] || [],
+ timeoutNotifyStrategy: data.timeoutNotifyStrategy
+ ? [data.timeoutNotifyStrategy]
+ : [],
localParams: data.taskParams?.localParams || []
} as INodeData