Skip to content

Commit

Permalink
fix: Group sets fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
beygorghor authored Dec 9, 2024
2 parents cb4d8b4 + ce0b2d6 commit 24ec655
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
11 changes: 6 additions & 5 deletions hat/assets/js/apps/Iaso/domains/orgUnits/groupSets/config.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import React, { useMemo } from 'react';
import { Column, IconButton, useSafeIntl } from 'bluesquare-components';
import { Chip } from '@mui/material';
import { makeStyles } from '@mui/styles';
import { Column, IconButton, useSafeIntl } from 'bluesquare-components';
import React, { useMemo } from 'react';
import { DateTimeCell } from '../../../components/Cells/DateTimeCell';
import MESSAGES from './messages';
import { baseUrls } from '../../../constants/urls';
import { DisplayIfUserHasPerm } from '../../../components/DisplayIfUserHasPerm';
import { baseUrls } from '../../../constants/urls';
import MESSAGES from './messages';

import * as Permission from '../../../utils/permissions';
import DeleteDialog from '../../../components/dialogs/DeleteDialogComponent';
import * as Permission from '../../../utils/permissions';

export const baseUrl = baseUrls.groupSets;

Expand Down Expand Up @@ -51,6 +51,7 @@ export const useGroupSetsTableColumns = (deleteGroupSet): Column[] => {
className={classes.groupChip}
label={g.name}
color="primary"
key={g.id}
/>
))}
</span>
Expand Down
15 changes: 5 additions & 10 deletions hat/assets/js/apps/Iaso/domains/orgUnits/groupSets/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ import { makeStyles } from '@mui/styles';
import {
AddButton as AddButtonComponent,
commonStyles,
Table,
useRedirectTo,
useSafeIntl,
useSafeIntl
} from 'bluesquare-components';
import React from 'react';
import { useNavigate } from 'react-router-dom';
import TopBar from '../../../components/nav/TopBarComponent';
import { TableWithDeepLink } from '../../../components/tables/TableWithDeepLink';
import { baseUrls } from '../../../constants/urls';
import { useParamsObject } from '../../../routing/hooks/useParamsObject';
import { Filters } from './components/Filters';
Expand All @@ -23,7 +22,6 @@ const useStyles = makeStyles(theme => ({
const baseUrl = baseUrls.groupSets;
const GroupSets = () => {
const params = useParamsObject(baseUrl);
const redirectTo = useRedirectTo();
const classes = useStyles();
const { mutate: deleteGroupSet } = useDeleteGroupSet();
const tableColumns = useGroupSetsTableColumns(deleteGroupSet);
Expand All @@ -33,8 +31,7 @@ const GroupSets = () => {
const navigate = useNavigate();
const isLoading = isFetching;
const createGroupSet = () => {
// how to use the paths ?
navigate('/orgunits/configuration/groupSet/groupSetId/new');
navigate(`/${baseUrls.groupSetDetail}/groupSetId/new`);
};
return (
<>
Expand All @@ -56,20 +53,18 @@ const GroupSets = () => {
</Box>

{tableColumns && (
<Table
<TableWithDeepLink
data={data?.group_sets ?? []}
pages={data?.pages ?? 1}
defaultSorted={[{ id: 'name', desc: false }]}
columns={tableColumns}
count={data?.count ?? 0}
baseUrl={baseUrl}
redirectTo={(_, newParams) =>
redirectTo(baseUrl, newParams)
}
marginTop={false}
extraProps={{
loading: isLoading,
}}
params={params}
/>
)}
</Box>
Expand Down

0 comments on commit 24ec655

Please sign in to comment.