-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
serviceconnector: Add children to validate activity log #1557
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,20 +3,34 @@ | |
* Licensed under the MIT License. See License.md in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import { AzureWizardExecuteStep, nonNullValue } from "@microsoft/vscode-azext-utils"; | ||
import { AzureWizardExecuteStep, GenericTreeItem, nonNullValue } from "@microsoft/vscode-azext-utils"; | ||
import { ThemeColor, ThemeIcon } from "vscode"; | ||
import { IPickLinkerContext } from "../deleteLinker/IPickLinkerContext"; | ||
import { createLinkerClient } from "../linkerClient"; | ||
import { KnownValidationResultStatus } from "@azure/arm-servicelinker"; | ||
|
||
export class ValidateLinkerStep extends AzureWizardExecuteStep<IPickLinkerContext> { | ||
public priority: number = 10; | ||
|
||
public async execute(context: IPickLinkerContext): Promise<void> { | ||
const client = await createLinkerClient(context.credentials); | ||
const response = await client.linker.beginValidateAndWait(nonNullValue(context.sourceResourceUri), nonNullValue(context.linkerName)); | ||
|
||
context.activityChildren = []; | ||
|
||
for (const detail of nonNullValue(response.validationDetail)) { | ||
if (detail.result === KnownValidationResultStatus.Failure) { | ||
if (detail.result === "failure") { | ||
context.activityChildren.push(new GenericTreeItem(undefined, { | ||
contextValue: `validateResult-${detail.name}`, | ||
label: nonNullValue(detail.name), | ||
iconPath: new ThemeIcon('error', new ThemeColor('testing.iconFailed')) | ||
})); | ||
throw new Error(detail.description); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Although one validation failed, I think it's best to still show all other failed/passed validations as activity children. Maybe throw the error after all the children are added? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The portal currently only shows the one failure if the validation errors but I think it would be better to show all the checks. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually tested this out and for some reason when there is an error the validation result only contains the failed check. So moving the error after all the children doesn't change anything. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not exactly sure why that happens. But that's fine |
||
} else { | ||
context.activityChildren.push(new GenericTreeItem(undefined, { | ||
contextValue: `validateResult-${detail.name}`, | ||
label: nonNullValue(detail.name), | ||
iconPath: new ThemeIcon('pass', new ThemeColor('testing.iconPassed')) | ||
})); | ||
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this set or used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was using it in a previous implementation but will remove since it is no longer used.