dag.vue 22.1 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 19
<template>
  <div class="clearfix dag-model" >
    <div class="toolbar">
G
i18n  
gongzijian 已提交
20
      <div class="title"><span>{{$t('Toolbar')}}</span></div>
L
ligang 已提交
21 22 23 24
      <div class="toolbar-btn">
        <div class="bar-box roundedRect jtk-draggable jtk-droppable jtk-endpoint-anchor jtk-connected"
             :class="v === dagBarId ? 'active' : ''"
             :id="v"
B
break60 已提交
25
             :key="v"
L
ligang 已提交
26 27
             v-for="(item,v) in tasksTypeList"
             @mousedown="_getDagId(v)">
28
          <div data-toggle="tooltip" :title="item.desc">
L
ligang 已提交
29 30 31 32 33 34 35 36 37 38 39
            <div class="icos" :class="'icos-' + v" ></div>
          </div>
        </div>
      </div>
    </div>
    <div class="dag-contect">
      <div class="dag-toolbar">
        <div class="assist-btn">
          <x-button
                  style="vertical-align: middle;"
                  data-toggle="tooltip"
G
i18n  
gongzijian 已提交
40
                  :title="$t('View variables')"
L
ligang 已提交
41 42 43 44 45
                  data-container="body"
                  type="primary"
                  size="xsmall"
                  :disabled="$route.name !== 'projects-instance-details'"
                  @click="_toggleView"
46
                  icon="ans-icon-code">
L
ligang 已提交
47
          </x-button>
H
huyuanming 已提交
48 49 50 51 52 53 54 55 56
          <x-button
            style="vertical-align: middle;"
            data-toggle="tooltip"
            :title="$t('Startup parameter')"
            data-container="body"
            type="primary"
            size="xsmall"
            :disabled="$route.name !== 'projects-instance-details'"
            @click="_toggleParam"
57
            icon="ans-icon-arrow-circle-right">
H
huyuanming 已提交
58
          </x-button>
59
          <span class="name">{{name}}</span>
G
gongzijian 已提交
60
          &nbsp;
61
          <span v-if="name"  class="copy-name" @click="_copyName" :data-clipboard-text="name"><em class="ans-icon-copy" data-container="body"  data-toggle="tooltip" :title="$t('Copy name')" ></em></span>
L
ligang 已提交
62 63
        </div>
        <div class="save-btn">
Z
zhukai 已提交
64
          <div class="operation" style="vertical-align: middle;">
L
ligang 已提交
65 66 67 68
            <a href="javascript:"
               v-for="(item,$index) in toolOperList"
               :class="_operationClass(item)"
               :id="item.code"
B
break60 已提交
69
               :key="$index"
L
ligang 已提交
70
               @click="_ckOperation(item,$event)">
71
              <x-button type="text" data-container="body" :icon="item.icon" v-tooltip.light="item.desc"></x-button>
L
ligang 已提交
72 73
            </a>
          </div>
Z
zhukai 已提交
74 75
          <x-button
                  type="primary"
76
                  v-tooltip.light="$t('Format DAG')"
Z
zhukai 已提交
77 78
                  icon="ans-icon-triangle-solid-right"
                  size="xsmall"
79
                  data-container="body"
G
gaojun2048 已提交
80
                  v-if="(type === 'instance' || 'definition') && urlParam.id !=undefined"
Z
zhukai 已提交
81
                  style="vertical-align: middle;"
82 83
                  @click="dagAutomaticLayout">
          </x-button>
L
ligang 已提交
84
          <x-button
85
                  v-tooltip.light="$t('Refresh DAG status')"
L
ligang 已提交
86 87
                  data-container="body"
                  style="vertical-align: middle;"
88
                  icon="ans-icon-refresh"
L
ligang 已提交
89 90 91 92 93 94 95 96 97 98 99
                  type="primary"
                  :loading="isRefresh"
                  v-if="type === 'instance'"
                  @click="!isRefresh && _refresh()"
                  size="xsmall" >
          </x-button>
          <x-button
                  v-if="isRtTasks"
                  style="vertical-align: middle;"
                  type="primary"
                  size="xsmall"
