Skip to content

Commit

Permalink
(fix) Change page title of channels to be changed based on the enab…
Browse files Browse the repository at this point in the history
…led providers.
  • Loading branch information
Achintha Isuru committed Nov 19, 2023
1 parent e4c26e2 commit b7ff5e1
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 19 deletions.
18 changes: 15 additions & 3 deletions apps/console/src/extensions/i18n/models/extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1858,9 +1858,21 @@ export interface Extensions {
};
};
notificationChannel: {
heading: string;
title: string;
description: string;
heading: {
heading: string;
onlySMSProvider: string;
onlyEmailProvider: string;
},
title: {
heading: string;
onlySMSProvider: string;
onlyEmailProvider: string;
},
description: {
description: string;
onlySMSProvider: string;
onlyEmailProvider: string;
}
};
smsProviders: {
heading: string;
Expand Down
18 changes: 15 additions & 3 deletions apps/console/src/extensions/i18n/resources/en-US/extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2090,9 +2090,21 @@ export const extensions: Extensions = {
}
},
notificationChannel: {
heading: "SMS / Email Providers",
title: "SMS / Email Providers",
description: "Configure the SMS and Email providers for your organization."
heading: {
heading: "SMS / Email Providers",
onlySMSProvider: "SMS Provider",
onlyEmailProvider: "Email Provider"
},
title: {
heading: "SMS / Email Providers",
onlySMSProvider: "SMS Provider",
onlyEmailProvider: "Email Provider"
},
description: {
description: "Configure the SMS and Email providers for your organization.",
onlySMSProvider: "Configure the SMS provider for your organization.",
onlyEmailProvider: "Configure the Email provider for your organization."
}
},
smsProviders: {
heading: "Custom SMS Provider",
Expand Down
18 changes: 15 additions & 3 deletions apps/console/src/extensions/i18n/resources/fr-FR/extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2124,9 +2124,21 @@ export const extensions: Extensions = {
}
},
notificationChannel: {
heading: "Fournisseurs SMS/e-mail",
title: "Fournisseurs SMS/e-mail",
description: "Configurez les fournisseurs SMS et Email pour votre organisation."
heading: {
heading: "SMS / fournisseurs de courriels",
onlySMSProvider: "Fournisseur de SMS",
onlyEmailProvider: "Fournisseur de messagerie"
},
title: {
heading: "SMS / fournisseurs de courriels",
onlySMSProvider: "Fournisseur de SMS",
onlyEmailProvider: "Fournisseur de messagerie"
},
description: {
description: "Configurez les SMS et les fournisseurs de messagerie pour votre organisation.",
onlySMSProvider: "Configurez le fournisseur SMS pour votre organisation.",
onlyEmailProvider: "Configurez le fournisseur de messagerie pour votre organisation."
}
},
smsProviders: {
heading: "Fournisseur de SMS personnalisé",
Expand Down
18 changes: 15 additions & 3 deletions apps/console/src/extensions/i18n/resources/si-LK/extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2063,9 +2063,21 @@ export const extensions: Extensions = {
}
},
notificationChannel: {
heading: "SMS / ඊමේල් සපයන්නන්",
title: "SMS / ඊමේල් සපයන්නන්",
description: "ඔබේ සංවිධානය සඳහා SMS සහ විද්‍යුත් තැපැල් සපයන්නන් වින්‍යාස කරන්න."
heading: {
heading: "කෙටි පණිවුඩ / ඊමේල් සැපයුම්කරුවන්",
onlySMSProvider: "කෙටි පණිවුඩ සැපයුම්කරු",
onlyEmailProvider: "විද්යුත් තැපැල් සැපයුම්කරු"
},
title: {
heading: "කෙටි පණිවුඩ / ඊමේල් සැපයුම්කරුවන්",
onlySMSProvider: "කෙටි පණිවුඩ සැපයුම්කරු",
onlyEmailProvider: "විද්යුත් තැපැල් සැපයුම්කරු"
},
description: {
description: "ඔබේ සංවිධානය සඳහා කෙටි පණිවුඩ සහ විද්යුත් තැපැල් සපයන්නන් වින්‍යාස කරන්න.",
onlySMSProvider: "ඔබේ සංවිධානය සඳහා කෙටි පණිවුඩ සැපයුම්කරු වින්‍යාස කරන්න.",
onlyEmailProvider: "ඔබේ සංවිධානය සඳහා විද්යුත් තැපැල් සැපයුම්කරු වින්‍යාස කරන්න."
}
},
smsProviders: {
heading: "අභිරුචි කෙටි පණිවුඩ සපයන්නා",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,18 @@ export const NotificationChannelPage: FunctionComponent<NotificationChannelPageI

const featureConfig : FeatureConfigInterface = useSelector((state: AppState) => state.config.ui.features);

/**
* Check if the email provider is enabled for the tenant.
*/
const isEmailProviderEnabled: boolean = featureConfig.emailProviders?.enabled
&& !(featureConfig?.emailProviders?.disabledFeatures?.includes("superTenantProvider")
&& organizationType === OrganizationType.SUPER_ORGANIZATION);

/**
* Check if the SMS provider is enabled for the tenant.
*/
const isSMSProviderEnabled: boolean = featureConfig.smsProviders?.enabled;

/**
* Handle connector advance setting selection.
*/
Expand All @@ -61,17 +73,44 @@ export const NotificationChannelPage: FunctionComponent<NotificationChannelPageI
const handleEmailSelection = (): void => {
history.push(AppConstants.getPaths().get("EMAIL_PROVIDER"));
};

/**
* Get the page details based on the enabled providers.
*/
const getPageDetails = (): {
description: string;
pageTitle: string;
title: string;
} => {
if (isEmailProviderEnabled === isSMSProviderEnabled) {
return {
description: t("extensions:develop.notificationChannel.description.description"),
pageTitle: t("extensions:develop.notificationChannel.heading.heading"),
title: t("extensions:develop.notificationChannel.title.title")
};
} else if (isSMSProviderEnabled) {
return {
description: t("extensions:develop.notificationChannel.description.onlySMSProvider"),
pageTitle: t("extensions:develop.notificationChannel.heading.onlySMSProvider"),
title: t("extensions:develop.notificationChannel.title.onlySMSProvider")
};
} else if (isEmailProviderEnabled) {
return {
description: t("extensions:develop.notificationChannel.description.onlyEmailProvider"),
pageTitle: t("extensions:develop.notificationChannel.heading.onlyEmailProvider"),
title: t("extensions:develop.notificationChannel.title.onlyEmailProvider")
};
}
};

return (
<PageLayout
pageTitle={ t("extensions:develop.notificationChannel.heading") }
title={ t("extensions:develop.notificationChannel.title") }
description={ t("extensions:develop.notificationChannel.description") }
pageTitle={ getPageDetails().pageTitle }
title={ getPageDetails().title }
description={ getPageDetails().description }
data-testid={ `${componentid}-page-layout` }
>
{ featureConfig.emailProviders?.enabled
&& !(featureConfig?.emailProviders?.disabledFeatures?.includes("superTenantProvider")
&& organizationType === OrganizationType.SUPER_ORGANIZATION) && (
{ isEmailProviderEnabled && (
<>
<Grid xs={ 12 } lg={ 6 }>
<SettingsSection
Expand All @@ -87,7 +126,7 @@ export const NotificationChannelPage: FunctionComponent<NotificationChannelPageI
<Divider hidden/>
</>
) }
{ featureConfig.smsProviders?.enabled && (
{ isSMSProviderEnabled && (
<Grid xs={ 12 } lg={ 6 }>
<SettingsSection
data-componentid={ "account-login-page-section" }
Expand Down

0 comments on commit b7ff5e1

Please sign in to comment.