未验证 提交 6a1631d2 编写于 作者: Q Qiuxia Fan 提交者: GitHub

Bugfix: version8.0.0 (#311)

* feat: remove default config

* feat: add item in endpoint and instance topology

* fix: ReadLabeledMetricsValues labels

* fix: add yAxis data in heatmap
上级 b0e47262
...@@ -89,7 +89,7 @@ limitations under the License. --> ...@@ -89,7 +89,7 @@ limitations under the License. -->
.rk-sidebox-inner-fixed { .rk-sidebox-inner-fixed {
height: 100%; height: 100%;
padding: 0; padding: 0;
overflow: hidden; overflow: auto;
} }
.rk-sidebox-title { .rk-sidebox-title {
font-size: 16px; font-size: 16px;
......
...@@ -86,17 +86,12 @@ const mutations: MutationTree<State> = { ...@@ -86,17 +86,12 @@ const mutations: MutationTree<State> = {
state.group = index; state.group = index;
state.current = current; state.current = current;
}, },
[types.ADD_COMPS_GROUP](state: State, params: any) { [types.ADD_COMPS_GROUP](state: State, params: { type: string; name: string }) {
if (!params.name) { if (!params.name) {
return; return;
} }
const templates = state.allTemplates.filter((item: any) => item.type === 'DASHBOARD' && item.activated)[0] || {}; switch (params.type) {
const tree = JSON.parse(templates.configuration) || [];
const groupServiceTemp = tree.filter((item: any) => item.type === 'service')[0] || {};
const groupDatabaseTemp = tree.filter((item: any) => item.type === 'database')[0] || {};
switch (params.template) {
case 'metric': case 'metric':
const newTree = []; const newTree = [];
Object.keys(state.tree).forEach((i: any) => { Object.keys(state.tree).forEach((i: any) => {
...@@ -114,7 +109,7 @@ const mutations: MutationTree<State> = { ...@@ -114,7 +109,7 @@ const mutations: MutationTree<State> = {
name: params.name, name: params.name,
type: params.type, type: params.type,
query: {}, query: {},
children: groupServiceTemp.children || [], children: [{ name: 'demo', children: [] }],
}); });
state.tree = newServerTree; state.tree = newServerTree;
break; break;
...@@ -127,7 +122,7 @@ const mutations: MutationTree<State> = { ...@@ -127,7 +122,7 @@ const mutations: MutationTree<State> = {
name: params.name, name: params.name,
type: params.type, type: params.type,
query: {}, query: {},
children: groupDatabaseTemp.children || [], children: [{ name: 'demo', children: [] }],
}); });
state.tree = newDatabaseTree; state.tree = newDatabaseTree;
break; break;
......
...@@ -239,6 +239,30 @@ const mutations = { ...@@ -239,6 +239,30 @@ const mutations = {
state.topoInstances.splice(index, 1); state.topoInstances.splice(index, 1);
window.localStorage.setItem('topologyInstances', JSON.stringify(state.topoInstances)); window.localStorage.setItem('topologyInstances', JSON.stringify(state.topoInstances));
}, },
[types.ADD_TOPO_INSTANCE_COMP](state: State) {
const comp = {
width: 3,
title: 'Title',
height: 350,
entityType: 'ServiceInstance',
independentSelector: false,
metricType: 'UNKNOWN',
};
state.topoInstances.push(comp);
window.localStorage.setItem('topologyInstances', JSON.stringify(state.topoInstances));
},
[types.ADD_TOPO_ENDPOINT_COMP](state: State) {
const comp = {
width: 3,
title: 'Title',
height: 350,
entityType: 'Endpoint',
independentSelector: false,
metricType: 'UNKNOWN',
};
state.topoEndpoints.push(comp);
window.localStorage.setItem('topologyEndpoints', JSON.stringify(state.topoEndpoints));
},
}; };
// actions // actions
......
...@@ -94,6 +94,8 @@ export const EDIT_TOPO_INSTANCE_CONFIG = 'EDIT_TOPO_INSTANCE_CONFIG'; ...@@ -94,6 +94,8 @@ export const EDIT_TOPO_INSTANCE_CONFIG = 'EDIT_TOPO_INSTANCE_CONFIG';
export const EDIT_TOPO_ENDPOINT_CONFIG = 'EDIT_TOPO_ENDPOINT_CONFIG'; export const EDIT_TOPO_ENDPOINT_CONFIG = 'EDIT_TOPO_ENDPOINT_CONFIG';
export const DELETE_TOPO_INSTANCE = 'DELETE_TOPO_INSTANCE'; export const DELETE_TOPO_INSTANCE = 'DELETE_TOPO_INSTANCE';
export const DELETE_TOPO_ENDPOINT = 'DELETE_TOPO_ENDPOINT'; export const DELETE_TOPO_ENDPOINT = 'DELETE_TOPO_ENDPOINT';
export const ADD_TOPO_INSTANCE_COMP = 'ADD_TOPO_INSTANCE_COMP';
export const ADD_TOPO_ENDPOINT_COMP = 'ADD_TOPO_ENDPOINT_COMP';
// profile // profile
export const SET_TASK_OPTIONS = 'SET_TASK_OPTIONS'; export const SET_TASK_OPTIONS = 'SET_TASK_OPTIONS';
......
...@@ -28,6 +28,7 @@ limitations under the License. --> ...@@ -28,6 +28,7 @@ limitations under the License. -->
@Prop() private type!: string; @Prop() private type!: string;
@Prop() private data!: any; @Prop() private data!: any;
@Prop() private intervalTime!: any; @Prop() private intervalTime!: any;
@Prop() private item!: any;
public resize() { public resize() {
const chart: any = this.$refs.chart; const chart: any = this.$refs.chart;
chart.myChart.resize(); chart.myChart.resize();
...@@ -61,7 +62,7 @@ limitations under the License. --> ...@@ -61,7 +62,7 @@ limitations under the License. -->
return { return {
tooltip: { tooltip: {
position: 'top', position: 'top',
formatter: (a: any) => `${a.data[1] * 100}ms [ ${a.data[2]} ]`, formatter: (a: any) => `${a.data[1] * 100}${this.item.unit} [ ${a.data[2]} ]`,
textStyle: { textStyle: {
fontSize: 13, fontSize: 13,
}, },
...@@ -95,11 +96,12 @@ limitations under the License. --> ...@@ -95,11 +96,12 @@ limitations under the License. -->
}, },
], ],
yAxis: { yAxis: {
type: 'value', type: 'category',
axisLine: { show: false }, axisLine: { show: false },
axisTick: { show: false }, axisTick: { show: false },
splitLine: { lineStyle: { color: '#c1c5ca', type: 'dashed' } }, splitLine: { lineStyle: { color: '#c1c5ca', type: 'dashed' } },
axisLabel: { color: '#9da5b2', fontSize: '11', formatter: (a: number) => `${a * 100}ms` }, axisLabel: { color: '#9da5b2', fontSize: '11' },
data: this.data.buckets,
}, },
series: [ series: [
{ {
......
...@@ -144,9 +144,8 @@ limitations under the License. --> ...@@ -144,9 +144,8 @@ limitations under the License. -->
private chartValue(data: Array<{ metricName: string; [key: string]: any; config: any }>) { private chartValue(data: Array<{ metricName: string; [key: string]: any; config: any }>) {
this.chartSource = {}; this.chartSource = {};
for (const params of data) { for (const params of data) {
const { queryMetricType, aggregation, aggregationNum, metricLabels } = params.config; const { queryMetricType, aggregation, aggregationNum, metricLabels, labelsIndex } = params.config;
const resVal = params[queryMetricType]; const resVal = params[queryMetricType];
const labels = (metricLabels || '').split(',').map((item: string) => item.replace(/^\s*|\s*$/g, ''));
if (queryMetricType === QueryTypes.ReadMetricsValue) { if (queryMetricType === QueryTypes.ReadMetricsValue) {
this.chartSource = { this.chartSource = {
...@@ -190,22 +189,30 @@ limitations under the License. --> ...@@ -190,22 +189,30 @@ limitations under the License. -->
nodes.push(...grids); nodes.push(...grids);
}); });
let buckets = [] as any;
if (resVal.buckets.length) {
buckets = [resVal.buckets[0].min, ...resVal.buckets.map((item: { min: string; max: string }) => item.max)];
}
this.chartSource = { nodes }; // nodes: number[][] this.chartSource = { nodes, buckets }; // nodes: number[][]
} }
if (queryMetricType === QueryTypes.ReadLabeledMetricsValues) { if (queryMetricType === QueryTypes.ReadLabeledMetricsValues) {
const labels = (metricLabels || '').split(',').map((item: string) => item.replace(/^\s*|\s*$/g, ''));
const indexList = (labelsIndex || '').split(',').map((item: string) => item.replace(/^\s*|\s*$/g, ''));
this.chartSource = {}; this.chartSource = {};
(resVal || []).forEach((item: any, index: number) => { for (const item of resVal || []) {
const list = item.values.values.map((d: { value: number }) => const list = item.values.values.map((d: { value: number }) =>
this.aggregationValue({ data: d.value, type: aggregation, aggregationNum: Number(aggregationNum) }), this.aggregationValue({ data: d.value, type: aggregation, aggregationNum: Number(aggregationNum) }),
); );
if (labels[index]) { const indexNum = indexList.findIndex((d: string) => d === item.label);
this.chartSource[labels[index]] = list; // {[label: string]: number[]} if (labels[indexNum] && indexNum > -1) {
this.chartSource[labels[indexNum]] = list; // {[label: string]: number[]}
} else { } else {
this.chartSource[item.label] = list; this.chartSource[item.label] = list;
} }
}); }
} }
} }
} }
......
...@@ -46,9 +46,6 @@ limitations under the License. --> ...@@ -46,9 +46,6 @@ limitations under the License. -->
</select> </select>
<div class="sm grey mb-5 mr-10">{{ $t('templateName') }}</div> <div class="sm grey mb-5 mr-10">{{ $t('templateName') }}</div>
<input class="mb-5 rk-dashboard-group-input" type="text" v-model="name" /> <input class="mb-5 rk-dashboard-group-input" type="text" v-model="name" />
<div v-show="type === 'database'">
<label class="mb-10 dib"><input type="checkbox" v-model="template" />{{ $t('template') }}</label>
</div>
<a class="rk-btn r vm long tc confirm" @click="handleCreate">{{ $t('confirm') }}</a> <a class="rk-btn r vm long tc confirm" @click="handleCreate">{{ $t('confirm') }}</a>
</div> </div>
</a> </a>
...@@ -76,7 +73,6 @@ limitations under the License. --> ...@@ -76,7 +73,6 @@ limitations under the License. -->
private name: string = ''; private name: string = '';
private type: string = DASHBOARDTYPE.SERVICE; private type: string = DASHBOARDTYPE.SERVICE;
private show: boolean = false; private show: boolean = false;
private template: boolean = false;
private DASHBOARDTYPE = DASHBOARDTYPE; private DASHBOARDTYPE = DASHBOARDTYPE;
private get compType() { private get compType() {
...@@ -98,22 +94,8 @@ limitations under the License. --> ...@@ -98,22 +94,8 @@ limitations under the License. -->
this.show = false; this.show = false;
} }
private handleCreate() { private handleCreate() {
let template = DASHBOARDTYPE.METRIC; this.ADD_COMPS_GROUP({ name: this.name, type: this.type });
if (this.type === DASHBOARDTYPE.SERVICE) {
template = DASHBOARDTYPE.SERVICE;
}
if (this.type === DASHBOARDTYPE.METRIC) {
template = DASHBOARDTYPE.METRIC;
}
if (this.type === DASHBOARDTYPE.DATABASE) {
template = DASHBOARDTYPE.DATABASE;
if (!this.template) {
template = DASHBOARDTYPE.METRIC;
}
}
this.ADD_COMPS_GROUP({ name: this.name, type: this.type, template });
this.handleHide(); this.handleHide();
this.template = false;
} }
} }
</script> </script>
......
...@@ -24,13 +24,16 @@ limitations under the License. --> ...@@ -24,13 +24,16 @@ limitations under the License. -->
:type="'TOPOLOGY_ENDPOINT'" :type="'TOPOLOGY_ENDPOINT'"
:updateObjects="updateObjects" :updateObjects="updateObjects"
/> />
<div v-show="rocketGlobal.edit" class="rk-add-dashboard-item g-sm-3" @click="ADD_TOPO_ENDPOINT_COMP">
+ Add An Item
</div>
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts">
import Vue from 'vue'; import Vue from 'vue';
import { Component, Prop } from 'vue-property-decorator'; import { Component, Prop } from 'vue-property-decorator';
import { State } from 'vuex-class'; import { State, Mutation } from 'vuex-class';
import DashboardItem from '@/views/components/dashboard/dashboard-item.vue'; import DashboardItem from '@/views/components/dashboard/dashboard-item.vue';
@Component({ @Component({
...@@ -40,6 +43,7 @@ limitations under the License. --> ...@@ -40,6 +43,7 @@ limitations under the License. -->
}) })
export default class InstancesSurvey extends Vue { export default class InstancesSurvey extends Vue {
@State('rocketbot') private rocketGlobal: any; @State('rocketbot') private rocketGlobal: any;
@Mutation('rocketTopo/ADD_TOPO_ENDPOINT_COMP') private ADD_TOPO_ENDPOINT_COMP: any;
@Prop() private endpointComps: any; @Prop() private endpointComps: any;
@Prop() private updateObjects!: string; @Prop() private updateObjects!: string;
} }
......
...@@ -24,13 +24,16 @@ limitations under the License. --> ...@@ -24,13 +24,16 @@ limitations under the License. -->
:type="'TOPOLOGY_INSTANCE'" :type="'TOPOLOGY_INSTANCE'"
:updateObjects="updateObjects" :updateObjects="updateObjects"
/> />
<div v-show="rocketGlobal.edit" class="rk-add-dashboard-item g-sm-3" @click="ADD_TOPO_INSTANCE_COMP">
+ Add An Item
</div>
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts">
import Vue from 'vue'; import Vue from 'vue';
import { Component, Prop } from 'vue-property-decorator'; import { Component, Prop } from 'vue-property-decorator';
import { State } from 'vuex-class'; import { State, Mutation } from 'vuex-class';
import DashboardItem from '@/views/components/dashboard/dashboard-item.vue'; import DashboardItem from '@/views/components/dashboard/dashboard-item.vue';
@Component({ @Component({
...@@ -40,6 +43,7 @@ limitations under the License. --> ...@@ -40,6 +43,7 @@ limitations under the License. -->
}) })
export default class InstancesSurvey extends Vue { export default class InstancesSurvey extends Vue {
@State('rocketbot') private rocketGlobal: any; @State('rocketbot') private rocketGlobal: any;
@Mutation('rocketTopo/ADD_TOPO_INSTANCE_COMP') private ADD_TOPO_INSTANCE_COMP: any;
@Prop() private instanceComps: any; @Prop() private instanceComps: any;
@Prop() private updateObjects!: string; @Prop() private updateObjects!: string;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册