From 8bc8a1124505f70d80b612cdcd24d0598f1df166 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 13 Aug 2021 15:33:02 +0200 Subject: [PATCH] Fix rule events page. --- .../Actions/Algolia/AlgoliaActionHandler.cs | 29 +- .../events/rule-events-page.component.html | 2 +- frontend/package-lock.json | 18275 +++++++++++++++- 3 files changed, 18178 insertions(+), 128 deletions(-) diff --git a/backend/extensions/Squidex.Extensions/Actions/Algolia/AlgoliaActionHandler.cs b/backend/extensions/Squidex.Extensions/Actions/Algolia/AlgoliaActionHandler.cs index 57daae3a4..9ff262a78 100644 --- a/backend/extensions/Squidex.Extensions/Actions/Algolia/AlgoliaActionHandler.cs +++ b/backend/extensions/Squidex.Extensions/Actions/Algolia/AlgoliaActionHandler.cs @@ -43,16 +43,9 @@ namespace Squidex.Extensions.Actions.Algolia { var delete = @event.ShouldDelete(scriptEngine, action.Delete); - var contentId = entityEvent.Id.ToString(); - var ruleDescription = string.Empty; - var ruleJob = new AlgoliaJob - { - AppId = action.AppId, - ApiKey = action.ApiKey, - ContentId = contentId, - IndexName = await FormatAsync(action.IndexName, @event) - }; + var contentId = entityEvent.Id.ToString(); + var content = (JObject?)null; if (delete) { @@ -62,7 +55,6 @@ namespace Squidex.Extensions.Actions.Algolia { ruleDescription = $"Add entry to Algolia index: {action.IndexName}"; - JObject json; try { string jsonString; @@ -77,18 +69,25 @@ namespace Squidex.Extensions.Actions.Algolia jsonString = ToJson(@event); } - json = JObject.Parse(jsonString); + content = JObject.Parse(jsonString); } catch (Exception ex) { - json = new JObject(new JProperty("error", $"Invalid JSON: {ex.Message}")); + content = new JObject(new JProperty("error", $"Invalid JSON: {ex.Message}")); } - json["objectID"] = contentId; - - ruleJob.Content = json; + content["objectID"] = contentId; } + var ruleJob = new AlgoliaJob + { + AppId = action.AppId, + ApiKey = action.ApiKey, + Content = content, + ContentId = contentId, + IndexName = await FormatAsync(action.IndexName, @event) + }; + return (ruleDescription, ruleJob); } diff --git a/frontend/app/features/rules/pages/events/rule-events-page.component.html b/frontend/app/features/rules/pages/events/rule-events-page.component.html index da4978152..35a368f56 100644 --- a/frontend/app/features/rules/pages/events/rule-events-page.component.html +++ b/frontend/app/features/rules/pages/events/rule-events-page.component.html @@ -1,6 +1,6 @@ - +