Skip to content

Commit e376c66

Browse files
preetriti1Priti Sambandamdependabot[bot]ccastrotrejoElaina-Lee
authored
fix(knowledge): add toaster notifications, centralized error handling, and file upload hooks (#9024) (#9058)
refactor(knowledge): add toaster notifications, centralized error handling, and file upload hooks (#9024) * fix(knowledge): Error handling and content changes for knowledge wizard and designer * chore(deps): bump lodash from 4.17.21 to 4.18.1 (#8996) Bumps [lodash](https://github.com/lodash/lodash) from 4.17.21 to 4.18.1. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](lodash/lodash@4.17.21...4.18.1) --- updated-dependencies: - dependency-name: lodash dependency-version: 4.18.1 dependency-type: direct:production ... * fix(designer): Only populate deploymentModelProperties for MicrosoftFoundry (#9012) fixed deploymentModelProperties not updating properly issue * fix(DesignerV2): Fixed nested workflow clickthrough button (#9018) * Fixed child run issue in standard logic apps * Fixed duplicate IO requests * Fixed data import issue with io * Added clickthrough to context menu * Fixing issues found in knowledge hub creation * Fixing tests --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Priti Sambandam <psamband@microsoft.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Carlos Castro <ccastrotrejo@microsoft.com> Co-authored-by: Elaina Lee <144840522+Elaina-Lee@users.noreply.github.com> Co-authored-by: Riley Evans <rllyy97@gmail.com>
1 parent 4322c5c commit e376c66

33 files changed

Lines changed: 1706 additions & 1019 deletions

Localize/lang/strings.json

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
"/LO3Ia": "Testing",
6262
"/NtebP": "(UTC+05:00) Islamabad, Karachi",
6363
"/QqADs": "Returns the elements in the array starting at index Count",
64+
"/RFd5i": "Successfully created the group.",
6465
"/RS9F7": "(UTC-06:00) Saskatchewan",
6566
"/ULFwg": "Change connection",
6667
"/VcZ9g": "This connector has multiple versions, built-in and Azure-hosted. Use built-in for the best performance, connection-string authentication, and other features. Use Azure-hosted for other authentication options.",
@@ -621,6 +622,7 @@
621622
"9hKeBq": "Select an Azure OpenAI resource",
622623
"9klmbJ": "Save",
623624
"9lP2zW": "Please select tool",
625+
"9mG3yl": "Failed to update connection",
624626
"9mjZIW": "Delete handoff",
625627
"9nAAU/": "Connections",
626628
"9o9MIz": "Set up a database for your knowledge base.",
@@ -834,6 +836,7 @@
834836
"EFQ56R": "Source code",
835837
"EHLy1u": "Hub name can't exceed 244 characters.",
836838
"EMcFck": "Some parameters might need configuration. Review before you continue.",
839+
"ENMteK": "File has been successfully uploaded in knowledge hub {groupName}.",
837840
"EPvt2J": "Select an Azure AI resource",
838841
"ES5vsI": "Value",
839842
"ESZXfC": "At these minutes",
@@ -865,7 +868,6 @@
865868
"F2wR+r": "Insert expression",
866869
"F3IDl8": "Required. The number of a specified time unit to add.",
867870
"F3q0Hk": "Cannot paste actions below agents in agent to agent workflows",
868-
"F6xkfB": "Please create a connection to add knowledge hubs.",
869871
"F83QRP": "On a schedule",
870872
"F9dR1Q": "Add",
871873
"F9yRDC": "Method",
@@ -950,6 +952,7 @@
950952
"GusLAj": "Case",
951953
"Gw0u+P": "EDI",
952954
"GxdV2y": "Expires",
955+
"GyPgdO": "Failed to create group",
953956
"GyUe4C": "Modify options regarding functions",
954957
"GzQQqH": "Array",
955958
"H/QVod": "Workflow has settings validation errors on the following operations: {invalidNodes}",
@@ -992,6 +995,7 @@
992995
"HuWIbw": "Package warning",
993996
"HzS2gJ": "Dynamic content not supported as properties in authentication.",
994997
"I+85NV": "Submit from this action",
998+
"I1A+Jw": "Connection created",
995999
"I1CYNA": "Invalid property ''{invalidProperties}'' for authentication type ''{authType}''.",
9961000
"I1xjeq": "The name {name} is already in use. Please choose a different name.",
9971001
"I2XWRg": "Add",
@@ -1416,6 +1420,7 @@
14161420
"QNfUf/": "Full screen",
14171421
"QT4IaP": "Filtered!",
14181422
"QVtqAn": "Description",
1423+
"QW+oZz": "Successfully updated details for knowledge hub connection.",
14191424
"QZBPUx": "Returns a single value matching the key name from form-data or form-encoded trigger output",
14201425
"QZnOGQ": "Managed connections",
14211426
"QZrxUk": "String functions",
@@ -1440,6 +1445,7 @@
14401445
"Qvk1rO": "Save",
14411446
"QwAEWd": "Select a project",
14421447
"QxEQwD": "Status",
1448+
"QzjaQG": "Connection updated",
14431449
"R/aiRy": "(UTC+12:00) Coordinated Universal Time+12",
14441450
"R0Skk9": "Confirm that you want to delete this artifact? You can't undo this action.",
14451451
"R7UxBX": "Learn more",
@@ -1978,6 +1984,7 @@
19781984
"_/LO3Ia.comment": "The text for the testing environment",
19791985
"_/NtebP.comment": "Time zone value ",
19801986
"_/QqADs.comment": "Label for description of custom skip Function",
1987+
"_/RFd5i.comment": "Title for the toaster after creating a group in add files panel",
19811988
"_/RS9F7.comment": "Time zone value ",
19821989
"_/ULFwg.comment": "Button text to take the user to the 'change connection' component",
19831990
"_/VcZ9g.comment": "Description about hybrid connectors",
@@ -2538,6 +2545,7 @@
25382545
"_9hKeBq.comment": "Select the Azure Cognitive Service Open AI resource to use for this connection",
25392546
"_9klmbJ.comment": "Button text for saving changes for parameter in the customize parameter panel",
25402547
"_9lP2zW.comment": "Placeholder text for tool selection dropdown",
2548+
"_9mG3yl.comment": "Error title when connection update fails",
25412549
"_9mjZIW.comment": "Text for button to delete a handoff",
25422550
"_9nAAU/.comment": "Connections button",
25432551
"_9o9MIz.comment": "Description for the database section in basics tab for quick app create panel",
@@ -2751,6 +2759,7 @@
27512759
"_EFQ56R.comment": "Link to the source code of the template",
27522760
"_EHLy1u.comment": "Error message when the hub name exceeds maximum length.",
27532761
"_EMcFck.comment": "The description for the actions information section",
2762+
"_ENMteK.comment": "Notification content for successful file upload in add files panel",
27542763
"_EPvt2J.comment": "Select the Azure Cognitive Service AI resource to use for this connection",
27552764
"_ES5vsI.comment": "Value",
27562765
"_ESZXfC.comment": "Label for schedule minutes",
@@ -2782,7 +2791,6 @@
27822791
"_F2wR+r.comment": "Label for button to open expression token picker",
27832792
"_F3IDl8.comment": "Required integer parameter to add to time",
27842793
"_F3q0Hk.comment": "Message shown when paste is disabled below agents in A2A workflows",
2785-
"_F6xkfB.comment": "Text to indicate that there is no connection",
27862794
"_F83QRP.comment": "Schedule trigger category",
27872795
"_F9dR1Q.comment": "Add",
27882796
"_F9yRDC.comment": "Label for the authentication method",
@@ -2867,6 +2875,7 @@
28672875
"_GusLAj.comment": "Label for the case node",
28682876
"_Gw0u+P.comment": "EDI category",
28692877
"_GxdV2y.comment": "Label for the key expiration",
2878+
"_GyPgdO.comment": "Error title when group creation fails",
28702879
"_GyUe4C.comment": "Description for the functions section",
28712880
"_GzQQqH.comment": "This is an option in a dropdown where users can select type Array for their parameter.",
28722881
"_H/QVod.comment": "Error message to show when there are invalid connections in the nodes.",
@@ -2909,6 +2918,7 @@
29092918
"_HuWIbw.comment": "Package warning message",
29102919
"_HzS2gJ.comment": "Error message for when putting token in authentication property",
29112920
"_I+85NV.comment": "Button label for submitting a workflow to rerun from this action",
2921+
"_I1A+Jw.comment": "Notification title for successful connection creation",
29122922
"_I1CYNA.comment": "Error message when having an invalid authentication property",
29132923
"_I1xjeq.comment": "Error message when the name is already in use",
29142924
"_I2XWRg.comment": "Button text for opening panel for adding workflows",
@@ -3333,6 +3343,7 @@
33333343
"_QNfUf/.comment": "Full Screen token picker",
33343344
"_QT4IaP.comment": "Filtered text",
33353345
"_QVtqAn.comment": "Label for description column.",
3346+
"_QW+oZz.comment": "Notification content for successful connection update",
33363347
"_QZBPUx.comment": "Label for description of custom triggerFormDataValue Function",
33373348
"_QZnOGQ.comment": "Managed connections label",
33383349
"_QZrxUk.comment": "Label for string functions",
@@ -3357,6 +3368,7 @@
33573368
"_Qvk1rO.comment": "Button text for updating action selections",
33583369
"_QwAEWd.comment": "Select the project to use for this connection",
33593370
"_QxEQwD.comment": "Status filter label",
3371+
"_QzjaQG.comment": "Notification title for successful connection update",
33603372
"_R/aiRy.comment": "Time zone value ",
33613373
"_R0Skk9.comment": "Content for the delete artifact",
33623374
"_R7UxBX.comment": "Link text for learning more about knowledge base group",
@@ -3938,7 +3950,6 @@
39383950
"_c8UPLp.comment": "Section 2 of text for including dynamic content section",
39393951
"_c8dbb/.comment": "Prompt to encourage searching in large datasets",
39403952
"_cAPPxZ.comment": "Label for subscription dropdown",
3941-
"_cBQnzA.comment": "Text to indicate that there are no artifacts in the knowledge hub",
39423953
"_cBw7SC.comment": "Label for connection creation date",
39433954
"_cHiBAn.comment": "Time zone value ",
39443955
"_cJkSrD.comment": "tooltip text of pagination setting",
@@ -4289,6 +4300,7 @@
42894300
"_iq+tiv.comment": "Hour of the day",
42904301
"_iql+jn.comment": "This is a period in time in seconds. {seconds} is replaced by the number and s is an abbreviation of seconds",
42914302
"_ir+plQ.comment": "title for panel error",
4303+
"_isF2bJ.comment": "Error message when group creation fails",
42924304
"_ituHoi.comment": "Trigger badge text",
42934305
"_iuh4i3.comment": "Created date label",
42944306
"_iwKxSD.comment": "Connection authenticated text",
@@ -4344,6 +4356,7 @@
43444356
"_k/X2ml.comment": "Title for solution type",
43454357
"_k/oqFL.comment": "Required base64 string parameter to be converted using base64ToString function",
43464358
"_k2a8ry.comment": "The tab label for the summary tab on the configure template wizard",
4359+
"_k47GxU.comment": "Error title when connection creation fails",
43474360
"_k5tGEr.comment": "This is the boolean value for Yes",
43484361
"_k6MqI+.comment": "Creating workspace in progress",
43494362
"_k8cbQ1.comment": "Header for the node parameter errors subsection",
@@ -4354,6 +4367,7 @@
43544367
"_kHcCxH.comment": "This is a time duration in abbreviated format",
43554368
"_kHs5R4.comment": "Chatbot flow preview message reminding user to check workflow actions",
43564369
"_kIei9R.comment": "Text that explains no tools exist in this agent",
4370+
"_kIxrfq.comment": "Text to indicate that there are no artifacts in the knowledge hub",
43574371
"_kKJMeM.comment": "Example of a sentence that the user should complete",
43584372
"_kLqXDY.comment": "Label for workflow Name",
43594373
"_kM+Mr0.comment": "Loading text when items are being fetched",
@@ -4724,12 +4738,14 @@
47244738
"_rREwxg.comment": "Refresh button",
47254739
"_rSIBjh.comment": "Parameter Field Value Placeholder Text",
47264740
"_rSa1Id.comment": "Files could not be found in specified path",
4741+
"_rUgi69.comment": "Notification title for successful file upload in add files panel",
47274742
"_raBiud.comment": "Require parameters to find maximum using max function",
47284743
"_rbVW+z.comment": "Last 24 hours filter",
47294744
"_rcz4w4.comment": "Label for description of custom uriComponent Function",
47304745
"_rd6fai.comment": "Aria describing the way to control the keyboard navigation",
47314746
"_rh5g4p.comment": "Successful run",
47324747
"_rhBKTF.comment": "Error shown when the template skus are empty",
4748+
"_rj0Nby.comment": "Notification content for successful connection creation",
47334749
"_rl9UOO.comment": "Descriptive message to show if the connection for an action cannot be changed or edited due to being shown in dual-pane (pinned action) view.",
47344750
"_rlfK4u.comment": "Content for the toaster for after saving template.",
47354751
"_rsdJcV.comment": "Main message displayed in the placeholder",
@@ -4738,6 +4754,7 @@
47384754
"_rxMXmZ.comment": "Time zone value ",
47394755
"_s+4LEa.comment": "Open folder label",
47404756
"_s0Qaot.comment": "Workflow Parameters Panel",
4757+
"_s2f0XK.comment": "Content for the toaster after creating a group in add files panel",
47414758
"_s2ydQX.comment": "Error validation message for invalid JSON object. Do not remove the double single quotes around the display name, as it is needed to wrap the placeholder text.",
47424759
"_s4omwa.comment": "Assertion field description title",
47434760
"_s5AOpV.comment": "Label for the title for panel header card",
@@ -5034,6 +5051,7 @@
50345051
"_woJtvu.comment": "Label text for subscriptions filter",
50355052
"_wtj07J.comment": "Time zone value ",
50365053
"_ww1mN/.comment": "Button text for showing the canvas view",
5054+
"_wwXFYB.comment": "Text to indicate that there is no connection",
50375055
"_wx/ZQP.comment": "Add Input",
50385056
"_wxZy/s.comment": "App event trigger category",
50395057
"_wxaQwD.comment": "Time zone value ",
@@ -5276,7 +5294,6 @@
52765294
"c8UPLp": "Dynamic content may also be added from other sources.",
52775295
"c8dbb/": "Type to search {options} items or scroll to see more...",
52785296
"cAPPxZ": "Subscription",
5279-
"cBQnzA": "No hub artifacts found. You can create hub and upload files to get started.",
52805297
"cBw7SC": "Created",
52815298
"cHiBAn": "(UTC+09:00) Seoul",
52825299
"cJkSrD": "Retrieve more results up to the pagination limit",
@@ -5627,6 +5644,7 @@
56275644
"iq+tiv": "11",
56285645
"iql+jn": "{seconds}s",
56295646
"ir+plQ": "Operation details error",
5647+
"isF2bJ": "Failed to create group: {errorMessage}",
56305648
"ituHoi": "Trigger",
56315649
"iuh4i3": "Created date",
56325650
"iwKxSD": "Authenticated",
@@ -5682,6 +5700,7 @@
56825700
"k/X2ml": "Type",
56835701
"k/oqFL": "Required. The base64 encoded string.",
56845702
"k2a8ry": "Review + publish",
5703+
"k47GxU": "Failed to create connection",
56855704
"k5tGEr": "Yes",
56865705
"k6MqI+": "Creating...",
56875706
"k8cbQ1": "Parameter errors",
@@ -5692,6 +5711,7 @@
56925711
"kHcCxH": "{minutes}m {seconds}s",
56935712
"kHs5R4": "Check these actions to see if any parameters need to be set.",
56945713
"kIei9R": "Add an MCP server (preview)",
5714+
"kIxrfq": "Can't find knowledge base artifacts. Create a knowledge base and upload files to get started.",
56955715
"kKJMeM": "Every week on Monday...",
56965716
"kLqXDY": "Name",
56975717
"kM+Mr0": "Loading...",
@@ -6062,12 +6082,14 @@
60626082
"rREwxg": "Refresh",
60636083
"rSIBjh": "Enter value for parameter.",
60646084
"rSa1Id": "No files found in {filePath}, please save XSLT to specified path to use this function",
6085+
"rUgi69": "File uploaded",
60656086
"raBiud": "Required. Either an array of values to find the maximum value, or the first value of a set.",
60666087
"rbVW+z": "Last 24 hours",
60676088
"rcz4w4": "Returns a URI encoded representation of a value",
60686089
"rd6fai": "Use left and right arrow keys to navigate between commands",
60696090
"rh5g4p": "Is successful",
60706091
"rhBKTF": "Atleast one sku is required for publish.",
6092+
"rj0Nby": "Knowledge hub connection has been created successfully.",
60716093
"rl9UOO": "Connections cannot be edited in pinned view. Release the pinned action to make connection changes.",
60726094
"rlfK4u": "Your template in action is in development mode.",
60736095
"rsdJcV": "Select source schema elements to build your map",
@@ -6076,6 +6098,7 @@
60766098
"rxMXmZ": "(UTC+04:00) Port Louis",
60776099
"s+4LEa": "Open folder",
60786100
"s0Qaot": "Workflow Parameters Panel",
6101+
"s2f0XK": "Group {name} has been created and selected.",
60796102
"s2ydQX": "''Value'' must be a valid JSON object",
60806103
"s4omwa": "Description",
60816104
"s5AOpV": "Card title",
@@ -6372,6 +6395,7 @@
63726395
"woJtvu": "Subscriptions",
63736396
"wtj07J": "(UTC-09:30) Marquesas Islands",
63746397
"ww1mN/": "Canvas",
6398+
"wwXFYB": "Create a connection to add knowledge hubs.",
63756399
"wx/ZQP": "Add Input",
63766400
"wxZy/s": "From an app",
63776401
"wxaQwD": "(UTC+04:30) Kabul",

libs/designer/src/lib/core/knowledge/utils/__test__/connection.spec.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,24 @@ vi.mock('@microsoft/logic-apps-shared', () => ({
1919
return defaultMessage;
2020
}
2121

22-
return defaultMessage.replace(/\{([^}]+)\}/g, (_, key) => values[key] ?? `{${key}}`);
22+
return defaultMessage.replace(/\{([^}]+)\}/g, (_: any, key: string | number) => values[key] ?? `{${key}}`);
2323
}),
2424
})),
2525
getPropertyValue: vi.fn((obj, key) => obj?.[key]),
2626
getObjectPropertyValue: vi.fn((obj, path) => path.reduce((acc: any, currentKey: string) => acc?.[currentKey], obj)),
2727
ConnectionType: {
2828
KnowledgeHub: 'KnowledgeHub',
2929
},
30+
LogEntryLevel: {
31+
Error: 'Error',
32+
Warning: 'Warning',
33+
Debug: 'Debug',
34+
Trace: 'Trace',
35+
Verbose: 'Verbose',
36+
},
37+
LoggerService: vi.fn(() => ({
38+
log: vi.fn(),
39+
})),
3040
}));
3141

