mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-12 10:09:02 +08:00
fix: dashboard variables should properly load for imported dashboards (#5123)
Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
This commit is contained in:
parent
2145e353c8
commit
ac2dc44abb
@ -7,7 +7,7 @@ import dashboardVariablesQuery from 'api/dashboard/variables/dashboardVariablesQ
|
|||||||
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
|
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
|
||||||
import { commaValuesParser } from 'lib/dashbaordVariables/customCommaValuesParser';
|
import { commaValuesParser } from 'lib/dashbaordVariables/customCommaValuesParser';
|
||||||
import sortValues from 'lib/dashbaordVariables/sortVariableValues';
|
import sortValues from 'lib/dashbaordVariables/sortVariableValues';
|
||||||
import { debounce } from 'lodash-es';
|
import { debounce, isArray, isString } from 'lodash-es';
|
||||||
import map from 'lodash-es/map';
|
import map from 'lodash-es/map';
|
||||||
import { memo, useEffect, useMemo, useState } from 'react';
|
import { memo, useEffect, useMemo, useState } from 'react';
|
||||||
import { useQuery } from 'react-query';
|
import { useQuery } from 'react-query';
|
||||||
@ -108,10 +108,28 @@ function VariableItem({
|
|||||||
|
|
||||||
if (!areArraysEqual(newOptionsData, oldOptionsData)) {
|
if (!areArraysEqual(newOptionsData, oldOptionsData)) {
|
||||||
/* eslint-disable no-useless-escape */
|
/* eslint-disable no-useless-escape */
|
||||||
|
|
||||||
|
let valueNotInList = false;
|
||||||
|
|
||||||
|
if (isArray(variableData.selectedValue)) {
|
||||||
|
variableData.selectedValue.forEach((val) => {
|
||||||
|
const isUsed = newOptionsData.includes(val);
|
||||||
|
|
||||||
|
if (!isUsed) {
|
||||||
|
valueNotInList = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if (isString(variableData.selectedValue)) {
|
||||||
|
const isUsed = newOptionsData.includes(variableData.selectedValue);
|
||||||
|
|
||||||
|
if (!isUsed) {
|
||||||
|
valueNotInList = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (
|
if (
|
||||||
variableData.type === 'QUERY' &&
|
variableData.type === 'QUERY' &&
|
||||||
variableData.name &&
|
variableData.name &&
|
||||||
variablesToGetUpdated.includes(variableData.name)
|
(variablesToGetUpdated.includes(variableData.name) || valueNotInList)
|
||||||
) {
|
) {
|
||||||
let value = variableData.selectedValue;
|
let value = variableData.selectedValue;
|
||||||
let allSelected = false;
|
let allSelected = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user