This commit is contained in:
OrangeM21
2020-06-10 14:32:35 +08:00
27 changed files with 87 additions and 160 deletions

View File

@@ -3,7 +3,7 @@
<table style="width: 100%">
<tr>
<td colspan="2">
<AssetSelect ref="assetSelect" @getAsset="getAsset" />
<AssetSelect ref="assetSelect" />
</td>
</tr>
<tr>
@@ -18,6 +18,7 @@
<script>
import IBox from '@/components/IBox'
import AssetSelect from '@/components/AssetSelect'
export default {
name: 'AssetRelationCard',
components: {
@@ -47,26 +48,19 @@ export default {
},
onAddSuccess: {
type: Function,
default(that) {
this.$log.debug('AssetSelect value', that.assets)
this.$message.success(this.$t('common.updateSuccessMsg'))
setTimeout(() => location.reload(), 300)
}
default: (objects, that) => {}
}
},
data() {
return {
assets: []
}
},
methods: {
addObjects() {
this.performAdd(this.assets, this).then(
() => this.onAddSuccess(this)
const objects = this.$refs.assetSelect.$refs.select2.iValue
this.performAdd(objects, this).then(
() => this.onAddSuccess(objects, this)
)
},
getAsset(assets) {
this.assets = assets
}
}
}

View File

@@ -11,7 +11,7 @@
@confirm="handleConfirm"
@cancel="handleCancel"
>
<GenericTreeListPage
<TreeTable
ref="ListPage"
:tree-setting="treeSetting"
:table-config="tableConfig"
@@ -22,13 +22,13 @@
</template>
<script>
import GenericTreeListPage from '@/layout/components/GenericTreeListPage'
import TreeTable from '@/components/TreeTable'
import { DetailFormatter } from '@/components/ListTable/formatters'
import { Select2, Dialog } from '@/components'
export default {
componentName: 'AssetSelect',
components: { GenericTreeListPage, Select2, Dialog },
components: { TreeTable, Select2, Dialog },
props: {
value: {
type: Array,

View File

@@ -176,7 +176,7 @@ export default {
background-color: #f5f5f5;
}
.treebox {
height: 100vh - 120;
height: calc(100vh - 120px);
overflow: auto;
}
</style>

View File

@@ -20,7 +20,7 @@ export default {
const url = col.deleteUrl + cellValue
this.$axios.delete(url).then(res => {
this.$message.success(this.$t('common.deleteSuccessMsg'))
setTimeout(() => location.reload(), 300)
reload()
}).catch(error => {
this.$message.error(this.$t('common.deleteErrorMsg' + ' ' + error))
})

View File

@@ -158,6 +158,9 @@ export default {
this.initialSelect()
this.initialized = true
}
this.$nextTick(() => {
this.$refs.select.elFormItem.clearValidate()
})
},
methods: {
async loadMore(load) {

View File

@@ -22,3 +22,4 @@ export { default as Switcher } from './Swicher'
export { default as SummaryCard } from './SummaryCard'
export { default as UploadField } from './UploadField'
export { default as AssetUserTable } from './AssetUserTable'
export { default as AssetRelationCard } from './AssetRelationCard'

View File

@@ -224,6 +224,7 @@
"createSuccessMsg": "创建成功",
"createdBy": "创建人",
"dateCreated": "创建日期",
"dateStart": "开始日期",
"dateExpired": "失效日期",
"deleteErrorMsg": "删除失败",
"deleteSelected": "删除所选",
@@ -338,7 +339,9 @@
"versionRunExecution": "执行历史",
"selectAssetsMessage":"选择左侧资产, 选择运行的系统用户,批量执行命令",
"selectedAssets": "已选择资产:",
"inTotal": "总共"
"inTotal": "总共",
"Execute": "执行",
"PleaseSelect": "请选择"
},
"perms": {
"Actions": "动作",
@@ -417,7 +420,7 @@
"CreateReplayStorage": "创建录像存储",
"Dashboard": "仪表盘",
"DatabaseApp": "数据库应用",
"DatabaseAppCreate": "",
"DatabaseAppCreate": "创建数据库应用",
"DatabaseAppDetail": "数据库详情",
"DatabaseAppPermission": "数据库授权",
"DatabaseAppPermissionCreate": "创建数据库授权规则",

View File

@@ -336,7 +336,9 @@
"TaskMonitor": "Task monitor",
"selectAssetsMessage":"Select the left asset, select the running system user, execute command in batch",
"selectedAssets": "Selected assets:",
"inTotal": "In total"
"inTotal": "In total",
"Execute": "Execute",
"PleaseSelect": "Please select"
},
"perms": {
"Actions": "Actions",

View File

@@ -91,7 +91,8 @@ export default {
formatter: DetailFormatter,
formatterArgs: {
route: 'AssetDetail'
}
},
showOverflowTooltip: true
},
ip: {
sortable: 'custom',
@@ -114,7 +115,7 @@ export default {
},
hasTips: true
},
width: '80px',
width: '90px',
align: 'center'
},
actions: {

View File

@@ -23,7 +23,7 @@
<CodeMirror :options="codeMirrorOptions" @change="handleActionChange" />
</div>
<div style="display: flex;flex-direction: column ;justify-content: space-between">
<el-select v-model="selectedSystemUser" placeholder="请选择" @change="handleSystemUserChange">
<el-select v-model="selectedSystemUser" :placeholder="this.$t('ops.PleaseSelect')" @change="handleSystemUserChange">
<el-option
v-for="item in options"
:key="item.id"
@@ -32,7 +32,7 @@
:value="item.id"
/>
</el-select>
<el-button type="primary" size="small" @click="execute">执行</el-button>
<el-button type="primary" size="small" @click="execute">{{ this.$t('ops.Execute') }}</el-button>
</div>
</div>
</IBox>

View File

@@ -32,16 +32,16 @@ export default {
icon: 'fa-info',
title: this.$t('ops.lastRunSuccessHosts'),
content: {
hostname: 'linux',
result: 'api没有该数据==api没有该数据api没有该数据api没有该数据api没有该数据'
hostname: this.object.last_success[0],
result: this.object.last_success[1]
}
},
RunFailedConfig: {
icon: 'fa-info',
title: this.$t('ops.lastRunFailedHosts'),
content: {
hostname: 'window',
result: 'api没有该数据api没有该数据api没有该数据api没有该数据api没有该数据'
hostname: this.object.last_failure[0],
result: this.object.last_failure[1]
}
},
taskData: {}

View File

@@ -23,6 +23,7 @@ export default {
initial: {
is_active: true,
actions: ['all', 'connect', 'updownload', 'upload_file', 'download_file'],
date_start: '2020-06-18 00:00:00 +0800',
date_expired: '2099-12-31 00:00:00 +0800',
nodes: nodesInitial,
assets: assetsInitial
@@ -32,7 +33,7 @@ export default {
[this.$t('perms.User'), ['users', 'user_groups']],
[this.$t('perms.Asset'), ['assets', 'nodes', 'system_users']],
[this.$t('common.action'), ['actions']],
[this.$t('common.Other'), ['is_active', 'date_expired', 'comment']]
[this.$t('common.Other'), ['is_active', 'date_start', 'date_expired', 'comment']]
],
url: '/api/v1/perms/asset-permissions/',
fieldsMeta: {
@@ -97,6 +98,9 @@ export default {
{ label: 'download_file', value: this.$t('perms.downloadFile') }
]
},
date_start: {
label: this.$t('common.dateStart')
},
date_expired: {
label: this.$t('common.dateExpired')
},

View File

@@ -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">
<AssetRelationCard type="primary" v-bind="assetRelationConfig" />
@@ -15,7 +15,7 @@
import ListTable from '@/components/ListTable'
import RelationCard from '@/components/RelationCard'
import { DeleteActionFormatter } from '@/components/ListTable/formatters/index'
import AssetRelationCard from './AssetRelationCard/index'
import AssetRelationCard from '@/components/AssetRelationCard'
export default {
name: 'AssetPermissionAsset',
@@ -64,16 +64,22 @@ export default {
assetRelationConfig: {
icon: 'fa-edit',
title: this.$t('perms.addAssetToThisPermission'),
performAdd: (items) => {
performAdd: (items, that) => {
const relationUrl = `/api/v1/perms/asset-permissions-assets-relations/`
const objectId = this.object.id
const data = items.map(v => {
const data = items.map(item => {
return {
assetpermission: objectId,
asset: v
asset: item
}
})
return this.$axios.post(relationUrl, data)
},
onAddSuccess: (items, that) => {
this.$log.debug('AssetSelect value', that.assets)
this.$message.success(this.$t('common.updateSuccessMsg'))
this.$refs.ListTable.reloadTable()
that.$refs.assetSelect.$refs.select2.clearSelected()
}
},
nodeRelationConfig: {
@@ -102,7 +108,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
@@ -119,7 +125,7 @@ export default {
that.select2.disabledValues.splice(i, 1)
}
this.$message.success(this.$t('common.deleteSuccessMsg'))
setTimeout(() => location.reload(), 300)
this.$refs.ListTable.reloadTable()
}
},
systemUserRelationConfig: {
@@ -148,7 +154,6 @@ export default {
that.iHasObjects = [...that.iHasObjects, ...objects]
that.$refs.select2.clearSelected()
this.$message.success(this.$t('common.updateSuccessMsg'))
setTimeout(() => location.reload(), 300)
},
performDelete: (item) => {
const itemId = item.value
@@ -167,7 +172,6 @@ export default {
that.select2.disabledValues.splice(i, 1)
}
this.$message.success(this.$t('common.deleteSuccessMsg'))
setTimeout(() => location.reload(), 300)
}
}
}

View File

@@ -1,7 +1,7 @@
<template>
<el-row :gutter="20">
<el-col :md="14" :sm="24">
<DetailCard :title="cardTitle" :items="detailCardItems" />
<DetailCard :items="detailCardItems" />
</el-col>
<el-col :md="10" :sm="24">
<QuickActions type="primary" :actions="quickActions" />
@@ -52,9 +52,6 @@ export default {
}
},
computed: {
cardTitle() {
return this.object.id
},
detailCardItems() {
return [
{

View File

@@ -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" />
@@ -85,7 +85,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: {
@@ -117,7 +117,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()
},
onDeleteSuccess: (obj, that) => {
const theRemoveIndex = that.iHasObjects.findIndex((v) => v.value === obj.value)
@@ -128,7 +128,7 @@ export default {
that.select2.disabledValues.splice(i, 1)
}
this.$message.success(this.$t('common.deleteSuccessMsg'))
setTimeout(() => location.reload(), 300)
this.$refs.ListTable.reloadTable()
}
}
}

View File

@@ -30,7 +30,7 @@ export default {
activeMenu: 'AssetPermissionDetail',
submenu: [
{
title: this.$t('perms.assetPermissionDetail'),
title: this.$t('common.BasicInfo'),
name: 'AssetPermissionDetail'
},
{

View File

@@ -24,7 +24,7 @@ export default {
url: '/api/v1/perms/asset-permissions/',
hasSelection: false,
hasTree: true,
columns: ['name', 'users_amount', 'user_groups_amount', 'assets_amount', 'nodes_amount', 'system_users_amount', 'is_active', 'actions'],
columns: ['name', 'users_amount', 'user_groups_amount', 'assets_amount', 'nodes_amount', 'system_users_amount', 'is_valid', 'actions'],
columnsMeta: {
name: {
formatterArgs: {

View File

@@ -12,13 +12,14 @@ export default {
return {
initial: {
is_active: true,
date_start: '2020-06-18 00:00:00 +0800',
date_expired: '2099-12-31 00:00:00 +0800'
},
fields: [
[this.$t('perms.' + 'Basic'), ['name']],
[this.$t('perms.' + 'USER'), ['users', 'user_groups']],
[this.$t('perms.' + 'databaseApp'), ['database_apps', 'system_users']],
[this.$t('common.Other'), ['is_active', 'date_expired', 'comment']]
[this.$t('common.Other'), ['is_active', 'date_start', 'date_expired', 'comment']]
],
url: '/api/v1/perms/database-app-permissions/',
fieldsMeta: {
@@ -61,6 +62,12 @@ export default {
}
}
},
date_start: {
label: this.$t('common.dateStart')
},
date_expired: {
label: this.$t('common.dateExpired')
},
actions: {
label: this.$t('perms.Actions')
},

View File

@@ -1,7 +1,7 @@
<template>
<el-row :gutter="20">
<el-col :md="14" :sm="24">
<DetailCard :title="cardTitle" :items="detailCardItems" />
<DetailCard :items="detailCardItems" />
</el-col>
<el-col :md="10" :sm="24">
<QuickActions type="primary" :actions="quickActions" />
@@ -52,9 +52,6 @@ export default {
}
},
computed: {
cardTitle() {
return this.object.id
},
detailCardItems() {
return [
{

View File

@@ -27,7 +27,7 @@ export default {
activeMenu: 'DatabaseAppPermissionDetail',
submenu: [
{
title: this.$t('perms.databaseAppPermissionDetail'),
title: this.$t('common.BasicInfo'),
name: 'DatabaseAppPermissionDetail'
},
{

View File

@@ -12,13 +12,14 @@ export default {
return {
initial: {
is_active: true,
date_start: '2020-06-18 00:00:00 +0800',
date_expired: '2099-12-31 00:00:00 +0800'
},
fields: [
[this.$t('perms.Basic'), ['name']],
[this.$t('perms.User'), ['users', 'user_groups']],
[this.$t('perms.remoteApp'), ['remote_apps', 'system_users']],
[this.$t('common.Other'), ['is_active', 'date_expired', 'comment']]
[this.$t('common.Other'), ['is_active', 'date_start', 'date_expired', 'comment']]
],
url: '/api/v1/perms/remote-app-permissions/',
fieldsMeta: {
@@ -61,6 +62,12 @@ export default {
}
}
},
date_start: {
label: this.$t('common.dateStart')
},
date_expired: {
label: this.$t('common.dateExpired')
},
actions: {
label: this.$t('perms.Actions')
},

View File

@@ -1,7 +1,7 @@
<template>
<el-row :gutter="20">
<el-col :span="14">
<DetailCard :title="cardTitle" :items="detailCardItems" />
<DetailCard :items="detailCardItems" />
</el-col>
<el-col :span="10">
<QuickActions type="primary" :actions="quickActions" />
@@ -52,9 +52,6 @@ export default {
}
},
computed: {
cardTitle() {
return this.object.id
},
detailCardItems() {
return [
{

View File

@@ -27,7 +27,7 @@ export default {
activeMenu: 'RemoteAppPermissionDetail',
submenu: [
{
title: this.$t('perms.remoteAppPermissionDetail'),
title: this.$t('common.BasicInfo'),
name: 'RemoteAppPermissionDetail'
},
{

View File

@@ -1,90 +0,0 @@
<template>
<IBox :fa="icon" :type="type" :title="title" v-bind="$attrs">
<table style="width: 100%">
<tr>
<td colspan="2">
<AssetSelect ref="assetSelect" @change="getAsset" />
</td>
</tr>
<tr>
<td colspan="2">
<el-button :type="type" size="small" @click="addObjects">{{ $t('common.Add') }}</el-button>
</td>
</tr>
</table>
</IBox>
</template>
<script>
import IBox from '@/components/IBox/index'
import AssetSelect from '@/components/AssetSelect/index'
export default {
name: 'AssetRelationCard',
components: {
IBox,
AssetSelect
},
props: {
title: {
type: String,
default: ''
},
icon: {
type: String,
default: ''
},
type: {
type: String,
default: 'primary'
},
value: {
type: [Array, Number, String],
default: () => []
},
performAdd: {
type: Function,
default: (objects, that) => {}
},
onAddSuccess: {
type: Function,
default(that) {
this.$log.debug('AssetSelect value', that.assets)
this.$message.success(this.$t('common.updateSuccessMsg'))
setTimeout(() => location.reload(), 500)
}
}
},
data() {
return {
assets: []
}
},
methods: {
addObjects() {
this.performAdd(this.assets, this).then(
() => this.onAddSuccess(this)
)
},
getAsset(assets) {
this.assets = assets
}
}
}
</script>
<style scoped>
b, strong {
font-weight: 700;
font-size: 13px;
}
tr td {
line-height: 1.42857;
padding: 8px;
vertical-align: top;
}
tr.item td {
border-top: 1px solid #e7eaec;
}
</style>

View File

@@ -13,7 +13,7 @@
<script>
import ListTable from '@/components/ListTable/index'
import RelationCard from '@/components/RelationCard/index'
import AssetRelationCard from './AssetRelationCard'
import AssetRelationCard from '@/components/AssetRelationCard'
export default {
name: 'ChangeAuthPlanAsset',
@@ -52,14 +52,14 @@ export default {
assetRelationConfig: {
icon: 'fa-edit',
title: this.$t('xpack.ChangeAuthPlan.AddAsset'),
performAdd: (items, vm) => {
performAdd: (items, that) => {
const relationUrl = `/api/v1/xpack/change-auth-plan/plan/${this.object.id}/asset/add/`
const data = {
assets: items
}
return this.$axios.patch(relationUrl, data)
},
onAddSuccess: (that) => {
onAddSuccess: (items, that) => {
this.$log.debug('AssetSelect value', that.assets)
this.$message.success(this.$t('common.updateSuccessMsg'))
this.$refs.listTable.reloadTable()

View File

@@ -22,13 +22,13 @@ export default {
config: {
activeMenu: 'SyncInstanceTaskList',
submenu: [
{
title: this.$t('xpack.Cloud.SyncInstanceTaskList'),
name: 'SyncInstanceTaskList'
},
{
title: this.$t('xpack.Cloud.AccountList'),
name: 'AccountList'
},
{
title: this.$t('xpack.Cloud.SyncInstanceTaskList'),
name: 'SyncInstanceTaskList'
}
]
}

View File

@@ -89,21 +89,21 @@ export default {
component: () => import('@/views/xpack/Cloud/SyncInstanceTask/SyncInstanceTaskList'),
name: 'SyncInstanceTaskList',
hidden: true,
meta: { title: i18n.t('xpack.Cloud.SyncInstanceTaskList') }
meta: { title: i18n.t('xpack.Cloud.SyncInstanceTaskList'), activeMenu: '/xpack/cloud' }
},
{
path: 'sync-instance-tasks/create',
component: () => import('@/views/xpack/Cloud/SyncInstanceTask/SyncInstanceTaskCreateUpdate'),
name: 'SyncInstanceTaskCreate',
hidden: true,
meta: { title: i18n.t('xpack.Cloud.SyncInstanceTaskCreate') }
meta: { title: i18n.t('xpack.Cloud.SyncInstanceTaskCreate'), activeMenu: '/xpack/cloud' }
},
{
path: 'sync-instance-tasks/:id/update',
component: () => import('@/views/xpack/Cloud/SyncInstanceTask/SyncInstanceTaskCreateUpdate'),
name: 'SyncInstanceTaskUpdate',
hidden: true,
meta: { title: i18n.t('xpack.Cloud.SyncInstanceTaskUpdate') }
meta: { title: i18n.t('xpack.Cloud.SyncInstanceTaskUpdate'), activeMenu: '/xpack/cloud' }
}
]
},