formModel.vue 22.4 KB
Newer Older
K
khadgarmage 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
/*
 * 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.
 */
L
ligang 已提交
17 18
<template>
  <div class="form-model-model" v-clickoutside="_handleClose">
19
    <div class="title-box">
G
i18n  
gongzijian 已提交
20
      <span class="name">{{$t('Current node settings')}}</span>
L
ligang 已提交
21 22 23
      <span class="go-subtask">
        <!-- Component can't pop up box to do component processing -->
        <m-log :item="backfillItem">
24 25
          <template slot="history"><a href="javascript:" @click="_seeHistory" ><em class="ansicon ans-icon-timer"></em><em>{{$t('View history')}}</em></a></template>
          <template slot="log"><a href="javascript:"><em class="ansicon ans-icon-log"></em><em>{{$t('View log')}}</em></a></template>
L
ligang 已提交
26
        </m-log>
27
        <a href="javascript:" @click="_goSubProcess" v-if="_isGoSubProcess"><em class="ansicon ans-icon-node"></em><em>{{$t('Enter this child node')}}</em></a>
L
ligang 已提交
28 29 30 31 32 33
      </span>
    </div>
    <div class="content-box" v-if="isContentBox">
      <div class="from-model">
        <!-- Node name -->
        <div class="clearfix list">
G
i18n  
gongzijian 已提交
34
          <div class="text-box"><span>{{$t('Node name')}}</span></div>
L
ligang 已提交
35 36 37
          <div class="cont-box">
            <label class="label-box">
              <x-input
38 39 40 41 42 43 44
                type="text"
                v-model="name"
                :disabled="isDetails"
                :placeholder="$t('Please enter name(required)')"
                maxlength="100"
                @on-blur="_verifName()"
                autocomplete="off">
L
ligang 已提交
45 46 47 48 49 50 51
              </x-input>
            </label>
          </div>
        </div>

        <!-- Running sign -->
        <div class="clearfix list">
G
i18n  
gongzijian 已提交
52
          <div class="text-box"><span>{{$t('Run flag')}}</span></div>
L
ligang 已提交
53 54 55
          <div class="cont-box">
            <label class="label-box">
              <x-radio-group v-model="runFlag" >
G
i18n  
gongzijian 已提交
56 57
                <x-radio :label="'NORMAL'" :disabled="isDetails">{{$t('Normal')}}</x-radio>
                <x-radio :label="'FORBIDDEN'" :disabled="isDetails">{{$t('Prohibition execution')}}</x-radio>
L
ligang 已提交
58 59 60 61 62
              </x-radio-group>
            </label>
          </div>
        </div>

B
break60 已提交
63
        <!-- description -->
L
ligang 已提交
64 65
        <div class="clearfix list">
          <div class="text-box">
G
i18n  
gongzijian 已提交
66
            <span>{{$t('Description')}}</span>
L
ligang 已提交
67 68 69 70
          </div>
          <div class="cont-box">
            <label class="label-box">
              <x-input
71 72 73 74
                resize
                :autosize="{minRows:2}"
                type="textarea"
                :disabled="isDetails"
B
break60 已提交
75
                v-model="description"
76 77
                :placeholder="$t('Please enter description')"
                autocomplete="off">
L
ligang 已提交
78 79 80 81 82 83 84 85
              </x-input>
            </label>
          </div>
        </div>

        <!-- Task priority -->
        <div class="clearfix list">
          <div class="text-box">
G
i18n  
gongzijian 已提交
86
            <span>{{$t('Task priority')}}</span>
L
ligang 已提交
87 88
          </div>
          <div class="cont-box">
G
gongzijian 已提交
89 90 91
            <span class="label-box" style="width: 193px;display: inline-block;">
              <m-priority v-model="taskInstancePriority"></m-priority>
            </span>
G
gongzijian 已提交
92
            <span class="text-b">{{$t('Worker group')}}</span>
93
            <m-worker-groups v-model="workerGroup"></m-worker-groups>
