This is an automated email from the ASF dual-hosted git repository. wusheng pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/skywalking-rocketbot-ui.git
The following commit(s) were added to refs/heads/master by this push: new 76c7d02 fix: set defalut selector (#401) 76c7d02 is described below commit 76c7d0204b2fae6a69d6154ccc052fe69a6cdf67 Author: Qiuxia Fan <fine0...@outlook.com> AuthorDate: Sat Dec 12 15:40:08 2020 +0800 fix: set defalut selector (#401) --- src/views/components/topology/topo-services.vue | 30 ++++++++++++------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/src/views/components/topology/topo-services.vue b/src/views/components/topology/topo-services.vue index 8193af9..7a28770 100644 --- a/src/views/components/topology/topo-services.vue +++ b/src/views/components/topology/topo-services.vue @@ -68,7 +68,7 @@ limitations under the License. --> this.group = this.groups[0]; this.services = json; this.currentServices = this.currentServiceList; - this.service = this.currentServiceList.length > 1 ? this.currentServices[1] : this.currentServices[0]; + this.service = this.currentServices[0]; this.renderTopo(); }, ); @@ -83,19 +83,14 @@ limitations under the License. --> duration: this.durationTime, }); } else { - const serviceIds = this.group.key ? this.currentServices.map((item) => item.key) : undefined; - - this.GET_TOPO({ - serviceIds, - duration: this.durationTime, - }); + this.getServicesTopo(); } } private changeGroup(i: { key: string; label: string }) { this.group = i; this.currentServices = this.currentServiceList; - this.service = this.currentServiceList.length > 1 ? this.currentServices[1] : this.currentServices[0]; + this.service = this.currentServices[0]; this.GET_TOPO({ serviceId: this.service.key, duration: this.durationTime, @@ -107,19 +102,22 @@ limitations under the License. --> if (groups) { const jsonGroup = JSON.parse(groups); if (!jsonGroup.length) { - this.GET_TOPO({ - serviceId: this.service.key, - duration: this.durationTime, - }); + this.getServicesTopo(); } } else { - this.GET_TOPO({ - serviceId: this.service.key, - duration: this.durationTime, - }); + this.getServicesTopo(); } } + private getServicesTopo() { + const serviceIds = this.group.key ? this.currentServices.map((item) => item.key) : undefined; + + this.GET_TOPO({ + serviceIds, + duration: this.durationTime, + }); + } + @Watch('durationTime') private watchDurationTime(newValue: DurationTime, oldValue: DurationTime) { // Avoid repeating fetchData() after enter the component for the first time.