Browse Source

Fix rule events page.

pull/748/head
Sebastian 4 years ago
parent
commit
8bc8a11245
  1. 29
      backend/extensions/Squidex.Extensions/Actions/Algolia/AlgoliaActionHandler.cs
  2. 2
      frontend/app/features/rules/pages/events/rule-events-page.component.html
  3. 18275
      frontend/package-lock.json

29
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 delete = @event.ShouldDelete(scriptEngine, action.Delete);
var contentId = entityEvent.Id.ToString();
var ruleDescription = string.Empty; var ruleDescription = string.Empty;
var ruleJob = new AlgoliaJob var contentId = entityEvent.Id.ToString();
{ var content = (JObject?)null;
AppId = action.AppId,
ApiKey = action.ApiKey,
ContentId = contentId,
IndexName = await FormatAsync(action.IndexName, @event)
};
if (delete) if (delete)
{ {
@ -62,7 +55,6 @@ namespace Squidex.Extensions.Actions.Algolia
{ {
ruleDescription = $"Add entry to Algolia index: {action.IndexName}"; ruleDescription = $"Add entry to Algolia index: {action.IndexName}";
JObject json;
try try
{ {
string jsonString; string jsonString;
@ -77,18 +69,25 @@ namespace Squidex.Extensions.Actions.Algolia
jsonString = ToJson(@event); jsonString = ToJson(@event);
} }
json = JObject.Parse(jsonString); content = JObject.Parse(jsonString);
} }
catch (Exception ex) 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; content["objectID"] = contentId;
ruleJob.Content = json;
} }
var ruleJob = new AlgoliaJob
{
AppId = action.AppId,
ApiKey = action.ApiKey,
Content = content,
ContentId = contentId,
IndexName = await FormatAsync(action.IndexName, @event)
};
return (ruleDescription, ruleJob); return (ruleDescription, ruleJob);
} }

2
frontend/app/features/rules/pages/events/rule-events-page.component.html

@ -1,6 +1,6 @@
<sqx-title message="i18n:rules.ruleEvents.listPageTitle"></sqx-title> <sqx-title message="i18n:rules.ruleEvents.listPageTitle"></sqx-title>
<sqx-layout titleText="i18n:common.events" titleIcon="events" [width]="50"> <sqx-layout layout="main" titleText="i18n:common.events" titleIcon="events" [width]="50">
<ng-container menu> <ng-container menu>
<button type="button" class="btn btn-text-secondary" (click)="reload()" title="i18n:rules.refreshEventsTooltip" shortcut="CTRL + B"> <button type="button" class="btn btn-text-secondary" (click)="reload()" title="i18n:rules.refreshEventsTooltip" shortcut="CTRL + B">
<i class="icon-reset"></i> {{ 'common.refresh' | sqxTranslate }} <i class="icon-reset"></i> {{ 'common.refresh' | sqxTranslate }}

18275
frontend/package-lock.json

File diff suppressed because it is too large
Loading…
Cancel
Save