L
ligang 已提交
94 95 96 97 98 99
          </div>
        </div>

        <!-- Number of failed retries -->
        <div class="clearfix list" v-if="taskType !== 'SUB_PROCESS'">
          <div class="text-box">
G
i18n  
gongzijian 已提交
100
            <span>{{$t('Number of failed retries')}}</span>
L
ligang 已提交
101 102 103 104
          </div>
          <div class="cont-box">
            <m-select-input v-model="maxRetryTimes" :list="[0,1,2,3,4]">
            </m-select-input>
G
i18n  
gongzijian 已提交
105 106
            <span>({{$t('Times')}})</span>
            <span class="text-b">{{$t('Failed retry interval')}}</span>
L
ligang 已提交
107 108
            <m-select-input v-model="retryInterval" :list="[1,10,30,60,120]">
            </m-select-input>
G
i18n  
gongzijian 已提交
109
            <span>({{$t('Minute')}})</span>
L
ligang 已提交
110 111
          </div>
        </div>
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
        <div class="clearfix list" v-if="taskType === 'CONDITIONS'">
          <div class="text-box">
            <span>{{$t('State')}}</span>
          </div>
          <div class="cont-box">
            <span class="label-box" style="width: 193px;display: inline-block;">
              <x-select style="width: 157px;" v-model="successNode" :disabled="true">
              <x-option v-for="item in stateList" :key="item.value" :value="item.value" :label="item.label">
              </x-option>
            </x-select>
            </span>
            <span class="text-b" style="padding-left: 38px">{{$t('Branch flow')}}</span>
            <x-select style="width: 157px;" v-model="successBranch" clearable>
              <x-option v-for="item in rearList" :key="item.value" :value="item.value" :label="item.label">
              </x-option>
            </x-select>
          </div>
        </div>

        <div class="clearfix list" v-if="taskType === 'CONDITIONS'">
          <div class="text-box">
            <span>{{$t('State')}}</span>
          </div>
          <div class="cont-box">
            <span class="label-box" style="width: 193px;display: inline-block;">
              <x-select style="width: 157px;" v-model="failedNode" :disabled="true">
              <x-option v-for="item in stateList" :key="item.value" :value="item.value" :label="item.label">
              </x-option>
            </x-select>
            </span>
            <span class="text-b" style="padding-left: 38px">{{$t('Branch flow')}}</span>
            <x-select style="width: 157px;" v-model="failedBranch" clearable>
              <x-option v-for="item in rearList" :key="item.value" :value="item.value" :label="item.label">
              </x-option>
            </x-select>
          </div>
        </div>
L
ligang 已提交
149 150 151

        <!-- Task timeout alarm -->
        <m-timeout-alarm
152 153 154
          ref="timeout"
          :backfill-item="backfillItem"
          @on-timeout="_onTimeout">
L
ligang 已提交
155 156 157 158
        </m-timeout-alarm>

        <!-- shell node -->
        <m-shell
159 160
          v-if="taskType === 'SHELL'"
          @on-params="_onParams"
Z
zhukai 已提交
161
          @on-cache-params="_onCacheParams"
162 163
          ref="SHELL"
          :backfill-item="backfillItem">
L
ligang 已提交
164 165 166
        </m-shell>
        <!-- sub_process node -->
        <m-sub-process
167 168
          v-if="taskType === 'SUB_PROCESS'"
          @on-params="_onParams"
Z
zhukai 已提交
169
          @on-cache-params="_onCacheParams"
170 171 172
          @on-set-process-name="_onSetProcessName"
          ref="SUB_PROCESS"
          :backfill-item="backfillItem">
L
ligang 已提交
173 174 175
        </m-sub-process>
        <!-- procedure node -->
        <m-procedure
176 177
          v-if="taskType === 'PROCEDURE'"
          @on-params="_onParams"
Z
zhukai 已提交
178
          @on-cache-params="_onCacheParams"
179 180
          ref="PROCEDURE"
          :backfill-item="backfillItem">
