From 13eba613575ea2d78ba7d0079caa54b036e7bda1 Mon Sep 17 00:00:00 2001 From: Nathan Turinski Date: Mon, 12 Aug 2024 14:23:57 -0700 Subject: [PATCH 1/7] Add onProgress state to show activity log creating in real-time --- utils/index.d.ts | 1 + utils/package-lock.json | 4 ++-- utils/package.json | 2 +- utils/src/activityLog/Activity.ts | 4 ++++ utils/src/activityLog/activities/ExecuteActivity.ts | 10 ++++++++++ utils/src/constants.ts | 2 ++ utils/src/wizard/AzureWizard.ts | 6 ++++++ utils/src/wizard/AzureWizardExecuteStep.ts | 2 ++ 8 files changed, 28 insertions(+), 3 deletions(-) diff --git a/utils/index.d.ts b/utils/index.d.ts index a079f5cca9..8027d78b7b 100644 --- a/utils/index.d.ts +++ b/utils/index.d.ts @@ -1161,6 +1161,7 @@ export interface IWizardOptions { export const activitySuccessContext: string; export const activityFailContext: string; +export const activityProgressContext: string; export const activityInfoIcon: ThemeIcon; export const activitySuccessIcon: ThemeIcon; diff --git a/utils/package-lock.json b/utils/package-lock.json index 792fec2abf..dce2e72360 100644 --- a/utils/package-lock.json +++ b/utils/package-lock.json @@ -1,12 +1,12 @@ { "name": "@microsoft/vscode-azext-utils", - "version": "2.5.4", + "version": "2.5.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@microsoft/vscode-azext-utils", - "version": "2.5.4", + "version": "2.5.5", "license": "MIT", "dependencies": { "@microsoft/vscode-azureresources-api": "^2.3.1", diff --git a/utils/package.json b/utils/package.json index 92b6cdcc8d..181219b1ae 100644 --- a/utils/package.json +++ b/utils/package.json @@ -1,7 +1,7 @@ { "name": "@microsoft/vscode-azext-utils", "author": "Microsoft Corporation", - "version": "2.5.4", + "version": "2.5.5", "description": "Common UI tools for developing Azure extensions for VS Code", "tags": [ "azure", diff --git a/utils/src/activityLog/Activity.ts b/utils/src/activityLog/Activity.ts index 2b913eceee..cc292a5858 100644 --- a/utils/src/activityLog/Activity.ts +++ b/utils/src/activityLog/Activity.ts @@ -37,6 +37,7 @@ export abstract class ActivityBase implements hTypes.Activity { abstract initialState(): hTypes.ActivityTreeItemOptions; abstract successState(): hTypes.ActivityTreeItemOptions; + abstract progressState(): hTypes.ActivityTreeItemOptions; abstract errorState(error?: types.IParsedError): hTypes.ActivityTreeItemOptions; public constructor(task: types.ActivityTask) { @@ -51,6 +52,7 @@ export abstract class ActivityBase implements hTypes.Activity { private report(progress: { message?: string; increment?: number }): void { this._onProgressEmitter.fire({ ...this.getState(), message: progress.message }); + this.status = ActivityStatus.Running; } public async run(): Promise { @@ -74,6 +76,8 @@ export abstract class ActivityBase implements hTypes.Activity { return this.errorState(this.error); case ActivityStatus.Succeeded: return this.successState(); + case ActivityStatus.Running: + return this.progressState(); default: return this.initialState(); } diff --git a/utils/src/activityLog/activities/ExecuteActivity.ts b/utils/src/activityLog/activities/ExecuteActivity.ts index e4cb49c9d4..20f4021b55 100644 --- a/utils/src/activityLog/activities/ExecuteActivity.ts +++ b/utils/src/activityLog/activities/ExecuteActivity.ts @@ -71,6 +71,16 @@ export class ExecuteActivity { + parent.compareChildrenImpl = () => 0; // Don't sort + return this.context.activityChildren || []; + }) : undefined + } + } + private appendErrorItemToActivityChildren(errorItem: AzExtTreeItem): void { // Honor any error suppression flag if ((this.context as unknown as types.IActionContext).errorHandling?.suppressDisplay) { diff --git a/utils/src/constants.ts b/utils/src/constants.ts index e47e04c50f..830b3ebce1 100644 --- a/utils/src/constants.ts +++ b/utils/src/constants.ts @@ -16,7 +16,9 @@ export namespace AzExtQuickInputButtons { export const activitySuccessContext: string = 'activity:success'; export const activityFailContext: string = 'activity:fail'; +export const activityProgressContext: string = 'activity:progress'; export const activityInfoIcon: ThemeIcon = new ThemeIcon('info', new ThemeColor('charts.blue')); export const activitySuccessIcon: ThemeIcon = new ThemeIcon('pass', new ThemeColor('testing.iconPassed')); export const activityFailIcon: ThemeIcon = new ThemeIcon('error', new ThemeColor('testing.iconFailed')); +export const activityProgressIcon: ThemeIcon = new ThemeIcon('loading~spin', new ThemeColor('testing.iconQueued')); diff --git a/utils/src/wizard/AzureWizard.ts b/utils/src/wizard/AzureWizard.ts index d00468bb5e..22f39f663b 100644 --- a/utils/src/wizard/AzureWizard.ts +++ b/utils/src/wizard/AzureWizard.ts @@ -193,6 +193,9 @@ export class AzureWizard t !== progressOutput.item) this.displayActivityOutput(output, step.options); currentStep += 1; diff --git a/utils/src/wizard/AzureWizardExecuteStep.ts b/utils/src/wizard/AzureWizardExecuteStep.ts index 84697be370..8ce9427481 100644 --- a/utils/src/wizard/AzureWizardExecuteStep.ts +++ b/utils/src/wizard/AzureWizardExecuteStep.ts @@ -16,4 +16,6 @@ export abstract class AzureWizardExecuteStep Date: Mon, 12 Aug 2024 14:31:26 -0700 Subject: [PATCH 2/7] Export icon --- utils/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/utils/index.d.ts b/utils/index.d.ts index 8027d78b7b..6649122f9d 100644 --- a/utils/index.d.ts +++ b/utils/index.d.ts @@ -1165,6 +1165,7 @@ export const activityProgressContext: string; export const activityInfoIcon: ThemeIcon; export const activitySuccessIcon: ThemeIcon; +export const activityProgressIcon: ThemeIcon; export const activityFailIcon: ThemeIcon; export type ActivityTask = (progress: Progress<{ message?: string, increment?: number }>, cancellationToken: CancellationToken) => Promise; From fc1d7c972ba9437f43eabc787465b1b26518e7ff Mon Sep 17 00:00:00 2001 From: Nathan Turinski Date: Mon, 12 Aug 2024 14:54:51 -0700 Subject: [PATCH 3/7] Add progressState to index --- utils/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/utils/index.d.ts b/utils/index.d.ts index 6649122f9d..1ed8c25a9a 100644 --- a/utils/index.d.ts +++ b/utils/index.d.ts @@ -1182,6 +1182,7 @@ export declare abstract class ActivityBase implements Activity { abstract initialState(): ActivityTreeItemOptions; abstract successState(): ActivityTreeItemOptions; + abstract progressState(): ActivityTreeItemOptions; abstract errorState(error: IParsedError): ActivityTreeItemOptions; public constructor(task: ActivityTask); From f31c27cf61f55251babfe8f7c53cbb606a71c176 Mon Sep 17 00:00:00 2001 From: Nathan Turinski Date: Mon, 12 Aug 2024 14:55:18 -0700 Subject: [PATCH 4/7] Also add it to the executeActivity --- utils/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/utils/index.d.ts b/utils/index.d.ts index 1ed8c25a9a..56a355ea09 100644 --- a/utils/index.d.ts +++ b/utils/index.d.ts @@ -1209,6 +1209,7 @@ export class ExecuteActivity); public initialState(): ActivityTreeItemOptions; public successState(): ActivityTreeItemOptions; + public progressState(): ActivityTreeItemOptions; public errorState(error: IParsedError): ActivityTreeItemOptions; protected get label(): string; } From 0f8a9e5d14c28b47c4c456795f612cbb1945b63c Mon Sep 17 00:00:00 2001 From: Nathan Turinski Date: Mon, 12 Aug 2024 14:56:39 -0700 Subject: [PATCH 5/7] Seems like I missed a few places...oops --- utils/index.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/utils/index.d.ts b/utils/index.d.ts index 56a355ea09..617872fff8 100644 --- a/utils/index.d.ts +++ b/utils/index.d.ts @@ -1306,6 +1306,11 @@ export declare abstract class AzureWizardExecuteStep Date: Tue, 13 Aug 2024 10:52:37 -0700 Subject: [PATCH 6/7] Export in the index also... --- utils/src/constants.ts | 2 +- utils/src/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/src/constants.ts b/utils/src/constants.ts index 830b3ebce1..2918bcd0f0 100644 --- a/utils/src/constants.ts +++ b/utils/src/constants.ts @@ -21,4 +21,4 @@ export const activityProgressContext: string = 'activity:progress'; export const activityInfoIcon: ThemeIcon = new ThemeIcon('info', new ThemeColor('charts.blue')); export const activitySuccessIcon: ThemeIcon = new ThemeIcon('pass', new ThemeColor('testing.iconPassed')); export const activityFailIcon: ThemeIcon = new ThemeIcon('error', new ThemeColor('testing.iconFailed')); -export const activityProgressIcon: ThemeIcon = new ThemeIcon('loading~spin', new ThemeColor('testing.iconQueued')); +export const activityProgressIcon: ThemeIcon = new ThemeIcon('loading~spin'); diff --git a/utils/src/index.ts b/utils/src/index.ts index 61d6d8cd53..3955a98a3f 100644 --- a/utils/src/index.ts +++ b/utils/src/index.ts @@ -8,7 +8,7 @@ export * from './activityLog/Activity'; export { createAzExtLogOutputChannel, createAzExtOutputChannel } from './AzExtOutputChannel'; export * from './AzExtTreeFileSystem'; export * from './callWithTelemetryAndErrorHandling'; -export { activityFailContext, activityFailIcon, activityInfoIcon, activitySuccessContext, activitySuccessIcon } from './constants'; +export { activityFailContext, activityFailIcon, activityInfoIcon, activityProgressContext, activityProgressIcon, activitySuccessContext, activitySuccessIcon } from './constants'; export * from './createApiProvider'; export { createExperimentationService } from './createExperimentationService'; export * from './DialogResponses'; From 54b59b36b74b5e0ca662dbc4b3a1b252648d2514 Mon Sep 17 00:00:00 2001 From: Nathan Turinski Date: Wed, 21 Aug 2024 16:04:43 -0700 Subject: [PATCH 7/7] Only filter out progress output if it actually exists --- utils/.vscode/settings.json | 2 +- utils/src/wizard/AzureWizard.ts | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/utils/.vscode/settings.json b/utils/.vscode/settings.json index 3a2f1b3c24..05c1687384 100644 --- a/utils/.vscode/settings.json +++ b/utils/.vscode/settings.json @@ -10,6 +10,6 @@ "**/node_modules": true }, "editor.codeActionsOnSave": { - "source.fixAll.eslint": true + "source.fixAll.eslint": "explicit" } } diff --git a/utils/src/wizard/AzureWizard.ts b/utils/src/wizard/AzureWizard.ts index 22f39f663b..efeeaa7856 100644 --- a/utils/src/wizard/AzureWizard.ts +++ b/utils/src/wizard/AzureWizard.ts @@ -193,8 +193,10 @@ export class AzureWizard t !== progressOutput.item) + if (progressOutput?.item) { + this._context.activityChildren = this._context.activityChildren?.filter(t => t !== progressOutput.item); + } + this.displayActivityOutput(output, step.options); currentStep += 1;