From cf53d261092a8ae4db4524352e33ebcc60f2ac44 Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Wed, 14 Aug 2019 03:53:15 +0530 Subject: [PATCH] resource table fixes and enhancements Signed-off-by: Rohit Yadav --- ui/src/components/CloudMonkey/Resource.vue | 79 ++++++++++++++++++---- ui/src/components/menu/SideMenu.vue | 1 - 2 files changed, 66 insertions(+), 14 deletions(-) diff --git a/ui/src/components/CloudMonkey/Resource.vue b/ui/src/components/CloudMonkey/Resource.vue index 05af44a2b7c..3211d1bf6b5 100644 --- a/ui/src/components/CloudMonkey/Resource.vue +++ b/ui/src/components/CloudMonkey/Resource.vue @@ -131,30 +131,30 @@ - - - -

{{ key }}: {{ value }}

-
+
+ + {{ text }} @@ -164,6 +164,15 @@ {{ text }} + + {{ text }} @@ -268,15 +277,17 @@ export default { if (!this.columnKeys.includes('name')) { this.columnKeys = ['name', ...this.columnKeys] } + var counter = 0 for (const key of this.columnKeys) { this.columns.push({ title: key, dataIndex: key, - key: key, + key: counter++, scopedSlots: { customRender: key }, sorter: (a, b) => a[key].length - b[key].length }) } + this.loading = true if (this.$route.params && this.$route.params.id) { params['id'] = this.$route.params.id @@ -423,6 +434,35 @@ export default { } }) }, + getRowClassName(record, index) { + if (index % 2 !== 0) { + return 'light-row' + } + return 'dark-row' + }, + getBadgeStatus(state) { + var status = "default" + switch (state) { + case "Running": + case "Ready": + case "Up": + case "BackedUp": + status = "success" + break + case "Stopped": + status = "error" + break + case "Migrating": + case "Starting": + status = "processing" + break + case "Alert": + case "Allocated": + status = "warning" + break + } + return status + }, start () { this.loading = true this.fetchData() @@ -439,6 +479,19 @@ export default { } - diff --git a/ui/src/components/menu/SideMenu.vue b/ui/src/components/menu/SideMenu.vue index f10121f82f4..b4aed5024bf 100644 --- a/ui/src/components/menu/SideMenu.vue +++ b/ui/src/components/menu/SideMenu.vue @@ -86,7 +86,6 @@ export default { .ant-menu-light { border-right-color: transparent; - padding: 24px 0; } } }