diff --git a/.vscode/launch.json b/.vscode/launch.json index aac2142..0788df0 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -134,55 +134,55 @@ // ------------------------------------ // Export apps to QVF files // ------------------------------------ - "args": [ - "app-export", - "--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", + // "args": [ + // "app-export", + // "--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", - "--app-tag", - "apiCreated", - "Ctrl-Q import", + // "--app-tag", + // "apiCreated", + // "Ctrl-Q import", - "--app-id", - "eb3ab049-d007-43d3-93da-5962f9208c65", - "2933711d-6638-41d4-a2d2-6dd2d965208b", + // "--app-id", + // "eb3ab049-d007-43d3-93da-5962f9208c65", + // "2933711d-6638-41d4-a2d2-6dd2d965208b", - "--exclude-app-data", - "false", + // "--exclude-app-data", + // "false", - "--qvf-name-format", - // "export-time", - "app-name", - "export-date", + // "--qvf-name-format", + // // "export-time", + // "app-name", + // "export-date", - "--qvf-name-separator", - "__", + // "--qvf-name-separator", + // "__", - "--output-dir", - "qvfs", + // "--output-dir", + // "qvfs", - // "--limit-export-count", - // "2", + // // "--limit-export-count", + // // "2", - "--sleep-app-export", - "500", + // "--sleep-app-export", + // "500", - "--qvf-overwrite", + // "--qvf-overwrite", - // "--dry-run" + // // "--dry-run" - "--metadata-file-create" - ] + // "--metadata-file-create" + // ] // ------------------------------------ @@ -311,61 +311,65 @@ // ------------------------------------ // Get reload tasks as CSV/Excel/JSON file // ------------------------------------ - // "args": [ - // "task-get", - // "--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", - // // "82bc3e66-c899-4e44-b52f-552145da5ee1", - // // "5748afa9-3abe-43ab-bb1f-127c48ced075", - // // "5520e710-91ad-41d2-aeb6-434cafbf366b", - // // "--task-tag", - // // "Abc 123", - // // "Butler 5.0 demo", - - // "--output-format", - // "table", + "args": [ + "task-get", + "--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", + // "82bc3e66-c899-4e44-b52f-552145da5ee1", + // "5748afa9-3abe-43ab-bb1f-127c48ced075", + // "5520e710-91ad-41d2-aeb6-434cafbf366b", + "--task-tag", + "Ctrl-Q demo", + // "Butler 5.0 demo", + + "--output-format", + "table", - // "--output-dest", - // "file", - // "--output-file-name", - // // "tasks.xlsx", - // "tasks.csv", - // // "tasks2.json", - // // "tasks2.xlsx", - // "--output-file-format", - // // "excel", - // // "json", - // "csv", - - // // "--text-color", - // // "no", - - // "--output-file-overwrite", - - // "--table-details", - // "common", - // // "lastexecution", - // "tag", - // // "customproperty", - // // "schematrigger", - // // "compositetrigger", - // // "comptimeconstraint", - // // "comprule", - // // "--log-level", - // // "debug" - // ] + "--output-dest", + "file", + "--output-file-name", + "tasks.xlsx", + // "tasks.csv", + // "tasks2.json", + // "tasks2.xlsx", + "--output-file-format", + "excel", + // "json", + // "csv", + + "--output-file-name", + "reload-tasks.xlsx", + + // "--text-color", + // "no", + + "--output-file-overwrite", + + // "--table-details", + // "common", + // "lastexecution", + // "tag", + // "customproperty", + // "schematrigger", + // "compositetrigger", + // "comptimeconstraint", + // "comprule", + + // "--log-level", + // "debug" + ] // ------------------------------------ // Create custom property with user activity buckets diff --git a/README.md b/README.md index f0e5c8e..d33b50d 100644 --- a/README.md +++ b/README.md @@ -1045,11 +1045,13 @@ Options: -h, --help display help for command ``` -The next example will export apps (including the data in them) that have either of two different tags set, plus two apps identified by app id. -If the QVF files exist a confirmation text will be shown for each existing app. -The name of the QVF files will be `_.qvf`. -QVF files will be stored in a subdirectory `qvf-export`. -An Excel file will be created, containing select metadata about the apps. +The next example will + +- Export apps (including the data in them) that have either of two different tags set, plus two apps identified by app id. +- If the QVF files exist a confirmation text will be shown for each existing app. +- The name of the QVF files will be `_.qvf`. +- QVF files will be stored in a subdirectory `qvf-export`. +- An Excel file will be created, containing select metadata about the apps. ``` .\ctrl-q.exe app-export ` @@ -1133,7 +1135,7 @@ Mode LastWriteTime Length Name ``` -The format of the created Excel file is almost identical as the one used when importing apps from QVF files, described [here](#source-file-columns-for-app-import-definitions). +The format of the created Excel file is almost identical to the one used when importing apps from QVF files, described [here](#source-file-columns-for-app-import-definitions). The only difference is that the app export format includes an "App id" column, which is not required when importing apps. App import will however work just fine if there is an "App id" column present, it just won't be used for anything. diff --git a/src/lib/cmd/exportapp.js b/src/lib/cmd/exportapp.js index aba403d..76c45c7 100644 --- a/src/lib/cmd/exportapp.js +++ b/src/lib/cmd/exportapp.js @@ -154,7 +154,7 @@ const exportAppToFile = async (options) => { } return true; } catch (err) { - logger.error(`GET TASK: ${err.stack}`); + logger.error(`EXPORT APP: ${err.stack}`); } }; diff --git a/src/lib/cmd/importapp.js b/src/lib/cmd/importapp.js index c1f8748..53a8b3b 100644 --- a/src/lib/cmd/importapp.js +++ b/src/lib/cmd/importapp.js @@ -80,7 +80,7 @@ const importAppFromFile = async (options) => { logger.debug(`Imported apps:\n${JSON.stringify(importedApps, null, 2)}`); } } catch (err) { - logger.error(`GET TASK: ${err.stack}`); + logger.error(`IMPORT APP: ${err.stack}`); } }; diff --git a/src/lib/cmd/importtask.js b/src/lib/cmd/importtask.js index 202a6ea..26b3119 100644 --- a/src/lib/cmd/importtask.js +++ b/src/lib/cmd/importtask.js @@ -394,7 +394,7 @@ const importTaskFromFile = async (options) => { await qlikSenseTasks.init(options, importedApps); const taskList = await qlikSenseTasks.getTaskModelFromFile(tasksFromFile, tagsExisting, cpExisting); } catch (err) { - logger.error(`GET TASK: ${err.stack}`); + logger.error(`IMPORT TASK: ${err.stack}`); } }; diff --git a/src/lib/task/class_alltasks.js b/src/lib/task/class_alltasks.js index 3502b42..6cf2aae 100644 --- a/src/lib/task/class_alltasks.js +++ b/src/lib/task/class_alltasks.js @@ -747,9 +747,13 @@ class QlikSenseTasks { for (let i = 1; i < this.options.taskId.length; i += 1) { filter += encodeURIComponent(` or id eq ${this.options.taskId[i]}`); } + } + + // Add closing parenthesis + if (this.options.taskId && this.options?.taskId.length >= 1) { filter += encodeURIComponent(')'); - logger.debug(`GET TASK: QRS query filter (incl ids): ${filter}`); } + logger.debug(`GET TASK: QRS query filter (incl ids): ${filter}`); // Add task tag(s) to query string if (this.options.taskTag && this.options?.taskTag.length >= 1) { @@ -769,9 +773,12 @@ class QlikSenseTasks { for (let i = 1; i < this.options.taskTag.length; i += 1) { filter += encodeURIComponent(` or tags.name eq '${this.options.taskTag[i]}'`); } + } + // Add closing parenthesis + if (this.options.taskTag && this.options?.taskTag.length >= 1) { filter += encodeURIComponent(')'); - logger.debug(`GET TASK: QRS query filter (incl ids, tags): ${filter}`); } + logger.debug(`GET TASK: QRS query filter (incl ids, tags): ${filter}`); let axiosConfig; if (filter === '') {