Skip to content

Commit

Permalink
Add project code to options
Browse files Browse the repository at this point in the history
  • Loading branch information
Onitoxan committed Nov 26, 2024
1 parent 8ad2f3d commit 88e5810
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion apps/hpc-ftsadmin/src/app/utils/fn-promises.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,23 @@ export const governingEntitiesOptions = (
tooltip,
}));
};

const projectsOptions = (
response: Array<{
name: string;
id: number;
code: string | null;
chipColor?: string;
tooltip?: string;
}>
): FormObjectValue[] => {
return response.map(({ name, id, chipColor, tooltip, code }) => ({
displayLabel: `${name}${code ? ' [' + code + ']' : ''}`,
value: id,
chipColor,
tooltip,
}));
};
// Functions to pass to <AsyncAutocompleteSelect /> fnPromise prop

export const fnOrganizations = async (
Expand Down Expand Up @@ -175,7 +192,7 @@ export const fnProjects = async (
env: Environment
) => {
const response = await env.model.projects.getAutocompleteProjects(query);
return defaultOptions(response);
return projectsOptions(response);
};

export const fnPlans = async (query: { query: string }, env: Environment) => {
Expand Down

0 comments on commit 88e5810

Please sign in to comment.