mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
ADS: Make select all tables by default instead of having to click edit and do select all (#21698)
* table are selected as default * refactor * fix save and close bug
This commit is contained in:
@@ -48,19 +48,6 @@ export class TableMigrationSelectionDialog {
|
|||||||
this._model.sourceConnectionId,
|
this._model.sourceConnectionId,
|
||||||
this._sourceDatabaseName);
|
this._sourceDatabaseName);
|
||||||
|
|
||||||
this._tableSelectionMap = new Map();
|
|
||||||
sourceTableList.forEach(table => {
|
|
||||||
const sourceTable = targetDatabaseInfo.sourceTables.get(table.tableName);
|
|
||||||
const isSelected = sourceTable?.selectedForMigration === true;
|
|
||||||
const tableInfo: TableInfo = {
|
|
||||||
databaseName: table.databaseName,
|
|
||||||
rowCount: table.rowCount,
|
|
||||||
selectedForMigration: isSelected,
|
|
||||||
tableName: table.tableName,
|
|
||||||
};
|
|
||||||
this._tableSelectionMap.set(table.tableName, tableInfo);
|
|
||||||
});
|
|
||||||
|
|
||||||
const targetTableList: TableInfo[] = await collectTargetDatabaseTableInfo(
|
const targetTableList: TableInfo[] = await collectTargetDatabaseTableInfo(
|
||||||
this._model._targetServerInstance as AzureSqlDatabaseServer,
|
this._model._targetServerInstance as AzureSqlDatabaseServer,
|
||||||
targetDatabaseInfo.databaseName,
|
targetDatabaseInfo.databaseName,
|
||||||
@@ -77,6 +64,28 @@ export class TableMigrationSelectionDialog {
|
|||||||
selectedForMigration: false,
|
selectedForMigration: false,
|
||||||
tableName: table.tableName,
|
tableName: table.tableName,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
this._tableSelectionMap = new Map();
|
||||||
|
sourceTableList.forEach(table => {
|
||||||
|
// If the source table doesn't exist in the target, set isSelected to false.
|
||||||
|
// Otherwise, set it to true as default.
|
||||||
|
var isSelected = false;
|
||||||
|
var sourceTable = targetDatabaseInfo.sourceTables.get(table.tableName);
|
||||||
|
if (sourceTable === null || sourceTable === undefined) {
|
||||||
|
sourceTable = this._targetTableMap.get(table.tableName);
|
||||||
|
isSelected = sourceTable === null || sourceTable === undefined ? false : true;
|
||||||
|
} else {
|
||||||
|
isSelected = sourceTable.selectedForMigration;
|
||||||
|
}
|
||||||
|
|
||||||
|
const tableInfo: TableInfo = {
|
||||||
|
databaseName: table.databaseName,
|
||||||
|
rowCount: table.rowCount,
|
||||||
|
selectedForMigration: isSelected,
|
||||||
|
tableName: table.tableName,
|
||||||
|
};
|
||||||
|
this._tableSelectionMap.set(table.tableName, tableInfo);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this._dialog!.message = {
|
this._dialog!.message = {
|
||||||
@@ -97,7 +106,9 @@ export class TableMigrationSelectionDialog {
|
|||||||
let tableRow = 0;
|
let tableRow = 0;
|
||||||
this._missingTableCount = 0;
|
this._missingTableCount = 0;
|
||||||
this._tableSelectionMap.forEach(sourceTable => {
|
this._tableSelectionMap.forEach(sourceTable => {
|
||||||
if (filterText?.length === 0 || sourceTable.tableName.indexOf(filterText) > -1) {
|
const tableName = sourceTable.tableName.toLocaleLowerCase();
|
||||||
|
const searchText = filterText.toLocaleLowerCase();
|
||||||
|
if (filterText?.length === 0 || tableName.indexOf(searchText) > -1) {
|
||||||
const targetTable = this._targetTableMap.get(sourceTable.tableName);
|
const targetTable = this._targetTableMap.get(sourceTable.tableName);
|
||||||
if (targetTable) {
|
if (targetTable) {
|
||||||
const targetTableRowCount = targetTable?.rowCount ?? 0;
|
const targetTableRowCount = targetTable?.rowCount ?? 0;
|
||||||
@@ -113,9 +124,11 @@ export class TableMigrationSelectionDialog {
|
|||||||
if (sourceTable.selectedForMigration) {
|
if (sourceTable.selectedForMigration) {
|
||||||
selectedItems.push(tableRow);
|
selectedItems.push(tableRow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tableRow++;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._missingTableCount += targetTable ? 0 : 1;
|
this._missingTableCount += targetTable ? 0 : 1;
|
||||||
tableRow++;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
await this._tableSelectionTable.updateProperty('data', data);
|
await this._tableSelectionTable.updateProperty('data', data);
|
||||||
|
|||||||
@@ -76,6 +76,11 @@ export class TargetSelectionPage extends MigrationWizardPage {
|
|||||||
this._disposables.forEach(
|
this._disposables.forEach(
|
||||||
d => { try { d.dispose(); } catch { } });
|
d => { try { d.dispose(); } catch { } });
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
if (this.migrationStateModel.resumeAssessment) {
|
||||||
|
await this.populateAzureAccountsDropdown();
|
||||||
|
}
|
||||||
|
|
||||||
await this._view.initializeModel(form);
|
await this._view.initializeModel(form);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -112,10 +112,14 @@ export class WizardController {
|
|||||||
this._model.refreshDatabaseBackupPage = true;
|
this._model.refreshDatabaseBackupPage = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the user selected network share and selected save & close afterwards, it should always return to the database backup page so that
|
if (this._model.savedInfo.closedPage >= Page.IntegrationRuntime && this._model.isSqlDbTarget) {
|
||||||
// the user can input their password again
|
// if the user selected the tables and selected save & close afterwards in SQLDB scenario,
|
||||||
if (this._model.savedInfo.closedPage >= Page.IntegrationRuntime &&
|
// it should always return to the target database selection page so that the user can input their password again
|
||||||
|
wizardSetupPromises.push(this._wizardObject.setCurrentPage(Page.TargetSelection));
|
||||||
|
} else if (this._model.savedInfo.closedPage >= Page.IntegrationRuntime &&
|
||||||
this._model.savedInfo.networkContainerType === NetworkContainerType.NETWORK_SHARE) {
|
this._model.savedInfo.networkContainerType === NetworkContainerType.NETWORK_SHARE) {
|
||||||
|
// if the user selected network share and selected save & close afterwards, it should always return to the database backup page so that
|
||||||
|
// the user can input their password again
|
||||||
wizardSetupPromises.push(this._wizardObject.setCurrentPage(Page.IntegrationRuntime));
|
wizardSetupPromises.push(this._wizardObject.setCurrentPage(Page.IntegrationRuntime));
|
||||||
} else {
|
} else {
|
||||||
wizardSetupPromises.push(this._wizardObject.setCurrentPage(this._model.savedInfo.closedPage));
|
wizardSetupPromises.push(this._wizardObject.setCurrentPage(this._model.savedInfo.closedPage));
|
||||||
|
|||||||
Reference in New Issue
Block a user