Przeglądaj źródła

feat(汉化+ 链路检索 一条数据时 打开决策树+ 决策树收起优化)

liujing 7 miesięcy temu
rodzic
commit
9950afea86

+ 26 - 7
src/views/business-analysis/analysisDetail/components/Topo.vue

@@ -106,15 +106,33 @@ export default {
     change() {
       this.isFull = screenfull.isFullscreen // 更新全屏状态
     },
+    addCollapsedToThirdLevel(data, level = 1) {
+      if (level === 3) {
+        return {
+          ...data,
+          collapsed: true,
+          children: data.children && data.children.map(child => ({...child}))
+        };
+      }
+
+      if (data.children && data.children.length > 0) {
+        return {
+          ...data,
+          children: data.children.map(child => this.addCollapsedToThirdLevel(child, level + 1))
+        };
+      }
+
+      return {...data};
+    },
     initGraph(data, id) {
       function replaceIds(obj) {
         if (typeof obj === 'object' && obj!== null) {
-          if (obj.unique_id) {
-            let arr = obj.unique_id.split('-')
-            if (arr.length == 3) { // 设置展开还是收起状态
-              obj.collapsed = true
-            }
-          }
+          // if (obj.unique_id) {
+          //   let arr = obj.unique_id.split('-')
+          //   if (arr.length == 3) { // 设置展开还是收起状态
+          //     obj.collapsed = true
+          //   }
+          // }
           if (obj.hasOwnProperty('id') && obj.hasOwnProperty('unique_id') ) {
             let temp = ''
             temp = obj.id
@@ -538,7 +556,8 @@ export default {
       if (typeof onInit === 'function') {
         onInit(graph)
       }
-      graph.data(data)
+      const tempData = this.addCollapsedToThirdLevel(data)
+      graph.data(tempData)
       graph.render()
       // 让画布内容适应视口
       graph.fitView()

+ 18 - 16
src/views/latency/components/TopoTree.vue

@@ -111,8 +111,7 @@ export default {
       apm: require('../../../assets/apm.jpg'),
       iconDown: require('../../../assets/icon_down.png'),
       flag: false,
-      globalGraph: null,
-      max_depth: 0
+      globalGraph: null
     }
   },
   mounted() {
@@ -600,8 +599,7 @@ export default {
       if (typeof onInit === 'function') {
         onInit(graph)
       }
-      this.max_depth = data.max_depth
-      const tempData = this.setNodeCollapsed(data)
+      const tempData = this.addCollapsedToThirdLevel(data)
       graph.data(tempData)
       graph.render()
       // 让画布内容适应视口
@@ -1254,21 +1252,25 @@ export default {
         }
       }
     },
-    setNodeCollapsed(data) {
-      if (this.max_depth> 3) {
-        for (let i = 0 ; i < data.children.length; i ++) {
-          let item = data.children[i]
-          if (this.max_depth - item.max_depth + 1 == 3 ){
-            item.collapsed = true
-            continue
-          } else if (item.children && item.children.length > 0){
-            this.setNodeCollapsed(item)
-          }
-        }
+    addCollapsedToThirdLevel(data, level = 1) {
+      if (level === 3) {
+        return {
+          ...data,
+          collapsed: true,
+          children: data.children && data.children.map(child => ({...child}))
+        };
+      }
 
+      if (data.children && data.children.length > 0) {
+        return {
+          ...data,
+          children: data.children.map(child => this.addCollapsedToThirdLevel(child, level + 1))
+        };
       }
-      return data
+
+      return {...data};
     },
+
     clearGraph() {
       this.globalGraph.clear()
     }

+ 10 - 27
src/views/latency/index.vue

@@ -730,32 +730,6 @@
             </el-collapse>
           </div>
         </el-drawer>
-
-        <!-- <div v-if="num == 1" id="legend" class="legend" :style="{left:left}">
-          <el-card>
-            <div>
-              <h2>图例</h2>
-              <div class="listwrap">
-                <span class="value">
-                  <el-progress :percentage="100" status="success" :show-text="false" />
-                </span>
-                <span class="lable">请求正常</span>
-              </div>
-              <div class="listwrap">
-                <span class="value">
-                  <el-progress :percentage="100" status="warning" :show-text="false" />
-                </span>
-                <span class="lable">高延迟</span>
-              </div>
-              <div class="listwrap">
-                <span class="value">
-                  <el-progress :percentage="100" status="exception" :show-text="false" />
-                </span>
-                <span class="lable">存在异常</span>
-              </div>
-            </div>
-          </el-card>
-        </div> -->
       </el-card>
     </template>
   </BasicLayout>
@@ -1064,6 +1038,15 @@ export default {
           this.loading = false
           this.selectList = res.data.list
           this.total = res.data.count
+          if (this.selectList && this.selectList.length == 1) {
+            let row = this.selectList[0]
+            setTimeout(() => {
+              this.flag = true
+              this.tractID = row.trace_id
+              this.$refs.table.setCurrentRow(row);
+              this.getTraceDetail(row.trace_id, row.timestamp)
+            }, 0)
+          }
         }
       })
     },
@@ -1219,12 +1202,12 @@ export default {
       })
     },
     handleRowClick(row, column, event) {
+
       setTimeout(() => {
         this.flag = true
         this.tractID = row.trace_id
         this.$refs.table.toggleRowSelection(row)
         this.getTraceDetail(row.trace_id, row.timestamp)
-        // this.getTraceGraph(this.tractID);
       }, 0)
     },
     toggleTab(val) {

+ 4 - 4
src/views/service/InterfaceSublist/index.vue

@@ -169,7 +169,7 @@
           >
             <el-table-column v-if="colData[0].istrue" header-align="center" label="接口名" prop="name" align="center" :show-overflow-tooltip="true" />
             <el-table-column v-if="colData[1].istrue" header-align="center" label="服务名称" prop="service_name_cn" align="center" :show-overflow-tooltip="true" />
-            <el-table-column v-if="colData[2].istrue" header-align="center" label="Method" prop="method" align="center" :show-overflow-tooltip="true">
+            <el-table-column v-if="colData[2].istrue" header-align="center" label="方法" prop="method" align="center" :show-overflow-tooltip="true">
               <template slot-scope="scope">
                 <el-tag type="info">{{ scope.row.method }}</el-tag>
               </template>
@@ -187,7 +187,7 @@
                 </div>
               </template>
             </el-table-column>
-            <el-table-column v-if="colData[6].istrue" header-align="center" label="ErrRate" sortable prop="error_rate" align="right" :show-overflow-tooltip="true">
+            <el-table-column v-if="colData[6].istrue" header-align="center" label="错误率" sortable prop="error_rate" align="right" :show-overflow-tooltip="true">
               <template slot-scope="scope">
                 <span>{{ scope.row.error_rate == 0 ? 0 :(scope.row.error_rate*100).toFixed(2)+ '%' }}</span>
               </template>
@@ -343,11 +343,11 @@ export default {
       colData: [
         { title: '接口名', istrue: false },
         { title: '服务名称', istrue: false },
-        { title: 'Method', istrue: false },
+        { title: '方法', istrue: false },
         { title: 'URL', istrue: false },
         { title: '所属模块', istrue: false },
         { title: '请求总数', istrue: false },
-        { title: 'ErrRate', istrue: false },
+        { title: '错误率', istrue: false },
         { title: '业务概述', istrue: false },
         // { title: "延迟比例", istrue: false },
         { title: '中位延迟', istrue: false },

+ 2 - 3
src/views/service/service/index.vue

@@ -80,7 +80,7 @@
                 </div>
               </template>
             </el-table-column>
-            <el-table-column v-if="colData[5].istrue" header-align="center" label="errRate" sortable prop="error_rate" align="right" :show-overflow-tooltip="true">
+            <el-table-column v-if="colData[5].istrue" header-align="center" label="错误率" sortable prop="error_rate" align="right" :show-overflow-tooltip="true">
               <template slot-scope="scope">
                 <div :class="scope.row.error_rate==0?'table_bg':'table_bg_red'">
                   <!-- {{ scope.row.error_rate==0?scope.row.error_rate:Number(scope.row.error_rate).toFixed(2) }} -->
@@ -248,7 +248,6 @@ export default {
         // "kind",
         // "rpm",
         '请求总数',
-        // "errRate",
         '最大延迟(ms)',
         // "延迟比例",
         '中位延迟',
@@ -261,7 +260,7 @@ export default {
         { title: 'kind', istrue: false },
         { title: 'rpm', istrue: false },
         { title: '请求总数', istrue: false },
-        { title: 'errRate', istrue: false },
+        { title: '错误率', istrue: false },
         { title: '最大延迟(ms)', istrue: false },
         { title: 'avg(ms)', istrue: false },
         // { title: "延迟比例", istrue: false },