Skip to content

Commit

Permalink
fix: Correctly create task chains when importing tasks
Browse files Browse the repository at this point in the history
Fixes #136
  • Loading branch information
Göran Sander committed Feb 10, 2023
1 parent e94177e commit dc0d33f
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 65 deletions.
116 changes: 58 additions & 58 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,46 +15,8 @@
// ------------------------------------
// Set custom property of reload task
// ------------------------------------
"args": [
"task-custom-property-set",
"--auth-type",
"cert",
"--host",
"192.168.100.109",
"--auth-cert-file",
"./cert/client.pem",
"--auth-cert-key-file",
"./cert/client_key.pem",
"--auth-user-dir",
"LAB",
"--auth-user-id",
"goran",
"--task-id",
"82bc3e66-c899-4e44-b52f-552145da5ee0",
"5748afa9-3abe-43ab-bb1f-127c48ced075",
"5520e710-91ad-41d2-aeb6-434cafbf366b",
// "--task-tag",
// "Test data",
// "api1",

"--custom-property-name",
"Department",
// "Department2",
// "DemoApp",
"--custom-property-value",
"Finance",
"Sales",
"--overwrite",
"--update-mode",
// "append",
"replace",
]

// ------------------------------------
// Import from Excel file
// ------------------------------------
// "args": [
// "task-import",
// "task-custom-property-set",
// "--auth-type",
// "cert",
// "--host",
Expand All @@ -67,26 +29,29 @@
// "LAB",
// "--auth-user-id",
// "goran",

// "--file-type",
// "excel",
// "--task-id",
// "82bc3e66-c899-4e44-b52f-552145da5ee0",
// "5748afa9-3abe-43ab-bb1f-127c48ced075",
// "5520e710-91ad-41d2-aeb6-434cafbf366b",
// // "--task-tag",
// // "Test data",
// // "api1",

// "--file-name",
// "tasks.xlsx",
// "--sheet-name",
// "Ctrl-Q task export",

// // "--overwrite",
// // "no",

// "--limit-import-count",
// "2",

// // "--dry-run"
// "--custom-property-name",
// "Department",
// // "Department2",
// // "DemoApp",
// "--custom-property-value",
// "Finance",
// "Sales",
// "--overwrite",
// "--update-mode",
// // "append",
// "replace",
// ]

// ------------------------------------
// Import from CSV file
// Import from Excel file
// ------------------------------------
// "args": [
// "task-import",
Expand All @@ -104,11 +69,12 @@
// "goran",

// "--file-type",
// "csv",
// "excel",

// "--file-name",
// // "tasks2source.csv",
// "tasks.csv",
// "tasks.xlsx",
// "--sheet-name",
// "Ctrl-Q task export",

// // "--overwrite",
// // "no",
Expand All @@ -119,6 +85,40 @@
// // "--dry-run"
// ]

// ------------------------------------
// Import from CSV file
// ------------------------------------
"args": [
"task-import",
"--auth-type",
"cert",
"--host",
"192.168.100.109",
"--auth-cert-file",
"./cert/client.pem",
"--auth-cert-key-file",
"./cert/client_key.pem",
"--auth-user-dir",
"LAB",
"--auth-user-id",
"goran",

"--file-type",
"csv",

"--file-name",
// "tasks2source.csv",
"task-chain.csv",

// "--overwrite",
// "no",

// "--limit-import-count",
// "2",

// "--dry-run"
]


// ------------------------------------
// Get task tree
Expand Down
2 changes: 2 additions & 0 deletions release-please-config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"last-release-sha": "e2b8e659aad5b27806d2c26f1f251228ed8b9ece",
"release-as": "3.4.2",

"release-type": "node",
"draft": true,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/cmd/gettask.js
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ const getTask = async (options) => {
}

if (columnBlockShow.comprule) {
headerRow = headerRow.concat(['Rule count', 'Rule state', 'Rule task name', 'Rule task id']);
headerRow = headerRow.concat(['Rule counter', 'Rule state', 'Rule task name', 'Rule task id']);
}

consoleTableConfig.header = {
Expand Down
11 changes: 5 additions & 6 deletions src/lib/task/class_alltasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ class QlikSenseTasks {
item[taskFileColumnHeaders.ruleCounter.pos] > 0
);

// Create an object using same format that Sense uses for composite events
// Create an object using same format that the Sense API uses for composite events
const compositeEvent = {
timeConstraint: {
days: compositeEventRow[taskFileColumnHeaders.timeConstraintDays.pos],
Expand Down Expand Up @@ -467,10 +467,7 @@ class QlikSenseTasks {
// The strategey is to first create all tasks, then add composite events.
// Only then can we be sure all composite events refer to existing tasks.

// Store this task object to the task list
// Parameters are
// source, task data, anonymize task names

// Create reload task in QSEoW
if (this.options.dryRun === false || this.options.dryRun === undefined) {
// eslint-disable-next-line no-await-in-loop
const newTaskId = await this.createReloadTaskInQseow(currentTask);
Expand All @@ -493,7 +490,7 @@ class QlikSenseTasks {
}
}

// Get task IDs for upstream tasks that composite events are connected to
// Get task IDs for upstream tasks that composite task events are connected to
this.qlikSenseCompositeEvents.compositeEventList.map((item) => {
const a = item;
a.compositeEvent.reloadTask.id = this.taskIdMap.get(item.compositeEvent.reloadTask.id);
Expand Down Expand Up @@ -558,6 +555,8 @@ class QlikSenseTasks {
body,
});

logger.debug(`/qrs/compositevent body: ${JSON.stringify(body, null, 2)}`);

axios
.request(axiosConfig)
.then((result) => {
Expand Down

0 comments on commit dc0d33f

Please sign in to comment.