mirror of
https://github.com/jumpserver/lina.git
synced 2025-09-28 15:55:24 +00:00
perf: 修改平台类别
This commit is contained in:
@@ -39,11 +39,10 @@
|
||||
:title="'选择模版'"
|
||||
:visible.sync="templateTable.visible"
|
||||
:destroy-on-close="true"
|
||||
:show-cancel="false"
|
||||
:show-confirm="false"
|
||||
width="70%"
|
||||
@submit="onSelectTemplate"
|
||||
>
|
||||
<ListTable v-bind="templateTable" />
|
||||
<AutoDataTable :config="templateTable.tableConfig" />
|
||||
</Dialog>
|
||||
</div>
|
||||
</template>
|
||||
@@ -51,12 +50,12 @@
|
||||
<script>
|
||||
import Dialog from '@/components/Dialog'
|
||||
import AccountCreateForm from '@/components/AccountCreateForm'
|
||||
import ListTable from '@/components/ListTable'
|
||||
import AutoDataTable from '@/components/AutoDataTable'
|
||||
export default {
|
||||
name: 'AssetAccounts',
|
||||
components: {
|
||||
Dialog,
|
||||
ListTable,
|
||||
AutoDataTable,
|
||||
AccountCreateForm
|
||||
},
|
||||
props: {
|
||||
@@ -79,9 +78,12 @@ export default {
|
||||
visible: false,
|
||||
tableConfig: {
|
||||
url: '/api/v1/assets/account-templates/',
|
||||
columns: ['name', 'username', 'privileged', 'actions']
|
||||
},
|
||||
headerActions: {
|
||||
columns: ['name', 'username', 'privileged', 'actions'],
|
||||
columnsMeta: {
|
||||
privileged: {
|
||||
width: '100px'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -133,6 +135,9 @@ export default {
|
||||
},
|
||||
onAddFromTemplateClick() {
|
||||
this.templateTable.visible = true
|
||||
},
|
||||
onSelectTemplate() {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -100,7 +100,7 @@
|
||||
"CreateDatabase": "Create asset - Database",
|
||||
"CreateHost": "Create asset - Host",
|
||||
"CreateRemoteApp": "Create asset - Remote app",
|
||||
"CreateNetworkDevice": "Create asset - Network device",
|
||||
"CreateDevice": "Create asset - Network device",
|
||||
"CreateCloud": "Create asset - Cloud platform",
|
||||
"CreateWeb": "Create asset - web",
|
||||
"SelectPlatforms": "Select platforms",
|
||||
|
@@ -105,7 +105,7 @@
|
||||
"CreateDatabase": "資産の作成 - データベース",
|
||||
"CreateHost": "資産の作成 - ホスト",
|
||||
"CreateRemoteApp": "資産の作成 - リモートアプリケーション",
|
||||
"CreateNetworkDevice": "資産の作成 - ネットワークデバイス",
|
||||
"CreateDevice": "資産の作成 - ネットワークデバイス",
|
||||
"CreateCloud": "資産の作成 - クラウドプラットフォーム",
|
||||
"CreateWeb": "資産の作成 - ウェブ",
|
||||
"SelectPlatforms": "プラットフォームを選択",
|
||||
|
@@ -105,7 +105,7 @@
|
||||
"CreateDatabase": "创建资产-数据库",
|
||||
"CreateHost": "创建资产-主机",
|
||||
"CreateRemoteApp": "创建资产-远程应用",
|
||||
"CreateNetworkDevice": "创建资产-网络设备",
|
||||
"CreateDevice": "创建资产-网络设备",
|
||||
"CreateCloud": "创建资产-云平台",
|
||||
"CreateWeb": "创建资产-web",
|
||||
"SelectPlatforms": "选择平台",
|
||||
@@ -729,7 +729,7 @@
|
||||
"AssetDetail": "资产详情",
|
||||
"AssetList": "资产列表",
|
||||
"HostList": "主机列表",
|
||||
"NetworkDevices": "网络设备",
|
||||
"Devices": "网络设备",
|
||||
"Databases": "数据库",
|
||||
"Session": "会话",
|
||||
"AssetPermission": "资产授权",
|
||||
|
@@ -92,30 +92,30 @@ export default [
|
||||
]
|
||||
},
|
||||
{
|
||||
path: 'networks',
|
||||
path: 'devices',
|
||||
component: empty,
|
||||
redirect: '',
|
||||
hidden: true,
|
||||
meta: { title: i18n.t('route.networking'), permissions: ['assets.view_asset'] },
|
||||
meta: { title: i18n.t('route.devices'), permissions: ['assets.view_asset'] },
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
name: 'NetworkingList',
|
||||
component: () => import('@/views/assets/Asset/AssetList/NetworkList.vue'),
|
||||
name: 'DeviceList',
|
||||
component: () => import('@/views/assets/Asset/AssetList/DeviceList.vue'),
|
||||
hidden: true,
|
||||
meta: { title: i18n.t('route.HostList'), activeMenu: '/console/assets/assets' }
|
||||
},
|
||||
{
|
||||
path: 'create',
|
||||
name: 'NetworkingCreate',
|
||||
component: () => import('@/views/assets/Asset/AssetCreateUpdate/NetworkCreateUpdate.vue'),
|
||||
name: 'DeviceCreate',
|
||||
component: () => import('@/views/assets/Asset/AssetCreateUpdate/DeviceCreateUpdate.vue'),
|
||||
hidden: true,
|
||||
meta: { title: i18n.t('assets.CreateNetworkDevice'), activeMenu: '/console/assets/assets' }
|
||||
meta: { title: i18n.t('assets.CreateDevice'), activeMenu: '/console/assets/assets' }
|
||||
},
|
||||
{
|
||||
path: ':id/update',
|
||||
name: 'NetworkingUpdate',
|
||||
component: () => import('@/views/assets/Asset/AssetCreateUpdate/NetworkCreateUpdate.vue'),
|
||||
name: 'DeviceUpdate',
|
||||
component: () => import('@/views/assets/Asset/AssetCreateUpdate/DeviceCreateUpdate.vue'),
|
||||
hidden: true,
|
||||
meta: { title: i18n.t('route.AssetUpdate'), activeMenu: '/console/assets/assets' }
|
||||
}
|
||||
@@ -131,7 +131,7 @@ export default [
|
||||
{
|
||||
path: '',
|
||||
name: 'CloudsPlatformList',
|
||||
component: () => import('@/views/assets/Asset/AssetList/CloudsPlatformList.vue'),
|
||||
component: () => import('@/views/assets/Asset/AssetList/CloudList.vue'),
|
||||
hidden: true,
|
||||
meta: { title: i18n.t('route.HostList'), activeMenu: '/console/assets/assets' }
|
||||
},
|
||||
|
@@ -71,7 +71,7 @@ export default {
|
||||
},
|
||||
{
|
||||
id: 'networking',
|
||||
label: 'Networking',
|
||||
label: 'Device',
|
||||
children: [
|
||||
{
|
||||
id: 'switch',
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<GenericCreateUpdatePage v-if="!iConfig.loading" v-bind="iConfig" />
|
||||
<GenericCreateUpdatePage v-if="!loading" v-bind="iConfig" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -21,8 +21,8 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: true,
|
||||
defaultConfig: {
|
||||
loading: true,
|
||||
initial: {},
|
||||
platform: {},
|
||||
url: '/api/v1/assets/hosts/',
|
||||
@@ -60,18 +60,15 @@ export default {
|
||||
},
|
||||
async created() {
|
||||
try {
|
||||
await this.setPlatformInitial()
|
||||
await this.setInitial()
|
||||
await this.setPlatformConstrains()
|
||||
} finally {
|
||||
this.defaultConfig.loading = false
|
||||
this.loading = false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async setPlatformInitial() {
|
||||
const nodesInitial = []
|
||||
if (!this.defaultConfig.initial) this.$set(this.defaultConfig, 'initial', {})
|
||||
if (this.$route.query['node']) {
|
||||
nodesInitial.push(this.$route.query.node)
|
||||
}
|
||||
async setInitial() {
|
||||
const nodesInitial = this.$route.query['node'] ? [this.$route.query['node']] : []
|
||||
const platformId = this.$route.query['platform'] || 1
|
||||
const url = `/api/v1/assets/platforms/${platformId}/`
|
||||
this.platform = await this.$axios.get(url)
|
||||
@@ -83,6 +80,8 @@ export default {
|
||||
protocols: this.platform.protocols || []
|
||||
}
|
||||
this.defaultConfig.initial = Object.assign({}, initial, this.defaultConfig.initial)
|
||||
},
|
||||
async setPlatformConstrains() {
|
||||
this.$set(this.defaultConfig.fieldsMeta.protocols.el, 'choices', (this.platform['protocols'] || []))
|
||||
this.$set(this.defaultConfig.fieldsMeta.accounts.el, 'protocols', (this.platform['protocols'] || []))
|
||||
const hiddenCheckFields = ['protocols', 'domain']
|
@@ -1,13 +1,13 @@
|
||||
<template>
|
||||
<BaseCreateUpdate v-bind="$data" />
|
||||
<BaseAssetCreateUpdate v-bind="$data" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BaseCreateUpdate from './components/BaseCreateUpdate'
|
||||
import BaseAssetCreateUpdate from './BaseAssetCreateUpdate'
|
||||
|
||||
export default {
|
||||
name: 'CloudCreateUpdate',
|
||||
components: { BaseCreateUpdate },
|
||||
components: { BaseAssetCreateUpdate },
|
||||
data() {
|
||||
return {
|
||||
url: '/api/v1/assets/clouds/',
|
||||
|
@@ -1,13 +1,13 @@
|
||||
<template>
|
||||
<BaseCreateUpdate v-bind="$data" />
|
||||
<BaseAssetCreateUpdate v-bind="$data" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BaseCreateUpdate from './components/BaseCreateUpdate'
|
||||
import BaseAssetCreateUpdate from './BaseAssetCreateUpdate'
|
||||
|
||||
export default {
|
||||
name: 'DatabaseCreateUpdate',
|
||||
components: { BaseCreateUpdate },
|
||||
components: { BaseAssetCreateUpdate },
|
||||
data() {
|
||||
return {
|
||||
url: '/api/v1/assets/databases/',
|
||||
|
@@ -0,0 +1,20 @@
|
||||
<template>
|
||||
<BaseAssetCreateUpdate v-bind="$data" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BaseAssetCreateUpdate from './BaseAssetCreateUpdate'
|
||||
|
||||
export default {
|
||||
name: 'DeviceCreateUpdate',
|
||||
components: { BaseAssetCreateUpdate },
|
||||
data() {
|
||||
return {
|
||||
url: '/api/v1/assets/assets/devices/'
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
@@ -1,13 +1,13 @@
|
||||
<template>
|
||||
<BaseCreateUpdate v-bind="$data" />
|
||||
<BaseAssetCreateUpdate v-bind="$data" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BaseCreateUpdate from './components/BaseCreateUpdate'
|
||||
import BaseAssetCreateUpdate from './BaseAssetCreateUpdate'
|
||||
|
||||
export default {
|
||||
name: 'HostCreateUpdate',
|
||||
components: { BaseCreateUpdate },
|
||||
components: { BaseAssetCreateUpdate },
|
||||
data() {
|
||||
return {
|
||||
url: '/api/v1/assets/hosts/'
|
||||
|
@@ -1,20 +0,0 @@
|
||||
<template>
|
||||
<BaseCreateUpdate v-bind="$data" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BaseCreateUpdate from './components/BaseCreateUpdate'
|
||||
|
||||
export default {
|
||||
name: 'NetworkingCreateUpdate',
|
||||
components: { BaseCreateUpdate },
|
||||
data() {
|
||||
return {
|
||||
url: '/api/v1/assets//assets/networks/'
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
@@ -1,13 +1,13 @@
|
||||
<template>
|
||||
<BaseCreateUpdate v-bind="$data" />
|
||||
<BaseAssetCreateUpdate v-bind="$data" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BaseCreateUpdate from './components/BaseCreateUpdate'
|
||||
import BaseAssetCreateUpdate from './BaseAssetCreateUpdate'
|
||||
|
||||
export default {
|
||||
name: 'WebCreateUpdate',
|
||||
components: { BaseCreateUpdate },
|
||||
components: { BaseAssetCreateUpdate },
|
||||
data() {
|
||||
return {
|
||||
url: '/api/v1/assets/web/',
|
||||
|
@@ -12,10 +12,10 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
config: {
|
||||
url: '/api/v1/assets/networks/',
|
||||
category: 'networking',
|
||||
url: '/api/v1/assets/devices/',
|
||||
category: 'device',
|
||||
headerActions: {
|
||||
createRoute: 'NetworkingCreate'
|
||||
createRoute: 'DeviceCreate'
|
||||
}
|
||||
}
|
||||
}
|
@@ -193,7 +193,6 @@ export default {
|
||||
vm.$hasPerm('assets.change_asset')
|
||||
},
|
||||
callback: ({ selectedRows }) => {
|
||||
console.log('selectedRows: ----------------------ss', selectedRows)
|
||||
vm.updateSelectedDialogSetting.selectedRows = selectedRows
|
||||
vm.updateSelectedDialogSetting.visible = true
|
||||
}
|
||||
|
@@ -31,10 +31,10 @@ export default {
|
||||
component: () => import('@/views/assets/Asset/AssetList/HostList.vue')
|
||||
},
|
||||
{
|
||||
title: this.$t('route.NetworkDevices'),
|
||||
name: 'networks',
|
||||
title: this.$t('route.Devices'),
|
||||
name: 'devices',
|
||||
hidden: () => false,
|
||||
component: () => import('@/views/assets/Asset/AssetList/NetworkList.vue')
|
||||
component: () => import('@/views/assets/Asset/AssetList/DeviceList.vue')
|
||||
},
|
||||
{
|
||||
title: this.$t('route.Databases'),
|
||||
@@ -43,10 +43,10 @@ export default {
|
||||
component: () => import('@/views/assets/Asset/AssetList/DatabaseList.vue')
|
||||
},
|
||||
{
|
||||
title: this.$t('assets.CloudPlatform'),
|
||||
title: this.$t('assets.Clouds'),
|
||||
name: 'clouds',
|
||||
hidden: () => false,
|
||||
component: () => import('@/views/assets/Asset/AssetList/CloudsPlatformList.vue')
|
||||
component: () => import('@/views/assets/Asset/AssetList/CloudList.vue')
|
||||
},
|
||||
{
|
||||
title: 'Web',
|
||||
|
@@ -35,21 +35,18 @@ export default {
|
||||
comment: '',
|
||||
charset: 'utf8',
|
||||
category_type: ['host', 'linux'],
|
||||
automation: {
|
||||
}
|
||||
automation: {}
|
||||
},
|
||||
fields: [
|
||||
[this.$t('common.Basic'), [
|
||||
'name', 'category_type'
|
||||
'name', 'category_type', 'charset', 'domain_enabled'
|
||||
]],
|
||||
['网络设备', ['brand']],
|
||||
['配置', [
|
||||
'protocols_enabled', 'protocols',
|
||||
'charset', 'domain_enabled', 'brand',
|
||||
'su_enabled', 'su_method'
|
||||
]],
|
||||
['自动化', [
|
||||
'automation'
|
||||
]],
|
||||
['自动化', ['automation']],
|
||||
[this.$t('common.Other'), ['comment']]
|
||||
],
|
||||
fieldsMeta: {
|
||||
@@ -87,6 +84,7 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
brand: {},
|
||||
protocols_enabled: {
|
||||
el: {
|
||||
disabled: false
|
||||
@@ -161,9 +159,10 @@ export default {
|
||||
}
|
||||
|
||||
this.fieldsMeta.protocols.el.choices = constraints['protocols'] || []
|
||||
await this.setOpsMethods(constraints)
|
||||
this.fieldsMeta.brand.hidden = () => constraints['brand_enabled'] !== true
|
||||
await this.setAutomationMethods(constraints)
|
||||
},
|
||||
async setOpsMethods(constraints) {
|
||||
async setAutomationMethods(constraints) {
|
||||
const category = this.$route.query.category
|
||||
const type = this.$route.query.type
|
||||
const allMethods = await this.$axios.get('/api/v1/assets/platforms/ops-methods/') || []
|
||||
|
@@ -14,7 +14,6 @@
|
||||
<script>
|
||||
import { GenericListTable, TabPage } from '@/layout/components'
|
||||
import { ChoicesDisplayFormatter } from '@/components/TableFormatters'
|
||||
import { Categories } from '@/views/assets/const'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -26,7 +25,7 @@ export default {
|
||||
return {
|
||||
loading: true,
|
||||
tab: {
|
||||
submenu: Categories,
|
||||
submenu: [],
|
||||
activeMenu: 'host'
|
||||
},
|
||||
tableConfig: {
|
||||
@@ -105,7 +104,7 @@ export default {
|
||||
},
|
||||
async mounted() {
|
||||
try {
|
||||
await this.$store.dispatch('assets/getAssetCategories')
|
||||
await this.setCategories()
|
||||
await this.changeMoreCreates()
|
||||
} finally {
|
||||
this.loading = false
|
||||
@@ -117,6 +116,15 @@ export default {
|
||||
this.headerActions.moreCreates.dropdown = this.$store.state.assets.assetCategoriesDropdown.filter(item => {
|
||||
return item.category === this.tab.activeMenu
|
||||
})
|
||||
},
|
||||
async setCategories() {
|
||||
const state = await this.$store.dispatch('assets/getAssetCategories')
|
||||
this.tab.submenu = state.assetCategories.map(item => {
|
||||
return {
|
||||
title: item.display_name,
|
||||
name: item.value
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -81,26 +81,3 @@ export const assetFieldsMeta = () => {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const Categories = [
|
||||
{
|
||||
title: '主机',
|
||||
name: 'host'
|
||||
},
|
||||
{
|
||||
title: '网络设备',
|
||||
name: 'networking'
|
||||
},
|
||||
{
|
||||
title: '数据库',
|
||||
name: 'database'
|
||||
},
|
||||
{
|
||||
title: '云平台',
|
||||
name: 'cloud'
|
||||
},
|
||||
{
|
||||
title: 'Web',
|
||||
name: 'web'
|
||||
}
|
||||
]
|
||||
|
Reference in New Issue
Block a user