Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
0bf844a
feat: recently accessed components
vani-walvekar1494 Jun 17, 2025
7a7c3b2
fix: format files to pass nx format check
vani-walvekar1494 Jun 17, 2025
6292b87
Fix: resolved merge conflicts and updated dashboard styles
vani-walvekar1494 Jun 17, 2025
0042a02
Added Quicklinks, Job status and system status to dashbaord
Jun 17, 2025
35f37ad
chore: format AppsSideNav to pass format:check
vani-walvekar1494 Jun 17, 2025
3ccaa74
Fix: Replace 'any' with proper types in RecentProjects to satisfy lin…
vani-walvekar1494 Jun 17, 2025
9a6aa1b
chore: format files to pass nx format check
vani-walvekar1494 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
vani-walvekar1494 Jun 23, 2025
c439559
wip: partial DB connection setup and fix for recent tools issue
vani-walvekar1494 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/…
vani-walvekar1494 Jun 24, 2025
89f43e8
Apply local changes after merging feat/react-dashboard
vani-walvekar1494 Jun 24, 2025
fc71cf5
Added SU allocations component on Dashbaord
Jun 24, 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
vani-walvekar1494 Jun 27, 2025
9698ff4
Fix lint error and update files after merging feat/react-dashboard
vani-walvekar1494 Jun 27, 2025
c4e91a4
Fix formatting issues
vani-walvekar1494 Jun 27, 2025
98b6f96
Format migration files with Black
vani-walvekar1494 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
vani-walvekar1494 Jun 30, 2025
b5e6a15
fix: format files to pass lint checks
vani-walvekar1494 Jul 1, 2025
b5d0868
fix(AppsSideNav): add Applications header text to resolve failing test
vani-walvekar1494 Jul 1, 2025
b6045cd
fix: resolve AppsSideNav formatting issues
vani-walvekar1494 Jul 1, 2025
245cefe
fix: remove unused imports and variables in AppsSideNav to pass lint …
vani-walvekar1494 Jul 1, 2025
7af4852
Merge feat/react-dashboard into feat/react-dashboard-utils: resolved …
vani-walvekar1494 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
03e9fa5
feat(dashboard): update layout and fix recent projects visibility
vani-walvekar1494 Jul 11, 2025
aaeed75
Resolved merge conflicts and merged feat/react-dashboard into feat/re…
vani-walvekar1494 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
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
9aede58
Updated Quicklinks to add icons
Jul 17, 2025
be8befc
Revert package-lock.json changes and formatting changes in api/datafi…
vani-walvekar1494 Jul 17, 2025
913da5a
changed sidebar styling and fixed tool navigation
vani-walvekar1494 Jul 17, 2025
294abbe
fixed linting for package-lock.json
vani-walvekar1494 Jul 17, 2025
6092a55
Fixed AppsSideNav hook usage
vani-walvekar1494 Jul 17, 2025
d23e6ef
fix: show Applications: header during loading to fix unit test
vani-walvekar1494 Jul 17, 2025
3c94d8d
Made suggested changes to follow best practices
Jul 24, 2025
0ce7d37
removed BrowserRouter import from main.tsx
Jul 24, 2025
e582a90
Refactored favorites logic, fix types,updated styling and dependencies
vani-walvekar1494 Jul 25, 2025
63701fd
Restore apps.ts from main to include missing comments/docstrings
vani-walvekar1494 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
vani-walvekar1494 Jul 29, 2025
b2cf30a
Removed Storage analyser component
vani-walvekar1494 Jul 30, 2025
29cbae0
Removed Storage analyser component and rebuilt
vani-walvekar1494 Jul 30, 2025
ed31b74
Fixed linting
vani-walvekar1494 Jul 30, 2025
1d2c691
Fixed linting for dashboard
vani-walvekar1494 Jul 30, 2025
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