Skip to content

Commit 88fd6e2

Browse files
lipalath-msdanielluo-msft
authored andcommitted
update the error message displayed when the user doesn't exist in the hr table
1 parent 05137c8 commit 88fd6e2

File tree

4 files changed

+31
-6
lines changed

4 files changed

+31
-6
lines changed

UI/web-app/src/components/HRQuerySource/HRQuerySource.base.tsx

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { updateOrgLeaderDetails, selectOrgLeaderDetails, selectObjectIdEmployeeI
2121
import { selectJobOwnerFilterSuggestions } from '../../store/jobs.slice';
2222
import { manageMembershipIsEditingExistingJob } from '../../store/manageMembership.slice';
2323
import { fetchDefaultSqlMembershipSourceAttributes } from '../../store/sqlMembershipSources.api';
24-
import { selectAttributes } from '../../store/sqlMembershipSources.slice';
24+
import { selectAttributes, selectSource } from '../../store/sqlMembershipSources.slice';
2525
import { SqlMembershipAttribute } from '../../models';
2626
import { IFilterPart } from '../../models/IFilterPart';
2727

@@ -61,6 +61,7 @@ export const HRQuerySourceBase: React.FunctionComponent<HRQuerySourceProps> = (p
6161
const [children, setChildren] = useState<ChildType[]>([]);
6262
const excludeLeaderQuery = `EmployeeId <> ${source.manager?.id}`
6363
const attributes = useSelector(selectAttributes);
64+
const hrSource = useSelector(selectSource);
6465
const [filteredOptions, setFilteredOptions] = useState<FilteredOptionsState>({});
6566
const [items, setItems] = useState<IFilterPart[]>([]);
6667
let options: IComboBoxOption[] = [];
@@ -86,6 +87,11 @@ export const HRQuerySourceBase: React.FunctionComponent<HRQuerySourceProps> = (p
8687
setFilteredOptions({});
8788
}, [children]);
8889

90+
useEffect(() => {
91+
if (!includeOrg) { setErrorMessage(''); }
92+
}, [includeOrg]);
93+
94+
8995
useEffect(() => {
9096
if (children.length > 0) {
9197
let newStr = "";
@@ -152,18 +158,29 @@ export const HRQuerySourceBase: React.FunctionComponent<HRQuerySourceProps> = (p
152158
}
153159
}, [orgLeaderDetails.employeeId, orgLeaderDetails.objectId]);
154160

161+
useEffect(() => {
162+
if (orgLeaderDetails.employeeId === 0 && orgLeaderDetails.maxDepth === 0 && includeOrg && partId === orgLeaderDetails.partId) {
163+
setErrorMessage(hrSource?.name && hrSource?.name !== "" ?
164+
orgLeaderDetails.text + strings.HROnboarding.customOrgLeaderMissingErrorMessage + hrSource?.name + strings.HROnboarding.source :
165+
orgLeaderDetails.text + strings.HROnboarding.orgLeaderMissingErrorMessage);
166+
}
167+
}, [orgLeaderDetails]);
168+
155169
const getPickerSuggestions = async (
156170
filterText: string
157171
): Promise<IPersonaProps[]> => {
158172
return filterText && ownerPickerSuggestions ? ownerPickerSuggestions : [];
159173
};
160174

161175
const handleOrgLeaderInputChange = (input: string): string => {
176+
setIncludeOrg(true);
177+
setErrorMessage('');
162178
dispatch(getJobOwnerFilterSuggestions({displayName: input, alias: input}))
163179
return input;
164180
}
165181

166182
const handleOrgLeaderChange = (items?: IPersonaProps[] | undefined) => {
183+
setIncludeOrg(true);
167184
setIsDisabled(true);
168185
if (items !== undefined && items.length > 0) {
169186
dispatch(fetchOrgLeaderDetails({
@@ -751,6 +768,12 @@ export const HRQuerySourceBase: React.FunctionComponent<HRQuerySourceProps> = (p
751768
</Stack>
752769
)}
753770

771+
772+
<div className={classNames.error}>
773+
{errorMessage}
774+
</div>
775+
<br />
776+
754777
<Label>{strings.HROnboarding.includeFilter}</Label>
755778
<ChoiceGroup
756779
selectedKey={(includeFilter || source.filter) ? strings.yes : strings.no}
@@ -789,10 +812,6 @@ export const HRQuerySourceBase: React.FunctionComponent<HRQuerySourceProps> = (p
789812
) : null
790813
}
791814

792-
<div className={classNames.error}>
793-
{errorMessage}
794-
</div>
795-
796815
</div>
797816
);
798817
};

UI/web-app/src/services/localization/IStrings.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ export type IStrings = {
4040
attributeValueInfo: string;
4141
orAndOperatorInfo: string;
4242
missingAttributeErrorMessage: string;
43+
customOrgLeaderMissingErrorMessage: string;
4344
orgLeaderMissingErrorMessage: string;
45+
source: string;
4446
invalidInputErrorMessage: string;
4547
},
4648
Components: {

UI/web-app/src/services/localization/i18n/locales/en/translations.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ export const strings: IStrings = {
4343
attributeValueInfo: "Select the attribute value",
4444
orAndOperatorInfo: "Select And/Or",
4545
missingAttributeErrorMessage: "Please provide missing info in the previous attribute",
46-
orgLeaderMissingErrorMessage: "This user doesn't exist in the HR Data source",
46+
customOrgLeaderMissingErrorMessage: " doesn't exist in the ",
47+
source: " source",
48+
orgLeaderMissingErrorMessage: " doesn't exist in the HR Data source",
4749
invalidInputErrorMessage: "Invalid input. Please enter only numbers."
4850
},
4951
Components: {

UI/web-app/src/services/localization/i18n/locales/es/translations.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ export const strings: IStrings = {
4444
attributeValueInfo: "Seleccione el operador de igualdad",
4545
orAndOperatorInfo: "Seleccione Y/O",
4646
missingAttributeErrorMessage: "Proporcione la información que falta en el atributo anterior",
47+
customOrgLeaderMissingErrorMessage: " no existe en ",
4748
orgLeaderMissingErrorMessage: "Este usuario no existe en la fuente de datos de RR.HH.",
49+
source: " fuente",
4850
invalidInputErrorMessage: "Entrada inválida. Por favor ingrese solo números."
4951
},
5052
Components: {

0 commit comments

Comments
 (0)