Added loading to dropdowns (#12214)

* Added loading prop to dropdowns

* Added property for setting loading text message

* removed unnecessary sets

* changed code to match new changes

* Changed the dropdown loader to use select component instead of edit.
Added missing props in dropdown loader
This commit is contained in:
Aasim Khan
2020-09-11 16:57:28 -07:00
committed by GitHub
parent 173a715a4d
commit 8cc8dcc89c
5 changed files with 73 additions and 19 deletions

View File

@@ -108,7 +108,6 @@ describe('File config page', function () {
should.notEqual(fileConfigPage.tableNameTextBox, undefined, 'tableNameTextBox should not be undefined');
should.notEqual(fileConfigPage.schemaDropdown, undefined, 'schemaDropdown should not be undefined');
should.notEqual(fileConfigPage.form, undefined, 'form should not be undefined');
should.notEqual(fileConfigPage.databaseLoader, undefined, 'databaseLoader should not be undefined');
should.notEqual(fileConfigPage.schemaLoader, undefined, 'schemaLoader should not be undefined');
await fileConfigPage.onPageLeave();

View File

@@ -18,7 +18,6 @@ export class FileConfigPage extends ImportPage {
private _schemaDropdown: azdata.DropDownComponent;
private _form: azdata.FormContainer;
private _databaseLoader: azdata.LoadingComponent;
private _schemaLoader: azdata.LoadingComponent;
public get serverDropdown(): azdata.DropDownComponent {
@@ -77,14 +76,6 @@ export class FileConfigPage extends ImportPage {
this._form = form;
}
public get databaseLoader(): azdata.LoadingComponent {
return this._databaseLoader;
}
public set databaseLoader(databaseLoader: azdata.LoadingComponent) {
this._databaseLoader = databaseLoader;
}
public get schemaLoader(): azdata.LoadingComponent {
return this._schemaLoader;
}
@@ -139,7 +130,7 @@ export class FileConfigPage extends ImportPage {
public setupNavigationValidator() {
this.instance.registerNavigationValidator((info) => {
if (this.schemaLoader.loading || this.databaseLoader.loading) {
if (this.schemaLoader.loading || this.databaseDropdown.loading) {
return false;
}
return true;
@@ -195,22 +186,20 @@ export class FileConfigPage extends ImportPage {
this.populateSchemaDropdown();
});
this.databaseLoader = this.view.modelBuilder.loadingComponent().withItem(this.databaseDropdown).component();
return {
component: this.databaseLoader,
component: this.databaseDropdown,
title: constants.databaseDropdownTitleText
};
}
private async populateDatabaseDropdown(): Promise<boolean> {
this.databaseLoader.loading = true;
this.databaseDropdown.loading = true;
this.databaseDropdown.updateProperties({ values: [] });
this.schemaDropdown.updateProperties({ values: [] });
if (!this.model.server) {
//TODO handle error case
this.databaseLoader.loading = false;
this.databaseDropdown.loading = false;
return false;
}
@@ -233,7 +222,7 @@ export class FileConfigPage extends ImportPage {
});
this.databaseDropdown.value = { displayName: this.model.database, name: this.model.database };
this.databaseLoader.loading = false;
this.databaseDropdown.loading = false;
return true;
}