diff --git a/ui/src/components/view/ListView.vue b/ui/src/components/view/ListView.vue
index 9d5cb00f0cd..d285d12a190 100644
--- a/ui/src/components/view/ListView.vue
+++ b/ui/src/components/view/ListView.vue
@@ -17,9 +17,9 @@
+
{{ text }}
{{ text }}
-
{{ text }}
@@ -29,8 +29,10 @@
{{ text }}
-
- source-nat
+
+
+ source-nat
+
{{ text }}
@@ -38,7 +40,12 @@
-
+
+ {{ text }}
+
+
+ {{ text }}
+
{{ text }}
{{ text }}
@@ -46,13 +53,18 @@
{{ text }}
+
+ {{ text }}
+
+
+ {{ text }}
+
+
+ {{ text }}
+
{{ text }}
-
-
- {{ text }}
-
diff --git a/ui/src/components/widgets/Console.vue b/ui/src/components/widgets/Console.vue
index 82071aca6a7..f52d39a354d 100644
--- a/ui/src/components/widgets/Console.vue
+++ b/ui/src/components/widgets/Console.vue
@@ -1,9 +1,9 @@
-
+
diff --git a/ui/src/config/section/compute.js b/ui/src/config/section/compute.js
index efa0ae69d48..0ed69a6903d 100644
--- a/ui/src/config/section/compute.js
+++ b/ui/src/config/section/compute.js
@@ -10,10 +10,13 @@ export default {
permission: [ 'listVirtualMachinesMetrics', 'listVirtualMachines' ],
resourceType: 'UserVm',
columns: [
- { 'name': (record) => { return record.displayname } }, 'state', 'instancename',
- { 'ipaddress': (record) => { return record.nic[0].ipaddress } },
- 'cpunumber', 'cpuused', 'cputotal', 'memoryintfreekbs', 'memorytotal',
- 'networkread', 'networkwrite', 'diskkbsread', 'diskkbswrite', 'diskiopstotal',
+ 'name', 'state', 'instancename', 'ipaddress', 'cpunumber', 'cpuused', 'cputotal',
+ { 'memoryused':
+ (record) => {
+ return record.memorykbs && record.memoryintfreekbs ? parseFloat(100.0 * (record.memorykbs - record.memoryintfreekbs) / record.memorykbs).toFixed(2) + '%' : '0.0%'
+ }
+ },
+ 'memorytotal', 'networkread', 'networkwrite', 'diskkbsread', 'diskkbswrite', 'diskiopstotal',
'account', 'zonename'
],
related: [{
diff --git a/ui/src/locales/en.json b/ui/src/locales/en.json
index 88c7193e769..e64b5760f5e 100644
--- a/ui/src/locales/en.json
+++ b/ui/src/locales/en.json
@@ -119,7 +119,7 @@
"cpuallocated": "CPU Allocated for VMs",
"cpuallocatedghz": "Allocated",
"cpumaxdeviation": "Deviation",
- "cpunumber": "# of CPU Cores",
+ "cpunumber": "CPU Cores",
"cpusockets": "The Number of CPU Sockets",
"cpuspeed": "CPU (in MHz)",
"cputotal": "Total",
@@ -939,4 +939,4 @@
"zoneId": "Zone",
"zoneid": "Zone",
"zonename": "Zone"
-}
\ No newline at end of file
+}
diff --git a/ui/src/views/AutogenView.vue b/ui/src/views/AutogenView.vue
index 8c7baf2f26f..a56b8b4f96f 100644
--- a/ui/src/views/AutogenView.vue
+++ b/ui/src/views/AutogenView.vue
@@ -313,14 +313,16 @@ export default {
})
}
- for (var key of this.columnKeys) {
- if (typeof key === 'object') {
- key = Object.keys(key)[0]
+ const customRender = {}
+ for (var columnKey of this.columnKeys) {
+ var key = columnKey
+ if (typeof columnKey === 'object') {
+ key = Object.keys(columnKey)[0]
+ customRender[key] = columnKey[key]
}
this.columns.push({
title: this.$t(key),
dataIndex: key,
- width: key === 'state' ? '8%' : '',
scopedSlots: { customRender: key },
sorter: (a, b) => String(a[key]).length - String(b[key]).length
})
@@ -358,6 +360,12 @@ export default {
}
for (let idx = 0; idx < this.items.length; idx++) {
this.items[idx]['key'] = idx
+ for (const key in customRender) {
+ const func = customRender[key]
+ if (func && typeof func === 'function') {
+ this.items[idx][key] = func(this.items[idx])
+ }
+ }
}
if (this.items.length > 0) {
this.resource = this.items[0]
@@ -399,10 +407,6 @@ export default {
closeAction () {
this.currentAction.loading = false
this.showAction = false
- if (this.currentAction.icon === 'delete') {
- this.currentAction = {}
- this.$router.go(-1)
- }
this.currentAction = {}
},
execAction (action) {
@@ -518,8 +522,6 @@ export default {
params['id'] = this.resource['id']
}
- const closeAction = this.closeAction
- const showError = this.$notification['error']
api(this.currentAction.api, params).then(json => {
for (const obj in json) {
if (obj.includes('response')) {
@@ -532,16 +534,20 @@ export default {
break
}
}
- closeAction()
- }).catch(function (error) {
- closeAction()
+ if (this.currentAction.icon === 'delete') {
+ this.$router.go(-1)
+ }
+ }).catch(error => {
console.log(error)
- showError({
+ this.$notification['error']({
message: 'Request Failed',
description: error.response.headers['x-description']
})
+ }).finally(f => {
+ this.closeAction()
})
+ // TODO: listen for notification success/fail and refresh
const fetchData = this.fetchData
setTimeout(function () {
fetchData()