mirror of
https://github.com/jumpserver/lina.git
synced 2025-09-16 07:09:14 +00:00
Merge pull request #2708 from jumpserver/pr@dev@perf_account_takss
perf: 优化 account tasks
This commit is contained in:
@@ -161,7 +161,7 @@ export default {
|
||||
push_now: {
|
||||
hidden: () => {
|
||||
const automation = this.iPlatform.automation || {}
|
||||
return !automation.push_account_enabled || !automation.ansible_enabled || !this.$hasPerm('assets.push_assetaccount')
|
||||
return !automation.push_account_enabled || !automation.ansible_enabled || !this.$hasPerm('accounts.push_account')
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@@ -208,11 +208,11 @@ export default {
|
||||
{
|
||||
name: 'Test',
|
||||
title: this.$t('common.Test'),
|
||||
can: this.$hasPerm('assets.test_account'),
|
||||
can: this.$hasPerm('accounts.verify_account'),
|
||||
callback: ({ row }) => {
|
||||
this.$axios.post(
|
||||
`/api/v1/accounts/accounts/${row.id}/verify/`,
|
||||
{ action: 'test' }
|
||||
`/api/v1/accounts/accounts/tasks/`,
|
||||
{ action: 'verify', accounts: [row.id] }
|
||||
).then(res => {
|
||||
openTaskPage(res['task'])
|
||||
})
|
||||
|
@@ -232,6 +232,16 @@ export default {
|
||||
}
|
||||
return col
|
||||
},
|
||||
addOrderingIfNeed(col) {
|
||||
if (col.prop) {
|
||||
const column = this.meta[col.prop] || {}
|
||||
if (column.order) {
|
||||
col.sortable = 'custom'
|
||||
col['column-key'] = col.prop
|
||||
}
|
||||
}
|
||||
return col
|
||||
},
|
||||
setDefaultFormatterIfNeed(col) {
|
||||
if (!col.formatter) {
|
||||
col.formatter = (row, column, cellValue) => {
|
||||
@@ -247,6 +257,7 @@ export default {
|
||||
}
|
||||
return col
|
||||
},
|
||||
|
||||
generateColumn(name) {
|
||||
const colMeta = this.meta[name] || {}
|
||||
const customMeta = this.config.columnsMeta ? this.config.columnsMeta[name] : {}
|
||||
@@ -258,6 +269,7 @@ export default {
|
||||
col = Object.assign(col, customMeta)
|
||||
col = this.addHelpTipsIfNeed(col)
|
||||
col = this.addFilterIfNeed(col)
|
||||
col = this.addOrderingIfNeed(col)
|
||||
return col
|
||||
},
|
||||
generateTotalColumns() {
|
||||
|
@@ -85,4 +85,7 @@ export default {
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
a {
|
||||
color: var(--color-success);
|
||||
}
|
||||
</style>
|
||||
|
@@ -29,6 +29,10 @@ export default {
|
||||
showUndefine: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
formatters: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@@ -103,7 +107,7 @@ export default {
|
||||
value = toSafeLocalDateStr(value)
|
||||
} else if (fieldMeta.type === 'labeled_choice') {
|
||||
value = value?.['label']
|
||||
} else if (fieldMeta.type === 'related_field') {
|
||||
} else if (fieldMeta.type === 'related_field' || fieldMeta.type === 'nested object') {
|
||||
value = value['name']
|
||||
} else if (fieldMeta.type === 'm2m_related_field') {
|
||||
value = value.map(item => item['name']).join(', ')
|
||||
@@ -121,7 +125,8 @@ export default {
|
||||
|
||||
const item = {
|
||||
key: label,
|
||||
value: value
|
||||
value: value,
|
||||
formatter: this.formatters[name]
|
||||
}
|
||||
this.items.push(item)
|
||||
}
|
||||
|
@@ -197,6 +197,7 @@
|
||||
"NoSQLProtocol": "NoSQL Protocol"
|
||||
},
|
||||
"assets": {
|
||||
"PushAccount": "Push account",
|
||||
"AuthUsername": "Auth using username",
|
||||
"Secure": "Secure",
|
||||
"AssetBulkUpdateTips": "device、cloud、web,Batch update of domain is not supported",
|
||||
|
@@ -197,6 +197,7 @@
|
||||
"NoSQLProtocol": "非リレーショナルデータベース"
|
||||
},
|
||||
"assets": {
|
||||
"PushAccount": "アカウント情報をプッシュ",
|
||||
"AuthUsername": "ユーザー名を使用した認証",
|
||||
"Secure": "安全である",
|
||||
"AssetBulkUpdateTips": "ネットワークデバイス、クラウドサービス、Web、一括更新ネットワークドメインはサポートされていません",
|
||||
|
@@ -197,6 +197,7 @@
|
||||
"NoSQLProtocol": "非关系数据库"
|
||||
},
|
||||
"assets": {
|
||||
"PushAccount": "推送账号",
|
||||
"SSHPort": "SSH 端口",
|
||||
"AuthUsername": "使用用户名认证",
|
||||
"Secure": "安全",
|
||||
|
@@ -15,7 +15,7 @@ export default [
|
||||
{
|
||||
path: '',
|
||||
name: 'AssetAccountList',
|
||||
component: () => import('@/views/accounts/AssetAccount/AssetAccountList'),
|
||||
component: () => import('@/views/accounts/Account/AccountList.vue'),
|
||||
meta: {
|
||||
title: i18n.t('route.AssetAccount'),
|
||||
app: 'accounts',
|
||||
@@ -24,7 +24,7 @@ export default [
|
||||
},
|
||||
{
|
||||
path: ':id',
|
||||
component: () => import('@/views/accounts/AssetAccount/AssetAccountDetail/index.vue'),
|
||||
component: () => import('@/views/accounts/Account/AccountDetail/index.vue'),
|
||||
name: 'AssetAccountDetail',
|
||||
meta: { title: i18n.t('route.AssetAccount') },
|
||||
hidden: true
|
||||
|
@@ -1,10 +1,10 @@
|
||||
<template>
|
||||
<el-row :gutter="20">
|
||||
<el-col :md="14" :sm="24">
|
||||
<AutoDetailCard :url="url" :excludes="excludes" :object="object" />
|
||||
<AutoDetailCard :object="object" v-bind="detail" />
|
||||
</el-col>
|
||||
<el-col :md="10" :sm="24">
|
||||
<QuickActions type="primary" :actions="quickActions" />
|
||||
<QuickActions :actions="quickActions" type="primary" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
@@ -73,13 +73,34 @@ export default {
|
||||
attrs: {
|
||||
type: 'primary',
|
||||
label: this.$t('assets.Test'),
|
||||
disabled: !vm.$hasPerm('assets.test_account')
|
||||
disabled: !vm.$hasPerm('accounts.verify_account')
|
||||
},
|
||||
callbacks: Object.freeze({
|
||||
click: () => {
|
||||
this.$axios.post(
|
||||
`/api/v1/accounts/accounts/${this.object.id}/verify/`,
|
||||
{ action: 'test' }
|
||||
`/api/v1/accounts/accounts/tasks/`,
|
||||
{
|
||||
action: 'test',
|
||||
accounts: [this.object.id]
|
||||
}
|
||||
).then(res => {
|
||||
openTaskPage(res['task'])
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
{
|
||||
title: this.$t('assets.PushAccount'),
|
||||
attrs: {
|
||||
type: 'primary',
|
||||
label: this.$t('assets.Push'),
|
||||
disabled: !vm.$hasPerm('accounts.push_account')
|
||||
},
|
||||
callbacks: Object.freeze({
|
||||
click: () => {
|
||||
this.$axios.post(
|
||||
`/api/v1/accounts/accounts/tasks/`,
|
||||
{ action: 'push', accounts: [this.object.id] }
|
||||
).then(res => {
|
||||
openTaskPage(res['task'])
|
||||
})
|
||||
@@ -102,7 +123,7 @@ export default {
|
||||
return { label: item.name + '(' + item.username + ')', value: item.id }
|
||||
}
|
||||
},
|
||||
disabled: !vm.$hasPerm('assets.test_account') || filterSuFrom.includes(vm.object?.asset?.category?.value)
|
||||
disabled: !vm.$hasPerm('accounts.verify_account') || filterSuFrom.includes(vm.object?.asset?.category?.value)
|
||||
},
|
||||
callbacks: Object.freeze({
|
||||
change: (value) => {
|
||||
@@ -112,11 +133,19 @@ export default {
|
||||
})
|
||||
}
|
||||
],
|
||||
url: `/api/v1/accounts/accounts/${this.object.id}`,
|
||||
excludes: [
|
||||
'asset', 'template', 'privileged', 'secret',
|
||||
'passphrase', 'specific', 'spec_info'
|
||||
]
|
||||
detail: {
|
||||
url: `/api/v1/accounts/accounts/${this.object.id}`,
|
||||
excludes: [
|
||||
'template', 'privileged', 'secret',
|
||||
'passphrase', 'spec_info'
|
||||
],
|
||||
formatters: {
|
||||
asset: (item, value) => {
|
||||
console.log('Value: ', value)
|
||||
return <a>hello</a>
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -124,5 +153,5 @@ export default {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
<style lang="scss" scoped>
|
||||
</style>
|
@@ -1,36 +0,0 @@
|
||||
<template>
|
||||
<el-row :gutter="20">
|
||||
<el-col :md="12" :sm="24">
|
||||
<TimelineCard :title="activityTitle" :url="activityUrl" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import TimelineCard from '@/components/TimelineCard'
|
||||
|
||||
export default {
|
||||
name: 'AssetActivity',
|
||||
components: {
|
||||
TimelineCard
|
||||
},
|
||||
props: {
|
||||
object: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
activityUrl: `/api/v1/audits/activities/?resource_id=${this.object.id}`,
|
||||
activityTitle: `${this.$t('common.Activity')} - ${this.$t('audits.OperateRecord')} (${this.$t('common.Last30')})`
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
@@ -3,7 +3,7 @@
|
||||
<li class="divider" />
|
||||
<li
|
||||
id="m_add_asset_to_node"
|
||||
v-perms="'assets.add_assettonode'"
|
||||
v-perms="'assets.change_assetnodes'"
|
||||
class="rmenu"
|
||||
tabindex="-1"
|
||||
@click="rMenuAddAssetToNode"
|
||||
@@ -12,7 +12,7 @@
|
||||
</li>
|
||||
<li
|
||||
id="m_move_asset_to_node"
|
||||
v-perms="'assets.move_assettonode'"
|
||||
v-perms="'assets.change_assetnodes'"
|
||||
class="rmenu"
|
||||
tabindex="-1"
|
||||
@click="rMenuMoveAssetToNode"
|
||||
@@ -21,14 +21,14 @@
|
||||
</li>
|
||||
<li
|
||||
id="m_remove_asset_from_node"
|
||||
v-perms="'assets.move_assettonode'"
|
||||
v-perms="'assets.change_assetnodes'"
|
||||
class="rmenu"
|
||||
tabindex="-1"
|
||||
@click="rMenuRemoveAssetFromNode"
|
||||
>
|
||||
<i class="fa fa-minus-square-o" /> {{ this.$t('tree.RemoveAssetFromNode') }}
|
||||
</li>
|
||||
<li v-if="$hasPerm('assets.move_assettonode | assets.add_assettonode')" class="divider" />
|
||||
<li v-if="$hasPerm('assets.change_assetnodes')" class="divider" />
|
||||
<li
|
||||
id="m_update_node_asset_hardware_info"
|
||||
v-perms="'assets.refresh_assethardwareinfo'"
|
||||
@@ -47,7 +47,7 @@
|
||||
>
|
||||
<i class="fa fa-link" /> {{ this.$t('tree.TestNodeAssetConnectivity') }}
|
||||
</li>
|
||||
<li v-if="$hasPerm('assets.add_assettonode | assets.test_assetconnectivity')" class="divider" />
|
||||
<li v-if="$hasPerm('assets.change_assetnodes | assets.test_assetconnectivity')" class="divider" />
|
||||
<li id="m_show_asset_only_current_node" class="rmenu" tabindex="-1" @click="rMenuShowAssetOnlyCurrentNode">
|
||||
<i class="fa fa-indent" /> {{ this.$t('tree.ShowAssetOnlyCurrentNode') }}
|
||||
</li>
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<el-row :gutter="20">
|
||||
<el-col :md="14" :sm="24">
|
||||
<AutoDetailCard :url="url" :excludes="excludes" :object="object" />
|
||||
<AutoDetailCard :excludes="excludes" :object="object" :url="url" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<IBox v-if="!loading">
|
||||
<GenericCreateUpdateForm v-bind="$data" />
|
||||
<GenericCreateUpdateForm class="form" v-bind="$data" />
|
||||
</IBox>
|
||||
</template>
|
||||
|
||||
@@ -69,5 +69,8 @@ export default {
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.form >>> .el-select {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
@@ -1,27 +1,27 @@
|
||||
<template>
|
||||
<Dialog
|
||||
:title="$tc('setting.SyncSetting')"
|
||||
:destroy-on-close="true"
|
||||
:show-cancel="false"
|
||||
:show-confirm="false"
|
||||
width="50%"
|
||||
:title="$tc('setting.SyncSetting')"
|
||||
top="10%"
|
||||
v-bind="$attrs"
|
||||
width="50%"
|
||||
v-on="$listeners"
|
||||
>
|
||||
<GenericCreateUpdateForm
|
||||
v-bind="settings"
|
||||
:has-detail-in-msg="false"
|
||||
v-bind="settings"
|
||||
@submitSuccess="onSuccess"
|
||||
/>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { GenericCreateUpdateForm } from '@/layout/components'
|
||||
import { Dialog } from '@/components'
|
||||
import { CronTab, Dialog } from '@/components'
|
||||
import Select2 from '@/components/FormFields/Select2'
|
||||
import { Required } from '@/components/DataForm/rules'
|
||||
import { CronTab } from '@/components'
|
||||
|
||||
export default {
|
||||
name: 'SyncSettingDialog',
|
||||
@@ -67,6 +67,11 @@ export default {
|
||||
submitMethod: () => 'patch'
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onSuccess() {
|
||||
this.$emit('update:visible', false)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<ListTable ref="list" :table-config="tableConfig" :header-actions="headerActions" />
|
||||
<ListTable ref="list" :header-actions="headerActions" :table-config="tableConfig" />
|
||||
</template>
|
||||
|
||||
<script type="text/jsx">
|
||||
@@ -24,8 +24,12 @@ export default {
|
||||
hasSelection: false,
|
||||
url: `/api/v1/ops/task-executions/?task_id=${this.object.id}`,
|
||||
columns: [
|
||||
'id', 'is_finished', 'is_success', 'time_cost', 'date_start', 'actions'
|
||||
'id', 'is_finished', 'is_success', 'time_cost', 'date_start',
|
||||
'date_published', 'date_finished', 'actions'
|
||||
],
|
||||
columnsShow: {
|
||||
default: ['id', 'is_finished', 'is_success', 'time_cost', 'date_start', 'actions']
|
||||
},
|
||||
columnsMeta: {
|
||||
is_finished: {
|
||||
label: this.$t('ops.isFinished'),
|
||||
|
Reference in New Issue
Block a user