mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-13 20:35:56 +08:00
fix: update saving column to storage (#3069)
This commit is contained in:
parent
f18b073810
commit
532ebdc856
@ -6,5 +6,6 @@ export enum LOCALSTORAGE {
|
|||||||
THEME = 'THEME',
|
THEME = 'THEME',
|
||||||
LOGS_VIEW_MODE = 'LOGS_VIEW_MODE',
|
LOGS_VIEW_MODE = 'LOGS_VIEW_MODE',
|
||||||
LOGS_LINES_PER_ROW = 'LOGS_LINES_PER_ROW',
|
LOGS_LINES_PER_ROW = 'LOGS_LINES_PER_ROW',
|
||||||
LIST_OPTIONS = 'LIST_OPTIONS',
|
LOGS_LIST_OPTIONS = 'LOGS_LIST_OPTIONS',
|
||||||
|
TRACES_LIST_OPTIONS = 'TRACES_LIST_OPTIONS',
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ import { Card, Typography } from 'antd';
|
|||||||
import ListLogView from 'components/Logs/ListLogView';
|
import ListLogView from 'components/Logs/ListLogView';
|
||||||
import RawLogView from 'components/Logs/RawLogView';
|
import RawLogView from 'components/Logs/RawLogView';
|
||||||
import Spinner from 'components/Spinner';
|
import Spinner from 'components/Spinner';
|
||||||
|
import { LOCALSTORAGE } from 'constants/localStorage';
|
||||||
import ExplorerControlPanel from 'container/ExplorerControlPanel';
|
import ExplorerControlPanel from 'container/ExplorerControlPanel';
|
||||||
import { Heading } from 'container/LogsTable/styles';
|
import { Heading } from 'container/LogsTable/styles';
|
||||||
import { useOptionsMenu } from 'container/OptionsMenu';
|
import { useOptionsMenu } from 'container/OptionsMenu';
|
||||||
@ -35,6 +36,7 @@ function LogsExplorerList({
|
|||||||
const { initialDataSource } = useQueryBuilder();
|
const { initialDataSource } = useQueryBuilder();
|
||||||
|
|
||||||
const { options, config } = useOptionsMenu({
|
const { options, config } = useOptionsMenu({
|
||||||
|
storageKey: LOCALSTORAGE.LOGS_LIST_OPTIONS,
|
||||||
dataSource: initialDataSource || DataSource.METRICS,
|
dataSource: initialDataSource || DataSource.METRICS,
|
||||||
aggregateOperator:
|
aggregateOperator:
|
||||||
currentStagedQueryData?.aggregateOperator || StringOperators.NOOP,
|
currentStagedQueryData?.aggregateOperator || StringOperators.NOOP,
|
||||||
|
@ -24,6 +24,7 @@ interface UseOptionsMenuProps {
|
|||||||
dataSource: DataSource;
|
dataSource: DataSource;
|
||||||
aggregateOperator: string;
|
aggregateOperator: string;
|
||||||
initialOptions?: InitialOptions;
|
initialOptions?: InitialOptions;
|
||||||
|
storageKey: LOCALSTORAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface UseOptionsMenu {
|
interface UseOptionsMenu {
|
||||||
@ -32,6 +33,7 @@ interface UseOptionsMenu {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const useOptionsMenu = ({
|
const useOptionsMenu = ({
|
||||||
|
storageKey,
|
||||||
dataSource,
|
dataSource,
|
||||||
aggregateOperator,
|
aggregateOperator,
|
||||||
initialOptions = {},
|
initialOptions = {},
|
||||||
@ -42,8 +44,9 @@ const useOptionsMenu = ({
|
|||||||
const [isFocused, setIsFocused] = useState<boolean>(false);
|
const [isFocused, setIsFocused] = useState<boolean>(false);
|
||||||
const debouncedSearchText = useDebounce(searchText, 300);
|
const debouncedSearchText = useDebounce(searchText, 300);
|
||||||
|
|
||||||
const localStorageOptionsQuery = getFromLocalstorage(
|
const localStorageOptionsQuery = useMemo(
|
||||||
LOCALSTORAGE.LIST_OPTIONS,
|
() => getFromLocalstorage(storageKey),
|
||||||
|
[storageKey],
|
||||||
);
|
);
|
||||||
|
|
||||||
const initialQueryParams = useMemo(
|
const initialQueryParams = useMemo(
|
||||||
@ -157,9 +160,9 @@ const useOptionsMenu = ({
|
|||||||
(newQueryData: OptionsQuery) => {
|
(newQueryData: OptionsQuery) => {
|
||||||
redirectWithOptionsData(newQueryData);
|
redirectWithOptionsData(newQueryData);
|
||||||
|
|
||||||
setToLocalstorage(LOCALSTORAGE.LIST_OPTIONS, JSON.stringify(newQueryData));
|
setToLocalstorage(storageKey, JSON.stringify(newQueryData));
|
||||||
},
|
},
|
||||||
[redirectWithOptionsData],
|
[storageKey, redirectWithOptionsData],
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleSelectColumns = useCallback(
|
const handleSelectColumns = useCallback(
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { ResizeTable } from 'components/ResizeTable';
|
import { ResizeTable } from 'components/ResizeTable';
|
||||||
|
import { LOCALSTORAGE } from 'constants/localStorage';
|
||||||
import { initialQueriesMap, PANEL_TYPES } from 'constants/queryBuilder';
|
import { initialQueriesMap, PANEL_TYPES } from 'constants/queryBuilder';
|
||||||
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
|
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
|
||||||
import { useOptionsMenu } from 'container/OptionsMenu';
|
import { useOptionsMenu } from 'container/OptionsMenu';
|
||||||
@ -28,6 +29,7 @@ function ListView(): JSX.Element {
|
|||||||
>((state) => state.globalTime);
|
>((state) => state.globalTime);
|
||||||
|
|
||||||
const { options, config } = useOptionsMenu({
|
const { options, config } = useOptionsMenu({
|
||||||
|
storageKey: LOCALSTORAGE.TRACES_LIST_OPTIONS,
|
||||||
dataSource: DataSource.TRACES,
|
dataSource: DataSource.TRACES,
|
||||||
aggregateOperator: 'count',
|
aggregateOperator: 'count',
|
||||||
initialOptions: {
|
initialOptions: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user