Skip to content

Commit

Permalink
fix(Designer): Stuck on loading after making Manage Identity Issue Ac…
Browse files Browse the repository at this point in the history
…tion (#4332)

* fixed the stuck on loading issue

* fixed breaking parts to let it display error message
  • Loading branch information
Elaina-Lee committed Mar 8, 2024
1 parent fd62aaa commit 1a366aa
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
23 changes: 21 additions & 2 deletions libs/designer/src/lib/core/actions/bjsworkflow/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ import { getConnectionsForConnector, getConnectorWithSwagger } from '../../queri
import { getOperationManifest } from '../../queries/operation';
import { initEmptyConnectionMap } from '../../state/connection/connectionSlice';
import type { NodeData, NodeOperation, OperationMetadataState } from '../../state/operation/operationMetadataSlice';
import { initializeNodes, initializeOperationInfo, updateNodeSettings } from '../../state/operation/operationMetadataSlice';
import {
ErrorLevel,
initializeNodes,
initializeOperationInfo,
updateErrorDetails,
updateNodeSettings,
} from '../../state/operation/operationMetadataSlice';
import type { RelationshipIds } from '../../state/panel/panelInterfaces';
import { changePanelNode, openPanel, setIsPanelLoading } from '../../state/panel/panelSlice';
import { addResultSchema } from '../../state/staticresultschema/staticresultsSlice';
Expand Down Expand Up @@ -232,7 +238,20 @@ export const initializeOperationDetails = async (
getState
);
} else if (connector) {
await trySetDefaultConnectionForNode(nodeId, connector, dispatch, isConnectionRequired);
try {
await trySetDefaultConnectionForNode(nodeId, connector, dispatch, isConnectionRequired);
} catch (e: any) {
dispatch(
updateErrorDetails({
id: nodeId,
errorInfo: {
level: ErrorLevel.Connection,
message: e?.message,
},
})
);
dispatch(setIsPanelLoading(false));
}
}

const schemaService = staticResultService.getOperationResultSchema(connectorId, operationId, swagger || parsedManifest);
Expand Down
6 changes: 3 additions & 3 deletions libs/designer/src/lib/core/utils/connectors/connections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,15 +191,15 @@ export function getSupportedParameterSets(
};
}

export function isIdentityPresentInLogicApp(identity: string, managedIdentity: ManagedIdentity): boolean {
export function isIdentityPresentInLogicApp(identity: string, managedIdentity: ManagedIdentity | undefined): boolean {
const identitiesInLogicApp = [];
const type = managedIdentity.type;
const type = managedIdentity?.type;
if (equals(type, ResourceIdentityType.SYSTEM_ASSIGNED) || equals(type, ResourceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED)) {
identitiesInLogicApp.push(constants.SYSTEM_ASSIGNED_MANAGED_IDENTITY);
}

if (equals(type, ResourceIdentityType.USER_ASSIGNED) || equals(type, ResourceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED)) {
for (const identity of Object.keys(managedIdentity.userAssignedIdentities ?? {})) {
for (const identity of Object.keys(managedIdentity?.userAssignedIdentities ?? {})) {
identitiesInLogicApp.push(identity);
}
}
Expand Down

0 comments on commit 1a366aa

Please sign in to comment.