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

@@ -1,6 +1,15 @@
# Microsoft SQL Server Import for SQL Operations Studio # Microsoft SQL Server Import for SQL Operations Studio
--
Import Flat File Wizard is a simple way to copy data from a flat file (.csv, .txt) to a destination. This overview describes the reasons for using this wizard, how to find this wizard, and a simple example to follow.
![image](https://user-images.githubusercontent.com/30873802/43433347-c958ed28-942b-11e8-8bbc-f4f2529c3978.png)
## Why would I use this wizard?
This wizard was created to improve the current import experience leveraging an intelligent framework known as Program Synthesis using Examples ([PROSE](https://microsoft.github.io/prose/)). For a user without specialized domain knowledge, importing data can often be a complex, error prone, and tedious task. This wizard streamlines the import process as simple as selecting an input file and unique table name, and the PROSE framework handles the rest.
PROSE analyzes data patterns in your input file to infer column names, types, delimiters, and more. This framework learns the structure of the file and does all of the hard work so users don't have to.
## Code of Conduct ## Code of Conduct
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.

View File

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

View File

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

View File

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