Merge branch 'dev' of github.com:jumpserver/lina into dev

This commit is contained in:
ibuler 2020-06-10 13:58:49 +08:00
commit dc35b2935d
20 changed files with 48 additions and 141 deletions

View File

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

View File

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

View File

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

View File

@ -338,7 +338,9 @@
"totalVersions": "版本数量", "totalVersions": "版本数量",
"version": "版本", "version": "版本",
"versionDetail": "版本详情", "versionDetail": "版本详情",
"versionRunExecution": "执行历史" "versionRunExecution": "执行历史",
"Execute": "执行",
"PleaseSelect": "请选择"
}, },
"perms": { "perms": {
"Actions": "动作", "Actions": "动作",

View File

@ -335,7 +335,9 @@
"version": "Version", "version": "Version",
"versionDetail": "Version detail", "versionDetail": "Version detail",
"versionRunExecution": "Version run execution", "versionRunExecution": "Version run execution",
"TaskMonitor": "Task monitor" "TaskMonitor": "Task monitor",
"Execute": "Execute",
"PleaseSelect": "Please select"
}, },
"perms": { "perms": {
"Actions": "Actions", "Actions": "Actions",

View File

@ -23,7 +23,7 @@
<CodeMirror :options="codeMirrorOptions" @change="handleActionChange" /> <CodeMirror :options="codeMirrorOptions" @change="handleActionChange" />
</div> </div>
<div style="display: flex;flex-direction: column ;justify-content: space-between"> <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 <el-option
v-for="item in options" v-for="item in options"
:key="item.id" :key="item.id"
@ -32,7 +32,7 @@
:value="item.id" :value="item.id"
/> />
</el-select> </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>
</div> </div>
</IBox> </IBox>

View File

@ -23,6 +23,7 @@ export default {
initial: { initial: {
is_active: true, is_active: true,
actions: ['all', 'connect', 'updownload', 'upload_file', 'download_file'], 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', date_expired: '2099-12-31 00:00:00 +0800',
nodes: nodesInitial, nodes: nodesInitial,
assets: assetsInitial assets: assetsInitial

View File

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

View File

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

View File

@ -1,7 +1,7 @@
<template> <template>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :md="14" :sm="24"> <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>
<el-col :md="10" :sm="24"> <el-col :md="10" :sm="24">
<RelationCard type="primary" v-bind="userRelationConfig" /> <RelationCard type="primary" v-bind="userRelationConfig" />
@ -85,7 +85,7 @@ export default {
that.iHasObjects = [...that.iHasObjects, ...objects] that.iHasObjects = [...that.iHasObjects, ...objects]
that.$refs.select2.clearSelected() that.$refs.select2.clearSelected()
this.$message.success(this.$t('common.updateSuccessMsg')) this.$message.success(this.$t('common.updateSuccessMsg'))
setTimeout(() => location.reload(), 300) this.$refs.ListTable.reloadTable()
} }
}, },
groupRelationConfig: { groupRelationConfig: {
@ -117,7 +117,7 @@ export default {
that.iHasObjects = [...that.iHasObjects, ...objects] that.iHasObjects = [...that.iHasObjects, ...objects]
that.$refs.select2.clearSelected() that.$refs.select2.clearSelected()
this.$message.success(this.$t('common.updateSuccessMsg')) this.$message.success(this.$t('common.updateSuccessMsg'))
setTimeout(() => location.reload(), 300) this.$refs.ListTable.reloadTable()
}, },
onDeleteSuccess: (obj, that) => { onDeleteSuccess: (obj, that) => {
const theRemoveIndex = that.iHasObjects.findIndex((v) => v.value === obj.value) const theRemoveIndex = that.iHasObjects.findIndex((v) => v.value === obj.value)
@ -128,7 +128,7 @@ export default {
that.select2.disabledValues.splice(i, 1) that.select2.disabledValues.splice(i, 1)
} }
this.$message.success(this.$t('common.deleteSuccessMsg')) 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', activeMenu: 'AssetPermissionDetail',
submenu: [ submenu: [
{ {
title: this.$t('perms.assetPermissionDetail'), title: this.$t('common.BasicInfo'),
name: 'AssetPermissionDetail' name: 'AssetPermissionDetail'
}, },
{ {

View File

@ -12,6 +12,7 @@ export default {
return { return {
initial: { initial: {
is_active: true, is_active: true,
date_start: '2020-06-18 00:00:00 +0800',
date_expired: '2099-12-31 00:00:00 +0800' date_expired: '2099-12-31 00:00:00 +0800'
}, },
fields: [ fields: [

View File

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

View File

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

View File

@ -12,6 +12,7 @@ export default {
return { return {
initial: { initial: {
is_active: true, is_active: true,
date_start: '2020-06-18 00:00:00 +0800',
date_expired: '2099-12-31 00:00:00 +0800' date_expired: '2099-12-31 00:00:00 +0800'
}, },
fields: [ fields: [

View File

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

View File

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

View File

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