From fbff3483f2b880c5ee6e28c0e028cea91953aec4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=B6ran=20Sander?= Date: Mon, 29 Apr 2024 08:31:00 +0000 Subject: [PATCH 1/2] feat(app-export): Add --app-published flag for exporting all published apps Implements #468 --- .release-please-manifest.json | 2 +- .vscode/launch.json | 142 +++++++++++++++++----------------- src/ctrl-q.js | 1 + src/lib/app/class_allapps.js | 14 +++- 4 files changed, 88 insertions(+), 71 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index b7d773f..f90c545 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1 +1 @@ -{".":"3.17.0"} +{ ".": "3.17.0" } diff --git a/.vscode/launch.json b/.vscode/launch.json index 758f72b..fa811d9 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -181,66 +181,70 @@ // ------------------------------------ // Export apps to QVF files // ------------------------------------ - // "args": [ - // "app-export", - // "--host", - // "192.168.100.109", + "args": [ + "app-export", + "--host", + "pro2-win1.lab.ptarmiganlabs.net", + // "192.168.100.109", - // "--port", - // // "4747", - // "443", + "--port", + "4242", + // "443", - // "--virtual-proxy", - // "jwt", - // "--auth-type", - // "jwt", - // "--auth-jwt", - // "", + // "--virtual-proxy", + // "jwt", + // "--auth-type", + // "jwt", + // "--auth-jwt", + // "", - // // "--auth-cert-file", - // // "./cert/client.pem", - // // "--auth-cert-key-file", - // // "./cert/client_key.pem", + "--auth-cert-file", + "./cert/client.pem", + "--auth-cert-key-file", + "./cert/client_key.pem", - // "--auth-user-dir", - // "LAB", - // "--auth-user-id", - // "goran", + "--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", + "--app-published", - // "--qvf-name-format", - // // "export-time", - // "app-name", - // "export-date", + "--exclude-app-data", + // "false", + "true", - // "--qvf-name-separator", - // "__", + "--qvf-name-format", + // "export-time", + "app-name", + "export-date", - // "--output-dir", - // "qvfs", + "--qvf-name-separator", + "__", - // // "--limit-export-count", - // // "2", + "--output-dir", + "qvfs", - // "--sleep-app-export", - // "500", + // "--limit-export-count", + // "2", - // "--qvf-overwrite", + "--sleep-app-export", + "500", - // // "--dry-run" + "--qvf-overwrite", - // "--metadata-file-create" - // ] + // "--dry-run" + + "--metadata-file-create" + ] // ------------------------------------ // Import apps from Excel file @@ -1053,36 +1057,36 @@ // ------------------------------------ // Get script // ------------------------------------ - "args": [ - "script-get", - "--host", - "192.168.100.109", - // "pro2-win1.lab.ptarmiganlabs.net", + // "args": [ + // "script-get", + // "--host", + // "192.168.100.109", + // // "pro2-win1.lab.ptarmiganlabs.net", - // "--port", - // "4747", - // "443", + // // "--port", + // // "4747", + // // "443", - // "--virtual-proxy", - // "jwt", + // // "--virtual-proxy", + // // "jwt", - // "--auth-type", - // "jwt", - // "cert", - // "--auth-jwt", - // "", + // // "--auth-type", + // // "jwt", + // // "cert", + // // "--auth-jwt", + // // "", - "--app-id", - "deba4bcf-47e4-472e-97b2-4fe8d6498e11", + // "--app-id", + // "deba4bcf-47e4-472e-97b2-4fe8d6498e11", - "--auth-user-dir", - "LAB", - "--auth-user-id", - "goran", + // "--auth-user-dir", + // "LAB", + // "--auth-user-id", + // "goran", - "--log-level", - "info" - ] + // "--log-level", + // "info" + // ] // ------------------------------------ // Connection test diff --git a/src/ctrl-q.js b/src/ctrl-q.js index c86fdfa..2d43db2 100644 --- a/src/ctrl-q.js +++ b/src/ctrl-q.js @@ -825,6 +825,7 @@ program.configureHelp({ .option('--app-id ', 'use app IDs to select which apps to export') .option('--app-tag ', 'use app tags to select which apps to export') + .requiredOption('--app-published', 'export all published apps ', false) .requiredOption('--output-dir ', 'relative or absolut path in which QVF files should be stored.', 'qvf-export') .addOption( diff --git a/src/lib/app/class_allapps.js b/src/lib/app/class_allapps.js index 5325173..99c2091 100644 --- a/src/lib/app/class_allapps.js +++ b/src/lib/app/class_allapps.js @@ -52,7 +52,7 @@ class QlikSenseApps { this.appList.push(newApp); } - // Get array of apps matching app id, tags etc filters + // Get array of apps matching app id, tags, published and other filters async getAppsFromQseow() { try { logger.debug('GET APPS: Starting get apps from QSEoW'); @@ -106,6 +106,18 @@ class QlikSenseApps { } logger.debug(`GET APPS FROM QSEOW: QRS query filter (incl ids, tags): ${filter}`); + // Add app publish status to query string + if (this.options.appPublished === true) { + // Add published apps flag + if (filter.length >= 1) { + // We've previously added some app IDs and/or tags and/or other filters + filter += encodeURIComponent(' or (published eq true)'); + } else { + // No app IDs or tags or other filters added yet + filter += encodeURIComponent('published eq true'); + } + } + // Should cerrificates be used for authentication? let axiosConfig; if (this.options.authType === 'cert') { From 591196b966e05f44ec9f06e354883c8dd334d5c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=B6ran=20Sander?= Date: Mon, 29 Apr 2024 08:31:35 +0000 Subject: [PATCH 2/2] chore(deps): Update dependencies --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index cdf778c..841a56a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29,7 +29,7 @@ "uuid": "^9.0.1", "winston": "^3.13.0", "winston-daily-rotate-file": "^5.0.0", - "ws": "^8.16.0", + "ws": "^8.17.0", "yesno": "^0.4.0" }, "devDependencies": { @@ -7208,9 +7208,9 @@ } }, "node_modules/ws": { - "version": "8.16.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.16.0.tgz", - "integrity": "sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==", + "version": "8.17.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.0.tgz", + "integrity": "sha512-uJq6108EgZMAl20KagGkzCKfMEjxmKvZHG7Tlq0Z6nOky7YF7aq4mOx6xK8TJ/i1LeK4Qus7INktacctDgY8Ow==", "engines": { "node": ">=10.0.0" }, diff --git a/package.json b/package.json index 0cf3e3a..6a24ec9 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "uuid": "^9.0.1", "winston": "^3.13.0", "winston-daily-rotate-file": "^5.0.0", - "ws": "^8.16.0", + "ws": "^8.17.0", "yesno": "^0.4.0" }, "devDependencies": {