Skip to content

Commit 270ee7a

Browse files
authored
Add Log Streaming capabilities (#350)
* Add start/stop to view * Add Streaming log capabilities * Suggested changes * More changes * Changes to RevisionListStep * Remove await * Change to "Stop all streams"
1 parent fa2f632 commit 270ee7a

13 files changed

+464
-136
lines changed

package-lock.json

Lines changed: 27 additions & 127 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,16 @@
150150
"command": "containerApps.addScaleRule",
151151
"title": "%containerApps.addScaleRule%",
152152
"category": "Azure Container Apps"
153+
},
154+
{
155+
"command": "containerApps.startStreamingLogs",
156+
"title": "%containerApps.startStreamingLogs%",
157+
"category": "Azure Container Apps"
158+
},
159+
{
160+
"command": "containerApps.stopStreamingLogs",
161+
"title": "%containerApps.stopStreamingLogs%",
162+
"category": "Azure Container Apps"
153163
}
154164
],
155165
"menus": {
@@ -252,6 +262,15 @@
252262
"command": "containerApps.addScaleRule",
253263
"when": "view == azureResourceGroups && viewItem =~ /scaleRules/i",
254264
"group": "1@1"
265+
},
266+
{
267+
"command": "containerApps.startStreamingLogs",
268+
"when": "view == azureResourceGroups && viewItem =~ /containerApp[^s]/i",
269+
"group": "4@1"
270+
},{
271+
"command": "containerApps.stopStreamingLogs",
272+
"when": "view == azureResourceGroups && viewItem =~ /containerApp[^s]/i",
273+
"group": "4@2"
255274
}
256275
],
257276
"commandPalette": [
@@ -343,12 +362,13 @@
343362
"webpack-cli": "^4.6.0"
344363
},
345364
"dependencies": {
346-
"@azure/arm-appcontainers": "^1.1.0",
365+
"@azure/arm-appcontainers": "^2.0.0-beta.1",
347366
"@azure/arm-containerregistry": "^10.0.0",
348367
"@azure/arm-operationalinsights": "^8.0.0",
349368
"@azure/arm-resources": "^5.0.1",
350369
"@azure/container-registry": "1.0.0-beta.5",
351370
"@azure/storage-blob": "^12.4.1",
371+
"@azure/core-rest-pipeline": "1.10.3",
352372
"@microsoft/vscode-azext-azureutils": "^1.0.1",
353373
"@microsoft/vscode-azext-utils": "^1.2.0",
354374
"@microsoft/vscode-azureresources-api": "^2.0.2",

package.nls.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,7 @@
2626
"containerApps.openInPortal": "Open in Portal",
2727
"containerApps.openConsoleInPortal": "Open Console in Portal",
2828
"containerApps.editScalingRange": "Edit Scaling Range...",
29-
"containerApps.addScaleRule": "Add Scale Rule..."
29+
"containerApps.addScaleRule": "Add Scale Rule...",
30+
"containerApps.startStreamingLogs": "Start Streaming Logs...",
31+
"containerApps.stopStreamingLogs": "Stop Streaming Logs..."
3032
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.md in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
import type { ReplicaContainer } from "@azure/arm-appcontainers";
7+
import { AzureWizardPromptStep, IAzureQuickPickItem, nonNullProp, nonNullValue } from "@microsoft/vscode-azext-utils";
8+
import { localize } from "../../utils/localize";
9+
import { IStreamLogsContext } from "./IStreamLogsContext";
10+
11+
export class ContainerListStep extends AzureWizardPromptStep<IStreamLogsContext> {
12+
public async prompt(context: IStreamLogsContext): Promise<void> {
13+
const placeHolder: string = localize('selectContainer', 'Select a container');
14+
context.container = (await context.ui.showQuickPick(this.getPicks(context), { placeHolder })).data;
15+
}
16+
17+
public shouldPrompt(context: IStreamLogsContext): boolean {
18+
return !context.container;
19+
}
20+
21+
private async getPicks(context: IStreamLogsContext): Promise<IAzureQuickPickItem<ReplicaContainer>[]> {
22+
return nonNullValue(context.replica?.containers).map((c) => {
23+
return { label: nonNullProp(c, 'name'), data: c, suppressPersistance: true };
24+
})
25+
}
26+
}

0 commit comments

Comments
 (0)