From 702f4057bdc970547e15730825f76cf0e11f44ae Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Tue, 31 May 2022 19:52:35 +0100 Subject: [PATCH] Progress towards using couchdb for automation logs, after testing redis and realising it won't work. --- packages/backend-core/src/redis/utils.js | 1 + .../AutomationBuilder/TestDisplay.svelte | 18 ++--- .../portal/overview/HistoryTab.svelte | 8 +-- .../server/src/automations/history/index.ts | 67 +++++++++++++++++++ packages/server/src/db/utils.js | 25 +++++++ packages/server/src/db/views/staticViews.js | 23 +++++++ packages/server/src/definitions/automation.ts | 13 ++++ packages/server/src/module.d.ts | 1 + packages/server/src/threads/index.ts | 6 +- 9 files changed, 149 insertions(+), 13 deletions(-) create mode 100644 packages/server/src/automations/history/index.ts create mode 100644 packages/server/src/definitions/automation.ts diff --git a/packages/backend-core/src/redis/utils.js b/packages/backend-core/src/redis/utils.js index 90ea5c33f9..033a9bf0cf 100644 --- a/packages/backend-core/src/redis/utils.js +++ b/packages/backend-core/src/redis/utils.js @@ -19,6 +19,7 @@ exports.Databases = { QUERY_VARS: "queryVars", LICENSES: "license", GENERIC_CACHE: "data_cache", + AUTOMATION_LOGS: "autoLogs", } exports.SEPARATOR = SEPARATOR diff --git a/packages/builder/src/components/automation/AutomationBuilder/TestDisplay.svelte b/packages/builder/src/components/automation/AutomationBuilder/TestDisplay.svelte index 41b9d59e4a..e8bcc2e349 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/TestDisplay.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/TestDisplay.svelte @@ -13,6 +13,13 @@ return results.steps.filter(x => x.stepId !== "LOOP" || []) } + function textArea(results, message) { + if (!results) { + return message + } + return JSON.stringify(results, null, 2) + } + $: filteredResults = prepTestResults(testResults) $: { @@ -66,11 +73,7 @@