mirror of
https://github.com/jumpserver/lina.git
synced 2025-08-31 22:48:27 +00:00
merge: with dev
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<template>
|
||||
<IBox fa="fa-info-circle" :title="title" v-bind="$attrs">
|
||||
<div class="quick-actions">
|
||||
<p v-if="iTag.length === 0">{{ $t('common.Nothing') }}</p>
|
||||
<el-tag v-for="i in iTag" :key="i" type="info">{{ i }}</el-tag>
|
||||
</div>
|
||||
</IBox>
|
||||
|
@@ -221,6 +221,9 @@ export default {
|
||||
},
|
||||
addObjects() {
|
||||
const objects = this.$refs.select2.getOptionsByValues(this.select2.value)
|
||||
if (objects.length === 0) {
|
||||
return
|
||||
}
|
||||
this.performAdd(objects, this).then(
|
||||
() => this.onAddSuccess(objects, this)
|
||||
)
|
||||
|
@@ -181,6 +181,7 @@
|
||||
"MoreActions": "更多操作",
|
||||
"Name": "名称",
|
||||
"No": "否",
|
||||
"Nothing": "无",
|
||||
"NoData": "暂无数据",
|
||||
"Open": "打开",
|
||||
"Other": "其它",
|
||||
@@ -207,6 +208,8 @@
|
||||
"activateSelected": "激活所选",
|
||||
"bulkDeleteErrorMsg": "批量删除失败: ",
|
||||
"bulkDeleteSuccessMsg": "批量删除成功",
|
||||
"bulkRemoveErrorMsg": "批量移除失败: ",
|
||||
"bulkRemoveSuccessMsg": "批量移除成功",
|
||||
"createBy": "创建者",
|
||||
"createErrorMsg": "创建失败",
|
||||
"createSuccessMsg": "创建成功",
|
||||
@@ -260,6 +263,8 @@
|
||||
"updateSuccessMsg": "更新成功",
|
||||
"SelectProperties": "选择属性",
|
||||
"ObjectNotFoundOrDeletedMsg": "没有找到对应资源或者已被删除",
|
||||
"removeSelected": "移除所选",
|
||||
"removeWarningMsg": "你确定要移除",
|
||||
"password": {
|
||||
"UPPER_CASE_REQUIRED": "须包含大写字母",
|
||||
"LOWER_CASE_REQUIRED": "须包含小写字母",
|
||||
@@ -341,7 +346,8 @@
|
||||
"totalVersions": "版本数量",
|
||||
"version": "版本",
|
||||
"versionDetail": "版本详情",
|
||||
"versionRunExecution": "执行历史"
|
||||
"versionRunExecution": "执行历史",
|
||||
"Unkown": "未知"
|
||||
},
|
||||
"perms": {
|
||||
"": "",
|
||||
|
@@ -142,6 +142,7 @@
|
||||
"ReLogin": "Re-Login"
|
||||
},
|
||||
"common": {
|
||||
"Nothing": "Nothing",
|
||||
"Action": "Action",
|
||||
"Actions": "Actions",
|
||||
"Activate": "Activate",
|
||||
@@ -208,6 +209,8 @@
|
||||
"activateSelected": "Activate selected",
|
||||
"bulkDeleteErrorMsg": "Bulk delete failed: ",
|
||||
"bulkDeleteSuccessMsg": "Bulk delete success",
|
||||
"bulkRemoveErrorMsg": "Bulk remove failed: ",
|
||||
"bulkRemoveSuccessMsg": "Bulk remove success",
|
||||
"createBy": "Create by",
|
||||
"createErrorMsg": "Create error",
|
||||
"createSuccessMsg": "Create success",
|
||||
@@ -260,6 +263,8 @@
|
||||
"updateSuccessMsg": "Update success",
|
||||
"SelectProperties": "Select properties",
|
||||
"ObjectNotFoundOrDeletedMsg": "Resource lost or deleted",
|
||||
"removeSelected": "Remove selected",
|
||||
"removeWarningMsg": "Are you sure to remove ",
|
||||
"password": {
|
||||
"UPPER_CASE_REQUIRED": "Upper case required",
|
||||
"LOWER_CASE_REQUIRED": "Lower case required",
|
||||
@@ -341,7 +346,8 @@
|
||||
"totalVersions": "Total versions",
|
||||
"version": "Version",
|
||||
"versionDetail": "Version detail",
|
||||
"versionRunExecution": "Version run execution"
|
||||
"versionRunExecution": "Version run execution",
|
||||
"Unkown": "Unkown"
|
||||
},
|
||||
"perms": {
|
||||
"": "",
|
||||
|
@@ -30,7 +30,7 @@ export default {
|
||||
name: 'Detail'
|
||||
}
|
||||
],
|
||||
hasRightSide: this.hasRightSide
|
||||
hasRightSide: this.$route.params.id > 7
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@@ -60,4 +60,10 @@ export default {
|
||||
.box-margin {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.el-table::before{
|
||||
display: none;
|
||||
}
|
||||
.el-table >>> td{
|
||||
border-bottom: none;
|
||||
}
|
||||
</style>
|
||||
|
@@ -57,7 +57,7 @@ export default {
|
||||
formatter: (row) => {
|
||||
const label = this.$t('audits.View')
|
||||
const route = { to: { name: 'CeleryTaskLog', params: { id: row.id }}}
|
||||
return <router-link {...{ attrs: route }}>{ label }</router-link>
|
||||
return <router-link {...{ attrs: route }} target='_blank'>{ label }</router-link>
|
||||
}
|
||||
},
|
||||
date_start: {
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<IBox :fa="icon" :type="type" :title="title" v-bind="$attrs">
|
||||
<table class="run-info">
|
||||
<tr>
|
||||
<tr v-for="content in contents" :key="content.hostname">
|
||||
<td>{{ content.hostname }}</td>
|
||||
<td>{{ content.result }}</td>
|
||||
</tr>
|
||||
@@ -26,9 +26,9 @@ export default {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
content: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
contents: {
|
||||
type: Array,
|
||||
default: () => ([])
|
||||
},
|
||||
url: {
|
||||
type: String,
|
||||
|
@@ -4,8 +4,8 @@
|
||||
<DetailCard :title="cardTitle" :items="detailCardItems" />
|
||||
</el-col>
|
||||
<el-col :span="10">
|
||||
<RunInfoCard type="primary" v-bind="RunSuccessConfig" />
|
||||
<RunInfoCard type="danger" style="margin-top: 15px" v-bind="RunFailedConfig" />
|
||||
<RunInfoCard type="info" v-bind="RunSuccessConfig" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
@@ -14,6 +14,7 @@
|
||||
import DetailCard from '@/components/DetailCard/index'
|
||||
import { toSafeLocalDateStr } from '@/utils/common'
|
||||
import RunInfoCard from '../../RunInfoCard'
|
||||
import { toLastFailureDisplay, toLastSucessDisplay } from '../business'
|
||||
|
||||
export default {
|
||||
name: 'AdhocDetail',
|
||||
@@ -32,24 +33,18 @@ export default {
|
||||
RunSuccessConfig: {
|
||||
icon: 'fa-info',
|
||||
title: this.$t('ops.lastRunSuccessHosts'),
|
||||
content: {
|
||||
hostname: 'linux',
|
||||
result: 'api没有该数据,api没有该数据api没有该数据api没有该数据api没有该数据api没有该数据api没有该数据api没有该数据api没有该数据api没有该数据api没有该数据api没有该数据'
|
||||
}
|
||||
contents: toLastSucessDisplay(this.object.latest_execution)
|
||||
},
|
||||
RunFailedConfig: {
|
||||
icon: 'fa-info',
|
||||
title: this.$t('ops.lastRunFailedHosts'),
|
||||
content: {
|
||||
hostname: 'window',
|
||||
result: 'api没有该数据api没有该数据api没有该数据api没有该数据api没有该数据api没有该数据api没有该数据api没有该数据'
|
||||
}
|
||||
contents: toLastFailureDisplay(this.object.latest_execution)
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
cardTitle() {
|
||||
return 'api 没有该数据'
|
||||
return `${this.object.task_name}: ${this.object.short_id}`
|
||||
},
|
||||
detailCardItems() {
|
||||
return [
|
||||
@@ -80,7 +75,7 @@ export default {
|
||||
},
|
||||
{
|
||||
key: this.$t('common.createBy'),
|
||||
value: 'api 没有该数据'
|
||||
value: this.object.created_by
|
||||
},
|
||||
{
|
||||
key: this.$t('common.dateCreated'),
|
||||
@@ -88,27 +83,34 @@ export default {
|
||||
},
|
||||
{
|
||||
key: this.$t('ops.runTimes'),
|
||||
value: 'api 没有该数据'
|
||||
value: this.object.run_times
|
||||
},
|
||||
{
|
||||
key: this.$t('ops.lastRun'),
|
||||
value: 'api 没有该数据'
|
||||
value: this.object.latest_execution.last_run
|
||||
},
|
||||
{
|
||||
key: this.$t('ops.timeDelta'),
|
||||
value: 'api 没有该数据'
|
||||
value: this.object.latest_execution.timedelta
|
||||
},
|
||||
{
|
||||
key: this.$t('ops.isFinished'),
|
||||
value: 'api 没有该数据'
|
||||
value: this.toBooleanDisplay(this.object.latest_execution.is_finished)
|
||||
},
|
||||
{
|
||||
key: this.$t('ops.isSuccess'),
|
||||
value: 'api 没有该数据'
|
||||
value: this.toBooleanDisplay(this.object.latest_execution.is_success)
|
||||
},
|
||||
{
|
||||
key: this.$t('ops.tasks'),
|
||||
value: 'api 没有该数据'
|
||||
value: this.toContentsDisplay(this.object.tasks),
|
||||
formatter(row, value) {
|
||||
return (<div>{
|
||||
value.map((content) => {
|
||||
return <div>{ content }</div>
|
||||
})}
|
||||
</div>)
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -122,6 +124,23 @@ export default {
|
||||
},
|
||||
disPlayOptions(options) {
|
||||
return options.replace(/:/g, '=').replace(/'/g, '').replace('{', '').replace('}', '')
|
||||
},
|
||||
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
|
||||
},
|
||||
toBooleanDisplay(value) {
|
||||
if (value === true) {
|
||||
return this.$t('ops.Yes')
|
||||
} else if (value === false) {
|
||||
return this.$t('ops.No')
|
||||
} else {
|
||||
return this.$t('ops.Unkown')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -4,8 +4,8 @@
|
||||
<DetailCard :title="cardTitle" :items="detailCardItems" />
|
||||
</el-col>
|
||||
<el-col :span="10">
|
||||
<RunInfoCard type="primary" v-bind="RunSuccessConfig" />
|
||||
<RunInfoCard type="danger" style="margin-top: 15px" v-bind="RunFailedConfig" />
|
||||
<RunInfoCard type="info" v-bind="RunSuccessConfig" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
@@ -14,6 +14,7 @@
|
||||
import DetailCard from '@/components/DetailCard'
|
||||
import { toSafeLocalDateStr } from '@/utils/common'
|
||||
import RunInfoCard from '../../RunInfoCard'
|
||||
import { toLastFailureDisplay, toLastSucessDisplay } from '../business'
|
||||
|
||||
export default {
|
||||
name: 'HistoryExecutionDetail',
|
||||
@@ -32,18 +33,12 @@ export default {
|
||||
RunSuccessConfig: {
|
||||
icon: 'fa-info',
|
||||
title: this.$t('ops.lastRunSuccessHosts'),
|
||||
content: {
|
||||
hostname: 'linux',
|
||||
result: 'api没有该数据==api没有该数据api没有该数据api没有该数据api没有该数据'
|
||||
}
|
||||
contents: toLastSucessDisplay(this.object)
|
||||
},
|
||||
RunFailedConfig: {
|
||||
icon: 'fa-info',
|
||||
title: this.$t('ops.lastRunFailedHosts'),
|
||||
content: {
|
||||
hostname: 'linux',
|
||||
result: 'api没有该数据==api没有该数据api没有该数据api没有该数据api没有该数据'
|
||||
}
|
||||
contents: toLastFailureDisplay(this.object)
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@@ -4,8 +4,8 @@
|
||||
<DetailCard :title="cardTitle" :items="detailCardItems" />
|
||||
</el-col>
|
||||
<el-col :span="10">
|
||||
<RunInfoCard v-for="config in RunSuccessConfigs" :key="config.host" type="info" v-bind="config" />
|
||||
<RunInfoCard v-for="config in RunFailedConfigs" :key="config.host" type="danger" style="margin-top: 15px" v-bind="config" />
|
||||
<RunInfoCard type="danger" style="margin-top: 15px" v-bind="RunFailedConfig" />
|
||||
<RunInfoCard type="info" v-bind="RunSuccessConfig" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
@@ -13,6 +13,7 @@
|
||||
<script type="text/jsx">
|
||||
import DetailCard from '@/components/DetailCard'
|
||||
import RunInfoCard from '../RunInfoCard/index'
|
||||
import { toLastFailureDisplay, toLastSucessDisplay } from './business'
|
||||
|
||||
export default {
|
||||
name: 'TaskDetail',
|
||||
@@ -27,43 +28,17 @@ export default {
|
||||
}
|
||||
},
|
||||
data() {
|
||||
let last_success = this.object.last_success
|
||||
last_success.length || (last_success = [''])
|
||||
|
||||
let last_failure = []
|
||||
for (const host in this.object.last_failure) {
|
||||
const task = this.object.last_failure[host]
|
||||
const msgs = []
|
||||
for (const name in task) {
|
||||
msgs.push(`${name} => ${task[name].msg}`)
|
||||
}
|
||||
|
||||
last_failure.push([host, msgs.join('\n')])
|
||||
}
|
||||
|
||||
last_failure.length || (last_failure = [['', '']])
|
||||
|
||||
return {
|
||||
RunSuccessConfigs: last_success.map(host => {
|
||||
return {
|
||||
icon: 'fa-info',
|
||||
title: this.$t('ops.lastRunSuccessHosts'),
|
||||
content: {
|
||||
hostname: host,
|
||||
result: ''
|
||||
}
|
||||
}
|
||||
}),
|
||||
RunFailedConfigs: last_failure.map(([host, msg]) => {
|
||||
return {
|
||||
icon: 'fa-info',
|
||||
title: this.$t('ops.lastRunFailedHosts'),
|
||||
content: {
|
||||
hostname: host,
|
||||
result: msg
|
||||
}
|
||||
}
|
||||
}),
|
||||
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: {}
|
||||
}
|
||||
},
|
||||
@@ -115,7 +90,14 @@ export default {
|
||||
},
|
||||
{
|
||||
key: this.$t('ops.contents'),
|
||||
value: 'api 没有该数据'
|
||||
value: this.toContentsDisplay(this.object.contents),
|
||||
formatter(row, value) {
|
||||
return (<div>{
|
||||
value.map((content) => {
|
||||
return <div>{ content }</div>
|
||||
})}
|
||||
</div>)
|
||||
}
|
||||
},
|
||||
{
|
||||
key: this.$t('ops.lastExecutionOutput'),
|
||||
@@ -137,6 +119,14 @@ export default {
|
||||
return this.$t('ops.No')
|
||||
}
|
||||
return this.$t('ops.Yes')
|
||||
},
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
36
src/views/ops/TaskDetail/business.js
Normal file
36
src/views/ops/TaskDetail/business.js
Normal file
@@ -0,0 +1,36 @@
|
||||
|
||||
export const toLastSucessDisplay = function(object) {
|
||||
const last_success = object && object.last_success
|
||||
|
||||
if (!(last_success instanceof Array)) return []
|
||||
return last_success.map(host => {
|
||||
return {
|
||||
hostname: host,
|
||||
result: ''
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export const toLastFailureDisplay = function(object) {
|
||||
const last_failure = object && object.last_failure
|
||||
if (!(last_failure instanceof Object)) return []
|
||||
|
||||
const ret = []
|
||||
|
||||
for (const host in last_failure) {
|
||||
const task = last_failure[host]
|
||||
const msgs = []
|
||||
for (const name in task) {
|
||||
msgs.push(`${name} => ${task[name].msg}`)
|
||||
}
|
||||
|
||||
ret.push(
|
||||
{
|
||||
hostname: host,
|
||||
result: msgs.join('\n')
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
return ret
|
||||
}
|
@@ -57,9 +57,15 @@ export default {
|
||||
}
|
||||
},
|
||||
headerActions: {
|
||||
hasSearch: false,
|
||||
hasLeftActions: false,
|
||||
hasRightActions: false
|
||||
hasSearch: true,
|
||||
hasRefresh: true,
|
||||
hasLeftActions: true,
|
||||
hasRightActions: true,
|
||||
hasExport: false,
|
||||
hasImport: false,
|
||||
hasCreate: false,
|
||||
hasBulkDelete: false,
|
||||
hasBulkUpdate: false
|
||||
},
|
||||
assetRelationConfig: {
|
||||
icon: 'fa-edit',
|
||||
|
@@ -54,9 +54,15 @@ export default {
|
||||
}
|
||||
},
|
||||
headerActions: {
|
||||
hasSearch: false,
|
||||
hasLeftActions: false,
|
||||
hasRightActions: false
|
||||
hasSearch: true,
|
||||
hasRefresh: true,
|
||||
hasLeftActions: true,
|
||||
hasRightActions: true,
|
||||
hasExport: false,
|
||||
hasImport: false,
|
||||
hasCreate: false,
|
||||
hasBulkDelete: false,
|
||||
hasBulkUpdate: false
|
||||
},
|
||||
userRelationConfig: {
|
||||
icon: 'fa-user',
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<el-row :gutter="20">
|
||||
<el-col :md="14" :sm="24">
|
||||
<ListTable ref="listTable" :table-config="tableConfig" :header-actions="headerActions" />
|
||||
<ListTable ref="ListTable" :table-config="tableConfig" :header-actions="headerActions" />
|
||||
</el-col>
|
||||
<el-col :md="10" :sm="24">
|
||||
<RelationCard type="primary" v-bind="databaseAppRelationConfig" />
|
||||
@@ -54,9 +54,15 @@ export default {
|
||||
}
|
||||
},
|
||||
headerActions: {
|
||||
hasSearch: false,
|
||||
hasLeftActions: false,
|
||||
hasRightActions: false
|
||||
hasSearch: true,
|
||||
hasRefresh: true,
|
||||
hasLeftActions: true,
|
||||
hasRightActions: true,
|
||||
hasExport: false,
|
||||
hasImport: false,
|
||||
hasCreate: false,
|
||||
hasBulkDelete: false,
|
||||
hasBulkUpdate: false
|
||||
},
|
||||
databaseAppRelationConfig: {
|
||||
icon: 'fa-edit',
|
||||
@@ -82,7 +88,7 @@ export default {
|
||||
that.iHasObjects = [...that.iHasObjects, ...objects]
|
||||
that.$refs.select2.clearSelected()
|
||||
this.$message.success(this.$t('common.updateSuccessMsg'))
|
||||
setTimeout(() => location.reload(), 300)
|
||||
this.$refs.ListTable.reloadTable()
|
||||
}
|
||||
},
|
||||
systemUserRelationConfig: {
|
||||
@@ -116,7 +122,7 @@ export default {
|
||||
that.iHasObjects = [...that.iHasObjects, ...objects]
|
||||
that.$refs.select2.clearSelected()
|
||||
this.$message.success(this.$t('common.updateSuccessMsg'))
|
||||
setTimeout(() => location.reload(), 300)
|
||||
this.$refs.ListTable.reloadTable()
|
||||
},
|
||||
performDelete: (item) => {
|
||||
const itemId = item.value
|
||||
@@ -133,7 +139,7 @@ export default {
|
||||
that.select2.disabledValues.splice(i, 1)
|
||||
}
|
||||
this.$message.success(this.$t('common.deleteSuccessMsg'))
|
||||
setTimeout(() => location.reload(), 300)
|
||||
this.$refs.ListTable.reloadTable()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<el-row :gutter="20">
|
||||
<el-col :md="14" :sm="24">
|
||||
<ListTable ref="listTable" :table-config="tableConfig" :header-actions="headerActions" />
|
||||
<ListTable ref="ListTable" :table-config="tableConfig" :header-actions="headerActions" />
|
||||
</el-col>
|
||||
<el-col :md="10" :sm="24">
|
||||
<RelationCard type="primary" v-bind="userRelationConfig" />
|
||||
@@ -55,9 +55,15 @@ export default {
|
||||
}
|
||||
},
|
||||
headerActions: {
|
||||
hasSearch: false,
|
||||
hasLeftActions: false,
|
||||
hasRightActions: false
|
||||
hasSearch: true,
|
||||
hasRefresh: true,
|
||||
hasLeftActions: true,
|
||||
hasRightActions: true,
|
||||
hasExport: false,
|
||||
hasImport: false,
|
||||
hasCreate: false,
|
||||
hasBulkDelete: false,
|
||||
hasBulkUpdate: false
|
||||
},
|
||||
userRelationConfig: {
|
||||
icon: 'fa-user',
|
||||
@@ -86,7 +92,7 @@ export default {
|
||||
that.iHasObjects = [...that.iHasObjects, ...objects]
|
||||
that.$refs.select2.clearSelected()
|
||||
this.$message.success(this.$t('common.updateSuccessMsg'))
|
||||
setTimeout(() => location.reload(), 300)
|
||||
this.$refs.ListTable.reloadTable()
|
||||
}
|
||||
},
|
||||
groupRelationConfig: {
|
||||
@@ -112,7 +118,7 @@ export default {
|
||||
that.iHasObjects = [...that.iHasObjects, ...objects]
|
||||
that.$refs.select2.clearSelected()
|
||||
this.$message.success(this.$t('common.updateSuccessMsg'))
|
||||
setTimeout(() => location.reload(), 300)
|
||||
this.$refs.ListTable.reloadTable()
|
||||
},
|
||||
performDelete: (item) => {
|
||||
const objectId = this.object.id
|
||||
@@ -129,7 +135,7 @@ export default {
|
||||
that.select2.disabledValues.splice(i, 1)
|
||||
}
|
||||
this.$message.success(this.$t('common.deleteSuccessMsg'))
|
||||
setTimeout(() => location.reload(), 300)
|
||||
this.$refs.ListTable.reloadTable()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<el-row :gutter="20">
|
||||
<el-col :md="14" :sm="24">
|
||||
<ListTable ref="listTable" :table-config="tableConfig" :header-actions="headerActions" />
|
||||
<ListTable ref="ListTable" :table-config="tableConfig" :header-actions="headerActions" />
|
||||
</el-col>
|
||||
<el-col :md="10" :sm="24">
|
||||
<RelationCard type="primary" v-bind="remoteAppRelationConfig" />
|
||||
@@ -54,9 +54,15 @@ export default {
|
||||
}
|
||||
},
|
||||
headerActions: {
|
||||
hasSearch: false,
|
||||
hasLeftActions: false,
|
||||
hasRightActions: false
|
||||
hasSearch: true,
|
||||
hasRefresh: true,
|
||||
hasLeftActions: true,
|
||||
hasRightActions: true,
|
||||
hasExport: false,
|
||||
hasImport: false,
|
||||
hasCreate: false,
|
||||
hasBulkDelete: false,
|
||||
hasBulkUpdate: false
|
||||
},
|
||||
remoteAppRelationConfig: {
|
||||
icon: 'fa-edit',
|
||||
@@ -78,7 +84,7 @@ export default {
|
||||
that.iHasObjects = [...that.iHasObjects, ...objects]
|
||||
that.$refs.select2.clearSelected()
|
||||
this.$message.success(this.$t('common.updateSuccessMsg'))
|
||||
setTimeout(() => location.reload(), 300)
|
||||
this.$refs.ListTable.reloadTable()
|
||||
}
|
||||
},
|
||||
systemUserRelationConfig: {
|
||||
@@ -109,12 +115,13 @@ export default {
|
||||
that.iHasObjects = [...that.iHasObjects, ...objects]
|
||||
that.$refs.select2.clearSelected()
|
||||
this.$message.success(this.$t('common.updateSuccessMsg'))
|
||||
setTimeout(() => location.reload(), 300)
|
||||
this.$refs.ListTable.reloadTable()
|
||||
},
|
||||
performDelete: (item) => {
|
||||
const objectId = this.object.id
|
||||
const relationUrl = `/api/v1/perms/remote-app-permissions/${objectId}/`
|
||||
const objectOldRelationSystemUsers = this.object.system_users
|
||||
console.log(1, objectOldRelationSystemUsers, item)
|
||||
const objectNewRelationSystemUsers = objectOldRelationSystemUsers.filter(v => v !== item.value)
|
||||
const data = { system_users: objectNewRelationSystemUsers }
|
||||
return this.$axios.patch(relationUrl, data)
|
||||
@@ -128,7 +135,7 @@ export default {
|
||||
that.select2.disabledValues.splice(i, 1)
|
||||
}
|
||||
this.$message.success(this.$t('common.deleteSuccessMsg'))
|
||||
setTimeout(() => location.reload(), 300)
|
||||
this.$refs.ListTable.reloadTable()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<el-row :gutter="20">
|
||||
<el-col :md="14" :sm="24">
|
||||
<ListTable ref="listTable" :table-config="tableConfig" :header-actions="headerActions" />
|
||||
<ListTable ref="ListTable" :table-config="tableConfig" :header-actions="headerActions" />
|
||||
</el-col>
|
||||
<el-col :md="10" :sm="24">
|
||||
<RelationCard type="primary" v-bind="userRelationConfig" />
|
||||
@@ -54,9 +54,15 @@ export default {
|
||||
}
|
||||
},
|
||||
headerActions: {
|
||||
hasSearch: false,
|
||||
hasLeftActions: false,
|
||||
hasRightActions: false
|
||||
hasSearch: true,
|
||||
hasRefresh: true,
|
||||
hasLeftActions: true,
|
||||
hasRightActions: true,
|
||||
hasExport: false,
|
||||
hasImport: false,
|
||||
hasCreate: false,
|
||||
hasBulkDelete: false,
|
||||
hasBulkUpdate: false
|
||||
},
|
||||
userRelationConfig: {
|
||||
icon: 'fa-user',
|
||||
@@ -81,7 +87,7 @@ export default {
|
||||
that.iHasObjects = [...that.iHasObjects, ...objects]
|
||||
that.$refs.select2.clearSelected()
|
||||
this.$message.success(this.$t('common.updateSuccessMsg'))
|
||||
setTimeout(() => location.reload(), 300)
|
||||
this.$refs.ListTable.reloadTable()
|
||||
}
|
||||
},
|
||||
groupRelationConfig: {
|
||||
@@ -104,7 +110,7 @@ export default {
|
||||
that.iHasObjects = [...that.iHasObjects, ...objects]
|
||||
that.$refs.select2.clearSelected()
|
||||
this.$message.success(this.$t('common.updateSuccessMsg'))
|
||||
setTimeout(() => location.reload(), 300)
|
||||
this.$refs.ListTable.reloadTable()
|
||||
},
|
||||
performDelete: (item) => {
|
||||
const objectId = this.object.id
|
||||
@@ -123,7 +129,7 @@ export default {
|
||||
that.select2.disabledValues.splice(i, 1)
|
||||
}
|
||||
this.$message.success(this.$t('common.deleteSuccessMsg'))
|
||||
setTimeout(() => location.reload(), 300)
|
||||
this.$refs.ListTable.reloadTable()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -29,7 +29,7 @@ export default {
|
||||
tableConfig: {
|
||||
url: this.url,
|
||||
columns: [
|
||||
'user', 'asset', 'system_user', 'remote_addr', 'protocol', 'login_from',
|
||||
'index', 'user', 'asset', 'system_user', 'remote_addr', 'protocol', 'login_from',
|
||||
'command_amount', 'date_start', 'duration', 'actions'
|
||||
],
|
||||
columnsMeta: {
|
||||
@@ -38,7 +38,9 @@ export default {
|
||||
align: 'center',
|
||||
width: '60px',
|
||||
formatter: function(row, column, cellValue, index) {
|
||||
return <a class='detail el-link el-link--success is-underline' href= { '/terminal/sessions/' + row.id }>{ index + 1}</a>
|
||||
const label = index + 1
|
||||
const route = { to: { name: 'SessionDetail', params: { id: row.id }}}
|
||||
return <router-link {...{ attrs: route }}>{ label }</router-link>
|
||||
}
|
||||
},
|
||||
command_amount: {
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<ListTable :table-config="ticketTableConfig" :header-actions="ticketActions" />
|
||||
</template>
|
||||
<script>
|
||||
<script type="text/jsx">
|
||||
import ListTable from '@/components/ListTable'
|
||||
import { DetailFormatter } from '@/components/ListTable/formatters'
|
||||
import { toSafeLocalDateStr } from '@/utils/common'
|
||||
|
@@ -13,6 +13,7 @@
|
||||
import { mapGetters } from 'vuex'
|
||||
import { GenericListPage } from '@/layout/components'
|
||||
import { GenericUpdateFormDialog } from '@/layout/components'
|
||||
import { createSourceIdCache } from '@/api/common'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -55,7 +56,16 @@ export default {
|
||||
}
|
||||
},
|
||||
headerActions: {
|
||||
hasBulkDelete: false,
|
||||
extraMoreActions: [
|
||||
{
|
||||
title: this.$t('common.deleteSelected'),
|
||||
name: 'deleteSelected',
|
||||
can({ selectedRows }) {
|
||||
return selectedRows.length > 0
|
||||
},
|
||||
callback: this.bulkDeleteCallback.bind(this)
|
||||
},
|
||||
{
|
||||
name: 'disableSelected',
|
||||
title: this.$t('common.disableSelected'),
|
||||
@@ -153,6 +163,11 @@ export default {
|
||||
return this.currentOrg.id === 'DEFAULT' || this.currentOrg.id === ''
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (!this.currentOrgIsDefault) {
|
||||
this.headerActions.extraMoreActions[0].title = this.$t('common.removeSelected')
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
removeUserFromOrg({ row, col, reload }) {
|
||||
const msg = this.$t('users.removeFromOrgWarningMsg') + ' "' + row.name + '"'
|
||||
@@ -180,6 +195,52 @@ export default {
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
bulkDeleteCallback({ selectedRows, reloadTable }) {
|
||||
let msgPrefix = this.$t('common.deleteWarningMsg')
|
||||
if (!this.currentOrgIsDefault) {
|
||||
msgPrefix = this.$t('common.removeWarningMsg')
|
||||
}
|
||||
const msg = msgPrefix + ' ' + selectedRows.length + ' ' + this.$t('common.rows') + ' ?'
|
||||
const title = this.$t('common.Info')
|
||||
const performDelete = this.performBulkDelete
|
||||
this.$alert(msg, title, {
|
||||
type: 'warning',
|
||||
confirmButtonClass: 'el-button--danger',
|
||||
showCancelButton: true,
|
||||
beforeClose: async(action, instance, done) => {
|
||||
if (action !== 'confirm') return done()
|
||||
instance.confirmButtonLoading = true
|
||||
try {
|
||||
await performDelete(selectedRows)
|
||||
done()
|
||||
reloadTable()
|
||||
let successMsg = this.$t('common.bulkDeleteSuccessMsg')
|
||||
if (!this.currentOrgIsDefault) {
|
||||
successMsg = this.$t('common.bulkRemoveSuccessMsg')
|
||||
}
|
||||
this.$message.success(successMsg)
|
||||
} catch (error) {
|
||||
let errorMsg = this.$t('common.bulkDeleteErrorMsg')
|
||||
if (!this.currentOrgIsDefault) {
|
||||
errorMsg = this.$t('common.bulkRemoveErrorMsg')
|
||||
}
|
||||
this.$message.error(errorMsg + error)
|
||||
} finally {
|
||||
instance.confirmButtonLoading = false
|
||||
}
|
||||
}
|
||||
}).catch(() => {
|
||||
/* 取消*/
|
||||
})
|
||||
},
|
||||
async performBulkDelete(selectedRows) {
|
||||
const ids = selectedRows.map((v) => {
|
||||
return v.id
|
||||
})
|
||||
const data = await createSourceIdCache(ids)
|
||||
const url = `${this.tableConfig.url}?spm=` + data.spm
|
||||
return this.$axios.delete(url)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -26,11 +26,11 @@ export default {
|
||||
hidden: (formValue) => {
|
||||
return !formValue.is_periodic
|
||||
},
|
||||
helpTips: this.$t('xpack.ChangeAuthPlan.HelpText.CrontabOfCreateUpdatePage')
|
||||
helpText: this.$t('xpack.ChangeAuthPlan.HelpText.CrontabOfCreateUpdatePage')
|
||||
},
|
||||
interval: {
|
||||
label: this.$t('xpack.ChangeAuthPlan.CyclePerform'),
|
||||
helpTips: this.$t('xpack.ChangeAuthPlan.HelpText.IntervalOfCreateUpdatePage'),
|
||||
helpText: this.$t('xpack.ChangeAuthPlan.HelpText.IntervalOfCreateUpdatePage'),
|
||||
hidden: (formValue) => {
|
||||
return !formValue.is_periodic
|
||||
}
|
||||
|
@@ -295,7 +295,7 @@ export default {
|
||||
},
|
||||
MFAConfirm() {
|
||||
if (this.MFAInput.length !== 6) {
|
||||
return this.$message.error(this.$t('common.updateErrorMsg'))
|
||||
return this.$message.error(this.$t('common.MFAErrorMsg'))
|
||||
}
|
||||
this.$axios.post(
|
||||
`/api/v1/authentication/otp/verify/`, {
|
||||
|
Reference in New Issue
Block a user