Required fields and labelling of buttons (#2237)

* Required fields and labelling of buttons

* Update the readme.

* Change localized string
This commit is contained in:
Amir Ali Omidi
2018-08-16 11:16:06 -07:00
committed by GitHub
parent 2c8e93cc96
commit db817a7192
5 changed files with 34 additions and 5 deletions

View File

@@ -133,6 +133,11 @@ export class FlatFileWizard {
this.wizard.registerNavigationValidator(validator);
}
public changeNextButtonLabel(label: string) {
this.wizard.nextButton.label = label;
}
}

View File

@@ -83,7 +83,9 @@ export class FileConfigPage extends ImportPage {
}
private async createServerDropdown(): Promise<sqlops.FormComponent> {
this.serverDropdown = this.view.modelBuilder.dropDown().component();
this.serverDropdown = this.view.modelBuilder.dropDown().withProperties({
required: true
}).component();
// Handle server changes
this.serverDropdown.onValueChanged(async (params) => {
@@ -163,7 +165,9 @@ export class FileConfigPage extends ImportPage {
}
private async createDatabaseDropdown(): Promise<sqlops.FormComponent> {
this.databaseDropdown = this.view.modelBuilder.dropDown().component();
this.databaseDropdown = this.view.modelBuilder.dropDown().withProperties({
required: true
}).component();
// Handle database changes
this.databaseDropdown.onValueChanged(async (db) => {
@@ -226,7 +230,9 @@ export class FileConfigPage extends ImportPage {
}
private async createFileBrowser(): Promise<sqlops.FormComponent> {
this.fileTextBox = this.view.modelBuilder.inputBox().component();
this.fileTextBox = this.view.modelBuilder.inputBox().withProperties({
required: true
}).component();
this.fileButton = this.view.modelBuilder.button().withProperties({
label: localize('flatFileImport.browseFiles', 'Browse'),
}).component();
@@ -295,6 +301,8 @@ export class FileConfigPage extends ImportPage {
}
return true;
}).withProperties({
required: true,
}).component();
this.tableNameTextBox.onTextChanged((tableName) => {
@@ -309,7 +317,9 @@ export class FileConfigPage extends ImportPage {
private async createSchemaDropdown(): Promise<sqlops.FormComponent> {
this.schemaDropdown = this.view.modelBuilder.dropDown().component();
this.schemaDropdown = this.view.modelBuilder.dropDown().withProperties({
required: true
}).component();
this.schemaLoader = this.view.modelBuilder.loadingComponent().withItem(this.schemaDropdown).component();
this.schemaDropdown.onValueChanged(() => {

View File

@@ -107,17 +107,20 @@ export class ModifyColumnsPage extends ImportPage {
async onPageEnter(): Promise<boolean> {
this.loading.loading = true;
await this.populateTable();
this.instance.changeNextButtonLabel(localize('flatFileImport.importData', 'Import Data'));
this.loading.loading = false;
return true;
}
async onPageLeave(): Promise<boolean> {
this.instance.changeNextButtonLabel(localize('flatFileImport.next', 'Next'));
return undefined;
}
async cleanup(): Promise<boolean> {
delete this.model.proseColumns;
this.instance.changeNextButtonLabel(localize('flatFileImport.next', 'Next'));
return true;
}
@@ -127,6 +130,7 @@ export class ModifyColumnsPage extends ImportPage {
return !this.loading.loading;
});
}
private async populateTable() {
let data: any[][] = [];

View File

@@ -68,6 +68,7 @@ export class SummaryPage extends ImportPage {
return !this.loading.loading;
});
}
private populateTable() {
this.table.updateProperties({
data: [