Compare commits

...

12 Commits

Author SHA1 Message Date
Shaheer Kochai
51e660d107 Merge branch 'main' into feat/add-auto-refresh-to-logs-explorer 2025-07-02 09:51:54 +04:30
ahmadshaheer
240740367b fix: fix the failing build by wrapping the logs explorer inside preferences context provider 2025-06-25 10:27:00 +04:30
Shaheer Kochai
db82c507f7 Merge branch 'main' into feat/add-auto-refresh-to-logs-explorer 2025-06-25 10:18:21 +04:30
ahmadshaheer
8eb714969d chore: remove the unnecessary useLocation search mock 2025-06-10 11:06:16 +04:30
ahmadshaheer
0b31259fcd chore: add test cases to check if autorefresh is present in all the views of logs explorer 2025-06-10 11:03:29 +04:30
ahmadshaheer
3463a52d8e chore: revert the changes out of scope of auto-refresh branch 2025-06-10 10:50:51 +04:30
ahmadshaheer
91ee3e3a3e chore: add test for auto refresh button in logs explorer 2025-06-10 10:46:27 +04:30
ahmadshaheer
ccc7290d88 feat: add auto refresh option in logs explorer toolbar 2025-06-10 10:46:27 +04:30
ahmadshaheer
135eda87f1 fix: fix the warning in logs chart by adding the missing date-time format option 2025-06-10 10:46:27 +04:30
ahmadshaheer
e3e4cb5856 fix: add optional chaining for filters in SpanScopeSelector to handle potential undefined values 2025-06-10 10:46:27 +04:30
ahmadshaheer
682c0db53d fix: add optional chaining for aggregateAttribute key check in Query component 2025-06-10 10:46:27 +04:30
ahmadshaheer
3d162dd992 fix: handle potential undefined values in groupBy calculation in TracesExplorer 2025-06-10 10:45:17 +04:30
2 changed files with 76 additions and 2 deletions

View File

@@ -22,7 +22,7 @@ const queryRangeURL = 'http://localhost/api/v3/query_range';
jest.mock('react-router-dom', () => ({
...jest.requireActual('react-router-dom'),
useLocation: (): { pathname: string } => ({
pathname: `${ROUTES.LOGS_EXPLORER}`,
pathname: ROUTES.LOGS_EXPLORER,
}),
}));
@@ -100,6 +100,24 @@ const logsQueryServerRequest = (): void =>
),
);
const checkAutoRefreshButtonsPresent = async (
getByRole: (role: string, options?: any) => HTMLElement,
): Promise<void> => {
await waitFor(() => {
expect(
getByRole('button', {
name: /sync/i,
}),
).toBeInTheDocument();
expect(
getByRole('button', {
name: /caret-down/i,
}),
).toBeInTheDocument();
});
};
describe('Logs Explorer Tests', () => {
test('Logs Explorer default view test without data', async () => {
const {
@@ -260,4 +278,60 @@ describe('Logs Explorer Tests', () => {
await fireEvent.click(histogramToggle);
expect(queryByText(frequencyChartContent)).not.toBeInTheDocument();
});
test.each([
{ panelType: PANEL_TYPES.LIST, viewName: 'list view' },
{ panelType: PANEL_TYPES.TIME_SERIES, viewName: 'time series view' },
{ panelType: PANEL_TYPES.TABLE, viewName: 'table view' },
])(
'check that auto refresh is present in $viewName',
async ({ panelType }) => {
const { getByRole } = render(
<QueryBuilderContext.Provider
value={{
isDefaultQuery: (): boolean => false,
currentQuery: {
...initialQueriesMap.logs,
builder: {
...initialQueriesMap.logs.builder,
queryData: [initialQueryBuilderFormValues],
},
},
setSupersetQuery: jest.fn(),
supersetQuery: initialQueriesMap.logs,
stagedQuery: initialQueriesMap.logs,
initialDataSource: null,
panelType,
isEnabledQuery: false,
lastUsedQuery: 0,
setLastUsedQuery: noop,
handleSetQueryData: noop,
handleSetFormulaData: noop,
handleSetQueryItemData: noop,
handleSetConfig: noop,
removeQueryBuilderEntityByIndex: noop,
removeQueryTypeItemByIndex: noop,
addNewBuilderQuery: noop,
cloneQuery: noop,
addNewFormula: noop,
addNewQueryItem: noop,
redirectWithQueryBuilderData: noop,
handleRunQuery: noop,
resetQuery: noop,
updateAllQueriesOperators: (): Query => initialQueriesMap.logs,
updateQueriesData: (): Query => initialQueriesMap.logs,
initQueryBuilderData: noop,
handleOnUnitsChange: noop,
isStagedQueryUpdated: (): boolean => false,
}}
>
<PreferenceContextProvider>
<LogsExplorer />
</PreferenceContextProvider>
</QueryBuilderContext.Provider>,
);
await checkAutoRefreshButtonsPresent(getByRole);
},
);
});

View File

@@ -248,7 +248,7 @@ function LogsExplorer(): JSX.Element {
)}
<section className={cx('log-module-right-section')}>
<Toolbar
showAutoRefresh={false}
showAutoRefresh
leftActions={
<LeftToolbarActions
showFilter={showFilters}