in ui/src/wizard/StorageAccountListStep.ts [107:166]
private async getQuickPicks(wizardContext: T, storageAccountsTask: Promise<StorageManagementModels.StorageAccount[]>): Promise<types.IAzureQuickPickItem<StorageManagementModels.StorageAccount | undefined>[]> {
const picks: types.IAzureQuickPickItem<StorageManagementModels.StorageAccount | undefined>[] = [{
label: localize('NewStorageAccount', '$(plus) Create new storage account'),
description: '',
data: undefined
}];
const kindRegExp: RegExp = new RegExp(`^${convertFilterToPattern(this._filters.kind)}$`, 'i');
const performanceRegExp: RegExp = new RegExp(`^${convertFilterToPattern(this._filters.performance)}_.*$`, 'i');
const replicationRegExp: RegExp = new RegExp(`^.*_${convertFilterToPattern(this._filters.replication)}$`, 'i');
let location: types.AzExtLocation | undefined;
if (LocationListStep.hasLocation(wizardContext)) {
location = await LocationListStep.getLocation(wizardContext, storageProvider);
}
let hasFilteredAccountsBySku: boolean = false;
let hasFilteredAccountsByLocation: boolean = false;
const storageAccounts: StorageManagementModels.StorageAccount[] = await storageAccountsTask;
for (const sa of storageAccounts) {
if (!sa.kind || sa.kind.match(kindRegExp) || !sa.sku || sa.sku.name.match(performanceRegExp) || sa.sku.name.match(replicationRegExp)) {
hasFilteredAccountsBySku = true;
continue;
}
if (location && !LocationListStep.locationMatchesName(location, sa.location)) {
hasFilteredAccountsByLocation = true;
continue;
}
picks.push({
id: sa.id,
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
label: sa.name!,
description: '',
data: sa
});
}
if (hasFilteredAccountsBySku && this._filters.learnMoreLink) {
picks.push({
label: localize('hasFilteredAccountsBySku', '$(info) Some storage accounts were filtered because of their sku. Learn more...'),
onPicked: async () => {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
await openUrl(this._filters.learnMoreLink!);
},
data: undefined
});
}
if (hasFilteredAccountsByLocation && location) {
picks.push({
label: localize('hasFilteredAccountsByLocation', '$(warning) Only storage accounts in the region "{0}" are shown.', location.displayName),
onPicked: () => { /* do nothing */ },
data: undefined
});
}
return picks;
}