Skip to content

Commit

Permalink
Fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Rashmini committed Nov 2, 2023
1 parent 7fdcdd4 commit 59ca706
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ const AddOrganizationDiscoveryDomains: FunctionComponent<AddOrganizationDiscover

const [ emailDomains, setEmailDomains ] = useState<string[]>([]);
const [ isEmailDomainDataError, setIsEmailDomainDataError ] = useState<boolean>(false);
const [ emailDomainDataError, setEmailDomainDataError ] = useState<string>("");

/**
* Filter the already configured organizations from the list of organizations.
Expand Down Expand Up @@ -175,18 +174,14 @@ const AddOrganizationDiscoveryDomains: FunctionComponent<AddOrganizationDiscover
/**
* Function to validate the input string is an email domain.
*
* @param values - Email domains.
* @param emailDomainList - Email domains.
*/
const validateEmailDomain = (emailDomainList: string[]) => {

const emailDomainValidation: boolean = FormValidation.domain(emailDomainList[emailDomainList.length-1]);
const isEmailDomainValid: boolean = FormValidation.domain(emailDomainList[emailDomainList.length-1]);

if (!emailDomainValidation) {
if (!isEmailDomainValid) {
setIsEmailDomainDataError(true);
setEmailDomainDataError( t(
"console:manage.features.organizationDiscovery.assign.form." +
"fields.emailDomains.validations.invalid.0"
) );
emailDomainList.pop();
}
};
Expand Down Expand Up @@ -300,7 +295,11 @@ const AddOrganizationDiscoveryDomains: FunctionComponent<AddOrganizationDiscover
error={ isEmailDomainDataError }
helperText= {
isEmailDomainDataError
&& emailDomainDataError
? t(
"console:manage.features.organizationDiscovery.assign.form." +
"fields.emailDomains.validations.invalid.0"
)
: null
}
placeholder={ t(
"console:manage.features.organizationDiscovery.assign.form." +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ const EditOrganizationDiscoveryDomains: FunctionComponent<EditOrganizationDiscov

const [ emailDomains, setEmailDomains ] = useState<string[]>([]);
const [ isEmailDomainDataError, setIsEmailDomainDataError ] = useState<boolean>(false);
const [ emailDomainDataError, setEmailDomainDataError ] = useState<string>("");

const optionsArray: string[] = [];

Expand Down Expand Up @@ -175,18 +174,14 @@ const EditOrganizationDiscoveryDomains: FunctionComponent<EditOrganizationDiscov
/**
* Function to validate the input string is an email domain.
*
* @param values - Email domains.
* @param emailDomainList - Email domains.
*/
const validateEmailDomain = (emailDomainList: string[]) => {

const emailDomainValidation: boolean = FormValidation.domain(emailDomainList[emailDomainList.length-1]);
const isEmailDomainValid: boolean = FormValidation.domain(emailDomainList[emailDomainList.length-1]);

if (!emailDomainValidation) {
if (!isEmailDomainValid) {
setIsEmailDomainDataError(true);
setEmailDomainDataError( t(
"console:manage.features.organizationDiscovery.assign.form." +
"fields.emailDomains.validations.invalid.0"
) );
emailDomainList.pop();
}
};
Expand Down Expand Up @@ -276,7 +271,11 @@ const EditOrganizationDiscoveryDomains: FunctionComponent<EditOrganizationDiscov
error={ isEmailDomainDataError }
helperText= {
isEmailDomainDataError
&& emailDomainDataError
? t(
"console:manage.features.organizationDiscovery.edit.form." +
"fields.emailDomains.validations.invalid.0"
)
: null
}
placeholder={ t(
"console:manage.features.organizationDiscovery.edit." +
Expand Down
6 changes: 6 additions & 0 deletions modules/i18n/src/models/namespaces/console-ns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3349,6 +3349,12 @@ export interface ConsoleNS {
label : string;
placeholder: string;
hint: string;
validations: {
invalid: {
0: string;
1: string;
}
}
};
organizationName: {
label: string;
Expand Down
8 changes: 7 additions & 1 deletion modules/i18n/src/translations/en-US/portals/console.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9524,7 +9524,13 @@ export const console: ConsoleNS = {
emailDomains: {
label : "Email Domains",
placeholder: "Enter email domains",
hint: "Type and enter to add email domains which should be mapped to the organization. (E.g. gmail.com etc.)."
hint: "Type and enter to add email domains which should be mapped to the organization. (E.g. gmail.com etc.).",
validations: {
invalid: {
0: "Please enter a valid email domain.",
1: "Provided email domain is already mapped to a different organization."
}
}
},
organizationName: {
label: "Organization Name",
Expand Down
8 changes: 7 additions & 1 deletion modules/i18n/src/translations/fr-FR/portals/console.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7744,7 +7744,13 @@ export const console: ConsoleNS = {
emailDomains: {
label : "Domaines de messagerie",
placeholder: "Entrez les domaines de messagerie",
hint: "Tapez et entrez pour ajouter des domaines de messagerie qui doivent être mappés à l'organisation. (Par exemple, gmail.com, etc.)"
hint: "Tapez et entrez pour ajouter des domaines de messagerie qui doivent être mappés à l'organisation. (Par exemple, gmail.com, etc.)",
validations: {
invalid: {
0: "Veuillez saisir un domaine de messagerie valide.",
1: "Le domaine de messagerie fourni est déjà mappé à une autre organisation."
}
}
},
organizationName: {
label: "nom de l'organisation",
Expand Down
8 changes: 7 additions & 1 deletion modules/i18n/src/translations/si-LK/portals/console.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7575,7 +7575,13 @@ export const console: ConsoleNS = {
emailDomains: {
label : "ඊමේල් වසම්",
placeholder: "විද්යුත් තැපැල් වසම් ඇතුළත් කරන්න",
hint: "සංවිධානයට සිතියම්ගත කළ යුතු ඊමේල් වසම් එක් කිරීමට ටයිප් කර ඇතුල් කරන්න. (උදා. gmail.com ආදිය)"
hint: "සංවිධානයට සිතියම්ගත කළ යුතු ඊමේල් වසම් එක් කිරීමට ටයිප් කර ඇතුල් කරන්න. (උදා. gmail.com ආදිය)",
validations: {
invalid: {
0: "කරුණාකර වලංගු විද්‍යුත් තැපැල් වසමක් ඇතුළු කරන්න.",
1: "සපයන ලද විද්‍යුත් තැපැල් වසම දැනටමත් වෙනත් සංවිධානයකට සිතියම්ගත කර ඇත."
}
}
},
organizationName: {
label: "සංවිධානයේ නම",
Expand Down

0 comments on commit 59ca706

Please sign in to comment.