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

@@ -173,7 +173,7 @@ export const modelFrameworkVersion = localize('models.frameworkVersion', "Framew
export const modelVersion = localize('models.version', "Version"); export const modelVersion = localize('models.version', "Version");
export const browseModels = localize('models.browseButton', "..."); export const browseModels = localize('models.browseButton', "...");
export const azureAccount = localize('models.azureAccount', "Azure account"); export const azureAccount = localize('models.azureAccount', "Azure account");
export const azureSignIn = localize('models.azureSignIn', "Sign in to Azure"); export const azureSignIn = localize('models.azureSignIn', "Azure sign in or refresh account");
export const columnDatabase = localize('predict.columnDatabase', "Source database"); export const columnDatabase = localize('predict.columnDatabase', "Source database");
export const columnDatabaseInfo = localize('predict.columnDatabaseInfo', "Select the database containing the dataset to apply the prediction."); export const columnDatabaseInfo = localize('predict.columnDatabaseInfo', "Select the database containing the dataset to apply the prediction.");
export const columnTable = localize('predict.columnTable', "Source table"); export const columnTable = localize('predict.columnTable', "Source table");

View File

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

View File

@@ -136,6 +136,10 @@ export class AzureResourceFilterComponent extends ModelViewBase implements IData
await this.onAccountSelected(); 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 * refreshes the view
*/ */

View File

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