mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -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:
@@ -40,7 +40,8 @@ export abstract class BasePage {
|
||||
* Sets up a navigation validator.
|
||||
* 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 }[]> {
|
||||
let cons = await azdata.connection.getActiveConnections();
|
||||
|
||||
@@ -129,30 +129,21 @@ export class FileConfigPage extends ImportPage {
|
||||
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> {
|
||||
this.serverDropdown = this.view.modelBuilder.dropDown().withProps({
|
||||
required: true
|
||||
}).component();
|
||||
|
||||
// Handle server changes
|
||||
this.serverDropdown.onValueChanged(async () => {
|
||||
const connectionValue = this.serverDropdown.value as ConnectionDropdownValue;
|
||||
if (!connectionValue) {
|
||||
return;
|
||||
this.serverDropdown.onValueChanged(async (value) => {
|
||||
if (value.selected) {
|
||||
const connectionValue = this.serverDropdown.value as ConnectionDropdownValue;
|
||||
if (!connectionValue) {
|
||||
return;
|
||||
}
|
||||
this.model.server = connectionValue.connection;
|
||||
await this.populateDatabaseDropdown();
|
||||
}
|
||||
this.model.server = connectionValue.connection;
|
||||
|
||||
await this.populateDatabaseDropdown();
|
||||
await this.populateSchemaDropdown();
|
||||
});
|
||||
|
||||
return {
|
||||
@@ -179,19 +170,21 @@ export class FileConfigPage extends ImportPage {
|
||||
}).component();
|
||||
|
||||
// Handle database changes
|
||||
this.databaseDropdown.onValueChanged(async () => {
|
||||
const nameValue = this.databaseDropdown.value as azdata.CategoryValue;
|
||||
if (!nameValue) {
|
||||
return;
|
||||
this.databaseDropdown.onValueChanged(async (value) => {
|
||||
if (value.selected) {
|
||||
const nameValue = this.databaseDropdown.value as azdata.CategoryValue;
|
||||
if (!nameValue) {
|
||||
return;
|
||||
}
|
||||
this.model.database = nameValue.name;
|
||||
if (!this.model.server) {
|
||||
return;
|
||||
}
|
||||
let connectionProvider = azdata.dataprotocol.getProvider<azdata.ConnectionProvider>(this.model.server.providerName, azdata.DataProviderType.ConnectionProvider);
|
||||
let connectionUri = await azdata.connection.getUriForConnection(this.model.server.connectionId);
|
||||
connectionProvider.changeDatabase(connectionUri, this.model.database);
|
||||
this.populateSchemaDropdown();
|
||||
}
|
||||
this.model.database = nameValue.name;
|
||||
if (!this.model.server) {
|
||||
return;
|
||||
}
|
||||
let connectionProvider = azdata.dataprotocol.getProvider<azdata.ConnectionProvider>(this.model.server.providerName, azdata.DataProviderType.ConnectionProvider);
|
||||
let connectionUri = await azdata.connection.getUriForConnection(this.model.server.connectionId);
|
||||
connectionProvider.changeDatabase(connectionUri, this.model.database);
|
||||
this.populateSchemaDropdown();
|
||||
});
|
||||
|
||||
return {
|
||||
@@ -347,12 +340,14 @@ export class FileConfigPage extends ImportPage {
|
||||
}).component();
|
||||
this.schemaLoader = this.view.modelBuilder.loadingComponent().withItem(this.schemaDropdown).component();
|
||||
|
||||
this.schemaDropdown.onValueChanged(() => {
|
||||
const schemaValue = this.schemaDropdown.value as azdata.CategoryValue;
|
||||
if (!schemaValue) {
|
||||
return;
|
||||
this.schemaDropdown.onValueChanged((value) => {
|
||||
if (value.selected) {
|
||||
const schemaValue = this.schemaDropdown.value as azdata.CategoryValue;
|
||||
if (!schemaValue) {
|
||||
return;
|
||||
}
|
||||
this.model.schema = schemaValue.name;
|
||||
}
|
||||
this.model.schema = schemaValue.name;
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -147,9 +147,9 @@ export class ModifyColumnsPage extends ImportPage {
|
||||
return true;
|
||||
}
|
||||
|
||||
public setupNavigationValidator() {
|
||||
public override setupNavigationValidator() {
|
||||
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;
|
||||
}
|
||||
|
||||
public setupNavigationValidator() {
|
||||
public override setupNavigationValidator() {
|
||||
this.instance.registerNavigationValidator((info) => {
|
||||
if (info) {
|
||||
// Prose Preview to Modify Columns
|
||||
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;
|
||||
|
||||
@@ -85,11 +85,6 @@ export class SummaryPage extends ImportPage {
|
||||
|
||||
return true;
|
||||
}
|
||||
public setupNavigationValidator() {
|
||||
this.instance.registerNavigationValidator((info) => {
|
||||
return !this.loading.loading;
|
||||
});
|
||||
}
|
||||
|
||||
private populateTable() {
|
||||
this.table.updateProperties({
|
||||
|
||||
Reference in New Issue
Block a user