@microsoft/vscode-azext-utils
Advanced tools
Comparing version 2.1.4 to 2.1.5
@@ -6,2 +6,11 @@ "use strict"; | ||
*--------------------------------------------------------------------------------------------*/ | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -12,2 +21,3 @@ exports.ExecuteActivity = void 0; | ||
const GenericTreeItem_1 = require("../../tree/GenericTreeItem"); | ||
const isAzExtTreeItem_1 = require("../../tree/isAzExtTreeItem"); | ||
const Activity_1 = require("../Activity"); | ||
@@ -54,7 +64,4 @@ class ExecuteActivity extends Activity_1.ActivityBase { | ||
parent.compareChildrenImpl = () => 0; // Don't sort | ||
errorItem.iconPath = constants_1.activityFailIcon; | ||
return [ | ||
...this.context.activityChildren, | ||
errorItem | ||
]; | ||
this.appendErrorItemToActivityChildren(errorItem); | ||
return this.context.activityChildren; | ||
} | ||
@@ -65,2 +72,24 @@ return [errorItem]; | ||
} | ||
appendErrorItemToActivityChildren(errorItem) { | ||
var _a, _b, _c, _d; | ||
// Honor any error suppression flag | ||
if ((_a = this.context.errorHandling) === null || _a === void 0 ? void 0 : _a.suppressDisplay) { | ||
return; | ||
} | ||
// Check if the last activity child was a parent fail item; if so, attach the actual error to it for additional user context | ||
const lastActivityChild = (_b = this.context.activityChildren) === null || _b === void 0 ? void 0 : _b.at(-1); | ||
if ((0, isAzExtTreeItem_1.isAzExtParentTreeItem)(lastActivityChild) && new RegExp(constants_1.activityFailContext).test((_c = lastActivityChild === null || lastActivityChild === void 0 ? void 0 : lastActivityChild.contextValue) !== null && _c !== void 0 ? _c : '')) { | ||
const previousLoadMoreChildrenImpl = lastActivityChild.loadMoreChildrenImpl.bind(lastActivityChild); | ||
lastActivityChild.loadMoreChildrenImpl = (clearCache, context) => __awaiter(this, void 0, void 0, function* () { | ||
return [ | ||
...yield previousLoadMoreChildrenImpl(clearCache, context), | ||
errorItem | ||
]; | ||
}); | ||
return; | ||
} | ||
// Otherwise append error item to the end of the list | ||
errorItem.iconPath = constants_1.activityFailIcon; | ||
(_d = this.context.activityChildren) === null || _d === void 0 ? void 0 : _d.push(errorItem); | ||
} | ||
get label() { | ||
@@ -67,0 +96,0 @@ var _a; |
@@ -7,3 +7,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.activityFailIcon = exports.AzExtQuickInputButtons = exports.showContextValueSetting = exports.azToolsPrefix = exports.learnMore = void 0; | ||
exports.activityFailIcon = exports.activitySuccessIcon = exports.activityInfoIcon = exports.activityFailContext = exports.activitySuccessContext = exports.AzExtQuickInputButtons = exports.showContextValueSetting = exports.azToolsPrefix = exports.learnMore = void 0; | ||
const vscode_1 = require("vscode"); | ||
@@ -17,3 +17,7 @@ exports.learnMore = vscode_1.l10n.t("Learn more"); | ||
})(AzExtQuickInputButtons = exports.AzExtQuickInputButtons || (exports.AzExtQuickInputButtons = {})); | ||
exports.activitySuccessContext = 'activity:success'; | ||
exports.activityFailContext = 'activity:fail'; | ||
exports.activityInfoIcon = new vscode_1.ThemeIcon('info', new vscode_1.ThemeColor('charts.blue')); | ||
exports.activitySuccessIcon = new vscode_1.ThemeIcon('pass', new vscode_1.ThemeColor('testing.iconPassed')); | ||
exports.activityFailIcon = new vscode_1.ThemeIcon('error', new vscode_1.ThemeColor('testing.iconFailed')); | ||
//# sourceMappingURL=constants.js.map |
@@ -21,3 +21,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.apiUtils = exports.registerReportIssueCommand = exports.maskValue = exports.callWithMaskHandling = exports.addExtensionValueToMask = exports.registerUIExtensionVariables = exports.createExperimentationService = exports.createAzExtOutputChannel = exports.createAzExtLogOutputChannel = void 0; | ||
exports.apiUtils = exports.registerReportIssueCommand = exports.maskValue = exports.callWithMaskHandling = exports.addExtensionValueToMask = exports.registerUIExtensionVariables = exports.createExperimentationService = exports.activitySuccessIcon = exports.activitySuccessContext = exports.activityInfoIcon = exports.activityFailIcon = exports.activityFailContext = exports.createAzExtOutputChannel = exports.createAzExtLogOutputChannel = void 0; | ||
var AzExtOutputChannel_1 = require("./AzExtOutputChannel"); | ||
@@ -31,2 +31,8 @@ Object.defineProperty(exports, "createAzExtLogOutputChannel", { enumerable: true, get: function () { return AzExtOutputChannel_1.createAzExtLogOutputChannel; } }); | ||
__exportStar(require("./callWithTelemetryAndErrorHandling"), exports); | ||
var constants_1 = require("./constants"); | ||
Object.defineProperty(exports, "activityFailContext", { enumerable: true, get: function () { return constants_1.activityFailContext; } }); | ||
Object.defineProperty(exports, "activityFailIcon", { enumerable: true, get: function () { return constants_1.activityFailIcon; } }); | ||
Object.defineProperty(exports, "activityInfoIcon", { enumerable: true, get: function () { return constants_1.activityInfoIcon; } }); | ||
Object.defineProperty(exports, "activitySuccessContext", { enumerable: true, get: function () { return constants_1.activitySuccessContext; } }); | ||
Object.defineProperty(exports, "activitySuccessIcon", { enumerable: true, get: function () { return constants_1.activitySuccessIcon; } }); | ||
__exportStar(require("./createApiProvider"), exports); | ||
@@ -33,0 +39,0 @@ var createExperimentationService_1 = require("./createExperimentationService"); |
@@ -17,6 +17,7 @@ "use strict"; | ||
exports.subscriptionExperience = void 0; | ||
const errors_1 = require("../../errors"); | ||
const AzureWizard_1 = require("../../wizard/AzureWizard"); | ||
const QuickPickAzureSubscriptionStep_1 = require("../quickPickAzureResource/QuickPickAzureSubscriptionStep"); | ||
const errors_1 = require("../../errors"); | ||
function subscriptionExperience(context, tdp) { | ||
function subscriptionExperience(context, tdp, options) { | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -27,4 +28,4 @@ const wizardContext = Object.assign({}, context); | ||
hideStepCount: true, | ||
promptSteps: [new QuickPickAzureSubscriptionStep_1.QuickPickAzureSubscriptionStep(tdp)], | ||
showLoadingPrompt: true, | ||
promptSteps: [new QuickPickAzureSubscriptionStep_1.QuickPickAzureSubscriptionStep(tdp, { selectBySubscriptionId: options === null || options === void 0 ? void 0 : options.selectBySubscriptionId })], | ||
showLoadingPrompt: (_a = options === null || options === void 0 ? void 0 : options.showLoadingPrompt) !== null && _a !== void 0 ? _a : true, | ||
}); | ||
@@ -31,0 +32,0 @@ yield wizard.prompt(); |
@@ -25,3 +25,3 @@ "use strict"; | ||
}); | ||
this.pickFilter = new AzureSubscriptionPickFilter(); | ||
this.pickFilter = new AzureSubscriptionPickFilter(options === null || options === void 0 ? void 0 : options.selectBySubscriptionId); | ||
} | ||
@@ -42,11 +42,15 @@ promptInternal(wizardContext) { | ||
class AzureSubscriptionPickFilter { | ||
isFinalPick(_node) { | ||
constructor(subscriptionId) { | ||
// Always ensure we are storing the subscriptionId, not the full subscription path | ||
this.subscriptionId = subscriptionId === null || subscriptionId === void 0 ? void 0 : subscriptionId.split('/').pop(); | ||
} | ||
isFinalPick(_treeItem) { | ||
// Subscription is never a direct pick | ||
return false; | ||
} | ||
isAncestorPick(_node) { | ||
isAncestorPick(_treeItem, element) { | ||
// All nodes at this level are always subscription nodes | ||
return true; | ||
return this.subscriptionId ? element.subscription.subscriptionId === this.subscriptionId : true; | ||
} | ||
} | ||
//# sourceMappingURL=QuickPickAzureSubscriptionStep.js.map |
@@ -194,3 +194,9 @@ "use strict"; | ||
else { | ||
yield vscode.window.withProgress(options, task); | ||
if (this._context.suppressNotification) { | ||
const internalProgress = { report: () => { return; } }; | ||
yield task(internalProgress, this._cancellationTokenSource.token); | ||
} | ||
else { | ||
yield vscode.window.withProgress(options, task); | ||
} | ||
} | ||
@@ -197,0 +203,0 @@ }); |
{ | ||
"name": "@microsoft/vscode-azext-utils", | ||
"author": "Microsoft Corporation", | ||
"version": "2.1.4", | ||
"version": "2.1.5", | ||
"description": "Common UI tools for developing Azure extensions for VS Code", | ||
@@ -57,3 +57,3 @@ "tags": [ | ||
"@typescript-eslint/eslint-plugin": "^5.53.0", | ||
"@vscode/test-electron": "^2.1.5", | ||
"@vscode/test-electron": "^2.3.8", | ||
"eslint": "^8.34.0", | ||
@@ -60,0 +60,0 @@ "eslint-plugin-import": "^2.22.1", |
Sorry, the diff of this file is too big to display
398526
7764