Fine0830 commented on a change in pull request #488: URL: https://github.com/apache/skywalking-rocketbot-ui/pull/488#discussion_r637795236
########## File path: src/views/components/common/trace-detail-statistics-table.vue ########## @@ -0,0 +1,140 @@ +<!-- Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. --> +<template> + <div class="trace-detail-chart-table"> + <div class="rk-trace-t-loading" v-show="loading"> + <svg class="icon loading"> + <use xlink:href="#spinner"></use> + </svg> + </div> + <TraceContainer :tableData="tableData" :type="HeaderType"> + <div class="trace-tips" v-if="!tableData.length">{{ $t('noData') }}</div> + </TraceContainer> + </div> +</template> +<style lang="scss"> + .rk-tooltip-popper.trace-table-tooltip .rk-tooltip-inner { + max-width: 600px; + } + .trace-detail-chart-table { + position: relative; + min-height: 300px; + border-bottom: 1px solid #ccc; + } +</style> + +<script lang="ts"> + import { Vue, Component, Prop, Watch } from 'vue-property-decorator'; + import { Span, StatisticsSpan } from '@/types/trace'; + import TraceContainer from './trace-chart-table/trace-container.vue'; + import TraceUtil from '../trace/trace-util'; + /* eslint-disable */ + /* tslint:disable */ Review comment: Please delete this. ########## File path: src/views/components/trace/trace-detail.vue ########## @@ -39,7 +39,12 @@ limitations under the License. --> <use xlink:href="#review-list"></use> </svg> </div> - + <a class="rk-btn mr-5 sm r" :class="{ ghost: displayMode !== 'statistics' }" @click="displayMode = 'statistics'"> + <svg class="icon vm sm"> Review comment: Again, please use`<rk-icon icon="statistics-bulleted" />` ########## File path: src/views/components/common/trace-chart-table/trace-container.vue ########## @@ -15,57 +15,131 @@ limitations under the License. --> <template> <div class="trace"> - <div class="trace-header"> + <div class="trace-header" v-if="type === 'statistics'"> + <div :class="item.label" v-for="(item, index) in headerData" :key="index"> + {{ item.value }} + <span class="r cp" @click="sortStatistics(item.key)" :key="componentKey" v-if="item.key != 'endpointName'"> + <svg class="icon"> + <use xlink:href="#sort"></use> + </svg> + </span> + </div> + </div> + <div class="trace-header" v-else> <div class="method" :style="`width: ${method}px`"> <span class="r cp" ref="dragger"> - <svg - class="icon" - > + <svg class="icon"> <use xlink:href="#settings_ethernet"></use> </svg> </span> - {{ data[0].value }} + {{ headerData[0].value }} </div> - <div :class="item.label" v-for="(item, index) in data.slice(1)" :key="index"> + <div :class="item.label" v-for="(item, index) in headerData.slice(1)" :key="index"> {{ item.value }} </div> </div> <Item :method="method" v-for="(item, index) in tableData" :data="item" :key="'key' + index" :type="type" /> <slot></slot> </div> </template> -<script lang="js"> - import { ProfileConstant, TraceConstant } from './trace-constant'; - import Item from './trace-item'; +<script lang="ts"> + import { Vue, Component, Prop } from 'vue-property-decorator'; + import { ProfileConstant, TraceConstant, StatisticsConstant } from './trace-constant'; + import Item from './trace-item.vue'; - export default { - components: {Item}, - name: 'TraceContainer', - props: ['type', 'tableData'], - data() { - return { - method: 300, - }; - }, - created() { - this.data = this.type === 'profile' ? ProfileConstant : TraceConstant; + @Component({ + components: { + Item, }, - mounted() { - const drag = this.$refs.dragger; - drag.onmousedown = (event) => { - const diffX = event.clientX; - const copy = this.method; - document.onmousemove = (documentEvent) => { - const moveX = documentEvent.clientX - diffX; - this.method = copy + moveX; - }; - document.onmouseup = () => { - document.onmousemove = null; - document.onmouseup = null; + }) + + export default class TraceContainer extends Vue { + @Prop() + public tableData: any; + @Prop() + public type!: string; + + private headerData: Array<{ label: string; value: string; }>|undefined; + private method: number = 300; + private componentKey: number = 0; + private flag: boolean = true; + + public created(): void { + if ( this.type === 'profile' ) { + this.headerData = ProfileConstant; + } else if ( this.type === 'statistics' ) { + this.headerData = StatisticsConstant; + } else { + this.headerData = TraceConstant; + } + } + + public mounted(): void { + if (this.type === 'statistics') { Review comment: ```suggestion if (this.type === 'statistics') { return; } const drag: any = this.$refs.dragger; ...... ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
