Fixed an issue when azure account is expired or not valid (#13483)

This commit is contained in:
Leila Lali
2020-11-23 13:03:50 -08:00
committed by GitHub
parent 6e0a4f27de
commit 3b20e8a61c
4 changed files with 9 additions and 5 deletions

View File

@@ -93,7 +93,7 @@ export class AzureModelsComponent extends ModelViewBase implements IDataComponen
public addComponents(formBuilder: azdata.FormBuilder) {
this.removeComponents(formBuilder);
if (this.azureFilterComponent?.data?.account) {
if (this.azureFilterComponent?.accountIsValid) {
this.addAzureComponents(formBuilder);
} else {
this.addAzureSignInComponents(formBuilder);

View File

@@ -136,6 +136,10 @@ export class AzureResourceFilterComponent extends ModelViewBase implements IData
await this.onAccountSelected();
}
public get accountIsValid(): boolean {
return this._azureAccounts !== undefined && this._azureAccounts.length > 0 && this._azureSubscriptions !== undefined && this._azureSubscriptions.length > 0;
}
/**
* refreshes the view
*/

View File

@@ -80,24 +80,24 @@ export class ModelBrowsePage extends ModelViewBase implements IPageView, IDataCo
if (this.localModelsComponent && this.azureModelsComponent && this.registeredModelsComponent) {
this.azureModelsComponent.removeComponents(this._formBuilder);
this.registeredModelsComponent.removeComponents(this._formBuilder);
this.localModelsComponent.addComponents(this._formBuilder);
await this.localModelsComponent.refresh();
this.localModelsComponent.addComponents(this._formBuilder);
}
} else if (this.modelSourceType === ModelSourceType.Azure) {
if (this.localModelsComponent && this.azureModelsComponent && this.registeredModelsComponent) {
this.localModelsComponent.removeComponents(this._formBuilder);
await this.azureModelsComponent.refresh();
this.azureModelsComponent.addComponents(this._formBuilder);
this.registeredModelsComponent.removeComponents(this._formBuilder);
await this.azureModelsComponent.refresh();
}
} else if (this.modelSourceType === ModelSourceType.RegisteredModels) {
if (this.localModelsComponent && this.azureModelsComponent && this.registeredModelsComponent) {
this.localModelsComponent.removeComponents(this._formBuilder);
this.azureModelsComponent.removeComponents(this._formBuilder);
this.registeredModelsComponent.addComponents(this._formBuilder);
await this.registeredModelsComponent.refresh();
this.registeredModelsComponent.addComponents(this._formBuilder);
}
}
}