private async getQuickPicks()

in appservice/src/createAppService/AppServicePlanListStep.ts [81:138]


    private async getQuickPicks(context: IAppServiceWizardContext): Promise<IAzureQuickPickItem<WebSiteManagementModels.AppServicePlan | undefined>[]> {
        const picks: IAzureQuickPickItem<WebSiteManagementModels.AppServicePlan | undefined>[] = !this._suppressCreate
            ? [{
                label: localize('CreateNewAppServicePlan', '$(plus) Create new App Service plan'),
                description: '',
                data: undefined
            }]
            : [];

        let plans: WebSiteManagementModels.AppServicePlan[] = await AppServicePlanListStep.getPlans(context);
        const famFilter: RegExp | undefined = context.planSkuFamilyFilter;
        if (famFilter) {
            plans = plans.filter(plan => !plan.sku || !plan.sku.family || famFilter.test(plan.sku.family));
        }

        let location: AzExtLocation | undefined;
        if (LocationListStep.hasLocation(context)) {
            location = await LocationListStep.getLocation(context, webProvider);
        }

        let hasFilteredLocations: boolean = false;
        for (const plan of plans) {
            const isNewSiteLinux: boolean = context.newSiteOS === WebsiteOS.linux;
            let isPlanLinux: boolean = nonNullProp(plan, 'kind').toLowerCase().includes(WebsiteOS.linux);

            if (plan.sku && (plan.sku.family === 'EP' || plan.sku.family === 'WS')) {
                // elastic premium plans and workflow standard plans do not have the os in the kind, so we have to check the "reserved" property
                // also, the "reserved" property is always "false" in the list of plans returned above. We have to perform a separate get on each plan
                const client: WebSiteManagementClient = await createWebSiteClient(context);
                const epPlan: WebSiteManagementModels.AppServicePlan | undefined = await tryGetAppServicePlan(client, nonNullProp(plan, 'resourceGroup'), nonNullProp(plan, 'name'));
                isPlanLinux = !!epPlan?.reserved;
            }

            // plan.kind will contain "linux" for Linux plans, but will _not_ contain "windows" for Windows plans. Thus we check "isLinux" for both cases
            if (isNewSiteLinux === isPlanLinux) {
                if (location && !LocationListStep.locationMatchesName(location, plan.location)) {
                    hasFilteredLocations = true;
                } else {
                    picks.push({
                        id: plan.id,
                        label: nonNullProp(plan, 'name'),
                        description: plan.sku?.name,
                        data: plan
                    });
                }
            }
        }

        if (hasFilteredLocations && location) {
            picks.push({
                label: localize('hasFilteredLocations', '$(warning) Only plans in the region "{0}" are shown.', location.displayName),
                onPicked: () => { /* do nothing */ },
                data: undefined
            });
        }

        return picks;
    }