mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-07-29 00:32:01 +08:00

* fix: step size is made dynamic * test: get step test is added * chore: alerts step is updated * chore: query is updated * chore: provider query is updated * fix: user input is being take care of * chore: query builder step interval is updated * test: lib/getStep is updated * test: test for getStep is updated * fix: step interval is taken care when we change from top nav * chore: while saving the dashboard query is updated * chore: updated when selected widget is present * chore: getStep is now multiple of 60 and test is updated accordingly * chore: user input is overriden from global step --------- Co-authored-by: Vishal Sharma <makeavish786@gmail.com>
33 lines
810 B
TypeScript
33 lines
810 B
TypeScript
import getStartEndRangeTime from 'lib/getStartEndRangeTime';
|
|
import store from 'store';
|
|
|
|
export const getDashboardVariables = (): Record<string, unknown> => {
|
|
try {
|
|
const {
|
|
globalTime,
|
|
dashboards: { dashboards },
|
|
} = store.getState();
|
|
const [selectedDashboard] = dashboards || [];
|
|
const {
|
|
data: { variables = {} },
|
|
} = selectedDashboard;
|
|
|
|
const { start, end } = getStartEndRangeTime({
|
|
type: 'GLOBAL_TIME',
|
|
interval: globalTime.selectedTime,
|
|
});
|
|
|
|
const variablesTuple: Record<string, unknown> = {
|
|
SIGNOZ_START_TIME: parseInt(start, 10) * 1e3,
|
|
SIGNOZ_END_TIME: parseInt(end, 10) * 1e3,
|
|
};
|
|
Object.keys(variables).forEach((key) => {
|
|
variablesTuple[key] = variables[key].selectedValue;
|
|
});
|
|
return variablesTuple;
|
|
} catch (e) {
|
|
console.error(e);
|
|
}
|
|
return {};
|
|
};
|