mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Fixing next button on flat file wizard file configuration page (#15988)
* WIP * Removing unnecessary validations from import extension * readding abstract method implementation * Moving setup navigation validator to base class
This commit is contained in:
@@ -238,7 +238,6 @@ describe('File config page', function () {
|
|||||||
fileConfigPage = new FileConfigPage(mockFlatFileWizard.object, page, mockImportModel.object, view, TypeMoq.It.isAny());
|
fileConfigPage = new FileConfigPage(mockFlatFileWizard.object, page, mockImportModel.object, view, TypeMoq.It.isAny());
|
||||||
pages.set(1, fileConfigPage);
|
pages.set(1, fileConfigPage);
|
||||||
await fileConfigPage.start();
|
await fileConfigPage.start();
|
||||||
fileConfigPage.setupNavigationValidator();
|
|
||||||
resolve();
|
resolve();
|
||||||
});
|
});
|
||||||
wizard.generateScriptButton.hidden = true;
|
wizard.generateScriptButton.hidden = true;
|
||||||
|
|||||||
@@ -40,7 +40,8 @@ export abstract class BasePage {
|
|||||||
* Sets up a navigation validator.
|
* Sets up a navigation validator.
|
||||||
* This will be called right before onPageEnter().
|
* This will be called right before onPageEnter().
|
||||||
*/
|
*/
|
||||||
public abstract setupNavigationValidator(): void;
|
public setupNavigationValidator(): void {
|
||||||
|
}
|
||||||
|
|
||||||
public async getServerValues(): Promise<{ connection: azdata.connection.Connection, displayName: string, name: string }[]> {
|
public async getServerValues(): Promise<{ connection: azdata.connection.Connection, displayName: string, name: string }[]> {
|
||||||
let cons = await azdata.connection.getActiveConnections();
|
let cons = await azdata.connection.getActiveConnections();
|
||||||
|
|||||||
@@ -129,30 +129,21 @@ export class FileConfigPage extends ImportPage {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public setupNavigationValidator() {
|
|
||||||
this.instance.registerNavigationValidator((info) => {
|
|
||||||
if (this.schemaLoader.loading || this.databaseDropdown.loading) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private async createServerDropdown(): Promise<azdata.FormComponent> {
|
private async createServerDropdown(): Promise<azdata.FormComponent> {
|
||||||
this.serverDropdown = this.view.modelBuilder.dropDown().withProps({
|
this.serverDropdown = this.view.modelBuilder.dropDown().withProps({
|
||||||
required: true
|
required: true
|
||||||
}).component();
|
}).component();
|
||||||
|
|
||||||
// Handle server changes
|
// Handle server changes
|
||||||
this.serverDropdown.onValueChanged(async () => {
|
this.serverDropdown.onValueChanged(async (value) => {
|
||||||
|
if (value.selected) {
|
||||||
const connectionValue = this.serverDropdown.value as ConnectionDropdownValue;
|
const connectionValue = this.serverDropdown.value as ConnectionDropdownValue;
|
||||||
if (!connectionValue) {
|
if (!connectionValue) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.model.server = connectionValue.connection;
|
this.model.server = connectionValue.connection;
|
||||||
|
|
||||||
await this.populateDatabaseDropdown();
|
await this.populateDatabaseDropdown();
|
||||||
await this.populateSchemaDropdown();
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -179,7 +170,8 @@ export class FileConfigPage extends ImportPage {
|
|||||||
}).component();
|
}).component();
|
||||||
|
|
||||||
// Handle database changes
|
// Handle database changes
|
||||||
this.databaseDropdown.onValueChanged(async () => {
|
this.databaseDropdown.onValueChanged(async (value) => {
|
||||||
|
if (value.selected) {
|
||||||
const nameValue = this.databaseDropdown.value as azdata.CategoryValue;
|
const nameValue = this.databaseDropdown.value as azdata.CategoryValue;
|
||||||
if (!nameValue) {
|
if (!nameValue) {
|
||||||
return;
|
return;
|
||||||
@@ -192,6 +184,7 @@ export class FileConfigPage extends ImportPage {
|
|||||||
let connectionUri = await azdata.connection.getUriForConnection(this.model.server.connectionId);
|
let connectionUri = await azdata.connection.getUriForConnection(this.model.server.connectionId);
|
||||||
connectionProvider.changeDatabase(connectionUri, this.model.database);
|
connectionProvider.changeDatabase(connectionUri, this.model.database);
|
||||||
this.populateSchemaDropdown();
|
this.populateSchemaDropdown();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -347,12 +340,14 @@ export class FileConfigPage extends ImportPage {
|
|||||||
}).component();
|
}).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((value) => {
|
||||||
|
if (value.selected) {
|
||||||
const schemaValue = this.schemaDropdown.value as azdata.CategoryValue;
|
const schemaValue = this.schemaDropdown.value as azdata.CategoryValue;
|
||||||
if (!schemaValue) {
|
if (!schemaValue) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.model.schema = schemaValue.name;
|
this.model.schema = schemaValue.name;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -147,9 +147,9 @@ export class ModifyColumnsPage extends ImportPage {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public setupNavigationValidator() {
|
public override setupNavigationValidator() {
|
||||||
this.instance.registerNavigationValidator((info) => {
|
this.instance.registerNavigationValidator((info) => {
|
||||||
return !this.loading.loading && this.table.data && this.table.data.length > 0;
|
return this.table.data && this.table.data.length > 0;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -144,12 +144,12 @@ export class ProsePreviewPage extends ImportPage {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public setupNavigationValidator() {
|
public override setupNavigationValidator() {
|
||||||
this.instance.registerNavigationValidator((info) => {
|
this.instance.registerNavigationValidator((info) => {
|
||||||
if (info) {
|
if (info) {
|
||||||
// Prose Preview to Modify Columns
|
// Prose Preview to Modify Columns
|
||||||
if (info.lastPage === 1 && info.newPage === 2) {
|
if (info.lastPage === 1 && info.newPage === 2) {
|
||||||
return !this.loading.loading && this.table.data && this.table.data.length > 0;
|
return this.table.data && this.table.data.length > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return !this.loading.loading;
|
return !this.loading.loading;
|
||||||
|
|||||||
@@ -85,11 +85,6 @@ export class SummaryPage extends ImportPage {
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
public setupNavigationValidator() {
|
|
||||||
this.instance.registerNavigationValidator((info) => {
|
|
||||||
return !this.loading.loading;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private populateTable() {
|
private populateTable() {
|
||||||
this.table.updateProperties({
|
this.table.updateProperties({
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ export default class DropDownComponent extends ComponentBase<azdata.DropDownProp
|
|||||||
}));
|
}));
|
||||||
this._validations.push(() => !this.required || this.editable || !!this._selectBox.value);
|
this._validations.push(() => !this.required || this.editable || !!this._selectBox.value);
|
||||||
}
|
}
|
||||||
|
this._validations.push(() => !this.loading);
|
||||||
this.baseInit();
|
this.baseInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user