list.vue 6.0 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 20 21
<template>
  <div class="list-model">
    <div class="table-box">
      <table class="fixed">
        <tr>
22
          <th scope="col" style="min-width: 50px">
G
i18n  
gongzijian 已提交
23
            <span>{{$t('#')}}</span>
L
ligang 已提交
24
          </th>
25
          <th scope="col" style="min-width: 200px;max-width: 300px;">
G
i18n  
gongzijian 已提交
26
            <span>{{$t('Name')}}</span>
L
ligang 已提交
27
          </th>
28
          <th scope="col" style="min-width: 200px;max-width: 300px;">
G
i18n  
gongzijian 已提交
29
            <span>{{$t('Process Instance')}}</span>
L
ligang 已提交
30
          </th>
31
          <th scope="col" style="min-width: 60px">
32 33
            <span>{{$t('Executor')}}</span>
          </th>
34
          <th scope="col" style="min-width: 70px">
35
            <span style="margin-left: 5px">{{$t('Node Type')}}</span>
L
ligang 已提交
36
          </th>
37
          <th scope="col" style="min-width: 30px">
G
i18n  
gongzijian 已提交
38
            <span>{{$t('State')}}</span>
L
ligang 已提交
39
          </th>
40
          <th scope="col" style="min-width: 130px">
G
i18n  
gongzijian 已提交
41
            <span>{{$t('Submit Time')}}</span>
L
ligang 已提交
42
          </th>
43
          <th scope="col" style="min-width: 130px">
G
i18n  
gongzijian 已提交
44
            <span>{{$t('Start Time')}}</span>
L
ligang 已提交
45
          </th>
46
          <th scope="col" style="min-width: 130px">
G
i18n  
gongzijian 已提交
47
            <span>{{$t('End Time')}}</span>
L
ligang 已提交
48
          </th>
49
          <th scope="col" style="min-width: 130px">
L
ligang 已提交
50 51
            <span>{{$t('host')}}</span>
          </th>
52
          <th scope="col" style="min-width: 70px">
G
i18n  
gongzijian 已提交
53
            <span>{{$t('Duration')}}(s)</span>
L
ligang 已提交
54
          </th>
55 56 57 58
          <th scope="col" style="min-width: 60px">
            <div style="width: 50px">
              <span>{{$t('Retry Count')}}</span>
            </div>
L
ligang 已提交
59
          </th>
60
          <th scope="col" style="min-width: 60px">
G
i18n  
gongzijian 已提交
61
            <span>{{$t('Operation')}}</span>
L
ligang 已提交
62 63 64 65 66 67
          </th>
        </tr>
        <tr v-for="(item, $index) in list" :key="item.id">
          <td>
            <span>{{parseInt(pageNo === 1 ? ($index + 1) : (($index + 1) + (pageSize * (pageNo - 1))))}}</span>
          </td>
B
break60 已提交
68
          <td style="min-width: 200px;max-width: 300px;padding-right: 10px;">
B
break60 已提交
69
            <span class="ellipsis" :title="item.name">{{item.name}}</span>
L
ligang 已提交
70
          </td>
B
break60 已提交
71
          <td style="min-width: 200px;max-width: 300px;padding-right: 10px;"><a href="javascript:" class="links" @click="_go(item)"><span class="ellipsis" :title="item.processInstanceName">{{item.processInstanceName}}</span></a></td>
72 73 74 75
          <td>
            <span v-if="item.executorName">{{item.executorName}}</span>
            <span v-else>-</span>
          </td>
76
          <td><span style="margin-left: 5px">{{item.taskType}}</span></td>
L
ligang 已提交
77
          <td><span v-html="_rtState(item.state)" style="cursor: pointer;"></span></td>
78 79 80 81 82 83 84 85
          <td>
            <span v-if="item.submitTime">{{item.submitTime | formatDate}}</span>
            <span v-else>-</span>
          </td>
          <td>
            <span v-if="item.startTime">{{item.startTime | formatDate}}</span>
            <span v-else>-</span>
          </td>
L
ligang 已提交
86 87
          <td>
            <span v-if="item.endTime">{{item.endTime | formatDate}}</span>
88
            <span v-else>-</span>
L
ligang 已提交
89 90 91 92 93 94 95 96 97 98
          </td>
          <td><span>{{item.host || '-'}}</span></td>
          <td><span>{{item.duration}}</span></td>
          <td><span>{{item.retryTimes}}</span></td>
          <td>
            <x-button
                    type="info"
                    shape="circle"
                    size="xsmall"
                    data-toggle="tooltip"
G
i18n  
gongzijian 已提交
99
                    :title="$t('View log')"
100
                    icon="ans-icon-log"
L
ligang 已提交
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
                    @click="_refreshLog(item)">
            </x-button>
          </td>
        </tr>
      </table>
    </div>
  </div>
</template>
<script>
  import Permissions from '@/module/permissions'
  import mLog from '@/conf/home/pages/dag/_source/formModel/log'
  import { tasksState } from '@/conf/home/pages/dag/_source/config'

  export default {
    name: 'list',
    data () {
      return {
        list: [],
        isAuth: Permissions.getAuth(),
        backfillItem: {}
      }
    },
    props: {
      taskInstanceList: Array,
      pageNo: Number,
      pageSize: Number
    },
    methods: {
      _rtState (code) {
        let o = tasksState[code]
131
        return `<em class="${o.icoUnicode} ${o.isSpin ? 'as as-spin' : ''}" style="color:${o.color}" data-toggle="tooltip" data-container="body" title="${o.desc}"></em>`
L
ligang 已提交
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
      },
      _refreshLog (item) {
        let self = this
        let instance = this.$modal.dialog({
          closable: false,
          showMask: true,
          escClose: true,
          className: 'v-modal-custom',
          transitionName: 'opacityp',
          render (h) {
            return h(mLog, {
              on: {
                ok () {
                },
                close () {
                  instance.remove()
                }
              },
              props: {
                self: self,
                source: 'list',
                logId: item.id
              }
            })
          }
        })
158 159 160 161
      },
      _go (item) {
        this.$router.push({ path: `/projects/instance/list/${item.processInstanceId}` })
      },
L
ligang 已提交
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177
    },
    watch: {
      taskInstanceList (a) {
        this.list = []
        setTimeout(() => {
          this.list = a
        })
      }
    },
    created () {
    },
    mounted () {
      this.list = this.taskInstanceList
    },
    components: { }
  }
178
</script>