Skip to content

Commit

Permalink
Merge pull request #7274 from ThaminduR/connector-ext
Browse files Browse the repository at this point in the history
Add extension point to governance connector listing
  • Loading branch information
ThaminduR authored Jan 9, 2025
2 parents 6ee01d5 + 721be7b commit 8d02b73
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .changeset/empty-fireants-sniff.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@wso2is/admin.server-configurations.v1": minor
"@wso2is/admin.extensions.v1": minor
---

Add extension point to governance connector listing
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export interface ServerConfigurationConfig {
) => PasswordExpiryInterface;
processPasswordExpirySubmitData: (data: ValidationFormInterface) => Promise<any>;
processPasswordPoliciesSubmitData: (data: ValidationFormInterface, isLegacy: boolean) => Promise<void>;
getConnectorCategoryExtension: () => Array<any>;
}

export interface PasswordHistoryCountInterface extends ValidationFormInterface {
Expand Down
3 changes: 3 additions & 0 deletions features/admin.extensions.v1/configs/server-configuration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ const serverConfigurationConfig: ServerConfigurationConfig = {
],
dynamicConnectors: true,
extendedConnectors: [],
getConnectorCategoryExtension: () : Array<any> => {
return [];
},
intendSettings: false,
passwordExpiryComponent: (
componentId: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export const ConnectorListingPage: FunctionComponent<ConnectorListingPageInterfa
);

const predefinedCategories: any = useMemo(() => {
const originalConnectors: Array<any> = GovernanceConnectorUtils.getPredefinedConnectorCategories();
const originalConnectors: Array<any> = GovernanceConnectorUtils.getCombinedPredefinedConnectorCategories();
const refinedConnectorCategories: Array<any> = [];

const isOrganizationDiscoveryEnabled: boolean = featureConfig?.organizationDiscovery?.enabled
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/

import { AppConstants, store } from "@wso2is/admin.core.v1";
import { serverConfigurationConfig } from "@wso2is/admin.extensions.v1";
import { FeatureStatusLabel } from "@wso2is/admin.feature-gate.v1/models/feature-status";
import { IdentityAppsApiException } from "@wso2is/core/exceptions";
import { AlertLevels } from "@wso2is/core/models";
Expand Down Expand Up @@ -176,6 +177,24 @@ export class GovernanceConnectorUtils {
});
}

public static getCombinedPredefinedConnectorCategories(): Array<any> {

return this.getPredefinedConnectorCategories().map((category: any) => {

const additionalConnectors: any = serverConfigurationConfig.getConnectorCategoryExtension()
.find((el: any) => el.id === category.id);

if (additionalConnectors) {
return {
...category,
connectors: [ ...category.connectors, ...additionalConnectors.connectors ]
};
} else {
return category;
}
});
}

public static getPredefinedConnectorCategories(): Array<any> {

return [
Expand Down

0 comments on commit 8d02b73

Please sign in to comment.