Skip to content

Commit

Permalink
Merged PR 2707: added params to getIncidentsbyConnection func
Browse files Browse the repository at this point in the history
- added params to getIncidentsbyConnection func
- fixed opening new tabs if tabs.length == limit
  • Loading branch information
Aleksy Lisowski authored and piotrczarnas committed Jun 6, 2024
2 parents 126d1db + c456035 commit f6f4dc1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
22 changes: 12 additions & 10 deletions dqops/src/main/frontend/src/components/IncidentsLayout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const IncidentsLayout = ({ route }: LayoutProps) => {
const history = useHistory();

const handleChange = (tab: TabOption) => {
console.log('tab', tab);
if (tab.url === window.location.pathname) {
return;
}
Expand All @@ -41,21 +42,22 @@ const IncidentsLayout = ({ route }: LayoutProps) => {
};

const closeTab = (value: string) => {
const tabIndex = pageTabs.findIndex((item) => item.url === value);
// console.log('tab', value);
// const tabIndex = pageTabs.findIndex((item) => item.url === value);
dispatch(closeFirstLevelTab(value));
if (pageTabs.length === 1) {
history.push(`/incidents`);
return;
}
if (tabIndex === 0 && pageTabs.length > 1) {
history.push(pageTabs[1]?.url);
dispatch(setActiveFirstLevelTab(pageTabs[1]?.url));
return;
}
history.push(pageTabs[tabIndex - 1]?.url || pageTabs[0]?.url);
dispatch(
setActiveFirstLevelTab(pageTabs[tabIndex - 1]?.url || pageTabs[0]?.url)
);
// if (tabIndex === 0 && pageTabs.length > 1) {
// history.push(pageTabs[1]?.url);
// dispatch(setActiveFirstLevelTab(pageTabs[1]?.url));
// return;
// }
// history.push(pageTabs[tabIndex - 1]?.url || pageTabs[0]?.url);
// dispatch(
// setActiveFirstLevelTab(pageTabs[tabIndex - 1]?.url || pageTabs[0]?.url)
// );
};

const tabOptions = useMemo(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ export const getIncidentsByConnection =
page = 1,
pageSize = 10,
optionalFilter = '',
dimension = undefined,
category = undefined,
sortBy = 'firstSeen',
sortDirection = 'desc'
}: IncidentFilter) =>
Expand All @@ -119,6 +121,8 @@ export const getIncidentsByConnection =
page,
pageSize,
optionalFilter,
dimension,
category,
sortBy,
sortDirection
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ export interface IncidentFilter {
page?: number;
pageSize?: number;
optionalFilter?: string;
dimension?: string;
category?: string;
sortBy?:
| 'table'
| 'tablePriority'
Expand Down

0 comments on commit f6f4dc1

Please sign in to comment.