100
                  icon="ans-icon-play"
L
ligang 已提交
101
                  @click="_rtNodesDag" >
G
i18n  
gongzijian 已提交
102
            {{$t('Return_1')}}
L
ligang 已提交
103 104 105 106 107 108 109
          </x-button>
          <x-button
                  style="vertical-align: middle;"
                  type="primary"
                  size="xsmall"
                  :loading="spinnerLoading"
                  @click="_saveChart"
110
                  icon="ans-icon-save"
111
                  >
G
i18n  
gongzijian 已提交
112
            {{spinnerLoading ? 'Loading...' : $t('Save')}}
L
ligang 已提交
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
          </x-button>
        </div>
      </div>
      <div class="scrollbar dag-container">
        <div class="jtk-demo" id="jtk-demo">
          <div class="jtk-demo-canvas canvas-wide statemachine-demo jtk-surface jtk-surface-nopan jtk-draggable" id="canvas" ></div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
  import _ from 'lodash'
  import Dag from './dag'
  import mUdp from './udp/udp'
  import i18n from '@/module/i18n'
  import { jsPlumb } from 'jsplumb'
G
gongzijian 已提交
130
  import Clipboard from 'clipboard'
L
ligang 已提交
131 132 133
  import { allNodesId } from './plugIn/util'
  import { toolOper, tasksType } from './config'
  import mFormModel from './formModel/formModel'
134
  import mFormLineModel from './formModel/formLineModel'