L
ligang 已提交
181 182 183
        </m-procedure>
        <!-- sql node -->
        <m-sql
184 185
          v-if="taskType === 'SQL'"
          @on-params="_onParams"
186
          @on-cache-params="_onCacheParams"
187 188 189
          ref="SQL"
          :create-node-id="id"
          :backfill-item="backfillItem">
L
ligang 已提交
190 191 192
        </m-sql>
        <!-- spark node -->
        <m-spark
193 194
          v-if="taskType === 'SPARK'"
          @on-params="_onParams"
195
          @on-cache-params="_onCacheParams"
196 197
          ref="SPARK"
          :backfill-item="backfillItem">
L
ligang 已提交
198
        </m-spark>
199 200 201
        <m-flink
          v-if="taskType === 'FLINK'"
          @on-params="_onParams"
202
          @on-cache-params="_onCacheParams"
203 204 205
          ref="FLINK"
          :backfill-item="backfillItem">
        </m-flink>
L
ligang 已提交
206 207
        <!-- mr node -->
        <m-mr
208 209
          v-if="taskType === 'MR'"
          @on-params="_onParams"
Z
zhukai 已提交
210
          @on-cache-params="_onCacheParams"
211 212
          ref="MR"
          :backfill-item="backfillItem">
L
ligang 已提交
213 214 215
        </m-mr>
        <!-- python node -->
        <m-python
216 217
          v-if="taskType === 'PYTHON'"
          @on-params="_onParams"
Z
zhukai 已提交
218
          @on-cache-params="_onCacheParams"
219 220
          ref="PYTHON"
          :backfill-item="backfillItem">
L
ligang 已提交
221 222 223
        </m-python>
        <!-- dependent node -->
        <m-dependent
224 225
          v-if="taskType === 'DEPENDENT'"
          @on-dependent="_onDependent"
Z
zhukai 已提交
226
          @on-cache-dependent="_onCacheDependent"
227 228
          ref="DEPENDENT"
          :backfill-item="backfillItem">
L
ligang 已提交
229
        </m-dependent>
230 231 232
        <m-http
          v-if="taskType === 'HTTP'"
          @on-params="_onParams"
233
          @on-cache-params="_onCacheParams"
234 235 236
          ref="HTTP"
          :backfill-item="backfillItem">
        </m-http>
237 238 239 240 241 242 243
        <m-datax
          v-if="taskType === 'DATAX'"
          @on-params="_onParams"
          @on-cache-params="_onCacheParams"
          ref="DATAX"
          :backfill-item="backfillItem">
        </m-datax>
_和's avatar
_和 已提交
244 245 246 247 248 249 250
        <m-sqoop
          v-if="taskType === 'SQOOP'"
          @on-params="_onParams"
          @on-cache-params="_onCacheParams"
          ref="SQOOP"
          :backfill-item="backfillItem">
        </m-sqoop>
251 252 253 254
        <m-conditions
          v-if="taskType === 'CONDITIONS'"
          ref="CONDITIONS"
          @on-dependent="_onDependent"
255
          @on-cache-dependent="_onCacheDependent"
256 257 258
          :backfill-item="backfillItem"
          :pre-node="preNode">
        </m-conditions>
L
ligang 已提交
259 260 261 262
      </div>
    </div>
    <div class="bottom-box">
      <div class="submit" style="background: #fff;">
G
i18n  
gongzijian 已提交
263
        <x-button type="text" @click="close()"> {{$t('Cancel')}} </x-button>
264
        <x-button type="primary" shape="circle" :loading="spinnerLoading" @click="ok()" :disabled="isDetails">{{spinnerLoading ? 'Loading...' : $t('Confirm add')}} </x-button>
L
ligang 已提交
265 266 267 268 269 270 271 272 273 274 275 276
      </div>
    </div>
  </div>
</template>
<script>
  import _ from 'lodash'
  import mLog from './log'
  import mMr from './tasks/mr'
  import mSql from './tasks/sql'
  import i18n from '@/module/i18n'
  import mShell from './tasks/shell'
  import mSpark from './tasks/spark'
