Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
218 commits
Select commit Hold shift + click to select a range
0e04f25
task/DES-3002 create test datasets from OpenTopography (#1331)
Beulah-Karrolla Jul 11, 2024
3d685fb
task/DES-3004: add python script to fetch the Opentopo data from git …
sajithalapati16 Jul 12, 2024
5dabe77
task/des 3007 Create script to integrate center point geojson with Op…
Beulah-Karrolla Jul 17, 2024
63deb58
Task/des 3005 endpoint to preconstructed geojson (#1335)
sajithalapati16 Jul 22, 2024
274500c
task/DES-3025 Support OT data in recon portal through Tapipy (#1373)
Beulah-Karrolla Jul 29, 2024
2b9b298
Task/DES-3013 integrate opentopo through api (#1362)
sajithalapati16 Jul 31, 2024
57f3e48
Merge branch 'main' into feature/opentopo
nathanfranklin Aug 21, 2024
efa18f7
task/DES-3037: Move filters to the top of UI and add filters to opent…
Beulah-Karrolla Aug 23, 2024
982ec54
hotifx: rework filter methods (#1414)
nathanfranklin Aug 23, 2024
f16b54f
Merge branch 'main' into feature/opentopo
nathanfranklin Aug 26, 2024
7a3ad7b
fix for filters, search results reflect on map (#1416)
shayanaijaz Aug 26, 2024
33fd5e1
hotifx/fix-caching-in-opentopo-endpoint (#1417)
nathanfranklin Aug 27, 2024
0e49dc5
Task/WG 370 open topo UI improvements (#1420)
sophia-massie Aug 30, 2024
16577d3
Merge branch 'main' into feature/opentopo
nathanfranklin Aug 30, 2024
a2e2e7b
Task/wg 375 recon portal UI changes (#1435)
sophia-massie Sep 25, 2024
d19d311
Merge branch 'main' into feature-opentopo
nathanfranklin Mar 31, 2025
28182df
task/DES-2880: add module and placeholder components (#1375)
nathanfranklin Jul 30, 2024
387bd4c
Task/des 3047 create custom query hooks (#1383)
sajithalapati16 Mar 31, 2025
96964b1
Merge branch 'feature-opentopo' into feat/recon-portal-react4
nathanfranklin Mar 31, 2025
d6594c6
initial commit replacing AngularJS recon portal with React placeholder
jarosenb Jul 17, 2024
6eb0978
Remove second rapid root
nathanfranklin Apr 9, 2025
efca394
Merge pull request #1536 from DesignSafe-CI/feat/recon-portal-react4
nathanfranklin Apr 10, 2025
3842489
Merge branch 'main' into feature-opentopo
nathanfranklin Apr 10, 2025
616ff22
task/WG-486: refactor types and hooks in recon-portal (#1541)
nathanfranklin Apr 21, 2025
fa4fffe
Task/wg 476 Recon Portal create top level layout (#1540)
sophia-massie Apr 21, 2025
3647a48
Task/WG-477: add react-leaflet map with two base layers for recon por…
nathanfranklin Apr 22, 2025
123e463
Remove two unused endpoints used during prototyping/investigating (#1…
nathanfranklin Apr 24, 2025
7f80ad7
task/WG-498/499 - Recon Portal Side Panel (#1555)
shayanaijaz May 30, 2025
bf99f2c
Merge branch 'main' into feature-opentopo
nathanfranklin Jun 10, 2025
1c5edb7
task/WG-500: add context/hook for event selection and filtered events…
nathanfranklin Jun 11, 2025
84f9047
task/WG-495: show open topo datasets on leaflet map (#1567)
nathanfranklin Jun 11, 2025
0bf844a
feat: recently accessed components
vaniwalvekar Jun 17, 2025
7a7c3b2
fix: format files to pass nx format check
vaniwalvekar Jun 17, 2025
6292b87
Fix: resolved merge conflicts and updated dashboard styles
vaniwalvekar Jun 17, 2025
0042a02
Added Quicklinks, Job status and system status to dashbaord
Jun 17, 2025
35f37ad
chore: format AppsSideNav to pass format:check
vaniwalvekar Jun 17, 2025
3ccaa74
Fix: Replace 'any' with proper types in RecentProjects to satisfy lin…
vaniwalvekar Jun 17, 2025
9a6aa1b
chore: format files to pass nx format check
vaniwalvekar Jun 17, 2025
0106bb1
Merge branch 'feat/react-dashboard' into task/WP-1000
Jun 18, 2025
f903667
Merge branch 'feat/react-dashboard' into task/WP-1000
Jun 18, 2025
14b2c80
revert NPM package changes
Jun 18, 2025
812c343
Changed css file import error
Jun 18, 2025
3a51712
Changed Dashboard.spec.tsx for client query error
Jun 18, 2025
b1da8ae
Changed Dashboard.specs.ts
Jun 18, 2025
1fcdb01
Removed useQuery() from my files
Jun 18, 2025
91d0c10
Removed useQuery() from my files
Jun 18, 2025
51c8fd1
Removed unit tests
Jun 18, 2025
9acbc98
test cases issue padted
Jun 18, 2025
8b11918
Merge branch 'feat/react-dashboard' into task/WP-1000
Jun 18, 2025
2fb2441
wip: partial DB connection setup and fix for recent tools issue
vaniwalvekar Jun 23, 2025
c439559
wip: partial DB connection setup and fix for recent tools issue
vaniwalvekar Jun 23, 2025
0287861
Fix Tools & Applications navigation issue and added SU allocations di…
Jun 23, 2025
4ec4659
Merge remote-tracking branch 'origin/feat/react-dashboard' into feat/…
vaniwalvekar Jun 24, 2025
89f43e8
Apply local changes after merging feat/react-dashboard
vaniwalvekar Jun 24, 2025
fc71cf5
Added SU allocations component on Dashbaord
Jun 24, 2025
9f16324
Merge branch 'main' into feature-opentopo
nathanfranklin Jun 26, 2025
4cf00c1
Merge branch 'main' into feature-opentopo
nathanfranklin Jun 26, 2025
14ef73c
Added user guide tutorials to Dashboard
Jun 26, 2025
bb4db54
changed Dashboard spec file
Jun 27, 2025
ae7e243
Fix lint error and other updates
vaniwalvekar Jun 27, 2025
9698ff4
Fix lint error and update files after merging feat/react-dashboard
vaniwalvekar Jun 27, 2025
c4e91a4
Fix formatting issues
vaniwalvekar Jun 27, 2025
98b6f96
Format migration files with Black
vaniwalvekar Jun 27, 2025
c52fbba
Made required changes to Dashboard and SUAllocationsCard files
Jun 27, 2025
322e52e
Fixed react unit tests and linting error
Jun 30, 2025
6dd374c
Fixed linting error
Jun 30, 2025
f7d2475
Fixed linting error
Jun 30, 2025
8c6cd55
Fixed linting error
Jun 30, 2025
3eb8be5
changed main.tsx for linting error
Jun 30, 2025
4d0a507
changed index.ts back to index.tsx
Jun 30, 2025
b63befa
format error fixed
Jun 30, 2025
db1aec1
chore: refactor dashboard API, cleanup migrations, remove unused icons
vaniwalvekar Jun 30, 2025
b5e6a15
fix: format files to pass lint checks
vaniwalvekar Jul 1, 2025
b5d0868
fix(AppsSideNav): add Applications header text to resolve failing test
vaniwalvekar Jul 1, 2025
b6045cd
fix: resolve AppsSideNav formatting issues
vaniwalvekar Jul 1, 2025
245cefe
fix: remove unused imports and variables in AppsSideNav to pass lint …
vaniwalvekar Jul 1, 2025
1ddfd15
Task/wg 494 recon event markers leaflet (#1581)
sophia-massie Jul 1, 2025
0e96c3c
Merge branch 'main' into feature-opentopo
sophia-massie Jul 1, 2025
0a84e4f
hotfix/main-nav-event-type-color-bug (#1585)
sophia-massie Jul 2, 2025
7af4852
Merge feat/react-dashboard into feat/react-dashboard-utils: resolved …
vaniwalvekar Jul 2, 2025
daa410f
Added sanitization of url when creating link (#1586)
shayanaijaz Jul 2, 2025
b78308a
Merge branch 'feat/react-dashboard' of https://github.com/DesignSafe-…
Jul 2, 2025
7b5202f
merge feat/react-dashbaord and task/WP-1000
Jul 2, 2025
ad9dde4
format fix
Jul 2, 2025
c51a02c
changed index.tsx to index.ts
Jul 3, 2025
ac5a008
fixed import errors
Jul 3, 2025
f1e03e8
fixed import errors of Jobstatus
Jul 3, 2025
cf466b7
fixed import errors of Jobstatus.tsx
Jul 3, 2025
b8cc307
Solved all Linting errors
Jul 3, 2025
bf54369
Solved all Linting errors and finished linting format
Jul 3, 2025
f57c208
Added collapsible section function to recent jobs and allocations
Jul 7, 2025
5d33cab
Merge branch 'main' into feature-opentopo
sophia-massie Jul 9, 2025
03e9fa5
feat(dashboard): update layout and fix recent projects visibility
vaniwalvekar Jul 11, 2025
aaeed75
Resolved merge conflicts and merged feat/react-dashboard into feat/re…
vaniwalvekar Jul 11, 2025
bca7ecb
Merged feat/react-dashboard into Task/WP-1000 and resolved conflicts
Jul 11, 2025
7903532
Updated apps.ts
Jul 11, 2025
1b9b47a
prevent long category names from overflowing the selection UI (#1591)
jarosenb Jul 14, 2025
321402f
scope System Status modal styles to the relevant component (#1592)
jarosenb Jul 14, 2025
5ec6508
Task/wc 255 update publish window for other (#1568)
van-go Jul 14, 2025
a8fa9a9
Task/wc 280 update data type code to research software (#1593)
van-go Jul 14, 2025
138a00c
Made suggested changes after code review
Jul 16, 2025
5220a45
Updated Dashboard.tsx to pass linting
Jul 16, 2025
a220aa6
Updated Dashboard.tsx to pass client side unit tests
Jul 16, 2025
b810589
Merge branch 'main' into feature-opentopo
sophia-massie Jul 16, 2025
8297d70
Added CustomStatusBadge component and applied it to JobsListing.tsx (…
erikriv16 Jul 16, 2025
9aede58
Updated Quicklinks to add icons
Jul 17, 2025
be8befc
Revert package-lock.json changes and formatting changes in api/datafi…
vaniwalvekar Jul 17, 2025
913da5a
changed sidebar styling and fixed tool navigation
vaniwalvekar Jul 17, 2025
294abbe
fixed linting for package-lock.json
vaniwalvekar Jul 17, 2025
6092a55
Fixed AppsSideNav hook usage
vaniwalvekar Jul 17, 2025
d23e6ef
fix: show Applications: header during loading to fix unit test
vaniwalvekar Jul 17, 2025
616076b
task/wg-519-add-hover-on-opentopo (#1590)
sophia-massie Jul 18, 2025
2ab450e
task/WG-520 - Recon Portal Map Filtering (#1595)
shayanaijaz Jul 18, 2025
ff31eb6
Always show layer control (#1603)
nathanfranklin Jul 21, 2025
a5eb827
task/wg-522 event tag match fix (#1600)
sophia-massie Jul 21, 2025
34bf4af
Remove legacy dataset.properties used to merge DS and OpenTopography …
nathanfranklin Jul 21, 2025
8578e8f
task/WG-530: limit year dropdown to available years (#1605)
nathanfranklin Jul 21, 2025
13d18a8
task/WG-523 - Persistent Recon Portal Map Pin Banner (#1596)
shayanaijaz Jul 21, 2025
3a7d773
task/WG 525 Event Title Wrap Style Fix (#1607)
sophia-massie Jul 21, 2025
99a9ba2
task/WG-532 add white border to event position markers (#1606)
nathanfranklin Jul 21, 2025
27782f3
task/WG-535: keep selected event popup from closing (#1608)
nathanfranklin Jul 22, 2025
3c94d8d
Made suggested changes to follow best practices
Jul 24, 2025
0ce7d37
removed BrowserRouter import from main.tsx
Jul 24, 2025
df8bf95
task/WG-536: stop flickering and refactor (#1610)
nathanfranklin Jul 24, 2025
0acc39b
Merge branch 'main' into feature-opentopo
sophia-massie Jul 24, 2025
e582a90
Refactored favorites logic, fix types,updated styling and dependencies
vaniwalvekar Jul 25, 2025
63701fd
Restore apps.ts from main to include missing comments/docstrings
vaniwalvekar Jul 25, 2025
7d3af80
Removed setupTests file
Jul 28, 2025
501c1d4
merged two branches
Jul 28, 2025
a238f69
final merged code
Jul 28, 2025
3f20f65
Refactored quicklinks
vaniwalvekar Jul 29, 2025
b2cf30a
Removed Storage analyser component
vaniwalvekar Jul 30, 2025
29cbae0
Removed Storage analyser component and rebuilt
vaniwalvekar Jul 30, 2025
ed31b74
Fixed linting
vaniwalvekar Jul 30, 2025
1d2c691
Fixed linting for dashboard
vaniwalvekar Jul 30, 2025
642ff38
WC-74 and WC-278: Entity Keywords and Datacite Updates (#1599)
SilversunKSauri Aug 1, 2025
3884786
Task/wp 979 ds file folder upload limits (#1579)
van-go Aug 1, 2025
7748d03
filter inactive users out of project user lookup (#1609)
jarosenb Aug 1, 2025
b88508e
Quick: Update python to 3.12 and node to 22 LTS (#1602)
rstijerina Aug 5, 2025
cee402d
task/WI-300 - End tapis session on logout (#1611)
fnets Aug 6, 2025
9a5b1be
task/WA-449: Move the reservation field to configuration page of job …
fnets Aug 6, 2025
5658e59
fix database order of operations during publication pipeline (#1614)
jarosenb Aug 11, 2025
7463b4c
bug/WP-987: Application Select File/Folder Modal updates (#1615)
SilversunKSauri Aug 11, 2025
db2e12c
WC-289: Path for published on data download modal (#1618)
SilversunKSauri Aug 11, 2025
c85c4fb
task/WC-292: Add projectId to tapis system notes and enable retry for…
jarosenb Aug 18, 2025
e846946
Merge branch 'main' into feature-opentopo
nathanfranklin Aug 19, 2025
aabdb78
Regenerate package-lock.json
nathanfranklin Aug 19, 2025
db21ac8
Combine new entities with existing project tree for subsequent publis…
jarosenb Aug 21, 2025
61c793e
Add es_setup step to readme (#1627)
nathanfranklin Aug 25, 2025
0a680cf
Bump pylint to 3
nathanfranklin Aug 25, 2025
507b34b
Quick/pylint version issue (#1629)
nathanfranklin Aug 26, 2025
0b1f586
Merge branch 'main' into feature-opentopo
nathanfranklin Aug 26, 2025
e9341b8
Update wording on queue choices for Apps (#1613)
jmartinez-tacc Aug 27, 2025
6a0f661
task/WG-544 - OpenTopo map marker and polygon changes (#1620)
shayanaijaz Sep 3, 2025
6de20fd
task/WG-543: default terrain basemap (#1623)
nathanfranklin Sep 4, 2025
8b558f6
task/WG-534 - Recon Portal Event Scroll Changes (#1632)
shayanaijaz Sep 5, 2025
423ba7c
task/WG-545 - Recon Portal Side Panel and Popup spacing (#1634)
shayanaijaz Sep 5, 2025
ca3f4cb
Merge branch 'main' into feature-opentopo
nathanfranklin Sep 5, 2025
69a32c4
task/WG-546: Add legend for OT dataset and DS events (#1625)
nathanfranklin Sep 5, 2025
bd97613
Task/WC-179: Software publication type (#1633)
jarosenb Sep 8, 2025
c811edf
Merge branch 'main' into feature-opentopo
nathanfranklin Sep 8, 2025
1d3b2d8
Task/cleanup feature opentopo (#1635)
nathanfranklin Sep 8, 2025
014ee35
Task/drop angular recon portal (#1636)
nathanfranklin Sep 8, 2025
7f08ebc
Adjust zoom levels to not zoom in so much (#1638)
nathanfranklin Sep 8, 2025
5dd9d6f
task/WC-307: updating search checkboxes to include software type (#1637)
SilversunKSauri Sep 9, 2025
2e57483
adding extra words to publish-amend-version button (#1628)
SilversunKSauri Sep 9, 2025
5b33084
adding flags for tombstones to disable file listings and entity trees…
SilversunKSauri Sep 9, 2025
47cb7a9
Merge branch 'main' into feature-opentopo
sophia-massie Sep 9, 2025
f5168e7
Fixed making calls to systems that don't exist (#1617)
erikriv16 Sep 11, 2025
18aec28
task/WG-561: shift event popup (#1642)
nathanfranklin Sep 11, 2025
fa4d96f
spacing rework for side panel (#1641)
shayanaijaz Sep 12, 2025
f4bd7d2
Task/WG-555: fix zooming when no events selected (#1645)
nathanfranklin Sep 12, 2025
ee5a5b1
Merge branch 'main' into feature-opentopo
nathanfranklin Sep 12, 2025
960affe
update border and fill color for OpenTopo datasets (#1646)
shayanaijaz Sep 12, 2025
939fe25
fix searchbar clearing on event select (#1643)
shayanaijaz Sep 12, 2025
de78fea
task/WG-564: Add recon data blurb (#1644)
rstijerina Sep 12, 2025
fbbb084
task/wg-554-560-nav-bar-map-flex-issues (#1640)
sophia-massie Sep 12, 2025
05e5915
feedback fixes for software projects (#1647)
jarosenb Sep 12, 2025
5fd48c6
Merge branch 'main' into feature-opentopo
nathanfranklin Sep 12, 2025
64b708d
Task/migrate nx (#1648)
nathanfranklin Sep 13, 2025
dc252af
Merge pull request #1424 from DesignSafe-CI/feature-opentopo
jarosenb Sep 15, 2025
467687f
Fix CSS on 'add/remove files' button group (#1649)
jarosenb Sep 15, 2025
cb47592
add policy and best practices links for software publications. (#1650)
jarosenb Sep 17, 2025
f2f005d
Fix deprecations/style regressions from recent package updates (#1654)
jarosenb Sep 22, 2025
dc1112d
Using system label instead of id (#1655)
erikriv16 Sep 30, 2025
d72669d
"App not found" for 404 errors (#1657)
erikriv16 Oct 10, 2025
3928235
task/WG-331: add ReconPortal events to Google Analytics (#1658)
nathanfranklin Oct 13, 2025
e133097
fix(css): Tools & Apps page affects user menu (#1652)
wesleyboar Oct 13, 2025
c05201d
task/WC-268: Description Minimum Update (#1622)
SilversunKSauri Oct 16, 2025
5e22041
Task/wc 285 Add list of citations to Metrics Modal (#1624)
van-go Oct 17, 2025
1b1bf4f
Revert "Task/wc 285 Add list of citations to Metrics Modal (#1624)" (…
jarosenb Oct 17, 2025
d58c2b8
task/WC-67: Subsequent Publish UI and Pipeline (#1659)
jarosenb Oct 20, 2025
5bdca7d
handle job notes as both json and string (#1664)
rstijerina Oct 31, 2025
1833b3c
Task/wg 521 recon add missing event types (#1663)
sophia-massie Nov 3, 2025
65ae4b5
Updated unsupported file type, no preview (#1662)
erikriv16 Nov 3, 2025
71f83d5
Change Data Type query to search the 'dataTypes' field instead of 'da…
jarosenb Nov 11, 2025
2b6d628
Supported extentions used from common settings (#1665)
erikriv16 Nov 14, 2025
4518d26
Universal pill styling (#1670)
erikriv16 Nov 14, 2025
115f2b7
Task/wc 343 348 update wording (#1672)
van-go Nov 19, 2025
ae6a4ee
Task/wc 356 add preprints to doi citation count (#1673)
van-go Nov 19, 2025
ed548f4
set USER_WORK_SYSTEM to Stampede3 as workaround for cloud.data outage…
jarosenb Nov 25, 2025
d4f6f1d
Task/wc 285 list of citations in metrics modal (#1675)
van-go Dec 4, 2025
0badea6
Message to attend office hours under curation directory (#1661)
erikriv16 Dec 4, 2025
daaf087
updating project notif email, swapping code blocks to make sure login…
SilversunKSauri Dec 5, 2025
d1a4949
task/WC-263: Archive publications to Ranch via Jenkins webhook (#1668)
jarosenb Dec 8, 2025
7adbc84
fix: RT #112250 youtube video not loading (#1666)
wesleyboar Dec 8, 2025
7b7fecc
updates to archive scripts ahead of 2025-12-16 deploy (#1679)
jarosenb Dec 16, 2025
8761757
pop isPreviewable attr before indexing file listings (#1682)
jarosenb Jan 7, 2026
e067420
Unit tests for reservation fields (#1681)
fnets Jan 8, 2026
876bb7f
Changed closing ticket modal to match rest of codebase, changed error…
Jan 8, 2026
f0d0abb
Organized file structure
Jan 9, 2026
819d286
Merge remote-tracking branch 'origin/main' into feat/new-dashboard
Jan 12, 2026
2d61150
Added close ticket modal and fixed closing ticket comment requirements
Jan 12, 2026
b5e1935
Revised system status component and factored out of main
Jan 13, 2026
48df962
Quick Links revised
Jan 16, 2026
73e0509
Recent Projects react query
Jan 16, 2026
8692cd6
Format check
Jan 16, 2026
3abf11a
Revert "Merge remote-tracking branch 'origin/main' into feat/new-dash…
fnets Jan 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 104 additions & 0 deletions client/modules/_hooks/src/favouritesApi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
import apiClient from './apiClient';

export interface FavoriteTool {
tool_id: string;
version?: string;
}

const fetchFavorites = async ({
signal,
}: {
signal: AbortSignal;
}): Promise<FavoriteTool[]> => {
const res = await apiClient.get('/api/workspace/user-favorites/', { signal });
return res.data;
};

const addFavorite = async (toolId: string): Promise<void> => {
await apiClient.post('/api/workspace/user-favorites/', { tool_id: toolId });
};

const removeFavorite = async (toolId: string): Promise<void> => {
await apiClient.post('/api/workspace/user-favorites/remove/', {
tool_id: toolId,
});
};

export const useFavorites = () => {
return useQuery({
queryKey: ['workspace', 'favorites'],
queryFn: fetchFavorites,
staleTime: 5 * 60 * 1000,
refetchOnMount: false,
refetchOnWindowFocus: false,
});
};

export const useAddFavorite = () => {
const queryClient = useQueryClient();

return useMutation({
mutationFn: addFavorite,
onMutate: async (toolId) => {
await queryClient.cancelQueries({ queryKey: ['workspace', 'favorites'] });

const previousFavorites = queryClient.getQueryData<FavoriteTool[]>([
'workspace',
'favorites',
]);

queryClient.setQueryData<FavoriteTool[]>(
['workspace', 'favorites'],
(old = []) => [...old, { tool_id: toolId }]
);

return { previousFavorites };
},
onError: (_err, _toolId, context) => {
if (context?.previousFavorites) {
queryClient.setQueryData(
['workspace', 'favorites'],
context.previousFavorites
);
}
},
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['workspace', 'favorites'] });
},
});
};

export const useRemoveFavorite = () => {
const queryClient = useQueryClient();

return useMutation({
mutationFn: removeFavorite,
onMutate: async (toolId) => {
await queryClient.cancelQueries({ queryKey: ['workspace', 'favorites'] });

const previousFavorites = queryClient.getQueryData<FavoriteTool[]>([
'workspace',
'favorites',
]);

queryClient.setQueryData<FavoriteTool[]>(
['workspace', 'favorites'],
(old = []) => old.filter((fav) => fav.tool_id !== toolId)
);

return { previousFavorites };
},
onError: (_err, _toolId, context) => {
if (context?.previousFavorites) {
queryClient.setQueryData(
['workspace', 'favorites'],
context.previousFavorites
);
}
},
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['workspace', 'favorites'] });
},
});
};
1 change: 1 addition & 0 deletions client/modules/_hooks/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ export * from './datafiles';
export * from './systems';
export * from './notifications';
export * from './onboarding';
export * from './favouritesApi';
1 change: 1 addition & 0 deletions client/modules/_hooks/src/workspace/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ export * from './usePostJobs';
export * from './types';
export * from './useGetAllocations';
export * from './useInteractiveModalContext';
export * from './useSUAllocations';
28 changes: 28 additions & 0 deletions client/modules/_hooks/src/workspace/useSUAllocations.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { useQuery } from '@tanstack/react-query';
import apiClient from '../apiClient';

export type TSUAllocation = {
system: string;
host: string;
project_code: string;
awarded: number;
remaining: number;
expiration: string;
};

const getSUAllocations = async ({ signal }: { signal: AbortSignal }) => {
const res = await apiClient.get<{ allocations: TSUAllocation[] }>(
'/api/users/allocations/',
{ signal }
);
return res.data.allocations;
};

const suAllocationsQuery = () => ({
queryKey: ['dashboard', 'getSUAllocations'],
queryFn: ({ signal }: { signal: AbortSignal }) =>
getSUAllocations({ signal }),
staleTime: 5000,
});

export const useGetSUAllocations = () => useQuery(suAllocationsQuery());
Loading
Loading