Aasim/release1.23/importfixes (#12721)

* 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

* version bump of flat file services (#12686)
This commit is contained in:
Aasim Khan
2020-10-02 15:17:55 -07:00
committed by GitHub
parent ac6bc56c4e
commit 9067204979
3 changed files with 23 additions and 12 deletions

View File

@@ -1,7 +1,7 @@
{ {
"downloadUrl": "https://sqlopsextensions.blob.core.windows.net/extensions/import/service/{#version#}/{#fileName#}", "downloadUrl": "https://sqlopsextensions.blob.core.windows.net/extensions/import/service/{#version#}/{#fileName#}",
"useDefaultLinuxRuntime": true, "useDefaultLinuxRuntime": true,
"version": "0.0.5", "version": "0.0.6",
"downloadFileNames": { "downloadFileNames": {
"Windows_64": "win-x64.zip", "Windows_64": "win-x64.zip",
"Windows_86": "win-x86.zip", "Windows_86": "win-x86.zip",

View File

@@ -96,10 +96,10 @@ export class ModifyColumnsPage extends ImportPage {
this.model.proseColumns = []; this.model.proseColumns = [];
this.table.data.forEach((row) => { this.table.data.forEach((row) => {
this.model.proseColumns.push({ this.model.proseColumns.push({
columnName: row[0], columnName: row[0].value,
dataType: row[1], dataType: row[1].value,
primaryKey: row[2], primaryKey: row[2].value,
nullable: row[3] nullable: row[3].value
}); });
}); });
}); });

View File

@@ -8,6 +8,7 @@ import * as azdata from 'azdata';
import { ImportPage } from '../api/importPage'; import { ImportPage } from '../api/importPage';
import { InsertDataResponse } from '../../services/contracts'; import { InsertDataResponse } from '../../services/contracts';
import * as constants from '../../common/constants'; import * as constants from '../../common/constants';
import { EOL } from 'os';
export class SummaryPage extends ImportPage { export class SummaryPage extends ImportPage {
private _table: azdata.TableComponent; private _table: azdata.TableComponent;
@@ -93,7 +94,7 @@ export class SummaryPage extends ImportPage {
private populateTable() { private populateTable() {
this.table.updateProperties({ this.table.updateProperties({
data: [ data: [
[constants.serverNameText, this.model.server.providerName], [constants.serverNameText, this.model.server.options.server],
[constants.databaseText, this.model.database], [constants.databaseText, this.model.database],
[constants.tableNameText, this.model.table], [constants.tableNameText, this.model.table],
[constants.tableSchemaText, this.model.schema], [constants.tableSchemaText, this.model.schema],
@@ -104,10 +105,9 @@ export class SummaryPage extends ImportPage {
}); });
} }
private async handleImport(): Promise<boolean> { private async handleImport(): Promise<void> {
let changeColumnResults = [];
let i = 0; let i = 0;
const changeColumnSettingsErrors = [];
for (let val of this.model.proseColumns) { for (let val of this.model.proseColumns) {
let columnChangeParams = { let columnChangeParams = {
index: i++, index: i++,
@@ -117,12 +117,24 @@ export class SummaryPage extends ImportPage {
newInPrimaryKey: val.primaryKey newInPrimaryKey: val.primaryKey
}; };
const changeColumnResult = await this.provider.sendChangeColumnSettingsRequest(columnChangeParams); 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 result: InsertDataResponse;
let err; let err;
let includePasswordInConnectionString = (this.model.server.options.connectionId === 'Integrated') ? false : true; let includePasswordInConnectionString = (this.model.server.options.authenticationType === 'Integrated') ? false : true;
try { try {
result = await this.provider.sendInsertDataRequest({ result = await this.provider.sendInsertDataRequest({
@@ -154,7 +166,6 @@ export class SummaryPage extends ImportPage {
this.statusText.updateProperties({ this.statusText.updateProperties({
value: updateText value: updateText
}); });
return true;
} }
// private async getCountRowsInserted(): Promise<Number> { // private async getCountRowsInserted(): Promise<Number> {