You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by qi...@apache.org on 2021/04/29 07:01:17 UTC
[skywalking-rocketbot-ui] branch master updated: Support to
configure the maximum number of displayed items (#481)
This is an automated email from the ASF dual-hosted git repository.
qiuxiafan 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 283b2bb Support to configure the maximum number of displayed items (#481)
283b2bb is described below
commit 283b2bbc5d42687ec33d2376baa7fb77602cb9bc
Author: horber <de...@xdf.cn>
AuthorDate: Thu Apr 29 15:01:05 2021 +0800
Support to configure the maximum number of displayed items (#481)
* Support to configure the maximum number of displayed items
* set defaultVal '10' to maxItemNum
* Adjust the implementation of the 'setDefaultValue' method
Co-authored-by: Qiuxia Fan <fi...@outlook.com>
---
src/assets/lang/en.ts | 1 +
src/assets/lang/zh.ts | 1 +
.../modules/dashboard/dashboard-data-query.ts | 4 +--
.../components/dashboard/charts/chart-edit.vue | 30 +++++++++++++++++++++-
src/views/components/trace/trace-search.vue | 2 ++
5 files changed, 35 insertions(+), 3 deletions(-)
diff --git a/src/assets/lang/en.ts b/src/assets/lang/en.ts
index a218839..442ff73 100644
--- a/src/assets/lang/en.ts
+++ b/src/assets/lang/en.ts
@@ -150,6 +150,7 @@ const m = {
timeTips: 'Time interval cannot exceed 60 days',
standardAPM: 'Standard',
entityType: 'Entity type',
+ maxItemNum: 'Max number of Item',
independentSelector: 'Selectors',
unknownMetrics: 'Unknown Metrics',
labels: 'Labels',
diff --git a/src/assets/lang/zh.ts b/src/assets/lang/zh.ts
index 9901404..d206aa0 100644
--- a/src/assets/lang/zh.ts
+++ b/src/assets/lang/zh.ts
@@ -150,6 +150,7 @@ const m = {
timeTips: '时间区间不能超过60天',
standardAPM: '标准APM',
entityType: '实体类型',
+ maxItemNum: '最多条目数',
independentSelector: '独立选择器',
unknownMetrics: '未知指标',
labels: '标签',
diff --git a/src/store/modules/dashboard/dashboard-data-query.ts b/src/store/modules/dashboard/dashboard-data-query.ts
index 0cbac5e..5394335 100644
--- a/src/store/modules/dashboard/dashboard-data-query.ts
+++ b/src/store/modules/dashboard/dashboard-data-query.ts
@@ -80,7 +80,7 @@ const actions: ActionTree<State, any> = {
parentService: null,
normal: true,
scope: config.entityType,
- topN: 10,
+ topN: Number(config.maxItemNum) || 10,
order: config.sortOrder || 'DES',
},
}
@@ -109,7 +109,7 @@ const actions: ActionTree<State, any> = {
parentService: config.parentService ? parentService : null,
normal,
scope: normal ? config.entityType : config.parentService ? 'Service' : config.entityType,
- topN: 10,
+ topN: Number(config.maxItemNum) || 10,
order: config.sortOrder || 'DES',
},
};
diff --git a/src/views/components/dashboard/charts/chart-edit.vue b/src/views/components/dashboard/charts/chart-edit.vue
index b4ce9a4..2254416 100755
--- a/src/views/components/dashboard/charts/chart-edit.vue
+++ b/src/views/components/dashboard/charts/chart-edit.vue
@@ -226,6 +226,16 @@ limitations under the License. -->
@change="setItemConfig({ type: 'height', value: $event.target.value })"
/>
</div>
+ <div class="flex-h mb-5" v-show="!isChartType">
+ <div class="title grey sm">{{ $t('maxItemNum') }}:</div>
+ <input
+ type="number"
+ min="1"
+ class="rk-chart-edit-input long"
+ :value="itemConfig.maxItemNum"
+ @change="setItemConfig({ type: 'maxItemNum', value: $event.target.value })"
+ />
+ </div>
<div class="flex-h mb-5">
<div class="title grey sm">{{ $t('aggregation') }}:</div>
<select
@@ -318,6 +328,9 @@ limitations under the License. -->
@Prop() private intervalTime!: any;
@Prop() private type!: string;
private itemConfig: any = {};
+ private itemConfigDefault: any = {
+ maxItemNum: '10',
+ };
private EntityType = EntityType;
private IndependentType = IndependentType;
private CalculationType = CalculationType;
@@ -336,7 +349,7 @@ limitations under the License. -->
private ChartTable = 'ChartTable';
private created() {
- this.itemConfig = this.item;
+ this.setDefaultValue((this.itemConfig = this.item));
this.initConfig();
if (!this.itemConfig.independentSelector || this.pageTypes.includes(this.type)) {
return;
@@ -344,6 +357,21 @@ limitations under the License. -->
this.setItemServices();
}
+ private setDefaultValue(itemConfig: any) {
+ const currentKeys: string[] = Object.keys(itemConfig);
+ const defaultKeys: string[] = Object.keys(this.itemConfigDefault);
+
+ if (!currentKeys.length || !defaultKeys.length) {
+ return;
+ }
+
+ defaultKeys.forEach((key: string) => {
+ if (!currentKeys.includes(key)) {
+ itemConfig[key] = this.itemConfigDefault[key];
+ }
+ });
+ }
+
private initConfig() {
this.isDatabase = this.pageTypes.includes(this.type)
? false
diff --git a/src/views/components/trace/trace-search.vue b/src/views/components/trace/trace-search.vue
index 75d8de4..79ea57b 100644
--- a/src/views/components/trace/trace-search.vue
+++ b/src/views/components/trace/trace-search.vue
@@ -221,8 +221,10 @@ limitations under the License. -->
temp.traceId = this.traceId;
}
localStorage.setItem('traceId', this.traceId);
+
temp.tags = this.tagsMap;
localStorage.setItem('traceTags', JSON.stringify(this.tagsList));
+
this.SET_TRACE_FORM(temp);
this.$eventBus.$emit('SET_LOADING_TRUE', () => {
this.GET_TRACELIST().then(() => {