[fix]修资产bug

This commit is contained in:
OrangeM21
2020-05-21 14:41:25 +08:00
parent 284c8a7155
commit c8f1f2f566
6 changed files with 53 additions and 122 deletions

View File

@@ -226,6 +226,7 @@
"assets": {
"Assets": "资产",
"Nodes": "节点",
"AssetList": "资产列表",
"SystemUsers": "系统用户",
"RemoteApps": "远程应用",
"Hostname": "主机名",
@@ -260,6 +261,7 @@
"SerialNumber": "序列号",
"AssetNumber": "资产编号",
"DateJoined": "创建日期",
"AssetDetail": "资产详情",
"QuickModify": "快速修改",
"Active": "激活中",
"RefreshHardware": "更新硬件信息",
@@ -316,7 +318,6 @@
"PlatformDetail": "平台详情",
"Charset": "编码",
"Meta": "元数据",
"hostname": "",
"ip": "IP",
"Role":"角色",
"Email": "邮件",
@@ -331,61 +332,10 @@
"UpdatePassword": "更改密码",
"UpdateSSHPublicKey":"更改SSH密钥",
"ResetPublicKeyAndDownload":"重置并下载SSH密钥",
"TestAssetsConnective": "",
"username": "",
"version": "",
"date_created": "",
"Replace node assets admin user with this": "",
"name": "",
"created_by": "",
"AdminUserDetail": "",
"detail": "",
"assetlist": "",
"assets": "",
"hardware": "",
"reachable": "",
"comment": "",
"date_updated": "",
"commandFilterDetail": "",
"commandFilterRules": "",
"type": "",
"content": "",
"priority": "",
"ruleaction": "",
"rules": "",
"systemUser": "",
"资产": "",
"网关": "",
"port": "",
"protocol": "",
"TestConnection": "",
"asset": "",
"gateway": "",
"value": "",
"BasePlatform": "",
"quick_update": "",
"auto_push": "",
"command_filter_list": "",
"PushSystemUserNow": "",
"login_mode_display": "",
"SystemUserDetail": "",
"loginMode": "",
"IP": "IP",
"SystemUser": "",
"is_active": "",
"protocols": "",
"public_ip": "",
"admin_user": "",
"domain": "",
"vendor": "",
"model": "",
"cpu_model": "",
"memory": "",
"disk_info": "",
"platform": "",
"os_arch": "",
"sn": "",
"number": ""
"TestAssetsConnective": "测试资产可连接性",
"PushSystemUserNow": "推送系统用户",
"Push": "推送",
"Node": "节点"
},
"audits": {
"username": "用户名",

View File

@@ -10,21 +10,21 @@ export default [
path: 'assets/create',
name: 'AssetCreate',
component: () => import('@/views/assets/AssetList/AssetCreateUpdate.vue'),
meta: { title: i18n.t('route.AssetCreate'), activeMenu: '/assets' },
meta: { title: i18n.t('route.AssetCreate'), activeMenu: '/assets/assets' },
hidden: true
},
{
path: 'assets/:id',
name: 'AssetDetail',
component: () => import('@/views/assets/AssetList/AssetListDetail/index.vue'),
meta: { title: i18n.t('route.AssetDetail'), activeMenu: '/assets' },
meta: { title: i18n.t('route.AssetDetail'), activeMenu: '/assets/assets' },
hidden: true
},
{
path: 'assets/:id/update',
name: 'AssetUpdate',
component: () => import('@/views/assets/AssetList/AssetCreateUpdate.vue'),
meta: { title: i18n.t('route.AssetUpdate'), activeMenu: '/assets' },
meta: { title: i18n.t('route.AssetUpdate'), activeMenu: '/assets/assets' },
hidden: true
},
{

View File

@@ -24,20 +24,10 @@ export default {
tableConfig: {
url: '/api/v1/assets/assets/',
hasTree: true,
tagSearch: [
{
label: this.$t('assets.hostname'),
key: 'hostname'
}, {
label: this.$t('assets.ip'),
key: 'ip'
}
],
columns: [
{
prop: 'hostname',
label: this.$t('assets.hostname'),
label: this.$t('assets.Hostname'),
formatter: DetailFormatter,
sortable: true,
route: 'AssetDetail'
@@ -49,17 +39,18 @@ export default {
},
{
prop: 'hardware_info',
label: this.$t('assets.hardware')
label: this.$t('assets.Hardware')
},
{
prop: 'reachable',
label: this.$t('assets.reachable'),
label: this.$t('assets.Reachable'),
formatter: BooleanFormatter
},
{
prop: 'id',
align: 'center',
formatter: ActionsFormatter,
label: this.$t('assets.Action'),
width: '200px',
actions: {
performDelete: ({ row, col }) => {

View File

@@ -33,14 +33,15 @@ export default {
title: this.$t('assets.TestAssetsConnective'),
attrs: {
type: 'primary',
label: this.$t('common.Test')
label: this.$t('assets.Test')
},
callbacks: {
click: function() {
this.$axios.post(
`api/v1/assets/system-users/${this.object.id}/tasks/`,
`api/v1/assets/asset-users/tasks/?asset_id=${this.object.id}&latest=1`,
{ action: 'test' }
).then(res => {
console.log(`/ops/celery/task/${res.task}/log/`)
window.open(`/ops/celery/task/${res.task}/log/`, '', 'width=900,height=600')
}
)
@@ -53,7 +54,7 @@ export default {
columns: [
{
prop: 'hostname',
label: this.$t('assets.hostname')
label: this.$t('assets.Hostname')
},
{
prop: 'ip',
@@ -61,45 +62,32 @@ export default {
},
{
prop: 'username',
label: this.$t('assets.username')
label: this.$t('assets.Username')
},
{
prop: 'version',
label: this.$t('assets.version')
label: this.$t('assets.Version')
},
{
prop: 'date_created',
label: this.$t('assets.date_created'),
label: this.$t('assets.DateJoined'),
formatter: DateFormatter
},
{
prop: 'id',
align: 'center',
label: this.$t('assets.Action'),
formatter: CustomActionsFormatter,
actions: {
extraActions: [
{
name: this.$t('common.delete'),
title: this.$t('common.delete'),
name: this.$t('common.Delete'),
title: this.$t('common.Delete'),
callback: (val) => {
this.$axios.delete(`/api/v1/assets/asset-users/${val.cellValue}/`).then(
this.$refs.ListTable.reloadTable()
)
}
},
{
name: this.$t('common.Test'),
title: this.$t('common.Test'),
callback: (val) => {
console.log('Test')
}
},
{
name: this.$t('common.Push'),
title: this.$t('common.Push'),
callback: (val) => {
console.log('Push')
}
}
]
}

View File

@@ -33,7 +33,7 @@ export default {
return {
quickActions: [
{
title: this.$t('assets.is_active'),
title: this.$t('assets.IsActive'),
type: 'switcher',
attrs: {
label: this.$t('common.Test'),
@@ -55,7 +55,7 @@ export default {
title: this.$t('assets.TestAssetsConnective'),
attrs: {
type: 'primary',
label: this.$t('common.Test')
label: this.$t('assets.Test')
},
callbacks: {
click: function() {
@@ -73,7 +73,7 @@ export default {
title: this.$t('assets.PushSystemUserNow'),
attrs: {
type: 'primary',
label: this.$t('common.Push')
label: this.$t('assets.Push')
},
callbacks: {
click: function() {
@@ -90,7 +90,7 @@ export default {
],
nodeReletionConfig: {
icon: 'fa-info',
title: this.$t('perms.Add node to this permission'),
title: this.$t('assets.Node'),
objectsAjax: {
url: '/api/v1/assets/nodes/',
processResults(data) {
@@ -142,7 +142,7 @@ export default {
detailCardItems() {
return [
{
key: this.$t('assets.hostname'),
key: this.$t('assets.Hostname'),
value: this.object.hostname
},
{
@@ -150,71 +150,71 @@ export default {
value: this.object.ip
},
{
key: this.$t('assets.protocols'),
key: this.$t('assets.Protocols'),
value: this.object.protocols
},
{
key: this.$t('assets.public_ip'),
key: this.$t('assets.PublicIp'),
value: this.object.public_ip
},
{
key: this.$t('assets.admin_user'),
key: this.$t('assets.AdminUser'),
value: this.object.admin_user
},
{
key: this.$t('assets.domain'),
key: this.$t('assets.Domain'),
value: this.object.domain
},
{
key: this.$t('assets.vendor'),
key: this.$t('assets.Vendor'),
value: this.object.vendor
},
{
key: this.$t('assets.model'),
key: this.$t('assets.Model'),
value: this.object.model
},
{
key: this.$t('assets.cpu_model'),
key: this.$t('assets.Cpu'),
value: this.object.cpu_model
},
{
key: this.$t('assets.memory'),
key: this.$t('assets.Memory'),
value: this.object.memory
},
{
key: this.$t('assets.disk_info'),
key: this.$t('assets.Disk'),
value: this.object.disk_info
},
{
key: this.$t('assets.platform'),
key: this.$t('assets.Platform'),
value: this.object.platform
},
{
key: this.$t('assets.os_arch'),
key: this.$t('assets.Os'),
value: this.object.os_arch
},
{
key: this.$t('assets.is_active'),
value: `this.object.is_active`
key: this.$t('assets.IsActive'),
value: this.object.is_active.toString()
},
{
key: this.$t('assets.sn'),
key: this.$t('assets.SerialNumber'),
value: this.object.sn
},
{
key: this.$t('assets.number'),
key: this.$t('assets.AssetNumber'),
value: this.object.number
},
{
key: this.$t('assets.date_created'),
key: this.$t('assets.DateJoined'),
value: toSafeLocalDateStr(this.object.date_created)
},
{
key: this.$t('assets.created_by'),
key: this.$t('assets.CreatedBy'),
value: this.object.created_by
},
{
key: this.$t('assets.comment'),
key: this.$t('assets.Comment'),
value: this.object.comment
}
]
@@ -222,7 +222,7 @@ export default {
},
mounted() {
console.log(this.object)
},
methods: {

View File

@@ -9,7 +9,6 @@
<script>
import { GenericDetailPage, TabPage } from '@/layout/components'
import Detail from './Detail.vue'
import AssetList from './AssetList.vue'
export default {
name: 'AssetListDetail',
@@ -27,15 +26,18 @@ export default {
activeMenu: 'Detail',
submenu: [
{
title: this.$t('assets.detail'),
title: this.$t('assets.AssetDetail'),
name: 'Detail'
},
{
title: this.$t('assets.assetlist'),
title: this.$t('assets.AssetList'),
name: 'AssetList'
}
],
hasRightSide: true
hasRightSide: true,
getObjectName: function(obj) {
return obj.hostname
}
}
}
}