3242
vi.mock('../../../ReactQueryProvider', () => ({

libs/designer/src/lib/core/knowledge/utils/__test__/helper.spec.ts

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ vi.mock('@microsoft/logic-apps-shared', () => ({
1919
}),
2020
isNullOrEmpty: (value: string | undefined | null) => value === undefined || value === null || value === '',
2121
equals: (a: string, b: string) => a?.toLowerCase() === b?.toLowerCase(),
22+
getObjectPropertyValue: (obj: any, path: string[]) => {
23+
let current = obj;
24+
for (const key of path) {
25+
if (current === null || current === undefined) {
26+
return undefined;
27+
}
28+
current = current[key];
29+
}
30+
return current;
31+
},
2232
}));
2333

2434
describe('knowledge helper utils', () => {
@@ -44,7 +54,7 @@ describe('knowledge helper utils', () => {
4454
'api-version': '2018-11-01',
4555
'Content-Type': 'application/json',
4656
},
47-
JSON.stringify({ description })
57+
{ description }
4858
);
4959
});
5060

@@ -57,11 +67,11 @@ describe('knowledge helper utils', () => {
5767
expect(result).toEqual(response);
5868
});
5969

60-
it('should log error when API call fails', async () => {
70+
it('should log error and throw when API call fails', async () => {
6171
const errorResponse = { error: { code: 'BadRequest', message: 'Invalid hub name' } };
6272
mockExecuteResourceAction.mockRejectedValue(errorResponse);
6373

64-
await createKnowledgeHub(siteResourceId, groupName, description);
74+
await expect(createKnowledgeHub(siteResourceId, groupName, description)).rejects.toThrow('Invalid hub name');
6575

6676
expect(mockLog).toHaveBeenCalledTimes(1);
6777
expect(mockLog).toHaveBeenCalledWith({
@@ -72,23 +82,21 @@ describe('knowledge helper utils', () => {
7282
});
7383
});
7484

75-
it('should return undefined when API call fails', async () => {
85+
it('should throw error when API call fails', async () => {
7686
mockExecuteResourceAction.mockRejectedValue({ error: { message: 'Failed' } });
7787

78-
const result = await createKnowledgeHub(siteResourceId, groupName, description);
79-
80-
expect(result).toBeUndefined();
88+
await expect(createKnowledgeHub(siteResourceId, groupName, description)).rejects.toThrow('Failed');
8189
});
8290

8391
it('should handle error response without error property', async () => {
8492
mockExecuteResourceAction.mockRejectedValue({ message: 'Network error' });
8593

86-
await createKnowledgeHub(siteResourceId, groupName, description);
94+
await expect(createKnowledgeHub(siteResourceId, groupName, description)).rejects.toThrow('Network error');
8795

8896
expect(mockLog).toHaveBeenCalledWith({
8997
level: 'Error',
9098
area: 'KnowledgeHub.createKnowledgeHub',
91-
error: {},
99+
error: { message: 'Network error' },
92100
message: `Error while creating knowledge hub for the app: ${siteResourceId}`,
93101
});
94102
});

libs/designer/src/lib/core/knowledge/utils/connection.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@ import type {
55
Connector,
66
Connection,
77
} from '@microsoft/logic-apps-shared';
8-
import { ConnectionService, getIntl, ConnectionType, getObjectPropertyValue } from '@microsoft/logic-apps-shared';
8+
import {
9+
ConnectionService,
10+
getIntl,
11+
ConnectionType,
12+
getObjectPropertyValue,
13+
LogEntryLevel,
14+
LoggerService,
15+
} from '@microsoft/logic-apps-shared';
916
import type { IntlShape } from 'react-intl';
1017
import { getReactQueryClient } from '../../ReactQueryProvider';
1118

@@ -358,7 +365,7 @@ export const getCosmosDbConnectionParameters = (intl: IntlShape): ConnectionPara
358365
};
359366
};
360367

361-
export const createOrUpdateConnection = async (parameterValues: Record<string, any>) => {
368+
export const createOrUpdateConnection = async (parameterValues: Record<string, any>, isCreate = true) => {
362369
const intl = getIntl();
363370
const connectionParameters = getAllConnectionParameters(intl) as unknown as Record<string, ConnectionParameter>;
364371
const displayName = parameterValues.displayName;
@@ -377,6 +384,14 @@ export const createOrUpdateConnection = async (parameterValues: Record<string, a
377384
return connection;
378385
} catch (error: any) {
379386
const errorMessage = getObjectPropertyValue(error, ['error', 'message']) ?? getObjectPropertyValue(error, ['message']);
387+
388+
LoggerService().log({
389+
level: LogEntryLevel.Error,
390+
area: `KnowledgeHub.${isCreate ? 'Create' : 'Update'}Connection`,
391+
error,
392+
message: `Failed to ${isCreate ? 'create' : 'update'} connection with display name ${displayName}`,
393+
});
394+
380395
throw new Error(
381396
intl.formatMessage(
382397
{

0 commit comments

Comments
 (0)