This is an automated email from the ASF dual-hosted git repository.

juzhiyuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-apisix-dashboard.git


The following commit(s) were added to refs/heads/master by this push:
     new c3fba07  Fix some issues  (#81)
c3fba07 is described below

commit c3fba074a125195543606f5baf44f5431f7c6d2a
Author: 琚致远 <juzhiy...@apache.org>
AuthorDate: Sat Nov 30 14:51:50 2019 +0800

    Fix some issues  (#81)
    
    * expanded the width for SSL input
    
    * fix upstream node adding
    
    * fix upstream list sort
---
 src/views/schema/ssl/edit.vue      |  4 ++--
 src/views/schema/upstream/edit.vue |  7 +++++--
 src/views/schema/upstream/list.vue | 13 ++++++++-----
 3 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/src/views/schema/ssl/edit.vue b/src/views/schema/ssl/edit.vue
index 1084a93..09c30bf 100644
--- a/src/views/schema/ssl/edit.vue
+++ b/src/views/schema/ssl/edit.vue
@@ -180,10 +180,10 @@ export default class extends Vue {
   .el-form-item {
     .el-form-item__content {
       .el-input {
-        width: 220px;
+        width: 300px;
       }
       .el-textarea {
-        width: 220px;
+        width: 400px;
       }
     }
   }
diff --git a/src/views/schema/upstream/edit.vue 
b/src/views/schema/upstream/edit.vue
index eba61ab..53bc83f 100644
--- a/src/views/schema/upstream/edit.vue
+++ b/src/views/schema/upstream/edit.vue
@@ -100,7 +100,10 @@
             type="number"
           />
         </el-form-item>
-        <el-form-item>
+        <el-form-item
+          :rules="[{required: true}]"
+          :prop="'nodes.' + index + '.weights'"
+        >
           <el-input
             v-model="item.weights"
             placeholder="Weights"
@@ -317,7 +320,7 @@ export default class extends Vue {
     (this.form.nodes as any).push({
       ip: null,
       port: null,
-      weights: null
+      weights: 0
     })
   }
 
diff --git a/src/views/schema/upstream/list.vue 
b/src/views/schema/upstream/list.vue
index cad2d5f..efb91e8 100644
--- a/src/views/schema/upstream/list.vue
+++ b/src/views/schema/upstream/list.vue
@@ -40,7 +40,6 @@
       fit
       highlight-current-row
       style="width: 100%;"
-      :default-sort="{prop: 'id', order: 'descending'}"
       @sort-change="sortChange"
     >
       <el-table-column
@@ -177,16 +176,20 @@ export default class extends Vue {
 
     let tableData: any[] = []
     const arr = nodes.forEach((item: any) => {
-      Object.entries(item.nodes).forEach(([key, value]) => {
+      Object.entries(item.nodes).forEach(([ipWithPort, weights]) => {
+        // 释放 nodes
+        item.nodes = {}
         tableData = tableData.concat({
           ...item,
-          ip: key.split(':')[0],
-          port: key.split(':')[1],
-          weights: value
+          ip: ipWithPort.split(':')[0],
+          port: ipWithPort.split(':')[1],
+          weights
         })
       })
     })
 
+    tableData.sort((a, b) => b.id - a.id)
+
     this.tableData = tableData
     this.rowspan(0, 'id')
     this.rowspan(1, 'description')

Reply via email to