277
  import mFlink from './tasks/flink'
L
ligang 已提交
278 279 280 281
  import mPython from './tasks/python'
  import JSP from './../plugIn/jsPlumbHandle'
  import mProcedure from './tasks/procedure'
  import mDependent from './tasks/dependent'
282
  import mHttp from './tasks/http'
283
  import mDatax from './tasks/datax'
B
break60 已提交
284
  import mConditions from './tasks/conditions'
_和's avatar
_和 已提交
285
  import mSqoop from './tasks/sqoop'
L
ligang 已提交
286 287 288
  import mSubProcess from './tasks/sub_process'
  import mSelectInput from './_source/selectInput'
  import mTimeoutAlarm from './_source/timeoutAlarm'
G
gongzijian 已提交
289
  import mWorkerGroups from './_source/workerGroups'
L
ligang 已提交
290 291
  import clickoutside from '@/module/util/clickoutside'
  import disabledState from '@/module/mixin/disabledState'
G
gongzijian 已提交
292
  import { isNameExDag, rtBantpl } from './../plugIn/util'
L
ligang 已提交
293 294 295 296 297 298 299 300 301
  import mPriority from '@/module/components/priority/priority'

  export default {
    name: 'form-model',
    data () {
      return {
        // loading
        spinnerLoading: false,
        // node name
302
        name: '',
B
break60 已提交
303 304
        // description
        description: '',
L
ligang 已提交
305 306 307 308
        // Node echo data
        backfillItem: {},
        // Resource(list)
        resourcesList: [],
309 310 311 312 313 314 315 316
        successNode: 'success',
        failedNode: 'failed',
        successBranch: '',
        failedBranch: '',
        conditionResult: {
          'successNode': [],
          'failedNode': []
        },
L
ligang 已提交
317 318
        // dependence
        dependence: {},
Z
zhukai 已提交
319 320
        // cache dependence
        cacheDependence: {},
L
ligang 已提交
321 322 323 324 325 326 327 328 329 330 331 332 333
        // Current node params data
        params: {},
        // Running sign
        runFlag: 'NORMAL',
        // The second echo problem caused by the node data is specifically which node hook caused the unfinished special treatment
        isContentBox: false,
        // Number of failed retries
        maxRetryTimes: '0',
        // Failure retry interval
        retryInterval: '1',
        // Task timeout alarm
        timeout: {},
        // Task priority
G
gongzijian 已提交
334 335
        taskInstancePriority: 'MEDIUM',
        // worker group id
Q
test  
qiaozhanwei 已提交
336
<<<<<<< HEAD
337
        workerGroup: 'default'
Q
test  
qiaozhanwei 已提交
338
=======
339 340 341 342 343 344 345 346 347 348 349
        workerGroupId: -1,
        stateList:[
          {
            value: 'success',
            label: `${i18n.$t('success')}`
          },
          {
            value: 'failed',
            label: `${i18n.$t('failed')}`
          }
        ]
Q
test  
qiaozhanwei 已提交
350
>>>>>>> remotes/upstream/dev
L
ligang 已提交
351 352 353 354 355 356 357 358 359 360
      }
    },
    /**
     * Click on events that are not generated internally by the component
     */
    directives: { clickoutside },
    mixins: [disabledState],
    props: {
      id: Number,
      taskType: String,
361 362 363
      self: Object,
      preNode: Array,
      rearList: Array
L
ligang 已提交
364 365 366 367 368 369 370 371
    },
    methods: {
      /**
       * depend
       */
      _onDependent (o) {
        this.dependence = Object.assign(this.dependence, {}, o)
      },
Z
zhukai 已提交
372 373 374 375 376 377
      /**
       * cache dependent
       */
      _onCacheDependent (o) {
        this.cacheDependence = Object.assign(this.cacheDependence, {}, o)
      },
L
ligang 已提交
378 379 380 381 382 383 384 385 386 387
      /**
       * Task timeout alarm
       */
      _onTimeout (o) {
        this.timeout = Object.assign(this.timeout, {}, o)
      },
      /**
       * Click external to close the current component
       */
      _handleClose () {
388
        // this.close()
L
ligang 已提交
389 390 391 392 393 394
      },
      /**
       * Jump to task instance
       */
      _seeHistory () {
        this.self.$router.push({
395
          name: 'task-instance',
L
ligang 已提交
396 397 398 399 400 401 402 403 404 405 406 407 408
          query: {
            processInstanceId: this.self.$route.params.id,
            taskName: this.backfillItem.name
          }
        })
        this.$modal.destroy()
      },
      /**
       * Enter the child node to judge the process instance or the process definition
       * @param  type = instance
       */
      _goSubProcess () {
        if (_.isEmpty(this.backfillItem)) {
G
i18n  
gongzijian 已提交
409
          this.$message.warning(`${i18n.$t('The newly created sub-Process has not yet been executed and cannot enter the sub-Process')}`)
L
ligang 已提交
410 411 412 413 414
          return
        }
        if (this.router.history.current.name === 'projects-instance-details') {
          let stateId = $(`#${this.id}`).attr('data-state-id') || null
          if (!stateId) {
G
i18n  
gongzijian 已提交
415
            this.$message.warning(`${i18n.$t('The task has not been executed and cannot enter the sub-Process')}`)
L
ligang 已提交
416 417 418 419
            return
          }
          this.store.dispatch('dag/getSubProcessId', { taskId: stateId }).then(res => {
            this.$emit('onSubProcess', {
420 421
            subProcessId: res.data.subProcessInstanceId,
            fromThis: this
L
ligang 已提交
422
          })
423 424 425
        }).catch(e => {
            this.$message.error(e.msg || '')
        })
L
ligang 已提交
426 427 428 429 430 431 432 433 434 435 436
        } else {
          this.$emit('onSubProcess', {
            subProcessId: this.backfillItem.params.processDefinitionId,
            fromThis: this
          })
        }
      },
      /**
       * return params
       */
      _onParams (o) {
437
        this.params = Object.assign({}, o)
L
ligang 已提交
438
      },
439 440 441 442 443 444 445

      _onCacheParams (o) {
        this.params = Object.assign(this.params, {}, o)
        this._cacheItem()
      },

      _cacheItem () {
446 447
        this.conditionResult.successNode[0] = this.successBranch
        this.conditionResult.failedNode[0] = this.failedBranch
448 449 450 451 452
        this.$emit('cacheTaskInfo', {
          item: {
            type: this.taskType,
            id: this.id,
            name: this.name,
Z
zhukai 已提交
453
            params: this.params,
454 455
            description: this.description,
            runFlag: this.runFlag,
456
            conditionResult: this.conditionResult,
Z
zhukai 已提交
457
            dependence: this.cacheDependence,
458 459 460 461
            maxRetryTimes: this.maxRetryTimes,
            retryInterval: this.retryInterval,
            timeout: this.timeout,
            taskInstancePriority: this.taskInstancePriority,
Q
test  
qiaozhanwei 已提交
462
<<<<<<< HEAD
463
            workerGroup: this.workerGroup
Q
test  
qiaozhanwei 已提交
464
=======
465 466 467
            workerGroupId: this.workerGroupId,
            status: this.status,
            branch: this.branch
Q
test  
qiaozhanwei 已提交
468
>>>>>>> remotes/upstream/dev
469 470 471 472
          },
          fromThis: this
        })
      },
L
ligang 已提交
473 474 475 476 477
      /**
       * verification name
       */
      _verifName () {
        if (!_.trim(this.name)) {
G
i18n  
gongzijian 已提交
478
          this.$message.warning(`${i18n.$t('Please enter name (required)')}`)
L
ligang 已提交
479 480
          return false
        }
481
        if (this.successBranch !='' && this.successBranch !=null && this.successBranch == this.failedBranch) {
482 483 484
          this.$message.warning(`${i18n.$t('Cannot select the same node for successful branch flow and failed branch flow')}`)
          return false
        }
L
ligang 已提交
485 486 487 488 489
        if (this.name === this.backfillItem.name) {
          return true
        }
        // Name repeat depends on dom backfill dependent store
        if (isNameExDag(this.name, _.isEmpty(this.backfillItem) ? 'dom' : 'backfill')) {
G
i18n  
gongzijian 已提交
490
          this.$message.warning(`${i18n.$t('Name already exists')}`)
L
ligang 已提交
491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512
          return false
        }
        return true
      },
      /**
       * Global verification procedure
       */
      _verification () {
        // Verify name
        if (!this._verifName()) {
          return
        }
        // Verify task alarm parameters
        if (!this.$refs['timeout']._verification()) {
          return
        }
        // Verify node parameters
        if (!this.$refs[this.taskType]._verification()) {
          return
        }

        $(`#${this.id}`).find('span').text(this.name)
513 514
        this.conditionResult.successNode[0] = this.successBranch
        this.conditionResult.failedNode[0] = this.failedBranch
L
ligang 已提交
515 516 517 518 519 520 521
        // Store the corresponding node data structure
        this.$emit('addTaskInfo', {
          item: {
            type: this.taskType,
            id: this.id,
            name: this.name,
            params: this.params,
B
break60 已提交
522
            description: this.description,
L
ligang 已提交
523
            runFlag: this.runFlag,
524
            conditionResult: this.conditionResult,
L
ligang 已提交
525 526 527 528
            dependence: this.dependence,
            maxRetryTimes: this.maxRetryTimes,
            retryInterval: this.retryInterval,
            timeout: this.timeout,
G
gongzijian 已提交
529
            taskInstancePriority: this.taskInstancePriority,
Q
test  
qiaozhanwei 已提交
530
<<<<<<< HEAD
531
            workerGroup: this.workerGroup
Q
test  
qiaozhanwei 已提交
532
=======
533 534 535
            workerGroupId: this.workerGroupId,
            status: this.status,
            branch: this.branch
Q
test  
qiaozhanwei 已提交
536
>>>>>>> remotes/upstream/dev
L
ligang 已提交
537 538 539
          },
          fromThis: this
        })
G
bug1  
gongzijian 已提交
540 541 542

        // set run flag
        this._setRunFlag()
L
ligang 已提交
543 544 545 546 547 548 549
      },
      /**
       * Sub-workflow selected node echo name
       */
      _onSetProcessName (name) {
        this.name = name
      },
G
bug1  
gongzijian 已提交
550 551 552
      /**
       *  set run flag
       */
553
      _setRunFlag () {
G
bug1  
gongzijian 已提交
554 555 556 557 558 559
        let dom = $(`#${this.id}`).find('.ban-p')
        dom.html('')
        if (this.runFlag === 'FORBIDDEN') {
          dom.append(rtBantpl())
        }
      },
L
ligang 已提交
560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582
      /**
       * Submit verification
       */
      ok () {
        this._verification()
      },
      /**
       * Close and destroy component and component internal events
       */
      close () {
        let flag = false
        // Delete node without storage
        if (!this.backfillItem.name) {
          flag = true
        }
        this.isContentBox = false
        // flag Whether to delete a node this.$destroy()
        this.$emit('close', {
          flag: flag,
          fromThis: this
        })
      }
    },
G
gongzijian 已提交
583
    watch: {
584 585 586 587 588 589
      /**
       * Watch the item change, cache the value it changes
       **/
      _item (val) {
        this._cacheItem()
      }
G
gongzijian 已提交
590
    },
L
ligang 已提交
591 592 593 594 595
    created () {
      // Unbind copy and paste events
      JSP.removePaste()
      // Backfill data
      let taskList = this.store.state.dag.tasks
596 597 598

      //fillback use cacheTasks
      let cacheTasks = this.store.state.dag.cacheTasks
L
ligang 已提交
599
      let o = {}
600 601 602 603 604 605 606 607 608 609 610
      if (cacheTasks[this.id]) {
        o = cacheTasks[this.id]
        this.backfillItem = cacheTasks[this.id]
      } else {
        if (taskList.length) {
          taskList.forEach(v => {
            if (v.id === this.id) {
              o = v
              this.backfillItem = v
            }
          })
611
        }
612 613 614 615 616 617 618 619 620
      }
      // Non-null objects represent backfill
      if (!_.isEmpty(o)) {
        this.name = o.name
        this.taskInstancePriority = o.taskInstancePriority
        this.runFlag = o.runFlag || 'NORMAL'
        this.description = o.description
        this.maxRetryTimes = o.maxRetryTimes
        this.retryInterval = o.retryInterval
621 622 623 624
        if(o.conditionResult) {
          this.successBranch = o.conditionResult.successNode[0]
          this.failedBranch = o.conditionResult.failedNode[0]
        }
625 626 627
          // If the workergroup has been deleted, set the default workergroup
          var hasMatch = false;
          for (let i = 0; i < this.store.state.security.workerGroupsListAll.length; i++) {
628 629
            var workerGroup = this.store.state.security.workerGroupsListAll[i].id
            if (o.workerGroup == workerGroup) {
630 631 632 633 634 635
              hasMatch = true;
              break;
            }
          }

          if(!hasMatch){
636
            this.workerGroup = 'default'
637
          }else{
638
            this.workerGroup = o.workerGroup
639 640
          }

641 642
        this.params = o.params || {}
        this.dependence = o.dependence || {}
Z
zhukai 已提交
643
        this.cacheDependence = o.dependence || {}
644

L
ligang 已提交
645 646 647
      }
      this.isContentBox = true
    },
648 649 650
    mounted () {

    },
L
ligang 已提交
651 652 653 654 655 656 657 658 659 660 661 662
    updated () {
    },
    beforeDestroy () {
    },
    destroyed () {
    },
    computed: {
      /**
       * Child workflow entry show/hide
       */
      _isGoSubProcess () {
        return this.taskType === 'SUB_PROCESS' && this.name
663 664 665 666 667 668 669 670 671 672
      },

      //Define the item model
      _item () {
        return {
          type: this.taskType,
          id: this.id,
          name: this.name,
          description: this.description,
          runFlag: this.runFlag,
Z
zhukai 已提交
673
          dependence: this.cacheDependence,
674 675 676 677
          maxRetryTimes: this.maxRetryTimes,
          retryInterval: this.retryInterval,
          timeout: this.timeout,
          taskInstancePriority: this.taskInstancePriority,
Q
test  
qiaozhanwei 已提交
678
<<<<<<< HEAD
679
          workerGroup: this.workerGroup
Q
test  
qiaozhanwei 已提交
680
=======
681 682 683
          workerGroupId: this.workerGroupId,
          successBranch: this.successBranch,
          failedBranch: this.failedBranch
Q
test  
qiaozhanwei 已提交
684
>>>>>>> remotes/upstream/dev
685
        }
L
ligang 已提交
686 687 688 689 690 691 692 693 694 695
      }
    },
    components: {
      mMr,
      mShell,
      mSubProcess,
      mProcedure,
      mSql,
      mLog,
      mSpark,
696
      mFlink,
L
ligang 已提交
697 698
      mPython,
      mDependent,
699
      mHttp,
700
      mDatax,
_和's avatar
_和 已提交
701
      mSqoop,
702
      mConditions,
L
ligang 已提交
703 704
      mSelectInput,
      mTimeoutAlarm,
G
gongzijian 已提交
705 706
      mPriority,
      mWorkerGroups
L
ligang 已提交
707 708 709 710 711
    }
  }
</script>

<style lang="scss" rel="stylesheet/scss">
G
gongzijian 已提交
712
  @import "./formModel";
L
ligang 已提交
713
</style>