@microsoft/vscode-azext-utils
Advanced tools
Comparing version 0.3.22 to 0.3.23
@@ -278,2 +278,4 @@ /*--------------------------------------------------------------------------------------------- | ||
export type VSCodeRevealOptions = Parameters<vscode.TreeView<unknown>['reveal']>['1']; | ||
/** | ||
@@ -322,2 +324,9 @@ * The current (v2) Azure Resources extension API. | ||
/** | ||
* Reveal a resource in the Azure tree view. Works with subscriptions, resource groups, or resources. | ||
* | ||
* @param id The Azure Resource ID to reveal in the Azure tree view. | ||
* @param options Options for revealing the resource. See {@link vscode.TreeView.reveal} | ||
*/ | ||
revealAzureResource(id: string, options?: VSCodeRevealOptions): Promise<void>; | ||
} | ||
@@ -324,0 +333,0 @@ |
@@ -71,2 +71,3 @@ "use strict"; | ||
AzExtResourceType["SignalRService"] = "SignalRService"; | ||
AzExtResourceType["SpringApps"] = "SpringApps"; | ||
AzExtResourceType["SqlDatabases"] = "SqlDatabases"; | ||
@@ -73,0 +74,0 @@ AzExtResourceType["SqlServers"] = "SqlServers"; |
@@ -85,2 +85,3 @@ "use strict"; | ||
'microsoft.signalrservice/signalr': AzExtResourceType_1.AzExtResourceType.SignalRService, | ||
'microsoft.appplatform/spring': AzExtResourceType_1.AzExtResourceType.SpringApps, | ||
'microsoft.sql/servers': AzExtResourceType_1.AzExtResourceType.SqlServers, | ||
@@ -87,0 +88,0 @@ 'microsoft.sql/servers/databases': AzExtResourceType_1.AzExtResourceType.SqlDatabases, |
@@ -25,2 +25,6 @@ "use strict"; | ||
class CompatibilityContextValueQuickPickStep extends ContextValueQuickPickStep_1.ContextValueQuickPickStep { | ||
constructor() { | ||
super(...arguments); | ||
this.pickFilter = new CompatibleContextValuePickFilter(this.pickOptions); | ||
} | ||
prompt(wizardContext) { | ||
@@ -69,2 +73,12 @@ const _super = Object.create(null, { | ||
exports.CompatibilityContextValueQuickPickStep = CompatibilityContextValueQuickPickStep; | ||
class CompatibleContextValuePickFilter extends ContextValueQuickPickStep_1.ContextValuePickFilter { | ||
// For compatiblity, if the include option is a RegExp test the entire contextValue against it. | ||
isFinalPick(node) { | ||
const includeOption = this.pickOptions.contextValueFilter.include; | ||
if (includeOption instanceof RegExp && node.contextValue) { | ||
return includeOption.test(node.contextValue); | ||
} | ||
return super.isFinalPick(node); | ||
} | ||
} | ||
//# sourceMappingURL=CompatibilityContextValueQuickPickStep.js.map |
@@ -28,2 +28,3 @@ "use strict"; | ||
promptInternal(wizardContext) { | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -35,6 +36,3 @@ const picks = yield this.getPicks(wizardContext); | ||
else { | ||
const selected = yield wizardContext.ui.showQuickPick(picks, { | ||
/* TODO: options */ | ||
/* TODO: set id here so recently picked items appear at the top */ | ||
}); | ||
const selected = yield wizardContext.ui.showQuickPick(picks, Object.assign({}, ((_a = this.promptOptions) !== null && _a !== void 0 ? _a : {}))); | ||
// check if the last picked item is a create callback | ||
@@ -73,2 +71,9 @@ if (typeof selected.data === 'function') { | ||
const lastPickedItemTi = (0, registerCommandWithTreeNodeUnwrapping_1.isWrapper)(lastPickedItem) ? lastPickedItem.unwrap() : lastPickedItem; | ||
const promptOptions = (0, isAzExtTreeItem_1.isAzExtParentTreeItem)(lastPickedItemTi) ? { | ||
placeHolder: (0, localize_1.localize)('selectTreeItem', 'Select {0}', lastPickedItemTi.childTypeLabel), | ||
stepName: `treeItemPicker|${lastPickedItemTi.contextValue}`, | ||
noPicksMessage: wizardContext.noItemFoundErrorMessage, | ||
ignoreFocusOut: wizardContext.ignoreFocusOut, | ||
} : {}; | ||
const shouldAddCreatePick = (0, isAzExtTreeItem_1.isAzExtParentTreeItem)(lastPickedItemTi) && !!lastPickedItemTi.createChildImpl; | ||
// Need to keep going because the last picked node is not a match | ||
@@ -78,6 +83,6 @@ return { | ||
promptSteps: [ | ||
new CompatibilityRecursiveQuickPickStep(this.treeDataProvider, Object.assign(Object.assign({}, this.pickOptions), { skipIfOne: (0, isAzExtTreeItem_1.isAzExtParentTreeItem)(lastPickedItemTi) && !!lastPickedItemTi.createChildImpl, create: ((0, isAzExtTreeItem_1.isAzExtParentTreeItem)(lastPickedItemTi) && !!lastPickedItemTi.createChildImpl) ? { | ||
new CompatibilityRecursiveQuickPickStep(this.treeDataProvider, Object.assign(Object.assign({}, this.pickOptions), { skipIfOne: !shouldAddCreatePick, create: shouldAddCreatePick ? { | ||
callback: lastPickedItemTi.createChild.bind(lastPickedItemTi), | ||
label: (_a = lastPickedItemTi.createNewLabel) !== null && _a !== void 0 ? _a : (0, localize_1.localize)('createNewItem', '$(plus) Create new {0}', lastPickedItemTi.childTypeLabel) | ||
} : undefined })) | ||
} : undefined }), promptOptions) | ||
], | ||
@@ -84,0 +89,0 @@ }; |
@@ -7,3 +7,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ContextValueQuickPickStep = void 0; | ||
exports.ContextValuePickFilter = exports.ContextValueQuickPickStep = void 0; | ||
const contextUtils_1 = require("../../utils/contextUtils"); | ||
@@ -47,2 +47,3 @@ const GenericQuickPickStep_1 = require("../GenericQuickPickStep"); | ||
} | ||
exports.ContextValuePickFilter = ContextValuePickFilter; | ||
//# sourceMappingURL=ContextValueQuickPickStep.js.map |
@@ -17,2 +17,7 @@ "use strict"; | ||
const credentialUtils_1 = require("../../../utils/credentialUtils"); | ||
const CompatibilityRecursiveQuickPickStep_1 = require("../../contextValue/compatibility/CompatibilityRecursiveQuickPickStep"); | ||
const AzureWizard_1 = require("../../../wizard/AzureWizard"); | ||
const getLastNode_1 = require("../../getLastNode"); | ||
const errors_1 = require("../../../errors"); | ||
const registerCommandWithTreeNodeUnwrapping_1 = require("../../../registerCommandWithTreeNodeUnwrapping"); | ||
var PickTreeItemWithCompatibility; | ||
@@ -43,3 +48,32 @@ (function (PickTreeItemWithCompatibility) { | ||
PickTreeItemWithCompatibility.subscription = subscription; | ||
/** | ||
* Helper to provide compatibility for `AzExtParentTreeItem.showTreeItemPicker`. | ||
*/ | ||
function showTreeItemPicker(context, tdp, expectedContextValues, startingTreeItem) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const promptSteps = [ | ||
new CompatibilityRecursiveQuickPickStep_1.CompatibilityRecursiveQuickPickStep(tdp, { | ||
contextValueFilter: { | ||
include: expectedContextValues, | ||
}, | ||
skipIfOne: false, | ||
}), | ||
]; | ||
const wizardContext = Object.assign(Object.assign({}, context), { pickedNodes: startingTreeItem ? [startingTreeItem] : [] }); | ||
const wizard = new AzureWizard_1.AzureWizard(wizardContext, { | ||
hideStepCount: true, | ||
promptSteps: promptSteps, | ||
}); | ||
yield wizard.prompt(); | ||
const lastPickedItem = (0, getLastNode_1.getLastNode)(wizardContext); | ||
if (!lastPickedItem) { | ||
throw new errors_1.NoResourceFoundError(wizardContext); | ||
} | ||
else { | ||
return (0, registerCommandWithTreeNodeUnwrapping_1.isWrapper)(lastPickedItem) ? lastPickedItem.unwrap() : lastPickedItem; | ||
} | ||
}); | ||
} | ||
PickTreeItemWithCompatibility.showTreeItemPicker = showTreeItemPicker; | ||
})(PickTreeItemWithCompatibility = exports.PickTreeItemWithCompatibility || (exports.PickTreeItemWithCompatibility = {})); | ||
//# sourceMappingURL=PickTreeItemWithCompatibility.js.map |
@@ -21,3 +21,3 @@ "use strict"; | ||
class GenericQuickPickStep extends AzureWizardPromptStep_1.AzureWizardPromptStep { | ||
constructor(treeDataProvider, pickOptions) { | ||
constructor(treeDataProvider, pickOptions, promptOptions) { | ||
super(); | ||
@@ -27,2 +27,3 @@ this.treeDataProvider = treeDataProvider; | ||
this.supportsDuplicateSteps = true; | ||
this.promptOptions = Object.assign({ noPicksMessage: (0, localize_1.localize)('noMatchingResources', 'No matching resources found.') }, promptOptions); | ||
} | ||
@@ -42,2 +43,3 @@ prompt(wizardContext) { | ||
promptInternal(wizardContext) { | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -49,7 +51,3 @@ const picks = yield this.getPicks(wizardContext); | ||
else { | ||
const selected = yield wizardContext.ui.showQuickPick(picks, { | ||
noPicksMessage: (0, localize_1.localize)('noMatchingResources', 'No matching resources found.'), | ||
/* TODO: options */ | ||
/* TODO: set id here so recently picked items appear at the top */ | ||
}); | ||
const selected = yield wizardContext.ui.showQuickPick(picks, Object.assign({}, ((_a = this.promptOptions) !== null && _a !== void 0 ? _a : {}))); | ||
return selected.data; | ||
@@ -56,0 +54,0 @@ } |
@@ -19,5 +19,8 @@ "use strict"; | ||
const GenericQuickPickStep_1 = require("../GenericQuickPickStep"); | ||
const localize_1 = require("../../localize"); | ||
class QuickPickAzureResourceStep extends GenericQuickPickStep_1.GenericQuickPickStep { | ||
constructor() { | ||
super(...arguments); | ||
constructor(tdp, options) { | ||
super(tdp, options !== null && options !== void 0 ? options : {}, { | ||
placeHolder: (0, localize_1.localize)('selectResource', 'Select resource'), | ||
}); | ||
this.pickFilter = new AzureResourcePickFilter(this.pickOptions); | ||
@@ -24,0 +27,0 @@ } |
@@ -18,5 +18,9 @@ "use strict"; | ||
const GenericQuickPickStep_1 = require("../GenericQuickPickStep"); | ||
const localize_1 = require("../../localize"); | ||
class QuickPickAzureSubscriptionStep extends GenericQuickPickStep_1.GenericQuickPickStep { | ||
constructor(tdp, options) { | ||
super(tdp, Object.assign(Object.assign({}, options), { skipIfOne: true })); | ||
super(tdp, Object.assign(Object.assign({}, options), { skipIfOne: true }), { | ||
placeHolder: (0, localize_1.localize)('selectSubscription', 'Select subscription'), | ||
noPicksMessage: (0, localize_1.localize)('noSubscriptions', 'No subscriptions found'), | ||
}); | ||
this.pickFilter = new AzureSubscriptionPickFilter(); | ||
@@ -23,0 +27,0 @@ } |
@@ -12,3 +12,7 @@ "use strict"; | ||
constructor(tdp, options) { | ||
super(tdp, Object.assign(Object.assign({}, options), { skipIfOne: true })); | ||
var _a, _b; | ||
super(tdp, Object.assign(Object.assign({}, options), { skipIfOne: true }), { | ||
// Define id so that recently used picks are tracked separately for each group type | ||
id: `QuickPickGroupStep/${(_b = (_a = options.groupType) === null || _a === void 0 ? void 0 : _a.sort().join(',')) !== null && _b !== void 0 ? _b : ''}`, | ||
}); | ||
this.pickFilter = new GroupPickFilter(this.pickOptions); | ||
@@ -15,0 +19,0 @@ } |
{ | ||
"name": "@microsoft/vscode-azext-utils", | ||
"author": "Microsoft Corporation", | ||
"version": "0.3.22", | ||
"version": "0.3.23", | ||
"description": "Common UI tools for developing Azure extensions for VS Code", | ||
@@ -6,0 +6,0 @@ "tags": [ |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
387353
7616