Skip to content

Commit

Permalink
Feature/agent naming format and sorting names in filter - 395 (#79)
Browse files Browse the repository at this point in the history
* TEST: suppression du build hors Gitlab

* TEST: modification du nom des images

* adding an function to format agent name when we create

* Change function name and fix gitlabci

---------

Co-authored-by: pauldechorgnat <[email protected]>
Co-authored-by: Antoine Jeanneney <[email protected]>
  • Loading branch information
3 people authored Jan 30, 2024
1 parent b7438c9 commit c4bbfba
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { apiRouteOutType, idModule, ressourceFilterType, userType } from '@label
import { FilterButton, FilterChip } from '../../../components';
import { wordings } from '../../../wordings';
import { documentType } from 'packages/generic/core/dist';

export { StatisticsFilterButton };

function StatisticsFilterButton(props: {
Expand Down Expand Up @@ -187,7 +186,7 @@ function StatisticsFilterButton(props: {
kind: 'dropdown' as const,
name: 'user',
label: wordings.business.filters.fields.userName,
possibleValues: props.users.map(({ name }) => name),
possibleValues: props.users.map(({ name }) => name).sort(),
value: userName,
onChange: (userName: string | undefined) => {
if (!userName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function ToBeConfirmedDocuments(props: {
return {
userName: {
value: filterValues.userName,
possibleValues: filterInfo.userNames,
possibleValues: filterInfo.userNames.sort(),
setValue: (userName: userType['name'] | undefined) => setAndStoreFilterValues({ ...filterValues, userName }),
},
publicationCategoryLetter: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function TreatedDocuments(props: {
},
userName: {
value: filterValues.userName,
possibleValues: filterInfo.userNames,
possibleValues: filterInfo.userNames.sort(),
setValue: (userName: userType['name'] | undefined) => setAndStoreFilterValues({ ...filterValues, userName }),
},
publicationCategoryLetter: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function UntreatedDocumentsTable(props: {
text: wordings.untreatedDocumentsPage.table.optionItems.assignToWorkingUser.label,
dropdownLabel: wordings.untreatedDocumentsPage.table.optionItems.assignToWorkingUser.dropdownLabel,
description: wordings.untreatedDocumentsPage.table.optionItems.assignToWorkingUser.description,
items: props.users.map(({ name }) => name),
items: props.users.map(({ name }) => name).sort(),
iconName: 'assignmentInd' as const,
onSelect: buildOnSelectWorkingUserToAssignDocument(untreatedDocument.document._id),
isDisabled: userRole !== 'admin' || adminView !== 'admin',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
} from 'pelta-design-system';
import { wordings } from '../../../../wordings';
import { WorkingUserCreatedPopUp } from './UserCreatedPopUp';
import { processNames } from '../../../../utils/';

export { AddWorkingUserDrawer };

Expand Down Expand Up @@ -136,7 +137,7 @@ function AddWorkingUserDrawer(props: { isOpen: boolean; onClose: () => void; ref
try {
const { data: temporaryPassword } = await apiCaller.post<'createUser'>('createUser', {
email,
name: `${firstName} ${lastName}`,
name: processNames(firstName, lastName),
role,
});
props.refetch();
Expand Down
3 changes: 2 additions & 1 deletion packages/generic/client/src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useMousePosition, MouseMoveListener } from './mousePosition';
import { urlHandler } from './urlHandler';
import { dependencyManager } from './dependencyManager';
import { processNames } from './processNames';

export { dependencyManager, urlHandler, useMousePosition, MouseMoveListener };
export { dependencyManager, urlHandler, useMousePosition, MouseMoveListener, processNames };
8 changes: 8 additions & 0 deletions packages/generic/client/src/utils/processNames.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export { processNames };
function processNames(firstName: string, lastName: string): string {
if (firstName != '' || lastName != '') {
return `${lastName.toUpperCase()} ${firstName.charAt(0).toUpperCase() + firstName.slice(1)}`;
} else {
return `${lastName} ${firstName}`;
}
}

0 comments on commit c4bbfba

Please sign in to comment.