feat: 资产允许编辑更多信息 (#530)

* feat: 资产允许编辑更多信息

* feat: 资产允许编辑更多资产信息

* feat: 资产允许编辑更多资产信息

* fix: 修改组件名称

Co-authored-by: Orange <orangemtony@gmail.com>
This commit is contained in:
fit2bot
2020-12-08 20:25:54 +08:00
committed by GitHub
parent 9f12e1aa18
commit 32fa4f0b11
5 changed files with 125 additions and 1 deletions

View File

@@ -113,6 +113,7 @@
"OnlyLatestVersion": "仅最新版本",
"Os": "操作系统",
"Other": "其它",
"Hardware": "硬件信息",
"Password": "密码",
"PasswordWithoutSpecialCharHelpText": "不能包含特殊字符",
"Pending": "等待",
@@ -186,6 +187,7 @@
"Active": "激活中",
"actionsTips":"剪切板权限控制目前仅支持 RDP/VNC 协议的连接",
"Add": "添加",
"UpdateAssetDetail": "配置更多信息",
"AddSuccessMsg": "添加成功",
"Auth": "认证",
"BadRequestErrorMsg": "请求错误,请检查填写内容",

View File

@@ -58,6 +58,7 @@
"AdminUserDetail": "Admin user detail",
"AdminUserListHelpMessage": "Admin users are asset (charged server) on the root, or have NOPASSWD: ALL sudo permissions users, JumpServer users of the system using the user to `push system user`, `get assets hardware information`, etc.\n",
"Asset": "Asset",
"Hardware": "Hardware",
"AssetDetail": "Asset detail",
"AssetList": "Asset list",
"AssetListHelpMessage": "The left side is the asset tree, right click to create, delete, and change the tree node, authorization asset is also organized as a node, and the right side is the asset under that node\n",
@@ -186,6 +187,7 @@
"actionsTips":"Clipboard's copy and paste control only support RDP/VNC protocol.",
"Active": "Active",
"Add": "Add",
"UpdateAssetDetail": "Update more detail",
"AddSuccessMsg": "Add success",
"Auth": "Authorization",
"BadRequestErrorMsg": "Bad request, please check again",

View File

@@ -34,6 +34,13 @@ export default [
component: () => import('@/views/assets/Asset/AssetCreateUpdate.vue'),
meta: { title: i18n.t('route.AssetUpdate'), activeMenu: '/assets/assets' },
hidden: true
},
{
path: 'detail/:id/update',
name: 'AssetMoreInformationEdit',
component: () => import('@/views/assets/Asset/AssetMoreInformationEdit.vue'),
meta: { title: i18n.t('common.UpdateAssetDetail'), activeMenu: '/assets/assets' },
hidden: true
}
]
},

View File

@@ -136,7 +136,17 @@ export default {
const id = row.id
const url = `/api/v1/assets/assets/${id}/`
return this.$axios.delete(url)
}
},
extraActions: [
{
name: 'View',
title: this.$t(`common.UpdateAssetDetail`),
type: 'primary',
callback: function({ cellValue, tableData }) {
return this.$router.push({ name: 'AssetMoreInformationEdit', params: { id: cellValue }})
}
}
]
}
}
}

View File

@@ -0,0 +1,103 @@
<template>
<GenericCreateUpdatePage v-bind="$data" />
</template>
<script>
import GenericCreateUpdatePage from '@/layout/components/GenericCreateUpdatePage'
export default {
name: 'AssetMoreInformationEdit',
components: {
GenericCreateUpdatePage
},
data() {
const nodesInitial = []
if (this.$route.query['node']) {
nodesInitial.push(this.$route.query.node)
}
return {
initial: {
is_active: true,
platform: 'Linux',
protocols: ['ssh/22'],
nodes: nodesInitial
},
fields: [
[this.$t('common.Basic'), ['hostname', 'ip', 'platform']],
[this.$t('assets.Hardware'), ['vendor', 'model', 'cpu_model', 'memory', 'disk_info', 'disk_total']],
[this.$t('assets.Os'), ['sn', 'os', 'os_version', 'os_arch']]
],
fieldsMeta: {
platform: {
el: {
multiple: false,
ajax: {
url: '/api/v1/assets/platforms/',
transformOption: (item) => {
return { label: `${item.name}`, value: item.name }
}
}
}
},
vendor: {
el: {
type: `input`
}
},
model: {
el: {
type: `input`
}
},
cpu_model: {
el: {
type: `input`
}
},
memory: {
el: {
type: `input`
}
},
disk_info: {
el: {
type: `input`
}
},
disk_total: {
el: {
type: `input`
}
},
sn: {
el: {
type: `input`
}
},
os: {
el: {
type: `input`
}
},
os_version: {
el: {
type: `input`
}
},
os_arch: {
el: {
type: `input`
}
}
},
url: '/api/v1/assets/assets/',
updateSuccessNextRoute: { name: 'AssetList' },
createSuccessNextRoute: { name: 'AssetList' }
}
}
}
</script>
<style>
</style>