From 5d47fd64a5361db45200318ec7614aff22210f9c Mon Sep 17 00:00:00 2001 From: Sebastian Stehle Date: Sun, 2 Sep 2018 22:33:19 +0200 Subject: [PATCH] Almost finished refactoring. --- .../Actions/Algolia/AlgoliaAction.cs | 8 +- .../Actions/AzureQueue/AzureQueueAction.cs | 8 +- .../Actions/Discourse/DiscourseAction.cs | 8 +- .../ElasticSearch/ElasticSearchAction.cs | 8 +- .../Actions/Fastly/FastlyAction.cs | 8 +- .../Actions/Medium/MediumAction.cs | 8 +- .../Actions/Medium/MediumActionHandler.cs | 1 - .../Actions/RuleActionAttribute.cs | 6 +- .../Squidex.Extensions/Actions/RuleElement.cs | 18 +- .../Actions/RuleElementRegistry.cs | 38 +- .../Actions/Slack/SlackAction.cs | 8 +- .../Actions/Twitter/TweetAction.cs | 8 +- .../Actions/WebhookAction/WebhookAction.cs | 6 +- .../Rules/Models/RuleElementDto.cs | 12 +- .../Api/Controllers/Rules/RulesController.cs | 15 +- .../app/features/rules/declarations.ts | 1 + src/Squidex/app/features/rules/module.ts | 2 + .../pages/rules/rule-action.component.ts | 18 +- .../pages/rules/rule-element.component.html | 30 + .../pages/rules/rule-element.component.scss | 76 + .../pages/rules/rule-element.component.ts | 27 + .../pages/rules/rule-wizard.component.html | 24 +- .../pages/rules/rule-wizard.component.scss | 14 +- .../pages/rules/rules-page.component.html | 18 +- .../rules/pages/rules/rules-page.component.ts | 1 - .../asset-changed-trigger.component.html | 2 +- .../content-changed-trigger.component.html | 2 +- .../content-changed-trigger.component.scss | 4 + .../angular/hover-background.directive.ts | 36 + .../modals/modal-dialog.component.html | 4 +- .../angular/modals/modal-dialog.component.ts | 14 +- .../angular/pipes/colors.pipes.spec.ts | 64 + .../framework/angular/pipes/colors.pipes.ts | 164 ++ .../app/framework/angular/safe-html.pipe.ts | 24 + src/Squidex/app/framework/declarations.ts | 3 + src/Squidex/app/framework/module.ts | 12 + .../app/shared/services/rules.service.spec.ts | 75 + .../app/shared/services/rules.service.ts | 20 +- src/Squidex/app/theme/_mixins.scss | 6 +- src/Squidex/app/theme/_rules.scss | 98 -- .../app/theme/icomoon/demo-files/demo.css | 4 +- src/Squidex/app/theme/icomoon/demo.html | 1014 +++++++----- .../app/theme/icomoon/fonts/icomoon.eot | Bin 26096 -> 24676 bytes .../app/theme/icomoon/fonts/icomoon.svg | 12 +- .../app/theme/icomoon/fonts/icomoon.ttf | Bin 25932 -> 24512 bytes .../app/theme/icomoon/fonts/icomoon.woff | Bin 26008 -> 24588 bytes src/Squidex/app/theme/icomoon/selection.json | 1428 ++++++++--------- src/Squidex/app/theme/icomoon/style.css | 223 +-- src/Squidex/app/theme/theme.scss | 1 - .../Rules/Guards/GuardRuleTests.cs | 1 - .../Rules/RuleEnqueuerTests.cs | 1 - .../Rules/RuleGrainTests.cs | 1 - 52 files changed, 2033 insertions(+), 1551 deletions(-) create mode 100644 src/Squidex/app/features/rules/pages/rules/rule-element.component.html create mode 100644 src/Squidex/app/features/rules/pages/rules/rule-element.component.scss create mode 100644 src/Squidex/app/features/rules/pages/rules/rule-element.component.ts create mode 100644 src/Squidex/app/framework/angular/hover-background.directive.ts create mode 100644 src/Squidex/app/framework/angular/pipes/colors.pipes.spec.ts create mode 100644 src/Squidex/app/framework/angular/pipes/colors.pipes.ts create mode 100644 src/Squidex/app/framework/angular/safe-html.pipe.ts delete mode 100644 src/Squidex/app/theme/_rules.scss diff --git a/extensions/Squidex.Extensions/Actions/Algolia/AlgoliaAction.cs b/extensions/Squidex.Extensions/Actions/Algolia/AlgoliaAction.cs index a0fdf20e8..baff5dc43 100644 --- a/extensions/Squidex.Extensions/Actions/Algolia/AlgoliaAction.cs +++ b/extensions/Squidex.Extensions/Actions/Algolia/AlgoliaAction.cs @@ -6,15 +6,17 @@ // ========================================================================== using System.ComponentModel.DataAnnotations; -using Squidex.Domain.Apps.Core.HandleRules; using Squidex.Domain.Apps.Core.Rules; namespace Squidex.Extensions.Actions.Algolia { [RuleActionHandler(typeof(AlgoliaActionHandler))] - [RuleAction(Link = "https://www.algolia.com/", + [RuleAction( + IconImage = "", + IconColor = "#0d9bf9", Display = "Populate Algolia index", - Description = "Populate and synchronize indices in Algolia for full text search.")] + Description = "Populate and synchronize indices in Algolia for full text search.", + ReadMore = "https://www.algolia.com/")] public sealed class AlgoliaAction : RuleAction { [Required] diff --git a/extensions/Squidex.Extensions/Actions/AzureQueue/AzureQueueAction.cs b/extensions/Squidex.Extensions/Actions/AzureQueue/AzureQueueAction.cs index 9c96cc463..0ee5de663 100644 --- a/extensions/Squidex.Extensions/Actions/AzureQueue/AzureQueueAction.cs +++ b/extensions/Squidex.Extensions/Actions/AzureQueue/AzureQueueAction.cs @@ -8,16 +8,18 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Text.RegularExpressions; -using Squidex.Domain.Apps.Core.HandleRules; using Squidex.Domain.Apps.Core.Rules; using Squidex.Infrastructure; namespace Squidex.Extensions.Actions.AzureQueue { [RuleActionHandler(typeof(AzureQueueActionHandler))] - [RuleAction(Link = "https://azure.microsoft.com/en-us/services/storage/queues/", + [RuleAction( + IconImage = "", + IconColor = "#0d9bf9", Display = "Send to Azure Queue", - Description = "Send an event to azure queue storage.")] + Description = "Send an event to azure queue storage.", + ReadMore = "https://azure.microsoft.com/en-us/services/storage/queues/")] public sealed class AzureQueueAction : RuleAction { [Required] diff --git a/extensions/Squidex.Extensions/Actions/Discourse/DiscourseAction.cs b/extensions/Squidex.Extensions/Actions/Discourse/DiscourseAction.cs index 5fae2dd0d..b082130e4 100644 --- a/extensions/Squidex.Extensions/Actions/Discourse/DiscourseAction.cs +++ b/extensions/Squidex.Extensions/Actions/Discourse/DiscourseAction.cs @@ -7,14 +7,18 @@ using System; using System.ComponentModel.DataAnnotations; -using Squidex.Domain.Apps.Core.HandleRules; using Squidex.Domain.Apps.Core.Rules; using Squidex.Infrastructure; namespace Squidex.Extensions.Actions.Discourse { [RuleActionHandler(typeof(DiscourseActionHandler))] - [RuleAction(Description = "")] + [RuleAction( + IconImage = "", + IconColor = "#eB6121", + Display = "Post to discourse", + Description = "Create a post or topic at discourse.", + ReadMore = "https://www.discourse.org/")] public sealed class DiscourseAction : RuleAction { [AbsoluteUrl] diff --git a/extensions/Squidex.Extensions/Actions/ElasticSearch/ElasticSearchAction.cs b/extensions/Squidex.Extensions/Actions/ElasticSearch/ElasticSearchAction.cs index 83b839338..620f9ef6e 100644 --- a/extensions/Squidex.Extensions/Actions/ElasticSearch/ElasticSearchAction.cs +++ b/extensions/Squidex.Extensions/Actions/ElasticSearch/ElasticSearchAction.cs @@ -7,16 +7,18 @@ using System; using System.ComponentModel.DataAnnotations; -using Squidex.Domain.Apps.Core.HandleRules; using Squidex.Domain.Apps.Core.Rules; using Squidex.Infrastructure; namespace Squidex.Extensions.Actions.ElasticSearch { [RuleActionHandler(typeof(ElasticSearchActionHandler))] - [RuleAction(Link = "https://www.elastic.co/", + [RuleAction( + IconImage = "", + IconColor = "#1e5470", Display = "Populate ElasticSearch index", - Description = "Populate and synchronize indices in ElasticSearch for full text search.")] + Description = "Populate and synchronize indices in ElasticSearch for full text search.", + ReadMore = "https://www.elastic.co/")] public sealed class ElasticSearchAction : RuleAction { [AbsoluteUrl] diff --git a/extensions/Squidex.Extensions/Actions/Fastly/FastlyAction.cs b/extensions/Squidex.Extensions/Actions/Fastly/FastlyAction.cs index 55929893e..928dab189 100644 --- a/extensions/Squidex.Extensions/Actions/Fastly/FastlyAction.cs +++ b/extensions/Squidex.Extensions/Actions/Fastly/FastlyAction.cs @@ -6,15 +6,17 @@ // ========================================================================== using System.ComponentModel.DataAnnotations; -using Squidex.Domain.Apps.Core.HandleRules; using Squidex.Domain.Apps.Core.Rules; namespace Squidex.Extensions.Actions.Fastly { [RuleActionHandler(typeof(FastlyActionHandler))] - [RuleAction(Link = "https://www.fastly.com/", + [RuleAction( + IconImage = "", + IconColor = "#e23335", Display = "Purge fastly cache", - Description = "Remove entries from the fastly CDN cache.")] + Description = "Remove entries from the fastly CDN cache.", + ReadMore = "https://www.fastly.com/")] public sealed class FastlyAction : RuleAction { [Required] diff --git a/extensions/Squidex.Extensions/Actions/Medium/MediumAction.cs b/extensions/Squidex.Extensions/Actions/Medium/MediumAction.cs index 2ea91cd0e..6ee4048bb 100644 --- a/extensions/Squidex.Extensions/Actions/Medium/MediumAction.cs +++ b/extensions/Squidex.Extensions/Actions/Medium/MediumAction.cs @@ -6,15 +6,17 @@ // ========================================================================== using System.ComponentModel.DataAnnotations; -using Squidex.Domain.Apps.Core.HandleRules; using Squidex.Domain.Apps.Core.Rules; namespace Squidex.Extensions.Actions.Medium { [RuleActionHandler(typeof(MediumActionHandler))] - [RuleAction(Link = "https://medium.com/", + [RuleAction( + IconImage = "", + IconColor = "#00ab6c", Display = "Post to Medium", - Description = "Create a new story or post at medium.")] + Description = "Create a new story or post at medium.", + ReadMore = "https://medium.com/")] public sealed class MediumAction : RuleAction { [Required] diff --git a/extensions/Squidex.Extensions/Actions/Medium/MediumActionHandler.cs b/extensions/Squidex.Extensions/Actions/Medium/MediumActionHandler.cs index d45284d42..a397ed05c 100644 --- a/extensions/Squidex.Extensions/Actions/Medium/MediumActionHandler.cs +++ b/extensions/Squidex.Extensions/Actions/Medium/MediumActionHandler.cs @@ -14,7 +14,6 @@ using Newtonsoft.Json.Linq; using Squidex.Domain.Apps.Core.HandleRules; using Squidex.Domain.Apps.Core.HandleRules.Actions.Utils; using Squidex.Domain.Apps.Core.HandleRules.EnrichedEvents; -using Squidex.Infrastructure; using Squidex.Infrastructure.Http; #pragma warning disable SA1649 // File name must match first type name diff --git a/extensions/Squidex.Extensions/Actions/RuleActionAttribute.cs b/extensions/Squidex.Extensions/Actions/RuleActionAttribute.cs index 4c9fb707e..f26896b7b 100644 --- a/extensions/Squidex.Extensions/Actions/RuleActionAttribute.cs +++ b/extensions/Squidex.Extensions/Actions/RuleActionAttribute.cs @@ -12,7 +12,11 @@ namespace Squidex.Extensions.Actions [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] public sealed class RuleActionAttribute : Attribute { - public string Link { get; set; } + public string ReadMore { get; set; } + + public string IconImage { get; set; } + + public string IconColor { get; set; } public string Display { get; set; } diff --git a/extensions/Squidex.Extensions/Actions/RuleElement.cs b/extensions/Squidex.Extensions/Actions/RuleElement.cs index cbd19ee02..6d7244c01 100644 --- a/extensions/Squidex.Extensions/Actions/RuleElement.cs +++ b/extensions/Squidex.Extensions/Actions/RuleElement.cs @@ -11,22 +11,16 @@ namespace Squidex.Extensions.Actions { public sealed class RuleElement { - public Type Type { get; } + public Type Type { get; set; } - public string Link { get; set; } + public string ReadMore { get; set; } - public string Display { get; } + public string IconImage { get; set; } - public string Description { get; } + public string IconColor { get; set; } - public RuleElement(Type type, string color, string display, string description, string link = null) - { - Type = type; + public string Display { get; set; } - Display = display; - Description = description; - - Link = link; - } + public string Description { get; set; } } } diff --git a/extensions/Squidex.Extensions/Actions/RuleElementRegistry.cs b/extensions/Squidex.Extensions/Actions/RuleElementRegistry.cs index 603d4b231..1353cf09e 100644 --- a/extensions/Squidex.Extensions/Actions/RuleElementRegistry.cs +++ b/extensions/Squidex.Extensions/Actions/RuleElementRegistry.cs @@ -9,9 +9,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Reflection; -using Squidex.Domain.Apps.Core.HandleRules; using Squidex.Domain.Apps.Core.Rules; -using Squidex.Domain.Apps.Core.Rules.Triggers; using Squidex.Infrastructure; namespace Squidex.Extensions.Actions @@ -21,6 +19,29 @@ namespace Squidex.Extensions.Actions private const string Suffix = "Action"; private static readonly HashSet ActionHandlerTypes = new HashSet(); private static readonly Dictionary ActionTypes = new Dictionary(); + private static readonly Dictionary TriggerTypes = new Dictionary + { + ["ContentChanged"] = new RuleElement + { + IconImage = "", + IconColor = "#3389ff", + Display = "Content changed", + Description = "Content changed like created, updated, published, unpublished..." + }, + + ["AssetChanged"] = new RuleElement + { + IconImage = "", + IconColor = "#3389ff", + Display = "Asset changed", + Description = "Asset changed like created, updated, renamed..." + } + }; + + public static IReadOnlyDictionary Triggers + { + get { return TriggerTypes; } + } public static IReadOnlyDictionary Actions { @@ -54,10 +75,15 @@ namespace Squidex.Extensions.Actions var metadata = actionType.GetCustomAttribute(); ActionTypes[name] = - new RuleElement(actionType, - metadata.Display, - metadata.Description, - metadata.Link); + new RuleElement + { + Type = actionType, + Display = metadata.Display, + Description = metadata.Description, + IconColor = metadata.IconColor, + IconImage = metadata.IconImage, + ReadMore = metadata.ReadMore + }; ActionHandlerTypes.Add(actionType.GetCustomAttribute().HandlerType); } diff --git a/extensions/Squidex.Extensions/Actions/Slack/SlackAction.cs b/extensions/Squidex.Extensions/Actions/Slack/SlackAction.cs index 64d8765c1..792a0f3fc 100644 --- a/extensions/Squidex.Extensions/Actions/Slack/SlackAction.cs +++ b/extensions/Squidex.Extensions/Actions/Slack/SlackAction.cs @@ -7,16 +7,18 @@ using System; using System.ComponentModel.DataAnnotations; -using Squidex.Domain.Apps.Core.HandleRules; using Squidex.Domain.Apps.Core.Rules; using Squidex.Infrastructure; namespace Squidex.Extensions.Actions.Slack { [RuleActionHandler(typeof(SlackActionHandler))] - [RuleAction(Link = "https://slack.com", + [RuleAction( + IconImage = "", + IconColor = "#5c3a58", Display = "Send to Slack", - Description = "Create a status update at slack to a channel you define.")] + Description = "Create a status update at slack to a channel you define.", + ReadMore = "https://slack.com")] public sealed class SlackAction : RuleAction { [AbsoluteUrl] diff --git a/extensions/Squidex.Extensions/Actions/Twitter/TweetAction.cs b/extensions/Squidex.Extensions/Actions/Twitter/TweetAction.cs index 15b45240e..a16f98c6f 100644 --- a/extensions/Squidex.Extensions/Actions/Twitter/TweetAction.cs +++ b/extensions/Squidex.Extensions/Actions/Twitter/TweetAction.cs @@ -6,15 +6,17 @@ // ========================================================================== using System.ComponentModel.DataAnnotations; -using Squidex.Domain.Apps.Core.HandleRules; using Squidex.Domain.Apps.Core.Rules; namespace Squidex.Extensions.Actions.Twitter { [RuleActionHandler(typeof(TweetActionHandler))] - [RuleAction(Link = "https://twitter.com", + [RuleAction( + IconImage = "", + IconColor = "#1da1f2", Display = "Tweet", - Description = "Create a status update at Tweet to a your user account.")] + Description = "Create a status update at Tweet to a your user account.", + ReadMore = "https://twitter.com")] public sealed class TweetAction : RuleAction { [Required] diff --git a/extensions/Squidex.Extensions/Actions/WebhookAction/WebhookAction.cs b/extensions/Squidex.Extensions/Actions/WebhookAction/WebhookAction.cs index 2440ac43d..6830ec923 100644 --- a/extensions/Squidex.Extensions/Actions/WebhookAction/WebhookAction.cs +++ b/extensions/Squidex.Extensions/Actions/WebhookAction/WebhookAction.cs @@ -7,7 +7,6 @@ using System; using System.ComponentModel.DataAnnotations; -using Squidex.Domain.Apps.Core.HandleRules; using Squidex.Domain.Apps.Core.Rules; using Squidex.Infrastructure; @@ -15,8 +14,11 @@ namespace Squidex.Extensions.Actions.Webhook { [RuleActionHandler(typeof(WebhookActionHandler))] [RuleAction( + IconImage = "", + IconColor = "#4bb958", Display = "Send Webhook", - Description = "Send events like ContentPublished to your webhook.")] + Description = "Send events like ContentPublished to your webhook.", + ReadMore = "https://en.wikipedia.org/wiki/Webhook")] public sealed class WebhookAction : RuleAction { [AbsoluteUrl] diff --git a/src/Squidex/Areas/Api/Controllers/Rules/Models/RuleElementDto.cs b/src/Squidex/Areas/Api/Controllers/Rules/Models/RuleElementDto.cs index 92861b8c8..e419be526 100644 --- a/src/Squidex/Areas/Api/Controllers/Rules/Models/RuleElementDto.cs +++ b/src/Squidex/Areas/Api/Controllers/Rules/Models/RuleElementDto.cs @@ -23,9 +23,19 @@ namespace Squidex.Areas.Api.Controllers.Rules.Models [Required] public string Display { get; set; } + /// + /// The color for the icon. + /// + public string IconColor { get; set; } + + /// + /// The image for the icon. + /// + public string IconImage { get; set; } + /// /// The optional link to the product that is integrated. /// - public string Link { get; set; } + public string ReadMore { get; set; } } } diff --git a/src/Squidex/Areas/Api/Controllers/Rules/RulesController.cs b/src/Squidex/Areas/Api/Controllers/Rules/RulesController.cs index c6de4d60f..1170416ce 100644 --- a/src/Squidex/Areas/Api/Controllers/Rules/RulesController.cs +++ b/src/Squidex/Areas/Api/Controllers/Rules/RulesController.cs @@ -74,20 +74,7 @@ namespace Squidex.Areas.Api.Controllers.Rules [ApiCosts(0)] public IActionResult GetTriggers() { - var response = new Dictionary - { - ["ContentChanged"] = new RuleElementDto - { - Display = "Content changed", - Description = "Content changed like created, updated, published, unpublished..." - }, - - ["AssetChanged"] = new RuleElementDto - { - Display = "Asset changed", - Description = "Asset changed like created, updated, renamed..." - } - }; + var response = RuleElementRegistry.Triggers.ToDictionary(x => x.Key, x => SimpleMapper.Map(x.Value, new RuleElementDto())); return Ok(response); } diff --git a/src/Squidex/app/features/rules/declarations.ts b/src/Squidex/app/features/rules/declarations.ts index 7b850d55c..5231919ce 100644 --- a/src/Squidex/app/features/rules/declarations.ts +++ b/src/Squidex/app/features/rules/declarations.ts @@ -9,6 +9,7 @@ export * from './pages/rules/triggers/asset-changed-trigger.component'; export * from './pages/rules/triggers/content-changed-trigger.component'; export * from './pages/rules/rule-action.component'; +export * from './pages/rules/rule-element.component'; export * from './pages/rules/rule-wizard.component'; export * from './pages/rules/rules-page.component'; diff --git a/src/Squidex/app/features/rules/module.ts b/src/Squidex/app/features/rules/module.ts index 893583f9f..8bd1d4cfa 100644 --- a/src/Squidex/app/features/rules/module.ts +++ b/src/Squidex/app/features/rules/module.ts @@ -22,6 +22,7 @@ import { AssetChangedTriggerComponent, ContentChangedTriggerComponent, RuleActionComponent, + RuleElementComponent, RuleEventBadgeClassPipe, RuleEventsPageComponent, RulesPageComponent, @@ -62,6 +63,7 @@ const routes: Routes = [ AssetChangedTriggerComponent, ContentChangedTriggerComponent, RuleActionComponent, + RuleElementComponent, RuleEventBadgeClassPipe, RuleEventsPageComponent, RulesPageComponent, diff --git a/src/Squidex/app/features/rules/pages/rules/rule-action.component.ts b/src/Squidex/app/features/rules/pages/rules/rule-action.component.ts index 52527c125..2d30375f6 100644 --- a/src/Squidex/app/features/rules/pages/rules/rule-action.component.ts +++ b/src/Squidex/app/features/rules/pages/rules/rule-action.component.ts @@ -39,11 +39,7 @@ export class RuleActionComponent implements OnChanges, OnInit { } public ngOnChanges() { - if (this.component) { - this.component.instance.action = this.action; - this.component.instance.actionForm = this.actionForm; - this.component.instance.actionFormSubmitted = this.actionFormSubmitted; - } + this.updateInnerValues(); } public ngOnInit() { @@ -52,8 +48,14 @@ export class RuleActionComponent implements OnChanges, OnInit { this.component = this.viewContainer.createComponent(factory); - this.component.instance.action = this.action; - this.component.instance.actionForm = this.actionForm; - this.component.instance.actionFormSubmitted = this.actionFormSubmitted; + this.updateInnerValues(); + } + + private updateInnerValues() { + if (this.component) { + this.component.instance.action = this.action; + this.component.instance.actionForm = this.actionForm; + this.component.instance.actionFormSubmitted = this.actionFormSubmitted; + } } } \ No newline at end of file diff --git a/src/Squidex/app/features/rules/pages/rules/rule-element.component.html b/src/Squidex/app/features/rules/pages/rules/rule-element.component.html new file mode 100644 index 000000000..28fb2b0c1 --- /dev/null +++ b/src/Squidex/app/features/rules/pages/rules/rule-element.component.html @@ -0,0 +1,30 @@ + +
+ + + + + {{element.display}} + +
+
+ +
+
+
+
+
+
+
+
{{type}}
+ +
+ {{element.description}} +
+ + +
+
+
\ No newline at end of file diff --git a/src/Squidex/app/features/rules/pages/rules/rule-element.component.scss b/src/Squidex/app/features/rules/pages/rules/rule-element.component.scss new file mode 100644 index 000000000..2b61ad9ce --- /dev/null +++ b/src/Squidex/app/features/rules/pages/rules/rule-element.component.scss @@ -0,0 +1,76 @@ +@import '_vars'; +@import '_mixins'; + +.rule-element { + &-small { + & { + @include truncate; + @include transition(background-color .4s ease); + color: $color-dark-foreground; + cursor: pointer; + line-height: 2.8rem; + font-size: 1rem; + font-weight: normal; + padding-right: .8rem; + } + + &-icon { + height: 3rem; + display: inline-block; + line-height: 3rem; + font-size: 1.2rem; + font-weight: normal; + margin: 0; + margin-right: .5rem; + padding: 0 .8rem; + } + + .svg-icon { + display: inline-block; + min-width: 20px; + max-width: 20px; + min-height: 20px; + max-height: 20px; + fill: $color-dark-foreground; + } + } + + &-large { + & { + cursor: pointer; + min-height: 100px; + max-height: 100px; + } + + &-title { + font-weight: bold; + } + + &-link { + font-size: .8rem; + } + + &-text { + font-size: .8rem; + margin-top: .25rem; + margin-bottom: .25rem; + } + + &-icon { + display: inline-block; + margin-right: .5rem; + position: relative; + padding: 1rem; + line-height: 1px; + } + + .svg-icon { + display: inline-block; + min-width: 30px; + max-width: 30px; + min-height: 30px; + max-height: 30px; + fill: $color-dark-foreground; + } + } +} \ No newline at end of file diff --git a/src/Squidex/app/features/rules/pages/rules/rule-element.component.ts b/src/Squidex/app/features/rules/pages/rules/rule-element.component.ts new file mode 100644 index 000000000..a00d5ec0d --- /dev/null +++ b/src/Squidex/app/features/rules/pages/rules/rule-element.component.ts @@ -0,0 +1,27 @@ +/* + * Squidex Headless CMS + * + * @license + * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. + */ + +import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; + +import { RuleElementDto } from '@app/shared'; + +@Component({ + selector: 'sqx-rule-element', + styleUrls: ['./rule-element.component.scss'], + templateUrl: './rule-element.component.html', + changeDetection: ChangeDetectionStrategy.OnPush +}) +export class RuleElementComponent { + @Input() + public type: string; + + @Input() + public element: RuleElementDto; + + @Input() + public isSmall = true; +} \ No newline at end of file diff --git a/src/Squidex/app/features/rules/pages/rules/rule-wizard.component.html b/src/Squidex/app/features/rules/pages/rules/rule-wizard.component.html index 3cc020e90..bffb1a759 100644 --- a/src/Squidex/app/features/rules/pages/rules/rule-wizard.component.html +++ b/src/Squidex/app/features/rules/pages/rules/rule-wizard.component.html @@ -1,4 +1,4 @@ - + Edit Trigger @@ -22,14 +22,9 @@
-
-
- - - - - {{ruleTriggers[trigger].name}} - +
+
+
@@ -57,14 +52,9 @@
-
-
- - - - - {{ruleActions[action].name}} - +
+
+
diff --git a/src/Squidex/app/features/rules/pages/rules/rule-wizard.component.scss b/src/Squidex/app/features/rules/pages/rules/rule-wizard.component.scss index cdc25145f..2514319f5 100644 --- a/src/Squidex/app/features/rules/pages/rules/rule-wizard.component.scss +++ b/src/Squidex/app/features/rules/pages/rules/rule-wizard.component.scss @@ -3,4 +3,16 @@ .rule-element { margin: .25rem; -} \ No newline at end of file +} + +:host /deep/ { + .wizard-title { + background: $color-border; + margin: -1rem; + margin-bottom: 1rem; + font-weight: 400; + font-size: 1.05rem; + padding: 1rem; + } +} + diff --git a/src/Squidex/app/features/rules/pages/rules/rules-page.component.html b/src/Squidex/app/features/rules/pages/rules/rules-page.component.html index c873338e7..8a65830fb 100644 --- a/src/Squidex/app/features/rules/pages/rules/rules-page.component.html +++ b/src/Squidex/app/features/rules/pages/rules/rules-page.component.html @@ -36,26 +36,16 @@

