Skip to content

Commit 0e46371

Browse files
committed
StatsHouse UI: fix pack
show total and filled graph update total line dark theme remove dv param in single dash link create new dash
1 parent 0440d95 commit 0e46371

File tree

5 files changed

+10
-43
lines changed

5 files changed

+10
-43
lines changed

statshouse-ui/src/store2/helpers/getPlotLink.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ export function getPlotSingleLink(plotKey: PlotKey, params: QueryParams): string
8080
produce(params, (p) => {
8181
p.tabNum = plotKey;
8282
p.dashboardId = undefined;
83+
p.dashboardVersion = undefined;
8384
})
8485
)
8586
).toString()

statshouse-ui/src/store2/plotDataStore/changePlotParamForData.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { type PlotParams, type VariableParams } from 'url2';
1+
import { type PlotParams } from 'url2';
22
import { dequal } from 'dequal/lite';
3-
import { useVariableChangeStatusStore } from '../variableChangeStatusStore';
43

54
export function changePlotParamForData(plot?: PlotParams, prevPlot?: PlotParams) {
65
return (
@@ -16,6 +15,8 @@ export function changePlotParamForData(plot?: PlotParams, prevPlot?: PlotParams)
1615
plot.maxHost !== prevPlot.maxHost ||
1716
plot.backendVersion !== prevPlot.backendVersion ||
1817
plot.type !== prevPlot.type ||
19-
plot.prometheusCompat !== prevPlot.prometheusCompat
18+
plot.prometheusCompat !== prevPlot.prometheusCompat ||
19+
plot.totalLine !== prevPlot.totalLine ||
20+
plot.filledGraph !== prevPlot.filledGraph
2021
);
2122
}

statshouse-ui/src/store2/plotDataStore/normalizePlotData.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { calcYRange2 } from '../../common/calcYRange';
2121
import { getEmptyPlotData } from './getEmptyPlotData';
2222
import { deepClone } from '../../common/helpers';
2323
import { formatLegendValue, formatPercent, timeShiftToDash } from 'view/utils2';
24+
import { useThemeStore } from '../themeStore';
2425

2526
export function normalizePlotData(
2627
response: SeriesResponse,
@@ -44,7 +45,7 @@ export function normalizePlotData(
4445
let series_data = [...response.series.series_data];
4546
const totalLineId = plot.totalLine ? series_meta.length : null;
4647
const totalLineLabel = 'Total';
47-
const totalLineColor = '#333333';
48+
const totalLineColor = useThemeStore.getState().dark ? '#999999' : '#333333';
4849
const prefColor = '9'; // it`s magic prefix
4950
const usedDashes = {};
5051
const usedBaseColors = {};

statshouse-ui/src/store2/urlStore/urlStore.ts

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ export type UrlStore = {
7171
addDashboardGroup(groupKey: GroupKey): void;
7272
removeDashboardGroup(groupKey: GroupKey): void;
7373
setDashboardGroup(groupKey: GroupKey, next: ProduceUpdate<GroupInfo>): void;
74-
// moveDashboardPlot(index: PlotKey | null, indexTarget: PlotKey | null, indexGroup: GroupKey | null): void;
7574
setNextDashboardSchemePlot(nextScheme: { groupKey: GroupKey; plots: PlotKey[] }[]): void;
7675
autoSearchVariable(): Promise<Pick<QueryParams, 'variables' | 'orderVariables'>>;
7776
saveDashboard(): Promise<void>;
@@ -276,42 +275,6 @@ export const urlStore: StoreSlice<StatsHouseStore, UrlStore> = (setState, getSta
276275
setDashboardGroup(groupKey, next) {
277276
setUrlStore(updateGroup(groupKey, next));
278277
},
279-
// moveDashboardPlot(plotKey, plotKeyTarget, groupKey) {
280-
// if (plotKey != null && groupKey != null) {
281-
// setUrlStore(
282-
// updateParamsPlotStruct((plotStruct) => {
283-
// const sourceGroupKey = plotStruct.mapPlotToGroup[plotKey] ?? '';
284-
// const sourceGroupIndex = plotStruct.mapGroupIndex[sourceGroupKey];
285-
// const sourcePlotIndex = plotStruct.mapPlotIndex[plotKey];
286-
// const targetGroupIndex = plotStruct.mapGroupIndex[groupKey ?? sourceGroupKey];
287-
// let targetPlotIndex = plotStruct.mapPlotIndex[plotKeyTarget ?? plotKey];
288-
// if (sourceGroupIndex != null && sourcePlotIndex != null) {
289-
// const sourcePlots = plotStruct.groups[sourceGroupIndex].plots.splice(sourcePlotIndex, 1);
290-
// if (targetGroupIndex == null) {
291-
// plotStruct.groups.push({
292-
// plots: [...sourcePlots],
293-
// groupInfo: {
294-
// ...getNewGroup(),
295-
// id: groupKey,
296-
// },
297-
// });
298-
// } else {
299-
// if (targetPlotIndex) {
300-
// if (sourceGroupIndex === targetGroupIndex) {
301-
// targetPlotIndex = plotStruct.groups[targetGroupIndex].plots.findIndex(
302-
// ({ plotInfo }) => plotInfo.id === plotKeyTarget
303-
// );
304-
// }
305-
// plotStruct.groups[targetGroupIndex].plots.splice(targetPlotIndex, 0, ...sourcePlots);
306-
// } else {
307-
// plotStruct.groups[targetGroupIndex].plots.push(...sourcePlots);
308-
// }
309-
// }
310-
// }
311-
// })
312-
// );
313-
// }
314-
// },
315278
setNextDashboardSchemePlot(nextScheme) {
316279
setUrlStore(
317280
updateParamsPlotStruct((plotStruct) => {
@@ -358,6 +321,7 @@ export const urlStore: StoreSlice<StatsHouseStore, UrlStore> = (setState, getSta
358321
setUrlStore((store) => {
359322
store.saveParams = saveParams;
360323
store.params.dashboardVersion = saveParams.dashboardVersion;
324+
store.params.dashboardId = saveParams.dashboardId;
361325
});
362326
}
363327
},

statshouse-ui/src/url2/url.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ const params2: QueryParams = {
5757
};
5858

5959
describe('urlStore', () => {
60-
test.skip('urlEncode => urlDecode', () => {
60+
test('urlEncode => urlDecode', () => {
6161
expect(urlDecode(toTreeObj(arrToObj(urlEncode(params))), params)).toEqual(params);
6262
});
6363
test('urlEncode => urlDecode save', () => {
64-
// expect(urlDecode(toTreeObj(arrToObj(urlEncode(params2, params))), params)).toEqual(params2);
64+
expect(urlDecode(toTreeObj(arrToObj(urlEncode(params2, params))), params)).toEqual(params2);
6565
expect(urlDecode(toTreeObj(arrToObj(urlEncode(params, params2))), params2)).toEqual(params);
6666
});
6767
});

0 commit comments

Comments
 (0)