From 41b06c5dc726b1a4e6613fb4c969323d35457b61 Mon Sep 17 00:00:00 2001 From: Yasasr1 Date: Thu, 31 Oct 2024 08:42:04 +0530 Subject: [PATCH 1/7] Add org discovery for self-signup. --- .../update-organization-discovery-config.ts | 60 +++ .../use-get-organization-discovery-config.ts | 11 +- ...iscoverable-organizations-list-layout.scss | 15 + ...discoverable-organizations-list-layout.tsx | 256 ++++++++++ .../models/organization-discovery.ts | 2 +- .../organization-discovery-domains-page.tsx | 455 ++++++++---------- .../namespaces/organization-discovery-ns.ts | 25 + .../en-US/portals/organization-discovery.ts | 64 ++- .../src/translations/en-US/portals/pages.ts | 2 +- 9 files changed, 625 insertions(+), 265 deletions(-) create mode 100644 features/admin.organization-discovery.v1/api/update-organization-discovery-config.ts create mode 100644 features/admin.organization-discovery.v1/components/discoverable-organizations-list-layout.scss create mode 100644 features/admin.organization-discovery.v1/components/discoverable-organizations-list-layout.tsx diff --git a/features/admin.organization-discovery.v1/api/update-organization-discovery-config.ts b/features/admin.organization-discovery.v1/api/update-organization-discovery-config.ts new file mode 100644 index 00000000000..a9946765390 --- /dev/null +++ b/features/admin.organization-discovery.v1/api/update-organization-discovery-config.ts @@ -0,0 +1,60 @@ +/** + * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { AsgardeoSPAClient, HttpClientInstance } from "@asgardeo/auth-react"; +import { store } from "@wso2is/admin.core.v1/store"; +import { HttpMethods } from "@wso2is/core/models"; +import { AxiosError, AxiosRequestConfig, AxiosResponse } from "axios"; +import { OrganizationDiscoveryConfigInterface } from "../models/organization-discovery"; + +/** + * Get an axios instance. + */ +const httpClient: HttpClientInstance = AsgardeoSPAClient.getInstance() + .httpRequest.bind(AsgardeoSPAClient.getInstance()); + +/** + * Update organization discovery configurations + * + * @param properties - Data that needs to be updated. + */ +export const updateOrganizationDiscoveryConfig = ( + properties: OrganizationDiscoveryConfigInterface +): Promise => { + const requestConfig: AxiosRequestConfig = { + data: properties, + headers: { + "Content-Type": "application/json" + }, + method: HttpMethods.PUT, + url: `${ store.getState().config.endpoints.organizations }/organization-configs/discovery` + }; + + return httpClient(requestConfig) + .then((response: AxiosResponse) => { + if (response.status !== 200) { + return Promise.reject(new Error("Failed to update organization discovery configs.")); + } + + return Promise.resolve(response?.data); + }).catch((error: AxiosError) => { + return Promise.reject(error?.response?.data); + }); +}; + +export default updateOrganizationDiscoveryConfig; diff --git a/features/admin.organization-discovery.v1/api/use-get-organization-discovery-config.ts b/features/admin.organization-discovery.v1/api/use-get-organization-discovery-config.ts index c79fa7f50ce..23b0e61f3b1 100644 --- a/features/admin.organization-discovery.v1/api/use-get-organization-discovery-config.ts +++ b/features/admin.organization-discovery.v1/api/use-get-organization-discovery-config.ts @@ -36,7 +36,8 @@ import { * @returns SWR response object containing the data, error, isValidating, mutate. */ const useGetOrganizationDiscoveryConfig = < - Data = OrganizationDiscoveryConfigInterface & { isOrganizationDiscoveryEnabled: boolean }, + Data = OrganizationDiscoveryConfigInterface & { isOrganizationDiscoveryEnabled: boolean, + isEmailDomainBasedSelfRegistrationEnabled: boolean }, Error = RequestErrorInterface >(shouldFetch: boolean = true): RequestResultInterface => { const requestConfig: RequestConfigInterface = { @@ -53,13 +54,18 @@ const useGetOrganizationDiscoveryConfig = < }); let isOrganizationDiscoveryEnabled: boolean = false; + let isEmailDomainBasedSelfRegistrationEnabled: boolean = false; if ((data as OrganizationDiscoveryConfigInterface)?.properties) { (data as OrganizationDiscoveryConfigInterface).properties?.forEach( (property: OrganizationDiscoveryConfigPropertyInterface) => { - if (property.key === "emailDomain.enable") { + if (property.key === "emailDomain.enable" && property.value === "true") { isOrganizationDiscoveryEnabled = true; } + + if (property.key === "emailDomainBasedSelfSignup.enable" && property.value === "true") { + isEmailDomainBasedSelfRegistrationEnabled = true; + } } ); } @@ -83,6 +89,7 @@ const useGetOrganizationDiscoveryConfig = < return { data: { + isEmailDomainBasedSelfRegistrationEnabled, isOrganizationDiscoveryEnabled, ...data }, diff --git a/features/admin.organization-discovery.v1/components/discoverable-organizations-list-layout.scss b/features/admin.organization-discovery.v1/components/discoverable-organizations-list-layout.scss new file mode 100644 index 00000000000..84cc37b7d1c --- /dev/null +++ b/features/admin.organization-discovery.v1/components/discoverable-organizations-list-layout.scss @@ -0,0 +1,15 @@ +.discoverable-organizations-list-layout { + .top-action-panel { + display: flex; + flex-direction: row-reverse; + flex-wrap: nowrap; + align-content: center; + justify-content: flex-start; + align-items: center; + gap: 10px; + + >.ui.grid { + flex-grow: 1; + } + } +} diff --git a/features/admin.organization-discovery.v1/components/discoverable-organizations-list-layout.tsx b/features/admin.organization-discovery.v1/components/discoverable-organizations-list-layout.tsx new file mode 100644 index 00000000000..71729454ec8 --- /dev/null +++ b/features/admin.organization-discovery.v1/components/discoverable-organizations-list-layout.tsx @@ -0,0 +1,256 @@ +/** + * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { Show } from "@wso2is/access-control"; +import { EventPublisher, FeatureConfigInterface } from "@wso2is/admin.core.v1"; +import { AdvancedSearchWithBasicFilters } from "@wso2is/admin.core.v1/components"; +import { AppConstants } from "@wso2is/admin.core.v1/constants/app-constants"; +import { history } from "@wso2is/admin.core.v1/helpers/history"; +import { IdentifiableComponentInterface } from "@wso2is/core/models"; +import { I18n } from "@wso2is/i18n"; +import { ListLayout, PrimaryButton } from "@wso2is/react-components"; +import find from "lodash-es/find"; +import React, { + FunctionComponent, + MouseEvent, + ReactElement, + ReactNode, + SyntheticEvent, + useCallback, + useState } from "react"; +import { useTranslation } from "react-i18next"; +import { DropdownItemProps, DropdownProps, Icon, PaginationProps } from "semantic-ui-react"; +import DiscoverableOrganizationsList from "./discoverable-organizations-list"; +import { OrganizationListWithDiscoveryInterface } from "../models/organization-discovery"; +import "./discoverable-organizations-list-layout.scss"; + +/** + * Props interface of {@link DiscoverableOrganizationsListLayout} + */ +export interface DiscoverableOrganizationsListLayoutPropsInterface extends IdentifiableComponentInterface { + discoverableOrganizations: OrganizationListWithDiscoveryInterface + listItemLimit: number; + isDiscoverableOrganizationsFetchRequestLoading: boolean; + featureConfig: FeatureConfigInterface; + searchQuery: string; + onListItemLimitChange: (limit: number) => void; + onListOffsetChange: (offset: number) => void; + onSearchQueryChange: (query: string) => void; + +} + +/** + * Layout for the discoverable organizations list. + * + * @param props - Props injected to the component. + * @returns Discoverable organization list layout component. + */ +const DiscoverableOrganizationsListLayout: FunctionComponent = ( + props: DiscoverableOrganizationsListLayoutPropsInterface +): ReactElement => { + + const { + discoverableOrganizations, + listItemLimit, + isDiscoverableOrganizationsFetchRequestLoading, + featureConfig, + searchQuery, + onListItemLimitChange, + onListOffsetChange, + onSearchQueryChange, + [ "data-componentid" ]: componentId + } = props; + + const ORGANIZATIONS_LIST_SORTING_OPTIONS: DropdownItemProps[] = [ + { + key: 0, + text: I18n.instance.t("organizationDiscovery:advancedSearch." + + "form.dropdown.filterAttributeOptions.organizationName") as ReactNode, + value: "organizationName" + } + ]; + + const eventPublisher: EventPublisher = EventPublisher.getInstance(); + const { t } = useTranslation(); + const [ triggerClearQuery, setTriggerClearQuery ] = useState(false); + const [ listSortingStrategy, setListSortingStrategy ] = useState( + ORGANIZATIONS_LIST_SORTING_OPTIONS[ 0 ] + ); + + /** + * Handles the `onFilter` callback action from the + * organization search component. + * + * @param query - Search query. + */ + const handleOrganizationFilter: (query: string) => void = useCallback( + (query: string): void => { + onSearchQueryChange(query); + }, + [ onSearchQueryChange ] + ); + + /** + * Handles the `onSearchQueryClear` callback action. + */ + const handleSearchQueryClear: () => void = useCallback((): void => { + setTriggerClearQuery(!triggerClearQuery); + onSearchQueryChange(""); + }, [ onSearchQueryChange, triggerClearQuery ]); + + /** + * Handles per page dropdown page. + * + * @param event - Mouse event. + * @param data - Dropdown data. + */ + const handleItemsPerPageDropdownChange = (event: MouseEvent, data: DropdownProps): void => { + onListItemLimitChange(data.value as number); + }; + + /** + * Handles the pagination change. + * + * @param event - Mouse event. + * @param data - Pagination component data. + */ + const handlePaginationChange = (event: MouseEvent, data: PaginationProps) => { + const offsetValue: number = ((data.activePage as number) - 1) * listItemLimit; + + onListOffsetChange(offsetValue); + }; + + /** + * Sets the list sorting strategy. + * + * @param event - The event. + * @param data - Dropdown data. + */ + const handleListSortingStrategyOnChange = (event: SyntheticEvent, data: DropdownProps): void => { + setListSortingStrategy( + find(ORGANIZATIONS_LIST_SORTING_OPTIONS, (option: DropdownItemProps) => { + return data.value === option.value; + }) + ); + }; + + /** + * Checks if the `Next` page nav button should be shown. + * + * @param orgList - List of discoverable organizations. + * @returns `true` if `Next` page nav button should be shown. + */ + const shouldShowNextPageNavigation = (orgList: OrganizationListWithDiscoveryInterface): boolean => { + return orgList?.startIndex + orgList?.count !== orgList?.totalResults + 1; + }; + + return ( + + ) } + currentListSize={ discoverableOrganizations?.organizations?.length } + listItemLimit={ listItemLimit } + onItemsPerPageDropdownChange={ handleItemsPerPageDropdownChange } + onPageChange={ handlePaginationChange } + onSortStrategyChange={ handleListSortingStrategyOnChange } + showTopActionPanel={ + isDiscoverableOrganizationsFetchRequestLoading || + !(!searchQuery && discoverableOrganizations?.organizations?.length <= 0) + } + sortOptions={ ORGANIZATIONS_LIST_SORTING_OPTIONS } + sortStrategy={ listSortingStrategy } + topActionPanelExtension={ + ( + + { + eventPublisher.publish("organization-click-assign-email-domain-button"); + history.push( + AppConstants.getPaths().get("ASSIGN_ORGANIZATION_DISCOVERY_DOMAINS") + ); + } } + data-componentid={ `${ componentId }-list-layout-assign-button` } + > + + { t("organizationDiscovery:emailDomains.actions.assign") } + + + ) } + totalPages={ 10 } + totalListSize={ discoverableOrganizations?.organizations?.length } + isLoading={ isDiscoverableOrganizationsFetchRequestLoading } + paginationOptions={ { + disableNextButton: !shouldShowNextPageNavigation(discoverableOrganizations) + } } + data-componentid={ `${ componentId }-list-layout` } + className="discoverable-organizations-list-layout" + showPagination + > + { + history.push(AppConstants.getPaths().get("ASSIGN_ORGANIZATION_DISCOVERY_DOMAINS")); + } } + onSearchQueryClear={ handleSearchQueryClear } + searchQuery={ searchQuery } + data-componentid="organization-list-with-discovery" + /> + + ); +}; + +/** + * Default props for the component. + */ +DiscoverableOrganizationsListLayout.defaultProps = { + "data-componentid": "discoverable-organizations-list-layout" +}; + +export default DiscoverableOrganizationsListLayout; diff --git a/features/admin.organization-discovery.v1/models/organization-discovery.ts b/features/admin.organization-discovery.v1/models/organization-discovery.ts index df30bf2a559..727f7baa257 100644 --- a/features/admin.organization-discovery.v1/models/organization-discovery.ts +++ b/features/admin.organization-discovery.v1/models/organization-discovery.ts @@ -77,7 +77,7 @@ export interface OrganizationAttributesInterface { export interface OrganizationDiscoveryConfigPropertyInterface { key: string; - value: boolean; + value: string; } export interface OrganizationDiscoveryAttributesInterface { diff --git a/features/admin.organization-discovery.v1/pages/organization-discovery-domains-page.tsx b/features/admin.organization-discovery.v1/pages/organization-discovery-domains-page.tsx index 555f7508176..cfc8f9700ec 100644 --- a/features/admin.organization-discovery.v1/pages/organization-discovery-domains-page.tsx +++ b/features/admin.organization-discovery.v1/pages/organization-discovery-domains-page.tsx @@ -17,12 +17,9 @@ */ import Alert from "@oxygen-ui/react/Alert"; -import { Show } from "@wso2is/access-control"; import { - AdvancedSearchWithBasicFilters, AppConstants, AppState, - EventPublisher, FeatureConfigInterface, UIConstants, history @@ -30,51 +27,36 @@ import { import { hasRequiredScopes } from "@wso2is/core/helpers"; import { AlertLevels, IdentifiableComponentInterface } from "@wso2is/core/models"; import { addAlert } from "@wso2is/core/store"; -import { I18n } from "@wso2is/i18n"; -import { ListLayout, PageLayout, PrimaryButton } from "@wso2is/react-components"; -import find from "lodash-es/find"; -import isEmpty from "lodash-es/isEmpty"; +import { Field, Form } from "@wso2is/form"; +import { EmphasizedSegment, Link, PageLayout } from "@wso2is/react-components"; +import { AxiosError } from "axios"; import React, { FunctionComponent, - MouseEvent, ReactElement, - ReactNode, SyntheticEvent, - useCallback, useEffect, useMemo, useState } from "react"; -import { useTranslation } from "react-i18next"; +import { Trans, useTranslation } from "react-i18next"; import { useDispatch, useSelector } from "react-redux"; import { Dispatch } from "redux"; import { Checkbox, CheckboxProps, - Divider, - DropdownItemProps, - DropdownProps, - Icon, - PaginationProps + Divider } from "semantic-ui-react"; -import addOrganizationDiscoveryConfig from "../api/add-organization-discovery-config"; -import deleteOrganizationDiscoveryConfig from "../api/delete-organization-discovery-config"; +import { ConnectorPropertyInterface, GovernanceConnectorInterface } from "../../admin.connections.v1"; +import { + ServerConfigurationsConstants, + UpdateGovernanceConnectorConfigPropertyInterface, + getConnectorDetails +} from "../../admin.server-configurations.v1"; +import updateOrganizationDiscoveryConfig from "../api/update-organization-discovery-config"; import useGetOrganizationDiscovery from "../api/use-get-organization-discovery"; import useGetOrganizationDiscoveryConfig from "../api/use-get-organization-discovery-config"; -import DiscoverableOrganizationsList from "../components/discoverable-organizations-list"; -import { - OrganizationDiscoveryConfigInterface, - OrganizationListWithDiscoveryInterface -} from "../models/organization-discovery"; - -const ORGANIZATIONS_LIST_SORTING_OPTIONS: DropdownItemProps[] = [ - { - key: 0, - text: I18n.instance.t("organizationDiscovery:advancedSearch." + - "form.dropdown.filterAttributeOptions.organizationName") as ReactNode, - value: "organizationName" - } -]; +import DiscoverableOrganizationsListLayout from "../components/discoverable-organizations-list-layout"; +import { OrganizationDiscoveryConfigInterface } from "../models/organization-discovery"; /** * Props interface of {@link OrganizationDiscoveryDomainsPage} @@ -110,14 +92,8 @@ const OrganizationDiscoveryDomainsPage: FunctionComponent(""); - const [ listSortingStrategy, setListSortingStrategy ] = useState( - ORGANIZATIONS_LIST_SORTING_OPTIONS[ 0 ] - ); const [ listItemLimit, setListItemLimit ] = useState(UIConstants.DEFAULT_RESOURCE_LIST_ITEM_LIMIT); const [ listOffset, setListOffset ] = useState(0); - const [ triggerClearQuery, setTriggerClearQuery ] = useState(false); - - const eventPublisher: EventPublisher = EventPublisher.getInstance(); const filterQuery: string = useMemo(() => { let filterQuery: string = ""; @@ -130,7 +106,6 @@ const OrganizationDiscoveryDomainsPage: FunctionComponent(false); + + /** + * Fetch the self-registration configuration. + */ + useEffect(() => { + getConnectorDetails(ServerConfigurationsConstants.USER_ONBOARDING_CONNECTOR_ID, + ServerConfigurationsConstants.SELF_SIGN_UP_CONNECTOR_ID) + .then((response: GovernanceConnectorInterface) => { + const selfRegEnabledProperty: UpdateGovernanceConnectorConfigPropertyInterface = + response?.properties?.find((property: ConnectorPropertyInterface) => + property.name === ServerConfigurationsConstants.SELF_REGISTRATION_ENABLE + ); + + setIsSelfRegEnabled(selfRegEnabledProperty?.value === "true"); + }) + .catch((error: AxiosError) => { + if (error.response && error.response.data && error.response.data.detail) { + dispatch( + addAlert({ + description: t( + "governanceConnectors:notifications." + + "getConnector.error.description", + { description: error.response.data.description } + ), + level: AlertLevels.ERROR, + message: t( + "governanceConnectors:notifications." + + "getConnector.error.message" + ) + }) + ); + } else { + dispatch( + addAlert({ + description: t( + "governanceConnectors:notifications." + + "getConnector.genericError.description" + ), + level: AlertLevels.ERROR, + message: t( + "governanceConnectors:notifications." + + "getConnector.genericError.message" + ) + }) + ); + } + }); + }, []); + + const handleEmailDomainBasedSelfRegistration = (value: boolean): void => { + const updateData: OrganizationDiscoveryConfigInterface = { + properties: [] + }; + + updateData.properties.push({ + key: "emailDomain.enable", + value: isOrganizationDiscoveryEnabled ? "true" : "false" + }); + + updateData.properties.push({ + key: "emailDomainBasedSelfSignup.enable", + value: value ? "true" : "false" + }); + + updateOrganizationDiscoveryConfig(updateData) + .then(() => { + dispatch( + addAlert({ + description: value ? t( + "organizationDiscovery:notifications." + + "enableEmailDomainBasedSelfRegistration.success.description" + ) : t( + "organizationDiscovery:notifications." + + "disableEmailDomainBasedSelfRegistration.success.description" + ), + level: AlertLevels.SUCCESS, + message: value ? t( + "organizationDiscovery:notifications." + + "enableEmailDomainBasedSelfRegistration.success.message" + ) : t( + "organizationDiscovery:notifications." + + "disableEmailDomainBasedSelfRegistration.success.message" + ) + }) + ); + + mutateOrganizationDiscoveryConfigFetchRequest(); + }) + .catch(() => { + dispatch( + addAlert({ + description: value ? t( + "organizationDiscovery:notifications." + + "enableEmailDomainBasedSelfRegistration.error.description" + ) : t( + "organizationDiscovery:notifications." + + "disableEmailDomainBasedSelfRegistration.error.description" + ), + level: AlertLevels.ERROR, + message: value ? t( + "organizationDiscovery:notifications." + + "enableEmailDomainBasedSelfRegistration.error.message" + ) : t( + "organizationDiscovery:notifications." + + "disableEmailDomainBasedSelfRegistration.error.message" + ) + }) + ); + }); + }; /** * Handle error scenarios of the organization discovery config fetch request. @@ -192,63 +278,6 @@ const OrganizationDiscoveryDomainsPage: FunctionComponent, data: DropdownProps): void => { - setListSortingStrategy( - find(ORGANIZATIONS_LIST_SORTING_OPTIONS, (option: DropdownItemProps) => { - return data.value === option.value; - }) - ); - }; - - /** - * Handles the `onFilter` callback action from the - * organization search component. - * - * @param query - Search query. - */ - const handleOrganizationFilter: (query: string) => void = useCallback( - (query: string): void => { - setSearchQuery(query); - }, - [ setSearchQuery ] - ); - - /** - * Handles the pagination change. - * - * @param event - Mouse event. - * @param data - Pagination component data. - */ - const handlePaginationChange = (event: MouseEvent, data: PaginationProps) => { - const offsetValue: number = ((data.activePage as number) - 1) * listItemLimit; - - setListOffset(offsetValue); - }; - - /** - * Handles per page dropdown page. - * - * @param event - Mouse event. - * @param data - Dropdown data. - */ - const handleItemsPerPageDropdownChange = (event: MouseEvent, data: DropdownProps): void => { - setListItemLimit(data.value as number); - }; - - /** - * Handles the `onSearchQueryClear` callback action. - */ - const handleSearchQueryClear: () => void = useCallback((): void => { - setTriggerClearQuery(!triggerClearQuery); - setSearchQuery(""); - }, [ setSearchQuery, triggerClearQuery ]); - /** * This is called when the enable toggle changes. * @@ -256,63 +285,42 @@ const OrganizationDiscoveryDomainsPage: FunctionComponent { - if (data.checked === true) { - const updateData: OrganizationDiscoveryConfigInterface = { - properties: [] - }; + const updateData: OrganizationDiscoveryConfigInterface = { + properties: [] + }; + if (data.checked === true) { updateData.properties.push({ key: "emailDomain.enable", - value: true + value: "true" + }); + } else { + updateData.properties.push({ + key: "emailDomain.enable", + value: "false" }); - addOrganizationDiscoveryConfig(updateData) - .then(() => { - dispatch( - addAlert({ - description: t( - "organizationDiscovery:notifications." + - "enableEmailDomainDiscovery.success.description" - ), - level: AlertLevels.SUCCESS, - message: t( - "organizationDiscovery:notifications." + - "enableEmailDomainDiscovery.success.message" - ) - }) - ); - - mutateOrganizationDiscoveryConfigFetchRequest(); - }) - .catch(() => { - dispatch( - addAlert({ - description: t( - "organizationDiscovery:notifications." + - "enableEmailDomainDiscovery.error.description" - ), - level: AlertLevels.ERROR, - message: t( - "organizationDiscovery:notifications." + - "enableEmailDomainDiscovery.error.message" - ) - }) - ); - }); - - return; + updateData.properties.push({ + key: "emailDomainBasedSelfSignup.enable", + value: "false" + }); } - deleteOrganizationDiscoveryConfig() + updateOrganizationDiscoveryConfig(updateData) .then(() => { dispatch( addAlert({ - description: t( + description: data.checked ? t( "organizationDiscovery:notifications." + - "disableEmailDomainDiscovery.success.description" - ), + "enableEmailDomainDiscovery.success.description" + ) : t( + "organizationDiscovery:notifications." + + "disableEmailDomainDiscovery.success.description"), level: AlertLevels.SUCCESS, - message: t( + message: data.checked ? t( + "organizationDiscovery:notifications." + + "enableEmailDomainDiscovery.success.message" + ) : t( "organizationDiscovery:notifications." + "disableEmailDomainDiscovery.success.message" ) @@ -324,12 +332,18 @@ const OrganizationDiscoveryDomainsPage: FunctionComponent { dispatch( addAlert({ - description: t( + description: data.checked ? t( + "organizationDiscovery:notifications." + + "enableEmailDomainDiscovery.error.description" + ) : t( "organizationDiscovery:notifications." + "disableEmailDomainDiscovery.error.description" ), level: AlertLevels.ERROR, - message: t( + message: data.checked ? t( + "organizationDiscovery:notifications." + + "enableEmailDomainDiscovery.error.message" + ) : t( "organizationDiscovery:notifications." + "disableEmailDomainDiscovery.error.message" ) @@ -355,16 +369,6 @@ const OrganizationDiscoveryDomainsPage: FunctionComponent { - return orgList?.startIndex + orgList?.count !== orgList?.totalResults + 1; - }; - /** * Handle back button click. */ @@ -374,33 +378,6 @@ const OrganizationDiscoveryDomainsPage: FunctionComponent - { - eventPublisher.publish("organization-click-assign-email-domain-button"); - history.push( - AppConstants.getPaths().get("ASSIGN_ORGANIZATION_DISCOVERY_DOMAINS") - ); - } } - data-componentid={ `${ testId }-list-layout-assign-button` } - > - - { t("organizationDiscovery:emailDomains.actions.assign") } - - - ) - } pageTitle={ t("pages:emailDomainDiscovery.title") } title={ t("pages:emailDomainDiscovery.title") } description={ t("pages:emailDomainDiscovery.subTitle") } @@ -418,69 +395,63 @@ const OrganizationDiscoveryDomainsPage: FunctionComponent