Skip to content

Commit

Permalink
Da-326 cb import sometimes collection and scope field can be blank (#327
Browse files Browse the repository at this point in the history
)

Fix Bugs:
1. Collections and scope field not adjusting to spaces and newline
characters
2. CB Export -> path separator for windows was not present, might have
broken it
  • Loading branch information
lokesh-couchbase authored Nov 6, 2023
1 parent feeb7d1 commit a8401b1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/commands/tools/dataImport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,7 @@ export class DataImport {
// NO Validation Error on Page 1, We can shift to next page
const elementSplit = await this.getSampleElementContentSplit(formData.dataset);
const defaultKeysValue = await this.matchElements(elementSplit, this.possibleKeyFields);

currentPanel.webview.html =
getLoader("Data Import");
currentPanel.webview.html =
Expand Down Expand Up @@ -980,8 +980,8 @@ export class DataImport {
const defaultCollectionValue = await this.matchElements(elementSplit, this.possibleCollectionFields);
currentPanel.webview.postMessage({
command: "vscode-couchbase.tools.dataImport.defaultScopeAndCollectionDynamicField",
defaultScopeValue: `%${defaultScopeValue}%`,
defaultCollectionValue: `%${defaultCollectionValue}%`
defaultScopeValue: defaultScopeValue.trim().length > 0 ? `%${defaultScopeValue}%` : "",
defaultCollectionValue: defaultCollectionValue.trim().length>0 ? `%${defaultCollectionValue}%` : ""
});
} else {
logger.error("error while reading dataset: \n " + errors.join("\n"));
Expand Down
9 changes: 2 additions & 7 deletions src/tools/CBExport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Constants } from "../util/constants";
import { getCurrentDateTime } from "../util/util";
import * as keytar from "keytar";
import * as vscode from 'vscode';
import * as path from 'path';

export class CBExport {
static async export(
Expand Down Expand Up @@ -45,13 +46,7 @@ export class CBExport {
scp.push(...collections);

const fileName = `${bucket}_cbexport_${getCurrentDateTime()}.json`;
let currentPath: string;

if (filePath.endsWith("/")) { //TODO: Verify for windows
currentPath = filePath + fileName;
} else {
currentPath = `${filePath}/${fileName}`;
}
let currentPath: string = path.join(filePath, fileName);

const includeData = scp.join(",");
const fullPath = `\"${currentPath}\"`;
Expand Down

0 comments on commit a8401b1

Please sign in to comment.