From c8f1f2f56615cb0d2cc892c76ad89eb5d4845a37 Mon Sep 17 00:00:00 2001 From: OrangeM21 Date: Thu, 21 May 2020 14:41:25 +0800 Subject: [PATCH] =?UTF-8?q?[fix]=E4=BF=AE=E8=B5=84=E4=BA=A7bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/i18n/langs/cn.json | 62 ++----------------- src/router/assets.js | 6 +- src/views/assets/AssetList/AssetList.vue | 17 ++--- .../AssetList/AssetListDetail/AssetList.vue | 32 +++------- .../AssetList/AssetListDetail/Detail.vue | 48 +++++++------- .../AssetList/AssetListDetail/index.vue | 10 +-- 6 files changed, 53 insertions(+), 122 deletions(-) diff --git a/src/i18n/langs/cn.json b/src/i18n/langs/cn.json index b3f4a33f4..f9bd94df9 100644 --- a/src/i18n/langs/cn.json +++ b/src/i18n/langs/cn.json @@ -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": "用户名", diff --git a/src/router/assets.js b/src/router/assets.js index 19ae7a6b9..75a19380d 100644 --- a/src/router/assets.js +++ b/src/router/assets.js @@ -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 }, { diff --git a/src/views/assets/AssetList/AssetList.vue b/src/views/assets/AssetList/AssetList.vue index 51c5c020b..a20b160fc 100644 --- a/src/views/assets/AssetList/AssetList.vue +++ b/src/views/assets/AssetList/AssetList.vue @@ -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 }) => { diff --git a/src/views/assets/AssetList/AssetListDetail/AssetList.vue b/src/views/assets/AssetList/AssetListDetail/AssetList.vue index 30cf58929..a6b1a5da7 100644 --- a/src/views/assets/AssetList/AssetListDetail/AssetList.vue +++ b/src/views/assets/AssetList/AssetListDetail/AssetList.vue @@ -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') - } } ] } diff --git a/src/views/assets/AssetList/AssetListDetail/Detail.vue b/src/views/assets/AssetList/AssetListDetail/Detail.vue index 5dac076e3..3dc83457b 100644 --- a/src/views/assets/AssetList/AssetListDetail/Detail.vue +++ b/src/views/assets/AssetList/AssetListDetail/Detail.vue @@ -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: { diff --git a/src/views/assets/AssetList/AssetListDetail/index.vue b/src/views/assets/AssetList/AssetListDetail/index.vue index 627aa2b16..336b7608b 100644 --- a/src/views/assets/AssetList/AssetListDetail/index.vue +++ b/src/views/assets/AssetList/AssetListDetail/index.vue @@ -9,7 +9,6 @@