mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-12 20:09:00 +08:00
refactor: added check for dashboard length (#2997)
Co-authored-by: Palash Gupta <palashgdev@gmail.com>
This commit is contained in:
parent
e3e0787459
commit
c0d10f0d88
@ -7,24 +7,27 @@ export const getDashboardVariables = (): Record<string, unknown> => {
|
||||
globalTime,
|
||||
dashboards: { dashboards },
|
||||
} = store.getState();
|
||||
const [selectedDashboard] = dashboards || [];
|
||||
const {
|
||||
data: { variables = {} },
|
||||
} = selectedDashboard;
|
||||
if (dashboards.length > 0) {
|
||||
const [selectedDashboard] = dashboards || [];
|
||||
const {
|
||||
data: { variables = {} },
|
||||
} = selectedDashboard;
|
||||
|
||||
const { start, end } = getStartEndRangeTime({
|
||||
type: 'GLOBAL_TIME',
|
||||
interval: globalTime.selectedTime,
|
||||
});
|
||||
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;
|
||||
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;
|
||||
}
|
||||
return {};
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user