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