mirror of
https://github.com/jumpserver/lina.git
synced 2025-08-12 03:51:57 +00:00
perf: change diretory service account
This commit is contained in:
parent
bf687802d0
commit
5f1b71520f
@ -51,7 +51,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters } from 'vuex'
|
import { mapGetters } from 'vuex'
|
||||||
import { accountOtherActions, accountQuickFilters, connectivityMeta } from './const'
|
import { accountOtherActions, accountQuickFilters, connectivityMeta, isDirectoryServiceAccount } from './const'
|
||||||
import { openTaskPage } from '@/utils/jms'
|
import { openTaskPage } from '@/utils/jms'
|
||||||
import {
|
import {
|
||||||
AccountConnectFormatter,
|
AccountConnectFormatter,
|
||||||
@ -216,6 +216,7 @@ export default {
|
|||||||
width: '80px',
|
width: '80px',
|
||||||
formatter: AccountConnectFormatter,
|
formatter: AccountConnectFormatter,
|
||||||
formatterArgs: {
|
formatterArgs: {
|
||||||
|
asset: this.asset,
|
||||||
can: ({ row }) => {
|
can: ({ row }) => {
|
||||||
return this.currentUserIsSuperAdmin
|
return this.currentUserIsSuperAdmin
|
||||||
}
|
}
|
||||||
@ -291,7 +292,7 @@ export default {
|
|||||||
hasUpdate: false, // can set function(row, value)
|
hasUpdate: false, // can set function(row, value)
|
||||||
hasDelete: true, // can set function(row, value)
|
hasDelete: true, // can set function(row, value)
|
||||||
hasClone: false,
|
hasClone: false,
|
||||||
canDelete: () => vm.$hasPerm('accounts.delete_account'),
|
canDelete: ({ row }) => vm.$hasPerm('accounts.delete_account') && !isDirectoryServiceAccount(row, this),
|
||||||
moreActionsTitle: this.$t('More'),
|
moreActionsTitle: this.$t('More'),
|
||||||
extraActions: accountOtherActions(this)
|
extraActions: accountOtherActions(this)
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,12 @@ export const connectivityMeta = {
|
|||||||
width: '130px'
|
width: '130px'
|
||||||
}
|
}
|
||||||
|
|
||||||
export const accountOtherActions = (vm) => [
|
export function isDirectoryServiceAccount(account, vm) {
|
||||||
|
return vm.asset && vm.asset.id !== account.asset.id
|
||||||
|
}
|
||||||
|
|
||||||
|
export const accountOtherActions = (vm) => {
|
||||||
|
return [
|
||||||
{
|
{
|
||||||
name: 'View',
|
name: 'View',
|
||||||
title: vm.$t('View'),
|
title: vm.$t('View'),
|
||||||
@ -44,7 +49,11 @@ export const accountOtherActions = (vm) => [
|
|||||||
{
|
{
|
||||||
name: 'Update',
|
name: 'Update',
|
||||||
title: vm.$t('Edit'),
|
title: vm.$t('Edit'),
|
||||||
can: vm.$hasPerm('accounts.change_account') && !vm.$store.getters.currentOrgIsRoot,
|
can: ({ row }) => {
|
||||||
|
return vm.$hasPerm('accounts.change_account') &&
|
||||||
|
!vm.$store.getters.currentOrgIsRoot &&
|
||||||
|
!isDirectoryServiceAccount(row, vm)
|
||||||
|
},
|
||||||
callback: ({ row }) => {
|
callback: ({ row }) => {
|
||||||
vm.isUpdateAccount = true
|
vm.isUpdateAccount = true
|
||||||
const data = {
|
const data = {
|
||||||
@ -63,7 +72,11 @@ export const accountOtherActions = (vm) => [
|
|||||||
{
|
{
|
||||||
name: 'UpdateSecret',
|
name: 'UpdateSecret',
|
||||||
title: vm.$t('EditSecret'),
|
title: vm.$t('EditSecret'),
|
||||||
can: vm.$hasPerm('accounts.change_account') && !vm.$store.getters.currentOrgIsRoot,
|
can: ({ row }) => {
|
||||||
|
return vm.$hasPerm('accounts.change_account') &&
|
||||||
|
!vm.$store.getters.currentOrgIsRoot &&
|
||||||
|
!isDirectoryServiceAccount(row, vm)
|
||||||
|
},
|
||||||
callback: ({ row }) => {
|
callback: ({ row }) => {
|
||||||
const data = {
|
const data = {
|
||||||
...vm.asset,
|
...vm.asset,
|
||||||
@ -84,7 +97,11 @@ export const accountOtherActions = (vm) => [
|
|||||||
has: () => {
|
has: () => {
|
||||||
return !vm.asset
|
return !vm.asset
|
||||||
},
|
},
|
||||||
can: vm.$hasPerm('accounts.add_account') && !vm.$store.getters.currentOrgIsRoot,
|
can: ({ row }) => {
|
||||||
|
return vm.$hasPerm('accounts.add_account') &&
|
||||||
|
!vm.$store.getters.currentOrgIsRoot &&
|
||||||
|
!isDirectoryServiceAccount(row, vm)
|
||||||
|
},
|
||||||
callback: ({ row }) => {
|
callback: ({ row }) => {
|
||||||
vm.account = {
|
vm.account = {
|
||||||
name: `${row.name} - ${vm.$t('Duplicate').toLowerCase()}`,
|
name: `${row.name} - ${vm.$t('Duplicate').toLowerCase()}`,
|
||||||
@ -120,7 +137,10 @@ export const accountOtherActions = (vm) => [
|
|||||||
{
|
{
|
||||||
name: 'ClearSecret',
|
name: 'ClearSecret',
|
||||||
title: vm.$t('ClearSecret'),
|
title: vm.$t('ClearSecret'),
|
||||||
can: vm.$hasPerm('accounts.change_account'),
|
can: ({ row }) => {
|
||||||
|
return vm.$hasPerm('accounts.change_account') &&
|
||||||
|
!isDirectoryServiceAccount(row, vm)
|
||||||
|
},
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
callback: ({ row }) => {
|
callback: ({ row }) => {
|
||||||
vm.$axios.patch(
|
vm.$axios.patch(
|
||||||
@ -151,7 +171,11 @@ export const accountOtherActions = (vm) => [
|
|||||||
title: vm.$t('CopyToAsset'),
|
title: vm.$t('CopyToAsset'),
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
divided: true,
|
divided: true,
|
||||||
can: () => vm.$hasPerm('accounts.add_account') && !vm.$store.getters.currentOrgIsRoot,
|
can: ({ row }) => {
|
||||||
|
return vm.$hasPerm('accounts.add_account') &&
|
||||||
|
!vm.$store.getters.currentOrgIsRoot &&
|
||||||
|
!isDirectoryServiceAccount(row, vm)
|
||||||
|
},
|
||||||
has: () => {
|
has: () => {
|
||||||
return !vm.asset
|
return !vm.asset
|
||||||
},
|
},
|
||||||
@ -167,7 +191,11 @@ export const accountOtherActions = (vm) => [
|
|||||||
name: 'MoveToOther',
|
name: 'MoveToOther',
|
||||||
title: vm.$t('MoveToAsset'),
|
title: vm.$t('MoveToAsset'),
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
can: () => vm.$hasPerm('accounts.add_account') && !vm.$store.getters.currentOrgIsRoot,
|
can: ({ row }) => {
|
||||||
|
return vm.$hasPerm('accounts.add_account') &&
|
||||||
|
!vm.$store.getters.currentOrgIsRoot &&
|
||||||
|
!isDirectoryServiceAccount(row, vm)
|
||||||
|
},
|
||||||
has: () => {
|
has: () => {
|
||||||
return !vm.asset
|
return !vm.asset
|
||||||
},
|
},
|
||||||
@ -179,7 +207,8 @@ export const accountOtherActions = (vm) => [
|
|||||||
vm.showAddDialog = true
|
vm.showAddDialog = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
}
|
||||||
|
|
||||||
export const accountQuickFilters = (vm) => [
|
export const accountQuickFilters = (vm) => [
|
||||||
{
|
{
|
||||||
|
@ -54,13 +54,15 @@ export default {
|
|||||||
default() {
|
default() {
|
||||||
return {
|
return {
|
||||||
can: () => true,
|
can: () => true,
|
||||||
getConnectUrl: (row, protocol) => {
|
getConnectUrl: (row, protocol, asset) => {
|
||||||
|
const assetId = asset ? asset.id : row.asset.id
|
||||||
return `/luna/admin-connect/?
|
return `/luna/admin-connect/?
|
||||||
asset=${row.asset.id}
|
asset=${assetId}
|
||||||
&account=${row.id}
|
&account=${row.id}
|
||||||
&protocol=${protocol}
|
&protocol=${protocol}
|
||||||
`.replace(/\s+/g, '')
|
`.replace(/\s+/g, '')
|
||||||
},
|
},
|
||||||
|
asset: null,
|
||||||
assetUrl: '/api/v1/assets/assets/{id}/',
|
assetUrl: '/api/v1/assets/assets/{id}/',
|
||||||
buttonIcon: 'fa fa-desktop'
|
buttonIcon: 'fa fa-desktop'
|
||||||
}
|
}
|
||||||
@ -86,7 +88,7 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleProtocolConnect(protocol) {
|
handleProtocolConnect(protocol) {
|
||||||
const url = this.formatterArgs.getConnectUrl(this.row, protocol)
|
const url = this.formatterArgs.getConnectUrl(this.row, protocol, this.formatterArgs.asset)
|
||||||
window.open(url, '_blank')
|
window.open(url, '_blank')
|
||||||
},
|
},
|
||||||
visibleChange(visible) {
|
visibleChange(visible) {
|
||||||
|
@ -72,7 +72,6 @@ export const interval = {
|
|||||||
],
|
],
|
||||||
on: {
|
on: {
|
||||||
input: (val, updateForm) => {
|
input: (val, updateForm) => {
|
||||||
console.log('interval input', val)
|
|
||||||
updateForm({
|
updateForm({
|
||||||
crontab: ''
|
crontab: ''
|
||||||
})
|
})
|
||||||
|
@ -64,7 +64,7 @@ export default {
|
|||||||
[this.$t('Basic'), ['name', 'address', 'platform', 'nodes']],
|
[this.$t('Basic'), ['name', 'address', 'platform', 'nodes']],
|
||||||
[this.$t('Protocol'), ['protocols']],
|
[this.$t('Protocol'), ['protocols']],
|
||||||
[this.$t('Account'), ['accounts']],
|
[this.$t('Account'), ['accounts']],
|
||||||
[this.$t('Other'), ['domain', 'labels', 'is_active', 'comment']]
|
[this.$t('Other'), ['directory_services', 'domain', 'labels', 'is_active', 'comment']]
|
||||||
],
|
],
|
||||||
fieldsMeta: {},
|
fieldsMeta: {},
|
||||||
performSubmit(validValues) {
|
performSubmit(validValues) {
|
||||||
|
@ -50,7 +50,7 @@ export default {
|
|||||||
]],
|
]],
|
||||||
[this.$t('Config'), [
|
[this.$t('Config'), [
|
||||||
'protocols', 'su_enabled', 'su_method',
|
'protocols', 'su_enabled', 'su_method',
|
||||||
'domain_enabled', 'ds_enabled', 'ds',
|
'domain_enabled', 'ds_enabled',
|
||||||
'charset'
|
'charset'
|
||||||
]],
|
]],
|
||||||
[this.$t('Automations'), ['automation']],
|
[this.$t('Automations'), ['automation']],
|
||||||
|
@ -86,14 +86,7 @@ export const platformFieldsMeta = (vm) => {
|
|||||||
disabled: false
|
disabled: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ds: {
|
|
||||||
el: {
|
|
||||||
multiple: false,
|
|
||||||
url: '/api/v1/assets/directories/',
|
|
||||||
disabled: false
|
|
||||||
},
|
|
||||||
hidden: (formValue) => !formValue['ds_enabled']
|
|
||||||
},
|
|
||||||
protocols: {
|
protocols: {
|
||||||
label: i18n.t('SupportedProtocol'),
|
label: i18n.t('SupportedProtocol'),
|
||||||
...assetMeta.protocols,
|
...assetMeta.protocols,
|
||||||
|
@ -133,6 +133,15 @@ export const assetFieldsMeta = (vm, category, type) => {
|
|||||||
default: []
|
default: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
directory_services: {
|
||||||
|
el: {
|
||||||
|
url: '/api/v1/assets/directories/',
|
||||||
|
disabled: false
|
||||||
|
},
|
||||||
|
hidden: () => {
|
||||||
|
return vm.platform.ds_enabled === false
|
||||||
|
}
|
||||||
|
},
|
||||||
nodes: {
|
nodes: {
|
||||||
rules: [rules.RequiredChange],
|
rules: [rules.RequiredChange],
|
||||||
el: {
|
el: {
|
||||||
|
Loading…
Reference in New Issue
Block a user