Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(designer): Default nested items to use item token brandcolor/icon #6276

Merged
merged 1 commit into from
Dec 31, 2024
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
2 changes: 0 additions & 2 deletions libs/designer-ui/src/lib/tokenpicker/tokenpickerfooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,6 @@ export function TokenPickerFooter({
brandColor: constants.FX_COLOR,
icon: FxIcon,
title: getExpressionTokenTitle(currExpression),
// Todo: get Expression Token description
description: '',
key: guid(),
value: expression.value,
};
Expand Down
5 changes: 3 additions & 2 deletions libs/designer/src/lib/core/utils/parameters/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3232,9 +3232,10 @@ export function updateTokenMetadata(
const tokenNodeOperation = operations[tokenNodeId];
const nodeType = tokenNodeOperation?.type;
const isSecure = hasSecureOutputs(nodeType, settings ?? {});
const isFromExistingLoop = Boolean(arrayDetails?.loopSource && getPropertyValue(actionNodes, arrayDetails.loopSource));
const nodeOutputInfo = getOutputByTokenInfo(unmap(nodeOutputs?.outputs), valueSegment.token as SegmentToken, parameterType);
const brandColor = token.tokenType === TokenType.ITEM ? ItemBrandColor : operationMetadata?.brandColor;
const iconUri = token.tokenType === TokenType.ITEM ? ItemIcon : operationMetadata?.iconUri;
const brandColor = token.tokenType === TokenType.ITEM || isFromExistingLoop ? ItemBrandColor : operationMetadata?.brandColor;
const iconUri = token.tokenType === TokenType.ITEM || isFromExistingLoop ? ItemIcon : operationMetadata?.iconUri;

let outputInsideForeach = false;
if (parameterNodeId) {
Expand Down
24 changes: 4 additions & 20 deletions libs/designer/src/lib/core/utils/parameters/tokensegment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,35 +260,19 @@ export class TokenSegmentConvertor {

private _getTokenSource(expression: ExpressionFunction): string {
const dereferences = expression.dereferences;
switch (expression.name.toUpperCase()) {
case 'BODY':
case 'ACTIONBODY':
case 'TRIGGERBODY':
return OutputSource.Body;
default:
break;
if (['BODY', 'ACTIONBODY', 'TRIGGERBODY'].includes(expression.name.toUpperCase())) {
return OutputSource.Body;
}

// TODO: Please fix the below logic, it seems redundant to check and return the same output source.
if (dereferences.length >= 1) {
const dereferenceExpression = dereferences[0].expression;
if (isStringLiteral(dereferenceExpression)) {
const value = dereferenceExpression.value;
if (equals(value, OutputSource.StatusCode)) {
return OutputSource.StatusCode;
}
if (equals(value, OutputSource.Queries)) {
return OutputSource.Queries;
}
if (equals(value, OutputSource.Headers)) {
return OutputSource.Headers;
}
if (equals(value, OutputSource.Body)) {
return OutputSource.Body;
if ([OutputSource.StatusCode, OutputSource.Queries, OutputSource.Headers, OutputSource.Body].includes(value)) {
return value;
}
}
}

return OutputSource.Outputs;
}

Expand Down
Loading