Skip to content

Commit

Permalink
Merge branch 'develop' into release/v0.48.x
Browse files Browse the repository at this point in the history
  • Loading branch information
prashant-shahi committed Jun 20, 2024
2 parents 5376410 + adfeaaa commit 6c192f1
Show file tree
Hide file tree
Showing 29 changed files with 258 additions and 256 deletions.
1 change: 1 addition & 0 deletions frontend/src/constants/panelTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,5 @@ export const getComponentForPanelType = (
export const AVAILABLE_EXPORT_PANEL_TYPES = [
PANEL_TYPES.TIME_SERIES,
PANEL_TYPES.TABLE,
PANEL_TYPES.LIST,
];
3 changes: 3 additions & 0 deletions frontend/src/container/GridCardLayout/GridCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ function GridCardGraph({
query: updatedQuery,
globalSelectedInterval,
variables: getDashboardVariables(variables),
fillGaps: widget.fillSpans,
};
}
updatedQuery.builder.queryData[0].pageSize = 10;
Expand All @@ -122,6 +123,7 @@ function GridCardGraph({
limit: updatedQuery.builder.queryData[0].limit || 0,
},
},
fillGaps: widget.fillSpans,
};
});

Expand Down Expand Up @@ -152,6 +154,7 @@ function GridCardGraph({
widget?.query,
widget?.panelTypes,
widget.timePreferance,
widget.fillSpans,
requestData,
],
retry(failureCount, error): boolean {
Expand Down
38 changes: 27 additions & 11 deletions frontend/src/container/LogsExplorerViews/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import { useNotifications } from 'hooks/useNotifications';
import useUrlQueryData from 'hooks/useUrlQueryData';
import { FlatLogData } from 'lib/logs/flatLogData';
import { getPaginationQueryData } from 'lib/newQueryBuilder/getPaginationQueryData';
import { defaultTo, isEmpty, omit } from 'lodash-es';
import { cloneDeep, defaultTo, isEmpty, omit, set } from 'lodash-es';
import { Sliders } from 'lucide-react';
import { SELECTED_VIEWS } from 'pages/LogsExplorer/utils';
import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
Expand Down Expand Up @@ -117,6 +117,12 @@ function LogsExplorerViews({
return stagedQuery.builder.queryData.find((item) => !item.disabled) || null;
}, [stagedQuery]);

const { options, config } = useOptionsMenu({
storageKey: LOCALSTORAGE.LOGS_LIST_OPTIONS,
dataSource: initialDataSource || DataSource.LOGS,
aggregateOperator: listQuery?.aggregateOperator || StringOperators.NOOP,
});

const orderByTimestamp: OrderByPayload | null = useMemo(() => {
const timestampOrderBy = listQuery?.orderBy.find(
(item) => item.columnName === 'timestamp',
Expand Down Expand Up @@ -174,10 +180,10 @@ function LogsExplorerViews({
() =>
updateAllQueriesOperators(
currentQuery || initialQueriesMap.logs,
PANEL_TYPES.TIME_SERIES,
selectedPanelType,
DataSource.LOGS,
),
[currentQuery, updateAllQueriesOperators],
[currentQuery, selectedPanelType, updateAllQueriesOperators],
);

const handleModeChange = (panelType: PANEL_TYPES): void => {
Expand Down Expand Up @@ -309,6 +315,14 @@ function LogsExplorerViews({
isLoading: isUpdateDashboardLoading,
} = useUpdateDashboard();

const getUpdatedQueryForExport = useCallback((): Query => {
const updatedQuery = cloneDeep(currentQuery);

set(updatedQuery, 'builder.queryData[0].pageSize', 10);

return updatedQuery;
}, [currentQuery]);

const handleExport = useCallback(
(dashboard: Dashboard | null): void => {
if (!dashboard || !panelType) return;
Expand All @@ -319,11 +333,17 @@ function LogsExplorerViews({

const widgetId = v4();

const query =
panelType === PANEL_TYPES.LIST
? getUpdatedQueryForExport()
: exportDefaultQuery;

const updatedDashboard = addEmptyWidgetInDashboardJSONWithQuery(
dashboard,
exportDefaultQuery,
query,
widgetId,
panelTypeParam,
options.selectColumns,
);

updateDashboard(updatedDashboard, {
Expand Down Expand Up @@ -353,7 +373,7 @@ function LogsExplorerViews({
}

const dashboardEditView = generateExportToDashboardLink({
query: exportDefaultQuery,
query,
panelType: panelTypeParam,
dashboardId: data.payload?.uuid || '',
widgetId,
Expand All @@ -365,7 +385,9 @@ function LogsExplorerViews({
});
},
[
getUpdatedQueryForExport,
exportDefaultQuery,
options.selectColumns,
history,
notifications,
panelType,
Expand Down Expand Up @@ -460,12 +482,6 @@ function LogsExplorerViews({
selectedView,
]);

const { options, config } = useOptionsMenu({
storageKey: LOCALSTORAGE.LOGS_LIST_OPTIONS,
dataSource: initialDataSource || DataSource.METRICS,
aggregateOperator: listQuery?.aggregateOperator || StringOperators.NOOP,
});

const chartData = useMemo(() => {
if (!stagedQuery) return [];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
height: 100%;

.resize-table {
height: calc(100% - 40px);
height: calc(100% - 70px);
overflow: scroll;
overflow-x: hidden;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ function DashboardVariableSelection(): JSX.Element | null {
}}
onValueUpdate={onValueUpdate}
variablesToGetUpdated={variablesToGetUpdated}
setVariablesToGetUpdated={setVariablesToGetUpdated}
/>
))}
</Row>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ describe('VariableItem', () => {
existingVariables={{}}
onValueUpdate={mockOnValueUpdate}
variablesToGetUpdated={[]}
setVariablesToGetUpdated={(): void => {}}
/>
</MockQueryClientProvider>,
);
Expand All @@ -69,6 +70,7 @@ describe('VariableItem', () => {
existingVariables={{}}
onValueUpdate={mockOnValueUpdate}
variablesToGetUpdated={[]}
setVariablesToGetUpdated={(): void => {}}
/>
</MockQueryClientProvider>,
);
Expand All @@ -83,6 +85,7 @@ describe('VariableItem', () => {
existingVariables={{}}
onValueUpdate={mockOnValueUpdate}
variablesToGetUpdated={[]}
setVariablesToGetUpdated={(): void => {}}
/>
</MockQueryClientProvider>,
);
Expand Down Expand Up @@ -111,6 +114,7 @@ describe('VariableItem', () => {
existingVariables={{}}
onValueUpdate={mockOnValueUpdate}
variablesToGetUpdated={[]}
setVariablesToGetUpdated={(): void => {}}
/>
</MockQueryClientProvider>,
);
Expand All @@ -134,6 +138,7 @@ describe('VariableItem', () => {
existingVariables={{}}
onValueUpdate={mockOnValueUpdate}
variablesToGetUpdated={[]}
setVariablesToGetUpdated={(): void => {}}
/>
</MockQueryClientProvider>,
);
Expand All @@ -149,6 +154,7 @@ describe('VariableItem', () => {
existingVariables={{}}
onValueUpdate={mockOnValueUpdate}
variablesToGetUpdated={[]}
setVariablesToGetUpdated={(): void => {}}
/>
</MockQueryClientProvider>,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ interface VariableItemProps {
allSelected: boolean,
) => void;
variablesToGetUpdated: string[];
setVariablesToGetUpdated: React.Dispatch<React.SetStateAction<string[]>>;
}

const getSelectValue = (
Expand All @@ -73,6 +74,7 @@ function VariableItem({
existingVariables,
onValueUpdate,
variablesToGetUpdated,
setVariablesToGetUpdated,
}: VariableItemProps): JSX.Element {
const [optionsData, setOptionsData] = useState<(string | number | boolean)[]>(
[],
Expand Down Expand Up @@ -171,6 +173,10 @@ function VariableItem({
}

setOptionsData(newOptionsData);
} else {
setVariablesToGetUpdated((prev) =>
prev.filter((name) => name !== variableData.name),
);
}
}
} catch (e) {
Expand Down
8 changes: 7 additions & 1 deletion frontend/src/container/NewWidget/LeftContainer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,16 @@ function LeftContainer({
globalSelectedInterval,
graphType: getGraphType(selectedGraph || selectedWidget.panelTypes),
query: stagedQuery,
fillGaps: selectedWidget.fillSpans || false,
}));
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [stagedQuery, selectedTime, globalSelectedInterval]);
}, [
stagedQuery,
selectedTime,
selectedWidget.fillSpans,
globalSelectedInterval,
]);

const queryResponse = useGetQueryRange(
requestData,
Expand Down
44 changes: 0 additions & 44 deletions frontend/src/container/NewWidget/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,50 +189,6 @@ export const panelTypeDataSourceFormValuesMap: Record<
},
},
},
[PANEL_TYPES.HISTOGRAM]: {
[DataSource.LOGS]: {
builder: {
queryData: [
'filters',
'aggregateOperator',
'aggregateAttribute',
'groupBy',
'limit',
'having',
'orderBy',
'functions',
],
},
},
[DataSource.METRICS]: {
builder: {
queryData: [
'filters',
'aggregateOperator',
'aggregateAttribute',
'groupBy',
'limit',
'having',
'orderBy',
'functions',
'spaceAggregation',
],
},
},
[DataSource.TRACES]: {
builder: {
queryData: [
'filters',
'aggregateOperator',
'aggregateAttribute',
'groupBy',
'limit',
'having',
'orderBy',
],
},
},
},
[PANEL_TYPES.TABLE]: {
[DataSource.LOGS]: {
builder: {
Expand Down
12 changes: 11 additions & 1 deletion frontend/src/container/TraceDetail/TraceDetails.styles.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
.span-details-sider {
padding-top: 16px;

::-webkit-scrollbar {
width: 0.2em;
}

::-webkit-scrollbar-track {
box-shadow: inset 0 0 6px rgba(18, 18, 18, 0.3);
}

&.dark {
.ant-layout-sider-trigger {
background-color: black !important;
background-color: #0b0c0e !important;
}
}

Expand Down
3 changes: 2 additions & 1 deletion frontend/src/container/TraceDetail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -246,13 +246,14 @@ function TraceDetail({ response }: TraceDetailProps): JSX.Element {

<Sider
className={cx('span-details-sider', isDarkMode ? 'dark' : 'light')}
style={{ background: isDarkMode ? '#000' : '#fff' }}
style={{ background: isDarkMode ? '#0b0c0e' : '#fff' }}
theme={isDarkMode ? 'dark' : 'light'}
collapsible
collapsed={collapsed}
reverseArrow
width={300}
collapsedWidth={40}
defaultCollapsed
onCollapse={(value): void => setCollapsed(value)}
>
{!collapsed && (
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/container/TracesExplorer/TracesView/configs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ColumnsType } from 'antd/es/table';
import ROUTES from 'constants/routes';
import { getMs } from 'container/Trace/Filters/Panel/PanelBody/Duration/util';
import { DEFAULT_PER_PAGE_OPTIONS } from 'hooks/queryPagination';
import { generatePath } from 'react-router-dom';
import { generatePath, Link } from 'react-router-dom';
import { ListItem } from 'types/api/widgets/getQuery';

export const PER_PAGE_OPTIONS: number[] = [10, ...DEFAULT_PER_PAGE_OPTIONS];
Expand Down Expand Up @@ -38,14 +38,14 @@ export const columns: ColumnsType<ListItem['data']> = [
dataIndex: 'traceID',
key: 'traceID',
render: (traceID: string): JSX.Element => (
<Typography.Link
href={generatePath(ROUTES.TRACE_DETAIL, {
<Link
to={generatePath(ROUTES.TRACE_DETAIL, {
id: traceID,
})}
data-testid="trace-id"
>
{traceID}
</Typography.Link>
</Link>
),
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
height: 100%;

.resize-table {
height: calc(100% - 40px);
height: calc(100% - 70px);
overflow: scroll;
overflow-x: hidden;

Expand Down
Loading

0 comments on commit 6c192f1

Please sign in to comment.