Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/cds-unified-view-navigation-fixes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@wso2is/admin.core.v1": patch
"@wso2is/admin.home.v1": patch
"@wso2is/admin.cds.v1": patch
"@wso2is/console": patch
---
Comment thread
pavinduLakshan marked this conversation as resolved.

Fix Customer Data Service navigation issues in the unified Customer Data view. The Feature Preview menu no longer appears empty when there are no accessible preview features, the home-page CDS banner routes to the Customer Data page, and the profile details page returns to the Customer Data page.
7 changes: 5 additions & 2 deletions features/admin.cds.v1/components/profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ import { Dispatch } from "redux";
import { Divider, Form, Grid, TabProps } from "semantic-ui-react";
import { deleteCDSProfile } from "../api/profiles";
import { useCDSProfileDetails } from "../hooks/use-profiles";
import { isCDSUnifiedProfileViewEnabled } from "../utils/ui-mode-utils";

// Lazy load Monaco Editor at module scope to prevent repeated remounting
const MonacoEditor: LazyExoticComponent<any> = lazy(() =>
Expand All @@ -87,6 +88,8 @@ const ProfileDetailsPage: FunctionComponent<Props> = (props: Props): ReactElemen
const dispatch: Dispatch<any> = useDispatch();
const profileId: string = match?.params?.id;

const profilesListPath: string = isCDSUnifiedProfileViewEnabled() ? "CUSTOMER_DATA_PROFILE" : "PROFILES";

// Use SWR hook for fetching profile details
const { data: profile, error, isLoading } = useCDSProfileDetails(profileId);

Expand Down Expand Up @@ -454,7 +457,7 @@ const ProfileDetailsPage: FunctionComponent<Props> = (props: Props): ReactElemen
message: t("customerDataService:profiles.details.notifications.deleteProfile.success.message")
});

history.push(AppConstants.getPaths().get("PROFILES"));
history.push(AppConstants.getPaths().get(profilesListPath));
})
.catch((deleteError: any) => {
setModalAlert({
Expand Down Expand Up @@ -485,7 +488,7 @@ const ProfileDetailsPage: FunctionComponent<Props> = (props: Props): ReactElemen
pageTitle={ t("customerDataService:profiles.details.page.pageTitle") }
description={ displayName || undefined }
backButton={ {
onClick: () => history.push(AppConstants.getPaths().get("PROFILES")),
onClick: () => history.push(AppConstants.getPaths().get(profilesListPath)),
text: t("customerDataService:profiles.details.page.backButton")
} }
data-testid={ testId }
Expand Down
7 changes: 2 additions & 5 deletions features/admin.core.v1/hooks/use-preview-features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,8 @@ export const usePreviewFeatures = (): UsePreviewFeaturesReturnInterface => {

const hasAccessiblePreviewFeatures: boolean = accessibleFeatures.length > 0;
const canUsePreviewFeatures: boolean =
(
saasFeatureStatus === FeatureStatus.ENABLED &&
previewFeaturesFeatureStatus === FeatureStatus.ENABLED
) ||
cdsFeatureConfig?.enabled === true &&
saasFeatureStatus === FeatureStatus.ENABLED &&
previewFeaturesFeatureStatus === FeatureStatus.ENABLED &&
hasAccessiblePreviewFeatures;

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import Typography from "@oxygen-ui/react/Typography";
import { ChevronRightIcon } from "@oxygen-ui/react-icons";
import { FeatureAccessConfigInterface, FeatureFlagsInterface } from "@wso2is/access-control";
import { CDSConfig, useCDSConfig } from "@wso2is/admin.cds.v1";
import { isCDSUnifiedProfileViewEnabled } from "@wso2is/admin.cds.v1/utils/ui-mode-utils";
import { AppConstants } from "@wso2is/admin.core.v1/constants/app-constants";
import { history } from "@wso2is/admin.core.v1/helpers/history";
import { AppState } from "@wso2is/admin.core.v1/store";
Expand Down Expand Up @@ -215,6 +216,7 @@ export const FeatureCarousel = () => {
isLoading: isCDSConfigFetchRequestLoading
} = useCDSConfig<CDSConfig>(isCDSFeatureEnabled);
const isCDSEnabledForOrganization: boolean = isCDSFeatureEnabled && (cdsConfig?.cds_enabled ?? false);
const isCDSUnifiedProfileView: boolean = isCDSUnifiedProfileViewEnabled();


const isUserSurveyBannerEnabled: boolean = useSelector((state: AppState) =>
Expand Down Expand Up @@ -279,9 +281,15 @@ export const FeatureCarousel = () => {
src={ CustomerDataServiceIllustration }
/>
</Box>,
isEnabled: isCDSEnabledForOrganization,
isEnabled: isCDSUnifiedProfileView || isCDSEnabledForOrganization,
isEnabledStatusLoading: isCDSConfigFetchRequestLoading,
onTryOut: () => {
if (isCDSUnifiedProfileView) {
history.push(AppConstants.getPaths().get("CUSTOMER_DATA_PROFILE"));

return;
}

if (isCDSEnabledForOrganization) {
history.push(AppConstants.getPaths().get("PROFILES"));

Expand Down
Loading