mirror of https://github.com/Squidex/squidex.git
57 changed files with 519 additions and 1374 deletions
@ -0,0 +1,24 @@ |
|||
// ==========================================================================
|
|||
// Squidex Headless CMS
|
|||
// ==========================================================================
|
|||
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|||
// All rights reserved. Licensed under the MIT license.
|
|||
// ==========================================================================
|
|||
|
|||
namespace Squidex.Domain.Apps.Core.HandleRules |
|||
{ |
|||
public sealed class RuleActionProperty |
|||
{ |
|||
public RuleActionPropertyEditor Editor { get; set; } |
|||
|
|||
public string Name { get; set; } |
|||
|
|||
public string Display { get; set; } |
|||
|
|||
public string Description { get; set; } |
|||
|
|||
public bool IsFormattable { get; set; } |
|||
|
|||
public bool IsRequired { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,20 @@ |
|||
// ==========================================================================
|
|||
// Squidex Headless CMS
|
|||
// ==========================================================================
|
|||
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|||
// All rights reserved. Licensed under the MIT license.
|
|||
// ==========================================================================
|
|||
|
|||
namespace Squidex.Domain.Apps.Core.HandleRules |
|||
{ |
|||
public enum RuleActionPropertyEditor |
|||
{ |
|||
Checkbox, |
|||
Email, |
|||
Number, |
|||
Password, |
|||
Text, |
|||
TextArea, |
|||
Url |
|||
} |
|||
} |
|||
@ -0,0 +1,48 @@ |
|||
// ==========================================================================
|
|||
// Squidex Headless CMS
|
|||
// ==========================================================================
|
|||
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|||
// All rights reserved. Licensed under the MIT license.
|
|||
// ==========================================================================
|
|||
|
|||
using System.ComponentModel.DataAnnotations; |
|||
using Squidex.Domain.Apps.Core.HandleRules; |
|||
|
|||
namespace Squidex.Areas.Api.Controllers.Rules.Models |
|||
{ |
|||
public sealed class RuleElementPropertyDto |
|||
{ |
|||
/// <summary>
|
|||
/// The html editor.
|
|||
/// </summary>
|
|||
[Required] |
|||
public RuleActionPropertyEditor Editor { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// The name of the editor.
|
|||
/// </summary>
|
|||
[Required] |
|||
public string Name { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// The label to use.
|
|||
/// </summary>
|
|||
[Required] |
|||
public string Display { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// The optional description.
|
|||
/// </summary>
|
|||
public string Description { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// Indicates if the property is formattable.
|
|||
/// </summary>
|
|||
public bool IsFormattable { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// Indicates if the property is required.
|
|||
/// </summary>
|
|||
public bool IsRequired { get; set; } |
|||
} |
|||
} |
|||
@ -1,43 +0,0 @@ |
|||
<div [formGroup]="actionForm" class="form-horizontal"> |
|||
<div class="form-group row"> |
|||
<label class="col-3 col-form-label" for="appId">App ID</label> |
|||
|
|||
<div class="col-9"> |
|||
<sqx-control-errors for="appId" [submitted]="actionFormSubmitted"></sqx-control-errors> |
|||
|
|||
<input type="text" class="form-control" id="appId" formControlName="appId" /> |
|||
|
|||
<small class="form-text text-muted"> |
|||
The ID to you algolia application. |
|||
</small> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="form-group row"> |
|||
<label class="col-3 col-form-label" for="apiKey">Api Key</label> |
|||
|
|||
<div class="col-9"> |
|||
<sqx-control-errors for="apiKey" [submitted]="actionFormSubmitted"></sqx-control-errors> |
|||
|
|||
<input type="text" class="form-control" id="apiKey" formControlName="apiKey" /> |
|||
|
|||
<small class="form-text text-muted"> |
|||
The API Key to access you algolia app. |
|||
</small> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="form-group row"> |
|||
<label class="col-3 col-form-label" for="indexName">Index Name</label> |
|||
|
|||
<div class="col-9"> |
|||
<sqx-control-errors for="indexName" [submitted]="actionFormSubmitted"></sqx-control-errors> |
|||
|
|||
<input type="text" class="form-control" id="indexName" formControlName="indexName" /> |
|||
|
|||
<small class="form-text text-muted"> |
|||
The name of the index. You can use advanced formatting (read help section). |
|||
</small> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
@ -1,2 +0,0 @@ |
|||
@import '_vars'; |
|||
@import '_mixins'; |
|||
@ -1,42 +0,0 @@ |
|||
/* |
|||
* Squidex Headless CMS |
|||
* |
|||
* @license |
|||
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. |
|||
*/ |
|||
|
|||
import { Component, Input, OnInit } from '@angular/core'; |
|||
import { FormControl, FormGroup, Validators } from '@angular/forms'; |
|||
|
|||
@Component({ |
|||
selector: 'sqx-algolia-action', |
|||
styleUrls: ['./algolia-action.component.scss'], |
|||
templateUrl: './algolia-action.component.html' |
|||
}) |
|||
export class AlgoliaActionComponent implements OnInit { |
|||
@Input() |
|||
public action: any; |
|||
|
|||
@Input() |
|||
public actionForm: FormGroup; |
|||
|
|||
@Input() |
|||
public actionFormSubmitted = false; |
|||
|
|||
public ngOnInit() { |
|||
this.actionForm.setControl('appId', |
|||
new FormControl(this.action.appId || '', [ |
|||
Validators.required |
|||
])); |
|||
|
|||
this.actionForm.setControl('apiKey', |
|||
new FormControl(this.action.apiKey || '', [ |
|||
Validators.required |
|||
])); |
|||
|
|||
this.actionForm.setControl('indexName', |
|||
new FormControl(this.action.indexName || '$SCHEMA_NAME', [ |
|||
Validators.required |
|||
])); |
|||
} |
|||
} |
|||
@ -1,29 +0,0 @@ |
|||
<form [formGroup]="actionForm" class="form-horizontal"> |
|||
<div class="form-group row"> |
|||
<label class="col-3 col-form-label" for="connectionString">Connection String</label> |
|||
|
|||
<div class="col-9"> |
|||
<sqx-control-errors for="connectionString" [submitted]="actionFormSubmitted"></sqx-control-errors> |
|||
|
|||
<input type="text" class="form-control" id="connectionString" formControlName="connectionString" /> |
|||
|
|||
<small class="form-text text-muted"> |
|||
The connection string to the storage account. |
|||
</small> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="form-group row"> |
|||
<label class="col-3 col-form-label" for="queue">Queue Name</label> |
|||
|
|||
<div class="col-9"> |
|||
<sqx-control-errors for="queue" [submitted]="actionFormSubmitted"></sqx-control-errors> |
|||
|
|||
<input type="text" class="form-control" id="queue" formControlName="queue" /> |
|||
|
|||
<small class="form-text text-muted"> |
|||
The name of the queue. |
|||
</small> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
@ -1,2 +0,0 @@ |
|||
@import '_vars'; |
|||
@import '_mixins'; |
|||
@ -1,40 +0,0 @@ |
|||
/* |
|||
* Squidex Headless CMS |
|||
* |
|||
* @license |
|||
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. |
|||
*/ |
|||
|
|||
import { Component, Input, OnInit } from '@angular/core'; |
|||
import { FormControl, FormGroup, Validators } from '@angular/forms'; |
|||
|
|||
import { ValidatorsEx } from '@app/shared'; |
|||
|
|||
@Component({ |
|||
selector: 'sqx-azure-queue-action', |
|||
styleUrls: ['./azure-queue-action.component.scss'], |
|||
templateUrl: './azure-queue-action.component.html' |
|||
}) |
|||
export class AzureQueueActionComponent implements OnInit { |
|||
@Input() |
|||
public action: any; |
|||
|
|||
@Input() |
|||
public actionForm: FormGroup; |
|||
|
|||
@Input() |
|||
public actionFormSubmitted = false; |
|||
|
|||
public ngOnInit() { |
|||
this.actionForm.setControl('connectionString', |
|||
new FormControl(this.action.connectionString || '', [ |
|||
Validators.required |
|||
])); |
|||
|
|||
this.actionForm.setControl('queue', |
|||
new FormControl(this.action.queue || 'squidex', [ |
|||
Validators.required, |
|||
ValidatorsEx.pattern('[a-z][a-z0-9]{2,}(\-[a-z0-9]+)*', 'Name must be a valid azure queue name.') |
|||
])); |
|||
} |
|||
} |
|||
@ -1,99 +0,0 @@ |
|||
<div [formGroup]="actionForm" class="form-horizontal"> |
|||
<div class="form-group row"> |
|||
<label class="col-3 col-form-label" for="url">Url</label> |
|||
|
|||
<div class="col-9"> |
|||
<sqx-control-errors for="url" [submitted]="actionFormSubmitted"></sqx-control-errors> |
|||
|
|||
<input type="url" class="form-control" id="url" formControlName="url" /> |
|||
|
|||
<small class="form-text text-muted"> |
|||
The url to your discourse server. |
|||
</small> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="form-group row"> |
|||
<label class="col-3 col-form-label" for="apiKey">Api Key</label> |
|||
|
|||
<div class="col-9"> |
|||
<sqx-control-errors for="apiKey" [submitted]="actionFormSubmitted"></sqx-control-errors> |
|||
|
|||
<input type="text" class="form-control" id="apiKey" formControlName="apiKey" /> |
|||
|
|||
<small class="form-text text-muted"> |
|||
The api key to authenticate to your discourse server. |
|||
</small> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="form-group row"> |
|||
<label class="col-3 col-form-label" for="apiUsername">Api Username</label> |
|||
|
|||
<div class="col-9"> |
|||
<sqx-control-errors for="apiUsername" [submitted]="actionFormSubmitted"></sqx-control-errors> |
|||
|
|||
<input type="text" class="form-control" id="apiUsername" formControlName="apiUsername" /> |
|||
|
|||
<small class="form-text text-muted"> |
|||
The api username to authenticate to your discourse server. |
|||
</small> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="form-group row"> |
|||
<label class="col-3 col-form-label" for="text">Text</label> |
|||
|
|||
<div class="col-9"> |
|||
<sqx-control-errors for="text" [submitted]="actionFormSubmitted"></sqx-control-errors> |
|||
|
|||
<textarea class="form-control" id="text" formControlName="text"></textarea> |
|||
|
|||
<small class="form-text text-muted"> |
|||
The text for your topic or post. Read the <a routerLink="help">help</a> section for information about advanced formatting. |
|||
</small> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="form-group row"> |
|||
<label class="col-3 col-form-label" for="title">Title</label> |
|||
|
|||
<div class="col-9"> |
|||
<sqx-control-errors for="title" [submitted]="actionFormSubmitted"></sqx-control-errors> |
|||
|
|||
<input type="text" class="form-control" id="title" formControlName="title" /> |
|||
|
|||
<small class="form-text text-muted"> |
|||
The optional title, when you want to create a topic. Read the <a routerLink="help">help</a> section for information about advanced formatting. |
|||
</small> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="form-group row"> |
|||
<label class="col-3 col-form-label" for="topic">Topic</label> |
|||
|
|||
<div class="col-9"> |
|||
<sqx-control-errors for="topic" [submitted]="actionFormSubmitted"></sqx-control-errors> |
|||
|
|||
<input type="number" class="form-control" id="topic" formControlName="topic" /> |
|||
|
|||
<small class="form-text text-muted"> |
|||
The topic id when you want to create a post. |
|||
</small> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="form-group row"> |
|||
<label class="col-3 col-form-label" for="category">Category</label> |
|||
|
|||
<div class="col-9"> |
|||
<sqx-control-errors for="category" [submitted]="actionFormSubmitted"></sqx-control-errors> |
|||
|
|||
<input type="number" class="form-control" id="category" formControlName="category" /> |
|||
|
|||
<small class="form-text text-muted"> |
|||
The category id when you create a topic. |
|||
</small> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
@ -1,6 +0,0 @@ |
|||
@import '_vars'; |
|||
@import '_mixins'; |
|||
|
|||
textarea { |
|||
height: 150px; |
|||
} |
|||
@ -1,56 +0,0 @@ |
|||
/* |
|||
* Squidex Headless CMS |
|||
* |
|||
* @license |
|||
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. |
|||
*/ |
|||
|
|||
import { Component, Input, OnInit } from '@angular/core'; |
|||
import { FormControl, FormGroup, Validators } from '@angular/forms'; |
|||
|
|||
@Component({ |
|||
selector: 'sqx-discourse-action', |
|||
styleUrls: ['./discourse-action.component.scss'], |
|||
templateUrl: './discourse-action.component.html' |
|||
}) |
|||
export class DiscourseActionComponent implements OnInit { |
|||
@Input() |
|||
public action: any; |
|||
|
|||
@Input() |
|||
public actionForm: FormGroup; |
|||
|
|||
@Input() |
|||
public actionFormSubmitted = false; |
|||
|
|||
public ngOnInit() { |
|||
this.actionForm.setControl('url', |
|||
new FormControl(this.action.url || '', [ |
|||
Validators.required |
|||
])); |
|||
|
|||
this.actionForm.setControl('apiKey', |
|||
new FormControl(this.action.apiKey || '', [ |
|||
Validators.required |
|||
])); |
|||
|
|||
this.actionForm.setControl('apiUsername', |
|||
new FormControl(this.action.apiUsername || '', [ |
|||
Validators.required |
|||
])); |
|||
|
|||
this.actionForm.setControl('text', |
|||
new FormControl(this.action.text || '', [ |
|||
Validators.required |
|||
])); |
|||
|
|||
this.actionForm.setControl('title', |
|||
new FormControl(this.action.title)); |
|||
|
|||
this.actionForm.setControl('topic', |
|||
new FormControl(this.action.topic)); |
|||
|
|||
this.actionForm.setControl('category', |
|||
new FormControl(this.action.category)); |
|||
} |
|||
} |
|||
@ -1,71 +0,0 @@ |
|||
<div [formGroup]="actionForm" class="form-horizontal"> |
|||
<div class="form-group row"> |
|||
<label class="col-3 col-form-label" for="host">Host</label> |
|||
|
|||
<div class="col-9"> |
|||
<sqx-control-errors for="host" [submitted]="actionFormSubmitted"></sqx-control-errors> |
|||
|
|||
<input type="text" class="form-control" id="host" formControlName="host" placeholder="http://localhost:9200" /> |
|||
|
|||
<small class="form-text text-muted"> |
|||
The url to your elastic search instance. |
|||
</small> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="form-group row"> |
|||
<label class="col-3 col-form-label" for="username">Username</label> |
|||
|
|||
<div class="col-9"> |
|||
<sqx-control-errors for="username" [submitted]="actionFormSubmitted"></sqx-control-errors> |
|||
|
|||
<input type="text" class="form-control" id="username" formControlName="username" /> |
|||
|
|||
<small class="form-text text-muted"> |
|||
The username for authentication. Highly recommended. |
|||
</small> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="form-group row"> |
|||
<label class="col-3 col-form-label" for="username">Password</label> |
|||
|
|||
<div class="col-9"> |
|||
<sqx-control-errors for="password" [submitted]="actionFormSubmitted"></sqx-control-errors> |
|||
|
|||
<input type="text" class="form-control" id="password" formControlName="password" /> |
|||
|
|||
<small class="form-text text-muted"> |
|||
The password for authentication. Highly recommended. |
|||
</small> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="form-group row"> |
|||
<label class="col-3 col-form-label" for="indexName">Index Name</label> |
|||
|
|||
<div class="col-9"> |
|||
<sqx-control-errors for="indexName" [submitted]="actionFormSubmitted"></sqx-control-errors> |
|||
|
|||
<input type="text" class="form-control" id="indexName" formControlName="indexName" /> |
|||
|
|||
<small class="form-text text-muted"> |
|||
The name of the index. You can use advanced formatting (read help section). |
|||
</small> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="form-group row"> |
|||
<label class="col-3 col-form-label" for="indexType">Type Name</label> |
|||
|
|||
<div class="col-9"> |
|||
<sqx-control-errors for="indexType" [submitted]="actionFormSubmitted"></sqx-control-errors> |
|||
|
|||
<input type="text" class="form-control" id="indexType" formControlName="indexType" /> |
|||
|
|||
<small class="form-text text-muted"> |
|||
The name of the type. You can use advanced formatting (read help section). |
|||
</small> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
@ -1,2 +0,0 @@ |
|||
@import '_vars'; |
|||
@import '_mixins'; |
|||
@ -1,46 +0,0 @@ |
|||
/* |
|||
* Squidex Headless CMS |
|||
* |
|||
* @license |
|||
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. |
|||
*/ |
|||
|
|||
import { Component, Input, OnInit } from '@angular/core'; |
|||
import { FormControl, FormGroup, Validators } from '@angular/forms'; |
|||
|
|||
@Component({ |
|||
selector: 'sqx-elastic-search-action', |
|||
styleUrls: ['./elastic-search-action.component.scss'], |
|||
templateUrl: './elastic-search-action.component.html' |
|||
}) |
|||
export class ElasticSearchActionComponent implements OnInit { |
|||
@Input() |
|||
public action: any; |
|||
|
|||
@Input() |
|||
public actionForm: FormGroup; |
|||
|
|||
@Input() |
|||
public actionFormSubmitted = false; |
|||
|
|||
public ngOnInit() { |
|||
this.actionForm.setControl('host', |
|||
new FormControl(this.action.host || '', [ |
|||
Validators.required |
|||
])); |
|||
|
|||
this.actionForm.setControl('indexName', |
|||
new FormControl(this.action.indexName || '$APP_NAME', [ |
|||
Validators.required |
|||
])); |
|||
|
|||
this.actionForm.setControl('indexType', |
|||
new FormControl(this.action.indexType || '$SCHEMA_NAME')); |
|||
|
|||
this.actionForm.setControl('username', |
|||
new FormControl(this.action.username)); |
|||
|
|||
this.actionForm.setControl('password', |
|||
new FormControl(this.action.password)); |
|||
} |
|||
} |
|||
@ -1,128 +0,0 @@ |
|||
<div [formGroup]="actionForm" class="form-horizontal"> |
|||
<div class="form-group row"> |
|||
<label class="col-3 col-form-label" for="serverHost">ServerHost</label> |
|||
|
|||
<div class="col-9"> |
|||
<sqx-control-errors for="serverHost" [submitted]="actionFormSubmitted"></sqx-control-errors> |
|||
|
|||
<input type="text" class="form-control" id="serverHost" formControlName="serverHost" /> |
|||
|
|||
<small class="form-text text-muted"> |
|||
The IP address or host to the SMTP server. |
|||
</small> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="form-group row"> |
|||
<label class="col-3 col-form-label" for="serverPort">ServerPort</label> |
|||
|
|||
<div class="col-9"> |
|||
<sqx-control-errors for="serverPort" [submitted]="actionFormSubmitted"></sqx-control-errors> |
|||
|
|||
<input type="number" class="form-control" id="serverPort" formControlName="serverPort" /> |
|||
|
|||
<small class="form-text text-muted"> |
|||
The port to the SMTP server. |
|||
</small> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="form-group row"> |
|||
<div class="col-9 offset-3"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="checkbox" id="serverUseSsl" formControlName="serverUseSsl" /> |
|||
<label class="form-check-label" for="serverUseSsl"> |
|||
ServerUseSsl |
|||
</label> |
|||
</div> |
|||
<small class="form-text text-muted"> |
|||
Specify whether the SMTP client uses Secure Sockets Layer (SSL) to encrypt the connection. |
|||
</small> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="form-group row"> |
|||
<label class="col-3 col-form-label" for="serverUsername">ServerUsername</label> |
|||
|
|||
<div class="col-9"> |
|||
<sqx-control-errors for="serverUsername" [submitted]="actionFormSubmitted"></sqx-control-errors> |
|||
|
|||
<input type="text" class="form-control" id="serverUsername" formControlName="serverUsername" /> |
|||
|
|||
<small class="form-text text-muted"> |
|||
The username for the SMTP server. |
|||
</small> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="form-group row"> |
|||
<label class="col-3 col-form-label" for="serverPassword">ServerPassword</label> |
|||
|
|||
<div class="col-9"> |
|||
<sqx-control-errors for="serverPassword" [submitted]="actionFormSubmitted"></sqx-control-errors> |
|||
|
|||
<input type="password" class="form-control" id="serverPassword" formControlName="serverPassword" /> |
|||
|
|||
<small class="form-text text-muted"> |
|||
The password for the SMTP server. |
|||
</small> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="form-group row"> |
|||
<label class="col-3 col-form-label" for="messageFrom">MessageFrom</label> |
|||
|
|||
<div class="col-9"> |
|||
<sqx-control-errors for="messageFrom" [submitted]="actionFormSubmitted"></sqx-control-errors> |
|||
|
|||
<input type="text" class="form-control" id="messageFrom" formControlName="messageFrom" /> |
|||
|
|||
<small class="form-text text-muted"> |
|||
The email sending address. Read the <a routerLink="help">help</a> section for information about advanced formatting. |
|||
</small> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="form-group row"> |
|||
<label class="col-3 col-form-label" for="messageTo">MessageTo</label> |
|||
|
|||
<div class="col-9"> |
|||
<sqx-control-errors for="messageTo" [submitted]="actionFormSubmitted"></sqx-control-errors> |
|||
|
|||
<input type="text" class="form-control" id="messageTo" formControlName="messageTo" /> |
|||
|
|||
<small class="form-text text-muted"> |
|||
The email message will be sent to. Read the <a routerLink="help">help</a> section for information about advanced formatting. |
|||
</small> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="form-group row"> |
|||
<label class="col-3 col-form-label" for="messageSubject">MessageSubject</label> |
|||
|
|||
<div class="col-9"> |
|||
<sqx-control-errors for="messageSubject" [submitted]="actionFormSubmitted"></sqx-control-errors> |
|||
|
|||
<input type="text" class="form-control" id="messageSubject" formControlName="messageSubject" /> |
|||
|
|||
<small class="form-text text-muted"> |
|||
The subject line for this email message. Read the <a routerLink="help">help</a> section for information about advanced formatting. |
|||
</small> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div class="form-group row"> |
|||
<label class="col-3 col-form-label" for="messageBody">MessageBody</label> |
|||
|
|||
<div class="col-9"> |
|||
<sqx-control-errors for="messageBody" [submitted]="actionFormSubmitted"></sqx-control-errors> |
|||
|
|||
<textarea class="form-control" id="messageBody" formControlName="messageBody"></textarea> |
|||
|
|||
<small class="form-text text-muted"> |
|||
The message body. Read the <a routerLink="help">help</a> section for information about advanced formatting. |
|||
</small> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
@ -1,6 +0,0 @@ |
|||
@import '_vars'; |
|||
@import '_mixins'; |
|||
|
|||
textarea { |
|||
height: 250px; |
|||
} |
|||
@ -1,70 +0,0 @@ |
|||
/* |
|||
* Squidex Headless CMS |
|||
* |
|||
* @license |
|||
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. |
|||
*/ |
|||
|
|||
import { Component, Input, OnInit } from '@angular/core'; |
|||
import { FormControl, FormGroup, Validators } from '@angular/forms'; |
|||
|
|||
@Component({ |
|||
selector: 'sqx-email-action', |
|||
styleUrls: ['./email-action.component.scss'], |
|||
templateUrl: './email-action.component.html' |
|||
}) |
|||
export class EmailActionComponent implements OnInit { |
|||
@Input() |
|||
public action: any; |
|||
|
|||
@Input() |
|||
public actionForm: FormGroup; |
|||
|
|||
@Input() |
|||
public actionFormSubmitted = false; |
|||
|
|||
public ngOnInit() { |
|||
this.actionForm.setControl('serverHost', |
|||
new FormControl(this.action.serverHost || 'smtp.gmail.com', [ |
|||
Validators.required |
|||
])); |
|||
|
|||
this.actionForm.setControl('serverPort', |
|||
new FormControl(this.action.serverPort || 465, [ |
|||
Validators.required |
|||
])); |
|||
|
|||
this.actionForm.setControl('serverUseSsl', |
|||
new FormControl(this.action.serverUseSsl || true)); |
|||
|
|||
this.actionForm.setControl('serverUsername', |
|||
new FormControl(this.action.serverUsername || '', [ |
|||
Validators.required |
|||
])); |
|||
|
|||
this.actionForm.setControl('serverPassword', |
|||
new FormControl(this.action.serverPassword || '', [ |
|||
Validators.required |
|||
])); |
|||
|
|||
this.actionForm.setControl('messageFrom', |
|||
new FormControl(this.action.messageFrom || '', [ |
|||
Validators.required |
|||
])); |
|||
|
|||
this.actionForm.setControl('messageTo', |
|||
new FormControl(this.action.messageTo || '', [ |
|||
Validators.required |
|||
])); |
|||
|
|||
this.actionForm.setControl('messageSubject', |
|||
new FormControl(this.action.messageSubject || '', [ |
|||
Validators.required |
|||
])); |
|||
|
|||
this.actionForm.setControl('messageBody', |
|||
new FormControl(this.action.messageBody || '', [ |
|||
Validators.required |
|||
])); |
|||
} |
|||
} |
|||
@ -1,29 +0,0 @@ |
|||
<div [formGroup]="actionForm" class="form-horizontal"> |
|||
<div class="form-group row"> |
|||
<label class="col-3 col-form-label" for="serviceId">Service ID</label> |
|||
|
|||
<div class="col-9"> |
|||
<sqx-control-errors for="serviceId" [submitted]="actionFormSubmitted"></sqx-control-errors> |
|||
|
|||
<input type="text" class="form-control" id="serviceId" formControlName="serviceId" /> |
|||
|
|||
<small class="form-text text-muted"> |
|||
The service ID of the fastly account. |
|||
</small> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="form-group row"> |
|||
<label class="col-3 col-form-label" for="apiKey">Api Key</label> |
|||
|
|||
<div class="col-9"> |
|||
<sqx-control-errors for="apiKey" [submitted]="actionFormSubmitted"></sqx-control-errors> |
|||
|
|||
<input type="text" class="form-control" id="apiKey" formControlName="apiKey" /> |
|||
|
|||
<small class="form-text text-muted"> |
|||
The API key for the fastly account. |
|||
</small> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
@ -1,2 +0,0 @@ |
|||
@import '_vars'; |
|||
@import '_mixins'; |
|||
@ -1,37 +0,0 @@ |
|||
/* |
|||
* Squidex Headless CMS |
|||
* |
|||
* @license |
|||
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. |
|||
*/ |
|||
|
|||
import { Component, Input, OnInit } from '@angular/core'; |
|||
import { FormControl, FormGroup, Validators } from '@angular/forms'; |
|||
|
|||
@Component({ |
|||
selector: 'sqx-fastly-action', |
|||
styleUrls: ['./fastly-action.component.scss'], |
|||
templateUrl: './fastly-action.component.html' |
|||
}) |
|||
export class FastlyActionComponent implements OnInit { |
|||
@Input() |
|||
public action: any; |
|||
|
|||
@Input() |
|||
public actionForm: FormGroup; |
|||
|
|||
@Input() |
|||
public actionFormSubmitted = false; |
|||
|
|||
public ngOnInit() { |
|||
this.actionForm.setControl('serviceId', |
|||
new FormControl(this.action.serviceId || '', [ |
|||
Validators.required |
|||
])); |
|||
|
|||
this.actionForm.setControl('apiKey', |
|||
new FormControl(this.action.apiKey || '', [ |
|||
Validators.required |
|||
])); |
|||
} |
|||
} |
|||
@ -0,0 +1,34 @@ |
|||
<div [formGroup]="actionForm" class="form-horizontal"> |
|||
<div class="form-group row" *ngFor="let property of definition.properties"> |
|||
<label class="col-3 col-form-label" [for]="property.name">{{property.display}}</label> |
|||
|
|||
<div class="col-9"> |
|||
<sqx-control-errors [for]="property.name" [submitted]="actionFormSubmitted"></sqx-control-errors> |
|||
|
|||
<div [ngSwitch]="property.editor"> |
|||
<div *ngSwitchCase="'TextArea'"> |
|||
<textarea class="form-control" id="{{property.name}}" [formControlName]="property.name"></textarea> |
|||
</div> |
|||
<div *ngSwitchCase="'Checkbox'"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="checkbox" [formControlName]="property.name" /> |
|||
<label class="form-check-label" [for]="property.name"> |
|||
{{property.display}} |
|||
</label> |
|||
</div> |
|||
</div> |
|||
<div *ngSwitchDefault> |
|||
<input type="{{property.editor | lowercase}}" class="form-control" id="{{property.name}}" [formControlName]="property.name" /> |
|||
</div> |
|||
</div> |
|||
|
|||
<small class="form-text text-muted"> |
|||
{{property.description}} |
|||
|
|||
<ng-container *ngIf="property.isFormattable"> |
|||
You can use advanced formatting: <a href="https://docs.squidex.io/concepts/rules#3-formatting" sqxExternalLink>Documentation</a> |
|||
</ng-container> |
|||
</small> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
@ -0,0 +1,6 @@ |
|||
@import '_vars'; |
|||
@import '_mixins'; |
|||
|
|||
.form-check { |
|||
padding-top: .5rem; |
|||
} |
|||
@ -0,0 +1,44 @@ |
|||
/* |
|||
* Squidex Headless CMS |
|||
* |
|||
* @license |
|||
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. |
|||
*/ |
|||
|
|||
import { Component, Input, OnInit } from '@angular/core'; |
|||
import { FormControl, FormGroup, Validators } from '@angular/forms'; |
|||
|
|||
import { RuleElementDto } from '@app/shared'; |
|||
|
|||
@Component({ |
|||
selector: 'sqx-generic-action', |
|||
styleUrls: ['./generic-action.component.scss'], |
|||
templateUrl: './generic-action.component.html' |
|||
}) |
|||
export class GenericActionComponent implements OnInit { |
|||
@Input() |
|||
public definition: RuleElementDto; |
|||
|
|||
@Input() |
|||
public action: any; |
|||
|
|||
@Input() |
|||
public actionForm: FormGroup; |
|||
|
|||
@Input() |
|||
public actionFormSubmitted = false; |
|||
|
|||
public ngOnInit() { |
|||
for (let property of this.definition.properties) { |
|||
const validators = []; |
|||
|
|||
if (property.isRequired) { |
|||
validators.push(Validators.required); |
|||
} |
|||
|
|||
const control = new FormControl(this.action[property.name] || '', validators); |
|||
|
|||
this.actionForm.setControl(property.name, control); |
|||
} |
|||
} |
|||
} |
|||
@ -1,96 +0,0 @@ |
|||
<div [formGroup]="actionForm" class="form-horizontal"> |
|||
<div class="form-group row"> |
|||
<label class="col-3 col-form-label" for="accessToken">Access Token</label> |
|||
|
|||
<div class="col-9"> |
|||
<sqx-control-errors for="accessToken" [submitted]="actionFormSubmitted"></sqx-control-errors> |
|||
|
|||
<input type="text" class="form-control" id="accessToken" formControlName="accessToken" /> |
|||
|
|||
<small class="form-text text-muted"> |
|||
The self issued access token. Can be created under <a href="https://medium.com/me/settings" sqxExternalLink>https://medium.com/me/settings</a>. |
|||
</small> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="form-group row"> |
|||
<label class="col-3 col-form-label" for="title">Title</label> |
|||
|
|||
<div class="col-9"> |
|||
<sqx-control-errors for="title" [submitted]="actionFormSubmitted"></sqx-control-errors> |
|||
|
|||
<input type="text" class="form-control" id="title" formControlName="title" /> |
|||
|
|||
<small class="form-text text-muted"> |
|||
The title of the post. Note that this title is used for SEO and when rendering the post as a listing. |
|||
</small> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="form-group row"> |
|||
<label class="col-3 col-form-label" for="content">Content</label> |
|||
|
|||
<div class="col-9"> |
|||
<sqx-control-errors for="content" [submitted]="actionFormSubmitted"></sqx-control-errors> |
|||
|
|||
<textarea class="form-control" id="content" formControlName="content"></textarea> |
|||
|
|||
<small class="form-text text-muted"> |
|||
The body of the post, in a valid, semantic, HTML fragment, or Markdown. |
|||
</small> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="form-group row"> |
|||
<div class="col-9 offset-3"> |
|||
<div class="form-check"> |
|||
<input class="form-check-input" type="checkbox" id="isHtml" formControlName="isHtml" /> |
|||
<label class="form-check-label" for="isHtml"> |
|||
Is Html content |
|||
</label> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="form-group row"> |
|||
<label class="col-3 col-form-label" for="canonicalUrl">Canonical URL</label> |
|||
|
|||
<div class="col-9"> |
|||
<sqx-control-errors for="canonicalUrl" [submitted]="actionFormSubmitted"></sqx-control-errors> |
|||
|
|||
<input type="text" class="form-control" id="canonicalUrl" formControlName="canonicalUrl" /> |
|||
|
|||
<small class="form-text text-muted"> |
|||
The original home of this content, if it was originally published elsewhere. |
|||
</small> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="form-group row"> |
|||
<label class="col-3 col-form-label" for="tags">Tags</label> |
|||
|
|||
<div class="col-9"> |
|||
<sqx-control-errors for="tags" [submitted]="actionFormSubmitted"></sqx-control-errors> |
|||
|
|||
<input type="text" class="form-control" id="tags" formControlName="tags" /> |
|||
|
|||
<small class="form-text text-muted"> |
|||
Optional comma-separated list of tags. |
|||
</small> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="form-group row"> |
|||
<label class="col-3 col-form-label" for="publicationId">Publication</label> |
|||
|
|||
<div class="col-9"> |
|||
<sqx-control-errors for="publicationId" [submitted]="actionFormSubmitted"></sqx-control-errors> |
|||
|
|||
<input type="text" class="form-control" id="publicationId" formControlName="publicationId" /> |
|||
|
|||
<small class="form-text text-muted"> |
|||
Optional publication id. Go to <a href="https://medium.com/[PUBLICATION]>?format=json" sqxExternalLink>https://medium.com/[PUBLICATION]?format=json</a> to fetch the id. |
|||
</small> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
@ -1,6 +0,0 @@ |
|||
@import '_vars'; |
|||
@import '_mixins'; |
|||
|
|||
textarea { |
|||
height: 150px; |
|||
} |
|||
@ -1,54 +0,0 @@ |
|||
/* |
|||
* Squidex Headless CMS |
|||
* |
|||
* @license |
|||
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. |
|||
*/ |
|||
|
|||
import { Component, Input, OnInit } from '@angular/core'; |
|||
import { FormControl, FormGroup, Validators } from '@angular/forms'; |
|||
|
|||
@Component({ |
|||
selector: 'sqx-medium-action', |
|||
styleUrls: ['./medium-action.component.scss'], |
|||
templateUrl: './medium-action.component.html' |
|||
}) |
|||
export class MediumActionComponent implements OnInit { |
|||
@Input() |
|||
public action: any; |
|||
|
|||
@Input() |
|||
public actionForm: FormGroup; |
|||
|
|||
@Input() |
|||
public actionFormSubmitted = false; |
|||
|
|||
public ngOnInit() { |
|||
this.actionForm.setControl('accessToken', |
|||
new FormControl(this.action.accessToken || '', [ |
|||
Validators.required |
|||
])); |
|||
|
|||
this.actionForm.setControl('title', |
|||
new FormControl(this.action.title || '', [ |
|||
Validators.required |
|||
])); |
|||
|
|||
this.actionForm.setControl('content', |
|||
new FormControl(this.action.content || '', [ |
|||
Validators.required |
|||
])); |
|||
|
|||
this.actionForm.setControl('canonicalUrl', |
|||
new FormControl(this.action.canonicalUrl || '')); |
|||
|
|||
this.actionForm.setControl('tags', |
|||
new FormControl(this.action.tags || '')); |
|||
|
|||
this.actionForm.setControl('publicationId', |
|||
new FormControl(this.action.publicationId || '')); |
|||
|
|||
this.actionForm.setControl('isHtml', |
|||
new FormControl(this.action.isHtml || false)); |
|||
} |
|||
} |
|||
@ -1,29 +0,0 @@ |
|||
<div [formGroup]="actionForm" class="form-horizontal"> |
|||
<div class="form-group row"> |
|||
<label class="col-3 col-form-label" for="token">Token</label> |
|||
|
|||
<div class="col-9"> |
|||
<sqx-control-errors for="token" [submitted]="actionFormSubmitted"></sqx-control-errors> |
|||
|
|||
<input type="text" class="form-control" id="token" formControlName="token" /> |
|||
|
|||
<small class="form-text text-muted"> |
|||
The prerender token from your account. |
|||
</small> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="form-group row"> |
|||
<label class="col-3 col-form-label" for="url">Url</label> |
|||
|
|||
<div class="col-9"> |
|||
<sqx-control-errors for="url" [submitted]="actionFormSubmitted"></sqx-control-errors> |
|||
|
|||
<input type="url" class="form-control" id="url" formControlName="url" /> |
|||
|
|||
<small class="form-text text-muted"> |
|||
The url to recache. Read the <a routerLink="help">help</a> section for information about advanced formatting. |
|||
</small> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
@ -1,2 +0,0 @@ |
|||
@import '_vars'; |
|||
@import '_mixins'; |
|||
@ -1,37 +0,0 @@ |
|||
/* |
|||
* Squidex Headless CMS |
|||
* |
|||
* @license |
|||
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. |
|||
*/ |
|||
|
|||
import { Component, Input, OnInit } from '@angular/core'; |
|||
import { FormControl, FormGroup, Validators } from '@angular/forms'; |
|||
|
|||
@Component({ |
|||
selector: 'sqx-prerender-action', |
|||
styleUrls: ['./prerender-action.component.scss'], |
|||
templateUrl: './prerender-action.component.html' |
|||
}) |
|||
export class PrerenderActionComponent implements OnInit { |
|||
@Input() |
|||
public action: any; |
|||
|
|||
@Input() |
|||
public actionForm: FormGroup; |
|||
|
|||
@Input() |
|||
public actionFormSubmitted = false; |
|||
|
|||
public ngOnInit() { |
|||
this.actionForm.setControl('token', |
|||
new FormControl(this.action.token || '', [ |
|||
Validators.required |
|||
])); |
|||
|
|||
this.actionForm.setControl('url', |
|||
new FormControl(this.action.url || '', [ |
|||
Validators.required |
|||
])); |
|||
} |
|||
} |
|||
@ -1,29 +0,0 @@ |
|||
<form [formGroup]="actionForm" class="form-horizontal"> |
|||
<div class="form-group row"> |
|||
<label class="col-3 col-form-label" for="webhookUrl">Webhook Url</label> |
|||
|
|||
<div class="col-9"> |
|||
<sqx-control-errors for="webhookUrl" [submitted]="actionFormSubmitted"></sqx-control-errors> |
|||
|
|||
<input type="text" class="form-control" id="webhookUrl" formControlName="webhookUrl" /> |
|||
|
|||
<small class="form-text text-muted"> |
|||
The url to the incoming slack webhook. |
|||
</small> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="form-group row"> |
|||
<label class="col-3 col-form-label" for="text">Text</label> |
|||
|
|||
<div class="col-9"> |
|||
<sqx-control-errors for="text" [submitted]="actionFormSubmitted"></sqx-control-errors> |
|||
|
|||
<textarea class="form-control" id="text" formControlName="text"></textarea> |
|||
|
|||
<small class="form-text text-muted"> |
|||
The text to send to slack. Read the <a routerLink="help">help</a> section for information about advanced formatting. |
|||
</small> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
@ -1,6 +0,0 @@ |
|||
@import '_vars'; |
|||
@import '_mixins'; |
|||
|
|||
textarea { |
|||
height: 150px; |
|||
} |
|||
@ -1,37 +0,0 @@ |
|||
/* |
|||
* Squidex Headless CMS |
|||
* |
|||
* @license |
|||
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. |
|||
*/ |
|||
|
|||
import { Component, Input, OnInit } from '@angular/core'; |
|||
import { FormControl, FormGroup, Validators } from '@angular/forms'; |
|||
|
|||
@Component({ |
|||
selector: 'sqx-slack-action', |
|||
styleUrls: ['./slack-action.component.scss'], |
|||
templateUrl: './slack-action.component.html' |
|||
}) |
|||
export class SlackActionComponent implements OnInit { |
|||
@Input() |
|||
public action: any; |
|||
|
|||
@Input() |
|||
public actionForm: FormGroup; |
|||
|
|||
@Input() |
|||
public actionFormSubmitted = false; |
|||
|
|||
public ngOnInit() { |
|||
this.actionForm.setControl('webhookUrl', |
|||
new FormControl(this.action.webhookUrl || '', [ |
|||
Validators.required |
|||
])); |
|||
|
|||
this.actionForm.setControl('text', |
|||
new FormControl(this.action.text || '', [ |
|||
Validators.required |
|||
])); |
|||
} |
|||
} |
|||
@ -1,55 +0,0 @@ |
|||
<form [formGroup]="actionForm" class="form-horizontal"> |
|||
<div class="form-group row"> |
|||
<div class="col-9 offset-3"> |
|||
<ng-container *ngIf="!isRedirected"> |
|||
<button type="button" class="btn btn-twitter" [disabled]="isAuthenticating" (click)="auth()"> |
|||
Request access token with twitter |
|||
</button> |
|||
</ng-container> |
|||
|
|||
<ng-container *ngIf="isRedirected"> |
|||
<form class="form-inline" (ngSubmit)="complete()"> |
|||
<input class="form-control mr-1" [(ngModel)]="pinCode" [ngModelOptions]="{ standalone: true }" placeholder="Pin" /> |
|||
|
|||
<button type="submit" class="btn btn-secondary" [disabled]="!pinCode"> |
|||
Complete |
|||
</button> |
|||
</form> |
|||
</ng-container> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="form-group row"> |
|||
<label class="col-3 col-form-label" for="accessToken">Access Token</label> |
|||
|
|||
<div class="col-9"> |
|||
<sqx-control-errors for="accessToken" submitOnly="true" [submitted]="actionFormSubmitted"></sqx-control-errors> |
|||
|
|||
<input type="text" readonly class="form-control" id="accessToken" formControlName="accessToken" /> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="form-group row"> |
|||
<label class="col-3 col-form-label" for="accessToken">Access Secret</label> |
|||
|
|||
<div class="col-9"> |
|||
<sqx-control-errors for="accessSecret" submitOnly="true" [submitted]="actionFormSubmitted"></sqx-control-errors> |
|||
|
|||
<input type="text" readonly class="form-control" id="accessSecret" formControlName="accessSecret" /> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="form-group row"> |
|||
<label class="col-3 col-form-label" for="text">Text</label> |
|||
|
|||
<div class="col-9"> |
|||
<sqx-control-errors for="text" [submitted]="actionFormSubmitted"></sqx-control-errors> |
|||
|
|||
<textarea class="form-control" id="text" formControlName="text"></textarea> |
|||
|
|||
<small class="form-text text-muted"> |
|||
The text to tweet. Read the <a routerLink="help">help</a> section for information about advanced formatting. |
|||
</small> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
@ -1,6 +0,0 @@ |
|||
@import '_vars'; |
|||
@import '_mixins'; |
|||
|
|||
textarea { |
|||
height: 150px; |
|||
} |
|||
@ -1,98 +0,0 @@ |
|||
/* |
|||
* Squidex Headless CMS |
|||
* |
|||
* @license |
|||
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. |
|||
*/ |
|||
|
|||
import { HttpClient } from '@angular/common/http'; |
|||
import { Component, Input, OnInit } from '@angular/core'; |
|||
import { FormControl, FormGroup, Validators } from '@angular/forms'; |
|||
|
|||
import { DialogService } from '@app/shared'; |
|||
|
|||
@Component({ |
|||
selector: 'sqx-tweet-action', |
|||
styleUrls: ['./tweet-action.component.scss'], |
|||
templateUrl: './tweet-action.component.html' |
|||
}) |
|||
export class TweetActionComponent implements OnInit { |
|||
private request: any; |
|||
|
|||
@Input() |
|||
public action: any; |
|||
|
|||
@Input() |
|||
public actionForm: FormGroup; |
|||
|
|||
@Input() |
|||
public actionFormSubmitted = false; |
|||
|
|||
public isAuthenticating = false; |
|||
public isRedirected = false; |
|||
|
|||
public pinCode: string; |
|||
|
|||
constructor( |
|||
private readonly dialogs: DialogService, |
|||
private readonly httpClient: HttpClient |
|||
) { |
|||
} |
|||
|
|||
public ngOnInit() { |
|||
this.actionForm.setControl('accessToken', |
|||
new FormControl(this.action.accessToken || '', [ |
|||
Validators.required |
|||
])); |
|||
|
|||
this.actionForm.setControl('accessSecret', |
|||
new FormControl(this.action.accessSecret || '', [ |
|||
Validators.required |
|||
])); |
|||
|
|||
this.actionForm.setControl('text', |
|||
new FormControl(this.action.text || '', [ |
|||
Validators.required, |
|||
Validators.maxLength(280) |
|||
])); |
|||
} |
|||
|
|||
public auth() { |
|||
this.isAuthenticating = true; |
|||
|
|||
this.httpClient.get('api/rules/twitter/auth') |
|||
.subscribe((response: any) => { |
|||
this.request = { |
|||
requestToken: response.requestToken, |
|||
requestTokenSecret: response.requestTokenSecret |
|||
}; |
|||
|
|||
this.isAuthenticating = false; |
|||
this.isRedirected = true; |
|||
|
|||
window.open(response.authorizeUri, '_blank'); |
|||
}, () => { |
|||
this.dialogs.notifyError('Failed to authenticate with twitter.'); |
|||
|
|||
this.isAuthenticating = false; |
|||
this.isRedirected = false; |
|||
}); |
|||
} |
|||
|
|||
public complete() { |
|||
this.request.pinCode = this.pinCode; |
|||
|
|||
this.httpClient.post('api/rules/twitter/token', this.request) |
|||
.subscribe((response: any) => { |
|||
this.actionForm.get('accessToken')!.setValue(response.accessToken); |
|||
this.actionForm.get('accessSecret')!.setValue(response.accessTokenSecret); |
|||
|
|||
this.isRedirected = false; |
|||
}, () => { |
|||
this.dialogs.notifyError('Failed to request access token.'); |
|||
|
|||
this.isAuthenticating = false; |
|||
this.isRedirected = false; |
|||
}); |
|||
} |
|||
} |
|||
@ -1,29 +0,0 @@ |
|||
<div [formGroup]="actionForm" class="form-horizontal"> |
|||
<div class="form-group row"> |
|||
<label class="col-3 col-form-label" for="url">Url</label> |
|||
|
|||
<div class="col-9"> |
|||
<sqx-control-errors for="url" [submitted]="actionFormSubmitted"></sqx-control-errors> |
|||
|
|||
<input type="url" class="form-control" id="url" formControlName="url" /> |
|||
|
|||
<small class="form-text text-muted"> |
|||
The url where the events will be sent to. |
|||
</small> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="form-group row"> |
|||
<label class="col-3 col-form-label" for="sharedSecret">Secret</label> |
|||
|
|||
<div class="col-9"> |
|||
<sqx-control-errors for="sharedSecret" [submitted]="actionFormSubmitted"></sqx-control-errors> |
|||
|
|||
<input type="text" class="form-control" id="sharedSecret" formControlName="sharedSecret" /> |
|||
|
|||
<small class="form-text text-muted"> |
|||
The shared secret will be used to add a header X-Signature=Base64(Sha256(RequestBody + Secret)) |
|||
</small> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
@ -1,2 +0,0 @@ |
|||
@import '_vars'; |
|||
@import '_mixins'; |
|||
@ -1,35 +0,0 @@ |
|||
/* |
|||
* Squidex Headless CMS |
|||
* |
|||
* @license |
|||
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. |
|||
*/ |
|||
|
|||
import { Component, Input, OnInit } from '@angular/core'; |
|||
import { FormControl, FormGroup, Validators } from '@angular/forms'; |
|||
|
|||
@Component({ |
|||
selector: 'sqx-webhook-action', |
|||
styleUrls: ['./webhook-action.component.scss'], |
|||
templateUrl: './webhook-action.component.html' |
|||
}) |
|||
export class WebhookActionComponent implements OnInit { |
|||
@Input() |
|||
public action: any; |
|||
|
|||
@Input() |
|||
public actionForm: FormGroup; |
|||
|
|||
@Input() |
|||
public actionFormSubmitted = false; |
|||
|
|||
public ngOnInit() { |
|||
this.actionForm.setControl('url', |
|||
new FormControl(this.action.url || '', [ |
|||
Validators.required |
|||
])); |
|||
|
|||
this.actionForm.setControl('sharedSecret', |
|||
new FormControl(this.action.sharedSecret || '')); |
|||
} |
|||
} |
|||
@ -0,0 +1,166 @@ |
|||
// ==========================================================================
|
|||
// Squidex Headless CMS
|
|||
// ==========================================================================
|
|||
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|||
// All rights reserved. Licensed under the MIT license.
|
|||
// ==========================================================================
|
|||
|
|||
using System; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.Linq; |
|||
using FluentAssertions; |
|||
using Squidex.Domain.Apps.Core.HandleRules; |
|||
using Squidex.Domain.Apps.Core.Rules; |
|||
using Xunit; |
|||
|
|||
namespace Squidex.Domain.Apps.Core.Operations.HandleRules |
|||
{ |
|||
public class RuleElementRegistry |
|||
{ |
|||
private abstract class MyRuleActionHandler : RuleActionHandler<MyRuleAction, string> |
|||
{ |
|||
protected MyRuleActionHandler(RuleEventFormatter formatter) |
|||
: base(formatter) |
|||
{ |
|||
} |
|||
} |
|||
|
|||
[RuleActionHandler(typeof(MyRuleActionHandler))] |
|||
[RuleAction( |
|||
IconImage = "<svg></svg>", |
|||
IconColor = "#1e5470", |
|||
Display = "Action display", |
|||
Description = "Action description.", |
|||
ReadMore = "https://www.readmore.com/")] |
|||
public sealed class MyRuleAction : RuleAction |
|||
{ |
|||
[Required] |
|||
[Display(Name = "Url Name", Description = "Url Description")] |
|||
[DataType(DataType.Url)] |
|||
[Formattable] |
|||
public Uri Url { get; set; } |
|||
|
|||
[DataType(DataType.EmailAddress)] |
|||
public string Email { get; set; } |
|||
|
|||
[DataType(DataType.Text)] |
|||
public string Text { get; set; } |
|||
|
|||
[DataType(DataType.MultilineText)] |
|||
public string TextMultiline { get; set; } |
|||
|
|||
[DataType(DataType.Password)] |
|||
public string Password { get; set; } |
|||
|
|||
public bool Boolean { get; set; } |
|||
|
|||
public bool? BooleanOptional { get; set; } |
|||
|
|||
public int Number { get; set; } |
|||
|
|||
public int? NumberOptional { get; set; } |
|||
} |
|||
|
|||
[Fact] |
|||
public void Should_create_definition() |
|||
{ |
|||
var expected = new RuleActionDefinition |
|||
{ |
|||
Type = typeof(MyRuleAction), |
|||
IconImage = "<svg></svg>", |
|||
IconColor = "#1e5470", |
|||
Display = "Action display", |
|||
Description = "Action description.", |
|||
ReadMore = "https://www.readmore.com/" |
|||
}; |
|||
|
|||
expected.Properties.Add(new RuleActionProperty |
|||
{ |
|||
Name = "url", |
|||
Display = "Url Name", |
|||
Description = "Url Description", |
|||
Editor = RuleActionPropertyEditor.Url, |
|||
IsFormattable = true, |
|||
IsRequired = true |
|||
}); |
|||
|
|||
expected.Properties.Add(new RuleActionProperty |
|||
{ |
|||
Name = "email", |
|||
Display = "Email", |
|||
Description = null, |
|||
Editor = RuleActionPropertyEditor.Email, |
|||
IsRequired = false |
|||
}); |
|||
|
|||
expected.Properties.Add(new RuleActionProperty |
|||
{ |
|||
Name = "text", |
|||
Display = "Text", |
|||
Description = null, |
|||
Editor = RuleActionPropertyEditor.Text, |
|||
IsRequired = false |
|||
}); |
|||
|
|||
expected.Properties.Add(new RuleActionProperty |
|||
{ |
|||
Name = "textMultiline", |
|||
Display = "TextMultiline", |
|||
Description = null, |
|||
Editor = RuleActionPropertyEditor.TextArea, |
|||
IsRequired = false |
|||
}); |
|||
|
|||
expected.Properties.Add(new RuleActionProperty |
|||
{ |
|||
Name = "password", |
|||
Display = "Password", |
|||
Description = null, |
|||
Editor = RuleActionPropertyEditor.Password, |
|||
IsRequired = false |
|||
}); |
|||
|
|||
expected.Properties.Add(new RuleActionProperty |
|||
{ |
|||
Name = "boolean", |
|||
Display = "Boolean", |
|||
Description = null, |
|||
Editor = RuleActionPropertyEditor.Checkbox, |
|||
IsRequired = false |
|||
}); |
|||
|
|||
expected.Properties.Add(new RuleActionProperty |
|||
{ |
|||
Name = "booleanOptional", |
|||
Display = "BooleanOptional", |
|||
Description = null, |
|||
Editor = RuleActionPropertyEditor.Checkbox, |
|||
IsRequired = false |
|||
}); |
|||
|
|||
expected.Properties.Add(new RuleActionProperty |
|||
{ |
|||
Name = "number", |
|||
Display = "Number", |
|||
Description = null, |
|||
Editor = RuleActionPropertyEditor.Number, |
|||
IsRequired = true |
|||
}); |
|||
|
|||
expected.Properties.Add(new RuleActionProperty |
|||
{ |
|||
Name = "numberOptional", |
|||
Display = "NumberOptional", |
|||
Description = null, |
|||
Editor = RuleActionPropertyEditor.Number, |
|||
IsRequired = false |
|||
}); |
|||
|
|||
RuleActionRegistry.Add<MyRuleAction>(); |
|||
|
|||
var currentDefinition = RuleActionRegistry.Actions.Values.First(); |
|||
|
|||
currentDefinition.Should().BeEquivalentTo(expected); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue