Skip to content

Commit 47a2c4c

Browse files
authored
Merge pull request #10 from scalefocus/feature/103_trash_restore_delete_permanent
FE support for new web page Trash
2 parents bc6db8b + 900ef6b commit 47a2c4c

File tree

5 files changed

+523
-3
lines changed

5 files changed

+523
-3
lines changed

src/api/api.ts

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,50 @@ export async function trashObjects({
303303
}: {
304304
objectIds: string[];
305305
}): Promise<number> {
306-
307306
const response = await axiosClient.post('object/trash', {
308-
ObjectIds : objectIds,
307+
ObjectIds: objectIds,
309308
});
310309

311310
return response.data;
312-
}
311+
};
312+
313+
export const fetchTrashedIds = async ({
314+
pageParam,
315+
}: {
316+
pageParam: string;
317+
}): Promise<IGetObjects> => {
318+
const res = await axiosClient.get('/objects/trashed', {
319+
params: { lastId: pageParam, PageSize: NUMBER_OF_OBJECTS_PER_PAGE },
320+
});
321+
return res.data;
322+
};
323+
324+
export async function trashRestoreObjects({
325+
objectIds,
326+
}: {
327+
objectIds: string[];
328+
}): Promise<number> {
329+
const response = await axiosClient.post('/object/trash/removeObjects', {
330+
ObjectIds: objectIds,
331+
});
332+
333+
return response.data;
334+
};
335+
336+
export async function trashDeletePermamnentObjects({
337+
objectIds,
338+
}: {
339+
objectIds: string[];
340+
}): Promise<number> {
341+
const response = await axiosClient.post('/object/trash/deletePermanent', {
342+
ObjectIds: objectIds,
343+
});
344+
345+
return response.data;
346+
};
347+
348+
export async function emptyTrash(): Promise<boolean> {
349+
const response = await axiosClient.delete('emptytrash');
350+
351+
return response.data;
352+
};

src/components/Navlist.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import AnalyticsIcon from '@mui/icons-material/Analytics';
2+
import DeleteOutlineIcon from '@mui/icons-material/DeleteOutline';
23
import GroupIcon from '@mui/icons-material/Group';
34
import LogoutIcon from '@mui/icons-material/Logout';
45
import ManageAccountsIcon from '@mui/icons-material/ManageAccounts';
@@ -51,6 +52,12 @@ const NAVIGATION_ITEMS: Array<{
5152
icon: <SettingsIcon color="primary" />,
5253
adminOnly: true,
5354
},
55+
{
56+
to: '/trash',
57+
label: 'Trash',
58+
icon: <DeleteOutlineIcon color="primary" />,
59+
adminOnly: true,
60+
},
5461
{
5562
to: null,
5663
label: 'Logout',

0 commit comments

Comments
 (0)