Skip to content
代码片段 群组 项目
提交 293746ff 编辑于 作者: Daniele Rossetti's avatar Daniele Rossetti
浏览文件

Tracing - Remove fixed boundaries from scatter chart

上级 f9c9c56b
No related branches found
No related tags found
无相关合并请求
...@@ -8,7 +8,6 @@ import UrlSync from '~/vue_shared/components/url_sync.vue'; ...@@ -8,7 +8,6 @@ import UrlSync from '~/vue_shared/components/url_sync.vue';
import { contentTop, isMetaClick } from '~/lib/utils/common_utils'; import { contentTop, isMetaClick } from '~/lib/utils/common_utils';
import { DEFAULT_DEBOUNCE_AND_THROTTLE_MS } from '~/lib/utils/constants'; import { DEFAULT_DEBOUNCE_AND_THROTTLE_MS } from '~/lib/utils/constants';
import { DEFAULT_SORTING_OPTION } from '~/observability/constants'; import { DEFAULT_SORTING_OPTION } from '~/observability/constants';
import { periodFilterToDate } from '../trace_utils';
import { import {
queryToFilterObj, queryToFilterObj,
filterObjToQuery, filterObjToQuery,
...@@ -47,8 +46,6 @@ export default { ...@@ -47,8 +46,6 @@ export default {
traces: [], traces: [],
filters: queryToFilterObj(filterQuery), filters: queryToFilterObj(filterQuery),
nextPageToken: null, nextPageToken: null,
chartRangeMin: null,
chartRangeMax: null,
highlightedTraceId: null, highlightedTraceId: null,
sortBy: sortBy || DEFAULT_SORTING_OPTION, sortBy: sortBy || DEFAULT_SORTING_OPTION,
}; };
...@@ -77,7 +74,7 @@ export default { ...@@ -77,7 +74,7 @@ export default {
this.fetchTraces(); this.fetchTraces();
}, },
methods: { methods: {
async fetchTraces({ skipUpdatingChartRange = false } = {}) { async fetchTraces() {
this.loading = true; this.loading = true;
try { try {
...@@ -90,12 +87,6 @@ export default { ...@@ -90,12 +87,6 @@ export default {
pageSize: PAGE_SIZE, pageSize: PAGE_SIZE,
sortBy: this.sortBy, sortBy: this.sortBy,
}); });
if (!skipUpdatingChartRange) {
const { min, max } = periodFilterToDate(this.filters);
this.chartRangeMax = max;
this.chartRangeMin = min;
}
this.traces = [...this.traces, ...traces]; this.traces = [...this.traces, ...traces];
if (nextPageToken) { if (nextPageToken) {
this.nextPageToken = nextPageToken; this.nextPageToken = nextPageToken;
...@@ -169,8 +160,6 @@ export default { ...@@ -169,8 +160,6 @@ export default {
/> />
<scatter-chart <scatter-chart
:height="$options.CHART_HEIGHT" :height="$options.CHART_HEIGHT"
:range-min="chartRangeMin"
:range-max="chartRangeMax"
:traces="traces" :traces="traces"
@chart-item-selected="chartItemSelected" @chart-item-selected="chartItemSelected"
@chart-item-over="debouncedChartItemOver" @chart-item-over="debouncedChartItemOver"
......
...@@ -3,7 +3,6 @@ import { nextTick } from 'vue'; ...@@ -3,7 +3,6 @@ import { nextTick } from 'vue';
import { filterObjToFilterToken } from 'ee/tracing/list/filter_bar/filters'; import { filterObjToFilterToken } from 'ee/tracing/list/filter_bar/filters';
import FilteredSearch from 'ee/tracing/list/filter_bar/tracing_filtered_search.vue'; import FilteredSearch from 'ee/tracing/list/filter_bar/tracing_filtered_search.vue';
import ScatterChart from 'ee/tracing/list/tracing_scatter_chart.vue'; import ScatterChart from 'ee/tracing/list/tracing_scatter_chart.vue';
import * as traceUtils from 'ee/tracing/trace_utils';
import TracingTableList from 'ee/tracing/list/tracing_table.vue'; import TracingTableList from 'ee/tracing/list/tracing_table.vue';
import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
import TracingList from 'ee/tracing/list/tracing_list.vue'; import TracingList from 'ee/tracing/list/tracing_list.vue';
...@@ -491,15 +490,7 @@ describe('TracingList', () => { ...@@ -491,15 +490,7 @@ describe('TracingList', () => {
}); });
describe('scatter chart', () => { describe('scatter chart', () => {
const mockPeriodFilter = (filter) =>
jest.spyOn(traceUtils, 'periodFilterToDate').mockReturnValue(filter);
beforeEach(async () => { beforeEach(async () => {
mockPeriodFilter({
min: new Date('2023-10-09 12:30:00'),
max: new Date('2023-10-09 15:30:00'),
});
await mountComponent(); await mountComponent();
wrapper.vm.$refs.tableList.$el.querySelector = jest wrapper.vm.$refs.tableList.$el.querySelector = jest
...@@ -513,34 +504,6 @@ describe('TracingList', () => { ...@@ -513,34 +504,6 @@ describe('TracingList', () => {
const chart = findScatterChart(); const chart = findScatterChart();
expect(chart.exists()).toBe(true); expect(chart.exists()).toBe(true);
expect(chart.props('traces')).toEqual(mockResponse.traces); expect(chart.props('traces')).toEqual(mockResponse.traces);
expect(chart.props('rangeMin')).toEqual(new Date('2023-10-09 12:30:00'));
expect(chart.props('rangeMax')).toEqual(new Date('2023-10-09 15:30:00'));
});
it('updates the chart boundaries when changing the filters', async () => {
mockPeriodFilter({
min: new Date('2023-01-01 00:00:00'),
max: new Date('2023-01-02 00:00:00'),
});
await setFilters({});
const chart = findScatterChart();
expect(chart.props('rangeMin')).toEqual(new Date('2023-01-01 00:00:00'));
expect(chart.props('rangeMax')).toEqual(new Date('2023-01-02 00:00:00'));
});
it('does not updates the chart boundaries when scrolling down', async () => {
mockPeriodFilter({
min: new Date('2023-01-01 00:00:00'),
max: new Date('2023-01-02 00:00:00'),
});
await bottomReached();
const chart = findScatterChart();
expect(chart.props('rangeMin')).toEqual(new Date('2023-10-09 12:30:00'));
expect(chart.props('rangeMax')).toEqual(new Date('2023-10-09 15:30:00'));
}); });
it('goes to the trace details page on item selection', () => { it('goes to the trace details page on item selection', () => {
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册