mirror of
https://github.com/jumpserver/lina.git
synced 2025-07-19 01:27:14 +00:00
Merge branch 'v3' of github.com:jumpserver/lina into v3
This commit is contained in:
commit
32ec05e04c
@ -627,7 +627,11 @@
|
|||||||
"versionDetail": "Version detail",
|
"versionDetail": "Version detail",
|
||||||
"versionRunExecution": "Version run execution",
|
"versionRunExecution": "Version run execution",
|
||||||
"Unkown": "Unkown",
|
"Unkown": "Unkown",
|
||||||
"Unknown": "Unknown"
|
"Unknown": "Unknown",
|
||||||
|
"PENDING": "Pending",
|
||||||
|
"RUNNING": "Running",
|
||||||
|
"SUCCESS": "Success",
|
||||||
|
"FAILURE": "Failure"
|
||||||
},
|
},
|
||||||
"perms": {
|
"perms": {
|
||||||
"": "",
|
"": "",
|
||||||
@ -1228,7 +1232,6 @@
|
|||||||
"OrgUser": "Org User",
|
"OrgUser": "Org User",
|
||||||
"OrgAdmin": "Org Admin",
|
"OrgAdmin": "Org Admin",
|
||||||
"OrgAuditor": "Org Auditor",
|
"OrgAuditor": "Org Auditor",
|
||||||
|
|
||||||
"HelpText": {
|
"HelpText": {
|
||||||
"MFAOfUserFirstLoginPersonalInformationImprovementPage": "Enable multi-factor authentication to make the account more secure <br/> After is enabled, you will enter the multi-factor authentication binding process on your next login <br/> You can also bind directly in (personal information -> fast modifier -> modifier multiple factor Settings)",
|
"MFAOfUserFirstLoginPersonalInformationImprovementPage": "Enable multi-factor authentication to make the account more secure <br/> After is enabled, you will enter the multi-factor authentication binding process on your next login <br/> You can also bind directly in (personal information -> fast modifier -> modifier multiple factor Settings)",
|
||||||
"MFAOfUserFirstLoginUserGuidePage": "To protect the security of you and the company <br/> please properly keep your account, password, key and other important and sensitive information <br/> (e.g., set a complex password and enable multi-factor authentication)",
|
"MFAOfUserFirstLoginUserGuidePage": "To protect the security of you and the company <br/> please properly keep your account, password, key and other important and sensitive information <br/> (e.g., set a complex password and enable multi-factor authentication)",
|
||||||
|
@ -644,7 +644,11 @@
|
|||||||
"versionDetail": "版本详情",
|
"versionDetail": "版本详情",
|
||||||
"versionRunExecution": "执行历史",
|
"versionRunExecution": "执行历史",
|
||||||
"Unkown": "未知",
|
"Unkown": "未知",
|
||||||
"Unknown": "未知"
|
"Unknown": "未知",
|
||||||
|
"PENDING": "等待中",
|
||||||
|
"RUNNING": "运行中",
|
||||||
|
"SUCCESS": "成功",
|
||||||
|
"FAILURE": "失败"
|
||||||
},
|
},
|
||||||
"perms": {
|
"perms": {
|
||||||
"": "",
|
"": "",
|
||||||
|
@ -12,14 +12,14 @@ export default [
|
|||||||
path: '',
|
path: '',
|
||||||
name: 'TaskList',
|
name: 'TaskList',
|
||||||
component: () => import('@/views/ops/TaskList'),
|
component: () => import('@/views/ops/TaskList'),
|
||||||
meta: { title: i18n.t('route.TaskList') }
|
meta: { title: i18n.t('route.TaskList'), permissions: [] }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: ':id',
|
path: ':id',
|
||||||
component: () => import('@/views/ops/TaskDetail'),
|
component: () => import('@/views/ops/TaskDetail'),
|
||||||
name: 'TaskDetail',
|
name: 'TaskDetail',
|
||||||
hidden: true,
|
hidden: true,
|
||||||
meta: { title: i18n.t('route.TaskDetail') }
|
meta: { title: i18n.t('route.TaskDetail'), permissions: [] }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -1,103 +0,0 @@
|
|||||||
<template>
|
|
||||||
<ListTable :table-config="tableConfig" :header-actions="headerActions" />
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import ListTable from '@/components/ListTable'
|
|
||||||
import { toSafeLocalDateStr } from '@/utils/common'
|
|
||||||
import { DetailFormatter } from '@/components/TableFormatters'
|
|
||||||
export default {
|
|
||||||
name: 'TaskAdhoc',
|
|
||||||
components: {
|
|
||||||
ListTable
|
|
||||||
},
|
|
||||||
props: {
|
|
||||||
object: {
|
|
||||||
type: Object,
|
|
||||||
default: () => ({})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
tableConfig: {
|
|
||||||
url: `/api/v1/ops/adhoc/?task=${this.object.id}`,
|
|
||||||
columns: [
|
|
||||||
'short_id', 'hosts', 'pattern', 'run_as', 'become_display', 'date_created', 'actions'
|
|
||||||
],
|
|
||||||
columnsMeta: {
|
|
||||||
short_id: {
|
|
||||||
label: this.$t('ops.version'),
|
|
||||||
formatter: DetailFormatter,
|
|
||||||
formatterArgs: {
|
|
||||||
route: 'AdhocDetail'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
hosts: {
|
|
||||||
label: this.$t('ops.hosts'),
|
|
||||||
width: '80px',
|
|
||||||
formatter: (row, column, cellValue) => {
|
|
||||||
if (cellValue instanceof Array) {
|
|
||||||
return cellValue.length
|
|
||||||
}
|
|
||||||
return cellValue
|
|
||||||
},
|
|
||||||
showOverflowTooltip: true
|
|
||||||
},
|
|
||||||
pattern: {
|
|
||||||
label: this.$t('ops.pattern'),
|
|
||||||
width: '80px'
|
|
||||||
},
|
|
||||||
run_as: {
|
|
||||||
label: this.$t('ops.runAs'),
|
|
||||||
formatter: function(row) {
|
|
||||||
if (row.run_as_admin) {
|
|
||||||
return 'Admin'
|
|
||||||
}
|
|
||||||
if (row.run_as) {
|
|
||||||
return row.run_as
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
become_display: {
|
|
||||||
label: this.$t('ops.become')
|
|
||||||
},
|
|
||||||
date_created: {
|
|
||||||
label: this.$t('ops.datetime'),
|
|
||||||
formatter: function(row) {
|
|
||||||
return toSafeLocalDateStr(row.date_created)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
actions: {
|
|
||||||
prop: 'id',
|
|
||||||
width: '80px',
|
|
||||||
formatterArgs: {
|
|
||||||
hasEdit: false,
|
|
||||||
hasDelete: false,
|
|
||||||
hasUpdate: false,
|
|
||||||
hasClone: false,
|
|
||||||
extraActions: [
|
|
||||||
{
|
|
||||||
name: 'detail',
|
|
||||||
title: this.$t('ops.detail'),
|
|
||||||
type: 'primary',
|
|
||||||
callback: function({ row, tableData }) {
|
|
||||||
return this.$router.push({ name: 'AdhocDetail', params: { id: row.id }})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
headerActions: {
|
|
||||||
hasLeftActions: false,
|
|
||||||
hasRightActions: false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
|
|
||||||
</style>
|
|
@ -3,25 +3,16 @@
|
|||||||
<el-col :md="14" :sm="24">
|
<el-col :md="14" :sm="24">
|
||||||
<DetailCard :title="cardTitle" :items="detailCardItems" />
|
<DetailCard :title="cardTitle" :items="detailCardItems" />
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :md="10" :sm="24">
|
|
||||||
<RunInfoCard type="danger" style="margin-top: 15px" v-bind="RunFailedConfig" />
|
|
||||||
<RunInfoCard type="info" v-bind="RunSuccessConfig" style="margin-top: 15px" />
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script type="text/jsx">
|
<script type="text/jsx">
|
||||||
import DetailCard from '@/components/DetailCard'
|
import DetailCard from '@/components/DetailCard'
|
||||||
import RunInfoCard from '../RunInfoCard/index'
|
|
||||||
import { toLastFailureDisplay, toLastSucessDisplay } from './business'
|
|
||||||
import { toSafeLocalDateStr } from '@/utils/common'
|
|
||||||
import { openTaskPage } from '@/utils/jms'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'TaskDetail',
|
name: 'TaskDetail',
|
||||||
components: {
|
components: {
|
||||||
DetailCard,
|
DetailCard
|
||||||
RunInfoCard
|
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
object: {
|
object: {
|
||||||
@ -30,100 +21,22 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {}
|
||||||
RunSuccessConfig: {
|
|
||||||
icon: 'fa-info',
|
|
||||||
title: this.$t('ops.lastRunSuccessHosts'),
|
|
||||||
contents: toLastSucessDisplay(this.object.latest_execution)
|
|
||||||
},
|
|
||||||
RunFailedConfig: {
|
|
||||||
icon: 'fa-info',
|
|
||||||
title: this.$t('ops.lastRunFailedHosts'),
|
|
||||||
contents: toLastFailureDisplay(this.object.latest_execution)
|
|
||||||
},
|
|
||||||
taskData: {}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
cardTitle() {
|
cardTitle() {
|
||||||
return this.object.display_name
|
return this.object.name
|
||||||
},
|
},
|
||||||
detailCardItems() {
|
detailCardItems() {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
key: this.$t('common.Name'),
|
key: this.$t('common.Name'),
|
||||||
value: this.object.display_name
|
value: this.object.name
|
||||||
},
|
|
||||||
{
|
|
||||||
key: this.$t('common.dateCreated'),
|
|
||||||
value: toSafeLocalDateStr(this.object.date_created)
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: this.$t('ops.totalVersions'),
|
|
||||||
value: JSON.stringify(this.object.summary.total)
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: this.$t('ops.latestVersion'),
|
|
||||||
value: this.object.latest_execution,
|
|
||||||
formatter: function(row, data) {
|
|
||||||
const route = { to: { name: 'AdhocDetail', params: { id: data.adhoc }}}
|
|
||||||
if (!this.$hasPerm('ops.ops.view_adhoc')) {
|
|
||||||
return <span>{ data.adhoc_short_id }</span>
|
|
||||||
}
|
|
||||||
return <router-link {...{ attrs: route }}>{ data.adhoc_short_id }</router-link>
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: this.$t('ops.lastRun'),
|
|
||||||
value: toSafeLocalDateStr(this.object.latest_execution.date_finished)
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: this.$t('ops.timeDelta'),
|
|
||||||
value: this.object.latest_execution.timedelta.toFixed(2) + 's'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: this.$t('ops.isFinished'),
|
|
||||||
value: this.object.latest_execution.is_finished
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: this.$t('ops.isSuccess'),
|
|
||||||
value: this.object.latest_execution.is_success
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: this.$t('ops.contents'),
|
|
||||||
value: this.toContentsDisplay(this.object.contents),
|
|
||||||
formatter(row, value) {
|
|
||||||
return (<div>{
|
|
||||||
value.map((content) => {
|
|
||||||
return <div>{ content }</div>
|
|
||||||
})}
|
|
||||||
</div>)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: this.$t('ops.lastExecutionOutput'),
|
|
||||||
value: this.object.latest_execution.id,
|
|
||||||
formatter: function(row, value) {
|
|
||||||
const onClick = function() {
|
|
||||||
openTaskPage(value, 'ansible')
|
|
||||||
}
|
|
||||||
const title = this.$t('common.View')
|
|
||||||
return <a onClick={onClick} >{ title }</a>
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {}
|
||||||
toContentsDisplay(contents) {
|
|
||||||
const lines = []
|
|
||||||
for (let i = 0; i < contents.length; i++) {
|
|
||||||
const content = contents[i]
|
|
||||||
lines.push(`${i}. ${content.name} ::: ${content.action.module}`)
|
|
||||||
}
|
|
||||||
return lines
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -4,8 +4,6 @@
|
|||||||
|
|
||||||
<script type="text/jsx">
|
<script type="text/jsx">
|
||||||
import ListTable from '@/components/ListTable'
|
import ListTable from '@/components/ListTable'
|
||||||
import { DetailFormatter } from '@/components/TableFormatters'
|
|
||||||
import { toSafeLocalDateStr } from '@/utils/common'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'TaskHistory',
|
name: 'TaskHistory',
|
||||||
@ -21,63 +19,25 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
tableConfig: {
|
tableConfig: {
|
||||||
url: `/api/v1/ops/adhoc-executions/?task=${this.object.id}`,
|
url: `/api/v1/ops/tasks/${this.object.id}/executions/`,
|
||||||
columns: [
|
columns: [
|
||||||
'date_start', 'stat', 'ratio', 'is_finished', 'is_success', 'timedelta', 'adhoc_short_id', 'actions'
|
'id', 'state', 'is_finished', 'date_published', 'date_start', 'date_finished', 'actions'
|
||||||
],
|
],
|
||||||
columnsMeta: {
|
columnsMeta: {
|
||||||
date_start: {
|
state: {
|
||||||
formatter: (row) => toSafeLocalDateStr(row.date_start),
|
label: this.$t('ops.state'),
|
||||||
width: '160px'
|
width: '120px',
|
||||||
},
|
formatter: (row) => {
|
||||||
stat: {
|
switch (row.state) {
|
||||||
label: this.$t('ops.stat'),
|
case 'PENDING':
|
||||||
align: 'center',
|
return <span><i Class='fa fa-spinner fa-spin' />{this.$t(`ops.${row.state}`)}</span>
|
||||||
width: '100px',
|
case 'RUNNING':
|
||||||
formatter: function(row) {
|
return <span><i Class='fa fa-spinner fa-spin' />{this.$t(`ops.${row.state}`)}</span>
|
||||||
return (
|
case 'SUCCESS':
|
||||||
<div>
|
return <span Class='text-success'><i Class='fa fa-check' />{this.$t(`ops.${row.state}`)}</span>
|
||||||
<span class='text-primary'>{row.stat.success}</span>/
|
case 'FAILURE':
|
||||||
<span class='text-danger'>{row.stat.failed}</span>/
|
return <span Class='text-danger'><i Class='fa fa-times' />{this.$t(`ops.${row.state}`)}</span>
|
||||||
<span>{row.stat.total}</span>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
},
|
|
||||||
ratio: {
|
|
||||||
label: this.$t('ops.ratio'),
|
|
||||||
align: 'center',
|
|
||||||
width: '80px',
|
|
||||||
formatter: function(row) {
|
|
||||||
const ratio = (row.stat.success / row.stat.total) * 100
|
|
||||||
if (ratio === 100) {
|
|
||||||
return <span class='text-navy'>{ratio + '%'}</span>
|
|
||||||
}
|
|
||||||
return <span class='text-danger'>{ratio + '%'}</span>
|
|
||||||
}
|
|
||||||
},
|
|
||||||
is_finished: {
|
|
||||||
align: 'center',
|
|
||||||
width: '100px',
|
|
||||||
label: this.$t('ops.isFinished')
|
|
||||||
},
|
|
||||||
is_success: {
|
|
||||||
align: 'center',
|
|
||||||
width: '100px',
|
|
||||||
label: this.$t('ops.isSuccess')
|
|
||||||
},
|
|
||||||
timedelta: {
|
|
||||||
label: this.$t('ops.time'),
|
|
||||||
width: '100px',
|
|
||||||
formatter: function(row) {
|
|
||||||
return row.timedelta.toFixed(2) + 's'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
adhoc_short_id: {
|
|
||||||
label: this.$t('ops.version'),
|
|
||||||
formatter: DetailFormatter,
|
|
||||||
formatterArgs: {
|
|
||||||
route: 'HistoryExecutionDetail'
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
import { GenericDetailPage, TabPage } from '@/layout/components'
|
import { GenericDetailPage, TabPage } from '@/layout/components'
|
||||||
import TaskDetail from './TaskDetail'
|
import TaskDetail from './TaskDetail'
|
||||||
import TaskHistory from './TaskHistory'
|
import TaskHistory from './TaskHistory'
|
||||||
import TaskAdhoc from './TaskAdhoc'
|
|
||||||
import CeleryTaskLog from '../CeleryTaskLog'
|
import CeleryTaskLog from '../CeleryTaskLog'
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@ -18,7 +17,6 @@ export default {
|
|||||||
CeleryTaskLog,
|
CeleryTaskLog,
|
||||||
TaskHistory,
|
TaskHistory,
|
||||||
TaskDetail,
|
TaskDetail,
|
||||||
TaskAdhoc,
|
|
||||||
TabPage
|
TabPage
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@ -34,11 +32,6 @@ export default {
|
|||||||
title: this.$t('ops.taskDetail'),
|
title: this.$t('ops.taskDetail'),
|
||||||
name: 'TaskDetail'
|
name: 'TaskDetail'
|
||||||
},
|
},
|
||||||
{
|
|
||||||
title: this.$t('ops.taskVersions'),
|
|
||||||
name: 'TaskAdhoc',
|
|
||||||
hidden: () => !this.$hasPerm('ops.view_adhoc')
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
title: this.$t('ops.execution'),
|
title: this.$t('ops.execution'),
|
||||||
name: 'TaskHistory',
|
name: 'TaskHistory',
|
||||||
|
@ -3,14 +3,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script type="text/jsx">
|
<script type="text/jsx">
|
||||||
import { timeOffset, toSafeLocalDateStr } from '@/utils/common'
|
// import { timeOffset, toSafeLocalDateStr } from '@/utils/common'
|
||||||
import { GenericListPage } from '@/layout/components'
|
import { GenericListPage } from '@/layout/components'
|
||||||
import { openTaskPage } from '@/utils/jms'
|
// import { openTaskPage } from '@/utils/jms'
|
||||||
const performDelete = function({ row }) {
|
|
||||||
const id = row.id
|
|
||||||
const url = `${this.url}${id}/`
|
|
||||||
return this.$axios.delete(url)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@ -21,109 +16,150 @@ export default {
|
|||||||
tableConfig: {
|
tableConfig: {
|
||||||
url: '/api/v1/ops/tasks/',
|
url: '/api/v1/ops/tasks/',
|
||||||
columns: [
|
columns: [
|
||||||
'name', 'runtimes', 'host_amount', 'is_success',
|
'name', 'queue', 'comment', 'count', 'state', 'last_published_time'
|
||||||
'date_start', 'time', 'actions'
|
|
||||||
],
|
],
|
||||||
columnsMeta: {
|
columnsMeta: {
|
||||||
name: {
|
name: {
|
||||||
showOverflowTooltip: true,
|
|
||||||
formatterArgs: {
|
formatterArgs: {
|
||||||
getTitle({ row }) {
|
can: true
|
||||||
return row['display_name']
|
|
||||||
}
|
}
|
||||||
|
// formatter: (row) => {
|
||||||
|
// return row.meta.verbose_name != null ? row.meta.verbose_name : row.name
|
||||||
|
// }
|
||||||
|
},
|
||||||
|
comment: {
|
||||||
|
label: 'comment',
|
||||||
|
formatter: (row) => {
|
||||||
|
return row.meta.comment
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
runtimes: {
|
queue: {
|
||||||
label: this.$t('ops.runTimes'),
|
label: 'queue',
|
||||||
|
formatter: (row) => {
|
||||||
|
return row.meta.queue
|
||||||
|
}
|
||||||
|
},
|
||||||
|
last_published_time: {
|
||||||
|
width: '210px',
|
||||||
|
formatter: (row) => {
|
||||||
|
return row.last_published_time != null ? row.last_published_time : '-'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
count: {
|
||||||
|
label: 'success/total',
|
||||||
width: '120px',
|
width: '120px',
|
||||||
formatter: function(row) {
|
formatter: (row) => {
|
||||||
return (<div>
|
return <div>
|
||||||
<span Class='text-primary'>{row.summary.success}</span>/
|
<span Class='text-primary'>{row.success_count}</span>/
|
||||||
<span Class='text-danger'>{row.summary.failed}</span>/
|
<span>{row.publish_count}</span>
|
||||||
<span>{row.summary.total}</span>
|
</div>
|
||||||
</div>)
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
host_amount: {
|
state: {
|
||||||
label: this.$t('ops.hosts'),
|
width: '60px',
|
||||||
width: '65px',
|
|
||||||
formatter: function(row) {
|
|
||||||
return _.get(row, 'latest_execution.hosts_amount', 0)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
is_success: {
|
|
||||||
label: this.$t('ops.success'),
|
|
||||||
align: 'center',
|
align: 'center',
|
||||||
width: '80px',
|
formatter: (row) => {
|
||||||
formatter: row => {
|
switch (row.state) {
|
||||||
if (_.get(row, 'latest_execution.is_success', false)) {
|
case 'green':
|
||||||
return <i Class='fa fa-check text-primary'/>
|
return <i Class='fa fa-circle-o text-primary' />
|
||||||
|
case 'yellow':
|
||||||
|
return <i Class='fa fa-circle-o text-warning' />
|
||||||
|
case 'red':
|
||||||
|
return <i Class='fa fa-circle-o text-danger' />
|
||||||
}
|
}
|
||||||
return <i Class='fa fa-times text-danger'/>
|
|
||||||
}
|
|
||||||
},
|
|
||||||
date_start: {
|
|
||||||
label: this.$t('ops.date'),
|
|
||||||
width: '150px',
|
|
||||||
formatter: function(row) {
|
|
||||||
if (_.get(row, 'latest_execution.date_start', false)) {
|
|
||||||
return toSafeLocalDateStr(row.latest_execution.date_start)
|
|
||||||
}
|
|
||||||
return ''
|
|
||||||
}
|
|
||||||
},
|
|
||||||
time: {
|
|
||||||
label: this.$t('ops.time'),
|
|
||||||
width: '100px',
|
|
||||||
formatter: function(row) {
|
|
||||||
if (_.get(row, 'latest_execution.date_start', false)) {
|
|
||||||
return timeOffset(row.latest_execution.date_start, row.latest_execution.date_finished)
|
|
||||||
}
|
|
||||||
return ''
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// runtimes: {
|
||||||
|
// label: this.$t('ops.runTimes'),
|
||||||
|
// width: '120px',
|
||||||
|
// formatter: function(row) {
|
||||||
|
// return (<div>
|
||||||
|
// <span Class='text-primary'>{row.summary.success}</span>/
|
||||||
|
// <span Class='text-danger'>{row.summary.failed}</span>/
|
||||||
|
// <span>{row.summary.total}</span>
|
||||||
|
// </div>)
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// host_amount: {
|
||||||
|
// label: this.$t('ops.hosts'),
|
||||||
|
// width: '65px',
|
||||||
|
// formatter: function(row) {
|
||||||
|
// return _.get(row, 'latest_execution.hosts_amount', 0)
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// is_success: {
|
||||||
|
// label: this.$t('ops.success'),
|
||||||
|
// align: 'center',
|
||||||
|
// width: '80px',
|
||||||
|
// formatter: row => {
|
||||||
|
// if (_.get(row, 'latest_execution.is_success', false)) {
|
||||||
|
// return <i Class='fa fa-check text-primary'/>
|
||||||
|
// }
|
||||||
|
// return <i Class='fa fa-times text-danger'/>
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// date_start: {
|
||||||
|
// label: this.$t('ops.date'),
|
||||||
|
// width: '150px',
|
||||||
|
// formatter: function(row) {
|
||||||
|
// if (_.get(row, 'latest_execution.date_start', false)) {
|
||||||
|
// return toSafeLocalDateStr(row.latest_execution.date_start)
|
||||||
|
// }
|
||||||
|
// return ''
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// time: {
|
||||||
|
// label: this.$t('ops.time'),
|
||||||
|
// width: '100px',
|
||||||
|
// formatter: function(row) {
|
||||||
|
// if (_.get(row, 'latest_execution.date_start', false)) {
|
||||||
|
// return timeOffset(row.latest_execution.date_start, row.latest_execution.date_finished)
|
||||||
|
// }
|
||||||
|
// return ''
|
||||||
|
// }
|
||||||
|
// },
|
||||||
actions: {
|
actions: {
|
||||||
prop: 'id',
|
prop: 'id',
|
||||||
formatterArgs: {
|
formatterArgs: {
|
||||||
hasUpdate: false,
|
// hasUpdate: false,
|
||||||
hasClone: false,
|
// hasClone: false,
|
||||||
canDelete: this.$hasPerm('ops.delete_task'),
|
// canDelete: this.$hasPerm('ops.delete_task'),
|
||||||
onDelete: function({ row, col, cellValue, reload }) {
|
// onDelete: function({ row, col, cellValue, reload }) {
|
||||||
const msg = this.$t('common.deleteWarningMsg') + ` "${row.display_name || row.name}" ` + '?'
|
// const msg = this.$t('common.deleteWarningMsg') + ` "${row.display_name || row.name}" ` + '?'
|
||||||
const title = this.$t('common.Info')
|
// const title = this.$t('common.Info')
|
||||||
this.$alert(msg, title, {
|
// this.$alert(msg, title, {
|
||||||
type: 'warning',
|
// type: 'warning',
|
||||||
confirmButtonClass: 'el-button--danger',
|
// confirmButtonClass: 'el-button--danger',
|
||||||
showCancelButton: true,
|
// showCancelButton: true,
|
||||||
beforeClose: async(action, instance, done) => {
|
// beforeClose: async(action, instance, done) => {
|
||||||
if (action !== 'confirm') return done()
|
// if (action !== 'confirm') return done()
|
||||||
instance.confirmButtonLoading = true
|
// instance.confirmButtonLoading = true
|
||||||
try {
|
// try {
|
||||||
await performDelete.bind(this)({ row: row, col: col })
|
// await performDelete.bind(this)({ row: row, col: col })
|
||||||
done()
|
// done()
|
||||||
reload()
|
// reload()
|
||||||
this.$message.success(this.$t('common.deleteSuccessMsg'))
|
// this.$message.success(this.$t('common.deleteSuccessMsg'))
|
||||||
} finally {
|
// } finally {
|
||||||
instance.confirmButtonLoading = false
|
// instance.confirmButtonLoading = false
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
},
|
// },
|
||||||
extraActions: [
|
// extraActions: [
|
||||||
{
|
// {
|
||||||
name: 'run',
|
// name: 'run',
|
||||||
can: this.$hasPerm('ops.add_adhoc'),
|
// can: this.$hasPerm('ops.add_adhoc'),
|
||||||
title: this.$t('ops.run'),
|
// title: this.$t('ops.run'),
|
||||||
type: 'primary',
|
// type: 'primary',
|
||||||
callback: function({ row, tableData }) {
|
// callback: function({ row, tableData }) {
|
||||||
this.$axios.get(
|
// this.$axios.get(
|
||||||
`/api/v1/ops/tasks/${row.id}/run/`
|
// `/api/v1/ops/tasks/${row.id}/run/`
|
||||||
).then(res => {
|
// ).then(res => {
|
||||||
openTaskPage(res['task'])
|
// openTaskPage(res['task'])
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
]
|
// ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -133,7 +169,8 @@ export default {
|
|||||||
hasCreate: false
|
hasCreate: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
methods: {}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user