If

- - - - - - {{ruleTriggers[rule.triggerType].display}} - + +

then

- - - - - - {{ruleActions[rule.actionType].display}} - + + diff --git a/src/Squidex/app/features/rules/pages/rules/rules-page.component.ts b/src/Squidex/app/features/rules/pages/rules/rules-page.component.ts index d2798e192..849f26c94 100644 --- a/src/Squidex/app/features/rules/pages/rules/rules-page.component.ts +++ b/src/Squidex/app/features/rules/pages/rules/rules-page.component.ts @@ -41,7 +41,6 @@ export class RulesPageComponent implements OnInit { } public ngOnInit() { - this.rulesState.load().pipe(onErrorResumeNext()).subscribe(); this.rulesService.getActions() diff --git a/src/Squidex/app/features/rules/pages/rules/triggers/asset-changed-trigger.component.html b/src/Squidex/app/features/rules/pages/rules/triggers/asset-changed-trigger.component.html index fb6b031a1..4b3a709d8 100644 --- a/src/Squidex/app/features/rules/pages/rules/triggers/asset-changed-trigger.component.html +++ b/src/Squidex/app/features/rules/pages/rules/triggers/asset-changed-trigger.component.html @@ -1,4 +1,4 @@ -

Trigger rule when asset has been...

+

Trigger rule when events happen for assets...

diff --git a/src/Squidex/app/features/rules/pages/rules/triggers/content-changed-trigger.component.html b/src/Squidex/app/features/rules/pages/rules/triggers/content-changed-trigger.component.html index cbd5fe4d6..248c620d8 100644 --- a/src/Squidex/app/features/rules/pages/rules/triggers/content-changed-trigger.component.html +++ b/src/Squidex/app/features/rules/pages/rules/triggers/content-changed-trigger.component.html @@ -1,4 +1,4 @@ -

Trigger rule when an events for a schemas happens

+

Trigger rule when events happen for schemas...

diff --git a/src/Squidex/app/features/rules/pages/rules/triggers/content-changed-trigger.component.scss b/src/Squidex/app/features/rules/pages/rules/triggers/content-changed-trigger.component.scss index 5fa7102bd..62d9b45b4 100644 --- a/src/Squidex/app/features/rules/pages/rules/triggers/content-changed-trigger.component.scss +++ b/src/Squidex/app/features/rules/pages/rules/triggers/content-changed-trigger.component.scss @@ -7,6 +7,10 @@ padding-bottom: 0; } +.table { + margin-top: 3.5rem; +} + .form-check { margin-top: 1rem; } diff --git a/src/Squidex/app/framework/angular/hover-background.directive.ts b/src/Squidex/app/framework/angular/hover-background.directive.ts new file mode 100644 index 000000000..dae87605e --- /dev/null +++ b/src/Squidex/app/framework/angular/hover-background.directive.ts @@ -0,0 +1,36 @@ +/* + * Squidex Headless CMS + * + * @license + * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. + */ + +import { Directive, ElementRef, HostListener, Input, Renderer2 } from '@angular/core'; + +@Directive({ + selector: '[sqxHoverBackground]' +}) +export class HoverBackgroundDirective { + private previousBackground: string | null; + + @Input('sqxHoverBackground') + public background: string; + + constructor( + private readonly element: ElementRef, + private readonly renderer: Renderer2 + ) { + } + + @HostListener('mouseenter') + public onEnter() { + this.previousBackground = (this.element.nativeElement).style.background; + + this.renderer.setStyle(this.element.nativeElement, 'background', this.background); + } + + @HostListener('mouseleave') + public onLEave() { + this.renderer.setStyle(this.element.nativeElement, 'background', this.previousBackground); + } +} \ No newline at end of file diff --git a/src/Squidex/app/framework/angular/modals/modal-dialog.component.html b/src/Squidex/app/framework/angular/modals/modal-dialog.component.html index 040beb332..29d288597 100644 --- a/src/Squidex/app/framework/angular/modals/modal-dialog.component.html +++ b/src/Squidex/app/framework/angular/modals/modal-dialog.component.html @@ -13,7 +13,7 @@ - -