-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathContainerListStep.ts
More file actions
26 lines (22 loc) · 1.36 KB
/
ContainerListStep.ts
File metadata and controls
26 lines (22 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.md in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import type { ReplicaContainer } from "@azure/arm-appcontainers";
import { AzureWizardPromptStep, IAzureQuickPickItem, nonNullProp, nonNullValue } from "@microsoft/vscode-azext-utils";
import { localize } from "../../utils/localize";
import { IStreamLogsContext } from "./IStreamLogsContext";
export class ContainerListStep extends AzureWizardPromptStep<IStreamLogsContext> {
public async prompt(context: IStreamLogsContext): Promise<void> {
const placeHolder: string = localize('selectContainer', 'Select a container');
context.container = (await context.ui.showQuickPick(this.getPicks(context), { placeHolder })).data;
}
public shouldPrompt(context: IStreamLogsContext): boolean {
return !context.container;
}
private async getPicks(context: IStreamLogsContext): Promise<IAzureQuickPickItem<ReplicaContainer>[]> {
return nonNullValue(context.replica?.containers).map((c) => {
return { label: nonNullProp(c, 'name'), data: c, suppressPersistance: true };
})
}
}