mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Fixing import getting stuck on step 4 (#12677)
* Getting the proper attribute during column modification Exposing errors of change column settings and stopping import if they occur * removing extra space * Added a comment for error handling * Fixed a test error that was caused due to insufficient null checks. * removing unnecessary return
This commit is contained in:
@@ -96,10 +96,10 @@ export class ModifyColumnsPage extends ImportPage {
|
||||
this.model.proseColumns = [];
|
||||
this.table.data.forEach((row) => {
|
||||
this.model.proseColumns.push({
|
||||
columnName: row[0],
|
||||
dataType: row[1],
|
||||
primaryKey: row[2],
|
||||
nullable: row[3]
|
||||
columnName: row[0].value,
|
||||
dataType: row[1].value,
|
||||
primaryKey: row[2].value,
|
||||
nullable: row[3].value
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -8,6 +8,7 @@ import * as azdata from 'azdata';
|
||||
import { ImportPage } from '../api/importPage';
|
||||
import { InsertDataResponse } from '../../services/contracts';
|
||||
import * as constants from '../../common/constants';
|
||||
import { EOL } from 'os';
|
||||
|
||||
export class SummaryPage extends ImportPage {
|
||||
private _table: azdata.TableComponent;
|
||||
@@ -93,7 +94,7 @@ export class SummaryPage extends ImportPage {
|
||||
private populateTable() {
|
||||
this.table.updateProperties({
|
||||
data: [
|
||||
[constants.serverNameText, this.model.server.providerName],
|
||||
[constants.serverNameText, this.model.server.options.server],
|
||||
[constants.databaseText, this.model.database],
|
||||
[constants.tableNameText, this.model.table],
|
||||
[constants.tableSchemaText, this.model.schema],
|
||||
@@ -104,10 +105,9 @@ export class SummaryPage extends ImportPage {
|
||||
});
|
||||
}
|
||||
|
||||
private async handleImport(): Promise<boolean> {
|
||||
let changeColumnResults = [];
|
||||
private async handleImport(): Promise<void> {
|
||||
let i = 0;
|
||||
|
||||
const changeColumnSettingsErrors = [];
|
||||
for (let val of this.model.proseColumns) {
|
||||
let columnChangeParams = {
|
||||
index: i++,
|
||||
@@ -117,12 +117,24 @@ export class SummaryPage extends ImportPage {
|
||||
newInPrimaryKey: val.primaryKey
|
||||
};
|
||||
const changeColumnResult = await this.provider.sendChangeColumnSettingsRequest(columnChangeParams);
|
||||
changeColumnResults.push(changeColumnResult);
|
||||
if (changeColumnResult?.result?.errorMessage) {
|
||||
changeColumnSettingsErrors.push(changeColumnResult.result.errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
// Stopping import if there are errors in change column setting.
|
||||
if (changeColumnSettingsErrors.length !== 0) {
|
||||
let updateText: string;
|
||||
updateText = changeColumnSettingsErrors.join(EOL);
|
||||
this.statusText.updateProperties({
|
||||
value: updateText
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
let result: InsertDataResponse;
|
||||
let err;
|
||||
let includePasswordInConnectionString = (this.model.server.options.connectionId === 'Integrated') ? false : true;
|
||||
let includePasswordInConnectionString = (this.model.server.options.authenticationType === 'Integrated') ? false : true;
|
||||
|
||||
try {
|
||||
result = await this.provider.sendInsertDataRequest({
|
||||
@@ -154,7 +166,6 @@ export class SummaryPage extends ImportPage {
|
||||
this.statusText.updateProperties({
|
||||
value: updateText
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
// private async getCountRowsInserted(): Promise<Number> {
|
||||
|
||||
Reference in New Issue
Block a user