L
ligang 已提交
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
  import { formatDate } from '@/module/filter/filter'
  import { findComponentDownward } from '@/module/util/'
  import disabledState from '@/module/mixin/disabledState'
  import { mapActions, mapState, mapMutations } from 'vuex'

  let eventModel

  export default {
    name: 'dag-chart',
    data () {
      return {
        tasksTypeList: tasksType,
        toolOperList: toolOper(this),
        dagBarId: null,
        toolOperCode: '',
        spinnerLoading: false,
        urlParam: {
          id: this.$route.params.id || null
        },
        isRtTasks: false,
        isRefresh: false,
        isLoading: false,
B
break60 已提交
157 158
        taskId: null,
        arg: false,
G
gaojun2048 已提交
159

L
ligang 已提交
160 161 162 163 164 165 166 167 168
      }
    },
    mixins: [disabledState],
    props: {
      type: String,
      releaseState: String
    },
    methods: {
      ...mapActions('dag', ['saveDAGchart', 'updateInstance', 'updateDefinition', 'getTaskState']),
169
      ...mapMutations('dag', ['addTasks', 'cacheTasks', 'resetParams', 'setIsEditDag', 'setName', 'addConnects']),
170

B
break60 已提交
171 172 173
      // DAG automatic layout
      dagAutomaticLayout() {
        $('#canvas').html('')
Z
zhukai 已提交
174

B
break60 已提交
175 176 177 178 179 180 181
      // Destroy round robin
        Dag.init({
        dag: this,
        instance: jsPlumb.getInstance({
          Endpoint: [
            'Dot', { radius: 1, cssClass: 'dot-style' }
          ],
B
break60 已提交
182
          Connector: 'Bezier',
B
break60 已提交
183
          PaintStyle: { lineWidth: 2, stroke: '#456' }, // Connection style
G
gaojun2048 已提交
184
          HoverPaintStyle: {stroke: '#ccc', strokeWidth: 3}, 
B
break60 已提交
185 186 187 188 189 190 191 192 193
          ConnectionOverlays: [
            [
              'Arrow',
              {
                location: 1,
                id: 'arrow',
                length: 12,
                foldback: 0.8
              }
194 195 196 197 198
            ],
            ['Label', {
                location: 0.5,
                id: 'label'
            }]
B
break60 已提交
199
          ],
200 201
          Container: 'canvas',
          ConnectionsDetachable: true
B
break60 已提交
202 203 204 205
        })
      })
        if (this.tasks.length) {
          Dag.backfill(true)
206 207 208
          if (this.type === 'instance') {
            this._getTaskState(false).then(res => {})
          }
B
break60 已提交
209 210 211 212 213 214
        } else {
          Dag.create()
        }
      },

      init (args) {
L
ligang 已提交
215
        if (this.tasks.length) {
B
break60 已提交
216
          Dag.backfill(args)
L
ligang 已提交
217 218 219 220 221 222 223 224 225 226 227 228
          // Process instances can view status
          if (this.type === 'instance') {
            this._getTaskState(false).then(res => {})
            // Round robin acquisition status
            this.setIntervalP = setInterval(() => {
              this._getTaskState(true).then(res => {})
            }, 90000)
          }
        } else {
          Dag.create()
        }
      },
229 230 231
      /**
       * copy name
       */
G
gongzijian 已提交
232 233 234 235 236 237 238 239 240 241 242 243 244 245
      _copyName(){
        let clipboard = new Clipboard(`.copy-name`)
        clipboard.on('success', e => {
          this.$message.success(`${i18n.$t('Copy success')}`)
          // Free memory
          clipboard.destroy()
        })
        clipboard.on('error', e => {
          // Copy is not supported
          this.$message.warning(`${i18n.$t('The browser does not support automatic copying')}`)
          // Free memory
          clipboard.destroy()
        })
      },
L
ligang 已提交
246 247 248 249 250 251 252 253 254 255 256
      /**
       * Get state interface
       * @param isReset Whether to manually refresh
       */
      _getTaskState (isReset) {
        return new Promise((resolve, reject) => {
          this.getTaskState(this.urlParam.id).then(res => {
            let data = res.list
            let state = res.processInstanceState
            let taskList = res.taskList
            let idArr = allNodesId()
257
            const titleTpl = (item, desc) => {
L
ligang 已提交
258
              let $item = _.filter(taskList, v => v.name === item.name)[0]
259
              return `<div style="text-align: left">${i18n.$t('Name')}${$item.name}</br>${i18n.$t('State')}${desc}</br>${i18n.$t('type')}${$item.taskType}</br>${i18n.$t('host')}${$item.host || '-'}</br>${i18n.$t('Retry Count')}${$item.retryTimes}</br>${i18n.$t('Submit Time')}${formatDate($item.submitTime)}</br>${i18n.$t('Start Time')}${formatDate($item.startTime)}</br>${i18n.$t('End Time')}${$item.endTime ? formatDate($item.endTime) : '-'}</br></div>`
L
ligang 已提交
260
            }
261 262 263 264

            // remove tip state dom
            $('.w').find('.state-p').html('')

L
ligang 已提交
265 266 267 268 269
            data.forEach(v1 => {
              idArr.forEach(v2 => {
                if (v2.name === v1.name) {
                  let dom = $(`#${v2.id}`)
                  let state = dom.find('.state-p')
B
break60 已提交
270 271 272 273 274 275
                  let depState = ''
                   taskList.forEach(item=>{
                    if(item.name==v1.name) {
                      depState = item.state
                    }
                  })
L
ligang 已提交
276 277
                  dom.attr('data-state-id', v1.stateId)
                  dom.attr('data-dependent-result', v1.dependentResult || '')
B
break60 已提交
278
                  dom.attr('data-dependent-depState', depState)
279 280
                  state.append(`<strong class="${v1.icoUnicode} ${v1.isSpin ? 'as as-spin' : ''}" style="color:${v1.color}" data-toggle="tooltip" data-html="true" data-container="body"></strong>`)
                  state.find('strong').attr('title', titleTpl(v2, v1.desc))
L
ligang 已提交
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298
                }
              })
            })
            if (state === 'PAUSE' || state === 'STOP' || state === 'FAILURE' || this.state === 'SUCCESS') {
              // Manual refresh does not regain large json
              if (isReset) {
                findComponentDownward(this.$root, `${this.type}-details`)._reset()
              }
            }
            resolve()
          })
        })
      },
      /**
       * Get the action bar id
       * @param item
       */
      _getDagId (v) {
299 300 301
        // if (this.isDetails) {
        //   return
        // }
L
ligang 已提交
302 303 304 305 306 307 308 309 310
        this.dagBarId = v
      },
      /**
       * operating
       */
      _ckOperation (item) {
        let is = true
        let code = ''

311
        if (item.disable) {
L
ligang 已提交
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332
          return
        }

        if (this.toolOperCode === item.code) {
          this.toolOperCode = ''
          code = item.code
          is = false
        } else {
          this.toolOperCode = item.code
          code = this.toolOperCode
          is = true
        }

        // event type
        Dag.toolbarEvent({
          item: item,
          code: code,
          is: is
        })
      },
      _operationClass (item) {
333 334 335 336 337 338
        return this.toolOperCode === item.code ? 'active' : ''
        // if (item.disable) {
        //   return this.toolOperCode === item.code ? 'active' : ''
        // } else {
        //   return 'disable'
        // }
L
ligang 已提交
339 340 341 342 343
      },
      /**
       * Storage interface
       */
      _save (sourceType) {
B
break60 已提交
344 345 346 347 348
        return new Promise((resolve, reject) => {
          this.spinnerLoading = true
          // Storage store
          Dag.saveStore().then(res => {
            if(this._verifConditions(res.tasks)) {
B
break60 已提交
349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381
              if (this.urlParam.id) {
                /**
                 * Edit
                 * @param saveInstanceEditDAGChart => Process instance editing
                 * @param saveEditDAGChart => Process definition editing
                 */
                this[this.type === 'instance' ? 'updateInstance' : 'updateDefinition'](this.urlParam.id).then(res => {
                  this.$message.success(res.msg)
                  this.spinnerLoading = false
                  resolve()
                }).catch(e => {
                  this.$message.error(e.msg || '')
                  this.spinnerLoading = false
                  reject(e)
                })
              } else {
                // New
                this.saveDAGchart().then(res => {
                  this.$message.success(res.msg)
                  this.spinnerLoading = false
                  // source @/conf/home/pages/dag/_source/editAffirmModel/index.js
                  if (sourceType !== 'affirm') {
                    // Jump process definition
                    this.$router.push({ name: 'projects-definition-list' })
                  }
                  resolve()
                }).catch(e => {
                  this.$message.error(e.msg || '')
                  this.setName('')
                  this.spinnerLoading = false
                  reject(e)
                })
              }
B
break60 已提交
382
            }
L
ligang 已提交
383
          })
B
break60 已提交
384
        })
B
break60 已提交
385
      },
B
break60 已提交
386 387
      _verifConditions (value) {
        let tasks = value
B
break60 已提交
388 389 390 391 392 393
        let bool = true
        tasks.map(v=>{
          if(v.type == 'CONDITIONS' && (v.conditionResult.successNode[0] =='' || v.conditionResult.successNode[0] == null || v.conditionResult.failedNode[0] =='' || v.conditionResult.failedNode[0] == null)) {
            bool = false
            return false
          }
L
ligang 已提交
394
        })
B
break60 已提交
395 396
        if(!bool) {
          this.$message.warning(`${i18n.$t('Successful branch flow and failed branch flow are required')}`)
B
break60 已提交
397
          this.spinnerLoading = false
B
break60 已提交
398 399 400
          return false
        }
        return true
L
ligang 已提交
401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435
      },
      /**
       * Global parameter
       * @param Promise
       */
      _udpTopFloorPop () {
        return new Promise((resolve, reject) => {
          let modal = this.$modal.dialog({
            closable: false,
            showMask: true,
            escClose: true,
            className: 'v-modal-custom',
            transitionName: 'opacityp',
            render (h) {
              return h(mUdp, {
                on: {
                  onUdp () {
                    modal.remove()
                    resolve()
                  },
                  close () {
                    modal.remove()
                  }
                }
              })
            }
          })
        })
      },
      /**
       * Save chart
       */
      _saveChart () {
        // Verify node
        if (!this.tasks.length) {
G
i18n  
gongzijian 已提交
436
          this.$message.warning(`${i18n.$t('Failed to create node to save')}`)
L
ligang 已提交
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485
          return
        }

        // Global parameters (optional)
        this._udpTopFloorPop().then(() => {
          return this._save()
        })
      },
      /**
       * Return to the previous child node
       */
      _rtNodesDag () {
        let getIds = this.$route.query.subProcessIds
        let idsArr = getIds.split(',')
        let ids = idsArr.slice(0, idsArr.length - 1)
        let id = idsArr[idsArr.length - 1]
        let query = {}

        if (id !== idsArr[0]) {
          query = { subProcessIds: ids.join(',') }
        }
        let $name = this.$route.name.split('-')
        this.$router.push({ path: `/${$name[0]}/${$name[1]}/list/${id}`, query: query })
      },
      /**
       * Subprocess processing
       * @param subProcessId Subprocess ID
       */
      _subProcessHandle (subProcessId) {
        let subProcessIds = []
        let getIds = this.$route.query.subProcessIds
        if (getIds) {
          let newId = getIds.split(',')
          newId.push(this.urlParam.id)
          subProcessIds = newId
        } else {
          subProcessIds.push(this.urlParam.id)
        }
        let $name = this.$route.name.split('-')
        this.$router.push({ path: `/${$name[0]}/${$name[1]}/list/${subProcessId}`, query: { subProcessIds: subProcessIds.join(',') } })
      },
      /**
       * Refresh data
       */
      _refresh () {
        this.isRefresh = true
        this._getTaskState(false).then(res => {
          setTimeout(() => {
            this.isRefresh = false
G
i18n  
gongzijian 已提交
486
            this.$message.success(`${i18n.$t('Refresh status succeeded')}`)
L
ligang 已提交
487 488 489 490 491 492 493 494 495
          }, 2200)
        })
      },
      /**
       * View variables
       */
      _toggleView () {
        findComponentDownward(this.$root, `assist-dag-index`)._toggleView()
      },
H
huyuanming 已提交
496 497 498 499 500 501 502

      /**
       * Starting parameters
       */
      _toggleParam () {
        findComponentDownward(this.$root, `starting-params-dag-index`)._toggleParam()
      },
L
ligang 已提交
503 504 505 506
      /**
       * Create a node popup layer
       * @param Object id
       */
507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539
      _createLineLabel({id, sourceId, targetId}) {
        // $('#jsPlumb_2_50').text('111')
        let self = this
        self.$modal.destroy()
        const removeNodesEvent = (fromThis) => {
          // Manually destroy events inside the component
          fromThis.$destroy()
          // Close the popup
          eventModel.remove()
        }
        eventModel = this.$drawer({
          render (h) {
            return h(mFormLineModel,{
              on: {
                addLineInfo ({ item, fromThis }) {
                  self.addConnects(item)
                  setTimeout(() => {
                    removeNodesEvent(fromThis)
                  }, 100)
                },
                cancel ({fromThis}) {
                  removeNodesEvent(fromThis)
                }
              },
              props: {
                id: id,
                sourceId: sourceId,
                targetId: targetId
              }
            })
          }
        })
      },
L
ligang 已提交
540 541
      _createNodes ({ id, type }) {
        let self = this
542
        self.$modal.destroy()
543 544 545 546 547 548
        let preNode = []
        let rearNode = []
        let rearList = []
        $('div[data-targetarr*="' + id + '"]').each(function(){
          rearNode.push($(this).attr("id"))
        })
L
ligang 已提交
549

550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571
        if (rearNode.length>0) {
          rearNode.forEach(v => {
            let rearobj = {}
            rearobj.value = $(`#${v}`).find('.name-p').text()
            rearobj.label = $(`#${v}`).find('.name-p').text()
            rearList.push(rearobj)
          })
        } else {
          rearList = []
        }
        let targetarr = $(`#${id}`).attr('data-targetarr')
        if (targetarr) {
          let nodearr = targetarr.split(',')
          nodearr.forEach(v => {
            let nodeobj = {}
            nodeobj.value = $(`#${v}`).find('.name-p').text()
            nodeobj.label = $(`#${v}`).find('.name-p').text()
            preNode.push(nodeobj)
          })
        } else {
          preNode = []
        }
L
ligang 已提交
572 573 574 575 576 577 578 579 580 581 582 583
        if (eventModel) {
          eventModel.remove()
        }

        const removeNodesEvent = (fromThis) => {
          // Manually destroy events inside the component
          fromThis.$destroy()
          // Close the popup
          eventModel.remove()
        }

        this.taskId = id
Z
zhukai 已提交
584
        type = type || self.dagBarId
L
ligang 已提交
585 586 587 588 589 590 591 592 593 594 595 596 597

        eventModel = this.$drawer({
          closable: false,
          direction: 'right',
          escClose: true,
          render: h => h(mFormModel, {
            on: {
              addTaskInfo ({ item, fromThis }) {
                self.addTasks(item)
                setTimeout(() => {
                  removeNodesEvent(fromThis)
                }, 100)
              },
598 599 600 601 602 603 604 605
              /**
               * Cache the item
               * @param item
               * @param fromThis
               */
              cacheTaskInfo({item, fromThis}) {
                self.cacheTasks(item)
              },
606 607
              close ({ item,flag, fromThis }) {
                self.addTasks(item)
L
ligang 已提交
608 609 610 611 612 613 614 615 616 617 618 619 620 621
                // Edit status does not allow deletion of nodes
                if (flag) {
                  jsPlumb.remove(id)
                }

                removeNodesEvent(fromThis)
              },
              onSubProcess ({ subProcessId, fromThis }) {
                removeNodesEvent(fromThis)
                self._subProcessHandle(subProcessId)
              }
            },
            props: {
              id: id,
Z
zhukai 已提交
622
              taskType: type,
623 624
              self: self,
              preNode: preNode,
G
gaojun2048 已提交
625 626
              rearList: rearList,
              instanceId: this.$route.params.id
L
ligang 已提交
627 628 629
            }
          })
        })
Z
zhukai 已提交
630 631 632 633 634
      },
      removeEventModelById ($id) {
        if(eventModel && this.taskId == $id){
          eventModel.remove()
        }
L
ligang 已提交
635 636 637 638 639
      }
    },
    watch: {
      'tasks': {
        deep: true,
G
gongzijian 已提交
640 641
        handler (o) {

L
ligang 已提交
642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660
          // Edit state does not allow deletion of node a...
          this.setIsEditDag(true)
        }
      }
    },
    created () {
      // Edit state does not allow deletion of node a...
      this.setIsEditDag(false)

      if (this.$route.query.subProcessIds) {
        this.isRtTasks = true
      }

      Dag.init({
        dag: this,
        instance: jsPlumb.getInstance({
          Endpoint: [
            'Dot', { radius: 1, cssClass: 'dot-style' }
          ],
B
break60 已提交
661
          Connector: 'Bezier',
L
ligang 已提交
662
          PaintStyle: { lineWidth: 2, stroke: '#456' }, // Connection style
G
gaojun2048 已提交
663
          HoverPaintStyle: {stroke: '#ccc', strokeWidth: 3}, 
L
ligang 已提交
664 665 666 667 668 669 670 671 672
          ConnectionOverlays: [
            [
              'Arrow',
              {
                location: 1,
                id: 'arrow',
                length: 12,
                foldback: 0.8
              }
673 674 675 676 677
            ],
            ['Label', {
                location: 0.5,
                id: 'label'
            }]
L
ligang 已提交
678
          ],
679 680
          Container: 'canvas',
          ConnectionsDetachable: true
L
ligang 已提交
681 682 683 684
        })
      })
    },
    mounted () {
B
break60 已提交
685
      this.init(this.arg)
L
ligang 已提交
686 687 688 689 690 691 692 693
    },
    beforeDestroy () {
      this.resetParams()

      // Destroy round robin
      clearInterval(this.setIntervalP)
    },
    destroyed () {
Z
zhukai 已提交
694 695 696
      if (eventModel) {
        eventModel.remove()
      }
L
ligang 已提交
697 698 699 700 701 702 703 704 705
    },
    computed: {
      ...mapState('dag', ['tasks', 'locations', 'connects', 'isEditDag', 'name'])
    },
    components: {}
  }
</script>

<style lang="scss" rel="stylesheet/scss">
G
gongzijian 已提交
706
  @import "./dag";
L
ligang 已提交
707
</style>