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

utils: Add error item with error message on fail to activity children #1613

Merged
merged 2 commits into from
Oct 26, 2023
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
4 changes: 2 additions & 2 deletions utils/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion utils/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@microsoft/vscode-azext-utils",
"author": "Microsoft Corporation",
"version": "2.1.2",
"version": "2.1.3",
"description": "Common UI tools for developing Azure extensions for VS Code",
"tags": [
"azure",
Expand Down
21 changes: 14 additions & 7 deletions utils/src/activityLog/activities/ExecuteActivity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import * as vscode from 'vscode';
import * as hTypes from '../../../hostapi';
import * as types from '../../../index';
import { activityFailIcon } from '../../constants';
import { AzExtParentTreeItem } from "../../tree/AzExtParentTreeItem";
import { GenericTreeItem } from "../../tree/GenericTreeItem";
import { ActivityBase } from "../Activity";
Expand Down Expand Up @@ -52,16 +53,22 @@ export class ExecuteActivity<TContext extends types.ExecuteActivityContext = typ
return {
label: this.label,
getChildren: (parent: AzExtParentTreeItem) => {
const errorItem = new GenericTreeItem(parent, {
contextValue: 'executeError',
label: error.message
});

if (this.context.activityChildren) {
parent.compareChildrenImpl = () => 0; // Don't sort
return this.context.activityChildren;
errorItem.iconPath = activityFailIcon;

return [
...this.context.activityChildren,
errorItem
];
}
return [
new GenericTreeItem(parent, {
contextValue: 'executeError',
label: error.message
})
];

return [errorItem];
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion utils/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { l10n, QuickInputButton, ThemeIcon } from "vscode";
import { l10n, QuickInputButton, ThemeColor, ThemeIcon } from "vscode";

export const learnMore: string = l10n.t("Learn more");

Expand All @@ -13,3 +13,5 @@ export const showContextValueSetting: string = "showContextValues";
export namespace AzExtQuickInputButtons {
export const LearnMore: QuickInputButton = { iconPath: new ThemeIcon('question'), tooltip: learnMore }
}

export const activityFailIcon: ThemeIcon = new ThemeIcon('error', new ThemeColor('testing.iconFailed'));