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%">
<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

@ -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

@ -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

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

View File

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

@ -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

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

@ -12,6 +12,7 @@ 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: [

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,6 +12,7 @@ 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: [

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

@ -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' }
}
]
},