Skip to content

Commit

Permalink
feat: update task instance UI
Browse files Browse the repository at this point in the history
  • Loading branch information
dajiangyou committed Mar 9, 2021
1 parent 877ed45 commit 4e3190f
Showing 1 changed file with 19 additions and 22 deletions.
41 changes: 19 additions & 22 deletions src/renderer/views/home/InstanceList.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div>
<!-- table -->
<a-table style="overflow-y: auto" :columns="columns" rowKey="_id" :data-source="instanceList" :scroll="{ x: 1600, y: 600 }">
<a-table :columns="columns" rowKey="_id" :data-source="instanceList" :scroll="{ x: 1200 }">
<span slot="status" slot-scope="status">
<a-tag :color="taskStatusOptions[status].color">
{{ taskStatusOptions[status].desc }}
Expand All @@ -10,33 +10,33 @@
<span slot="preCommandList" slot-scope="preCommandList">
<p v-for="(item, index) in preCommandList" :key="index">
<template v-if="item.path && item.command">
<a-tag>{{ item.path }}</a-tag> {{ item.command }}
<span class="path-span">{{ item.path }}</span>
{{ item.command }}
</template>
</p>
</span>
<span slot="releasePath" slot-scope="releasePath">
<span class="path-span">{{ releasePath }}</span>
</span>
<span slot="localPreCommand" slot-scope="localPreCommand">
<p v-if="localPreCommand.path && localPreCommand.command">
<a-tag>{{ localPreCommand.path }}</a-tag>
<span class="path-span">{{ localPreCommand.path }}</span>
<template>{{ localPreCommand.command }}</template>
</p>
</span>
<span slot="projectPath" slot-scope="projectPath">
<a-icon v-if="projectPath" theme="twoTone"
:title="checkDirExist(projectPath) ? 'exist' : 'not exist'"
:type="checkDirExist(projectPath) ? 'check-circle' : 'warning'"
:two-tone-color="checkDirExist(projectPath) ? '#67C23A' : '#E6A23C'" />
{{ projectPath }}
<span class="path-span">{{ projectPath }}</span>
</span>
<span slot="localPostCommand" slot-scope="localPostCommand">
<p v-if="localPostCommand.path && localPostCommand.command">
<a-tag>{{ localPostCommand.path }}</a-tag>
<span class="path-span">{{ localPostCommand.path }}</span>
<template>{{ localPostCommand.command }}</template>
</p>
</span>
<span slot="postCommandList" slot-scope="postCommandList">
<p v-for="(item, index) in postCommandList" :key="index">
<template v-if="item.path && item.command">
<a-tag>{{ item.path }}</a-tag> {{ item.command }}
<span class="path-span">{{ item.path }}</span> {{ item.command }}
</template>
</p>
</span>
Expand Down Expand Up @@ -70,7 +70,6 @@ import dayjs from 'dayjs'
import TaskForm from './TaskForm'
import taskMixin from '@/store/task-mixin'
import instanceMixin from '@/store/instance-mixin'
const fs = require('fs')
export default {
name: 'InstanceList',
mixins: [taskMixin, instanceMixin],
Expand Down Expand Up @@ -103,7 +102,8 @@ export default {
},
{
dataIndex: 'releasePath',
title: '发布路径'
title: '发布路径',
scopedSlots: { customRender: 'releasePath' }
},
{
dataIndex: 'localPreCommand',
Expand All @@ -127,7 +127,8 @@ export default {
},
{
dataIndex: 'lastExecutedTime',
title: '上次执行时间'
title: '上次执行时间',
ellipsis: true
},
{
dataIndex: 'lastCostTime',
Expand Down Expand Up @@ -176,20 +177,16 @@ export default {
this.deployActionVisible = false
await this.editInstanceList(instance)
this.getInstanceList()
},
// 检查本地目录是否存在
checkDirExist (path) {
try {
fs.accessSync(path)
return true
} catch (err) {
console.log(err)
}
}
}
}
</script>
<style lang="stylus" scoped>
.path-span
text-decoration underline
&:hover
color #409EFF
.anticon
margin-right 6px
font-size 18px
Expand Down

0 comments on commit 4e3190f

Please sign in to comment.