The webhook activity text changes and the workflow designer update for webhooks
The webhook activity text changes and the workflow designer update for webhooks
This commit is contained in:
parent
bf336ebe10
commit
17600fcce6
|
|
@ -17,7 +17,8 @@ namespace Elsa.Activities.Webhooks.ActivityTypes
|
|||
public class WebhookActivityTypeProvider : IActivityTypeProvider
|
||||
{
|
||||
public const string WebhookMarkerAttribute = "WebhookMarker";
|
||||
private const string WebhookActivityCategory = "Webhooks";
|
||||
private const string WebhooksActivityType = "Webhook";
|
||||
private const string WebhooksActivityCategory = "Webhooks";
|
||||
|
||||
private readonly IWebhookDefinitionStore _webhookDefinitionStore;
|
||||
private readonly IActivityActivator _activityActivator;
|
||||
|
|
@ -47,14 +48,11 @@ namespace Elsa.Activities.Webhooks.ActivityTypes
|
|||
|
||||
private ActivityType CreateWebhookActivityType(WebhookDefinition webhook)
|
||||
{
|
||||
var typeName = webhook.Name;
|
||||
var displayName = webhook.Name;
|
||||
|
||||
var descriptor = new ActivityDescriptor
|
||||
{
|
||||
Type = typeName,
|
||||
DisplayName = displayName,
|
||||
Category = WebhookActivityCategory,
|
||||
Type = WebhooksActivityType, //$"{webhook.Name} {WebhooksActivityType}",
|
||||
DisplayName = $"{WebhooksActivityType}: {webhook.Name}",
|
||||
Category = WebhooksActivityCategory,
|
||||
Outcomes = new[] { OutcomeNames.Done },
|
||||
Traits = ActivityTraits.Trigger,
|
||||
InputProperties = new[]
|
||||
|
|
|
|||
|
|
@ -7,13 +7,28 @@
|
|||
|
||||
## Properties
|
||||
|
||||
| Property | Attribute | Description | Type | Default |
|
||||
| --------------- | ----------------- | ----------- | -------------- | ----------- |
|
||||
| `match` | -- | | `MatchResults` | `undefined` |
|
||||
| `monacoLibPath` | `monaco-lib-path` | | `string` | `undefined` |
|
||||
| `serverUrl` | `server-url` | | `string` | `undefined` |
|
||||
| Property | Attribute | Description | Type | Default |
|
||||
| ----------- | ------------ | ----------- | --------------- | ----------- |
|
||||
| `history` | -- | | `RouterHistory` | `undefined` |
|
||||
| `match` | -- | | `MatchResults` | `undefined` |
|
||||
| `serverUrl` | `server-url` | | `string` | `undefined` |
|
||||
|
||||
|
||||
## Dependencies
|
||||
|
||||
### Depends on
|
||||
|
||||
- [elsa-webhook-definition-editor-screen](../../../screens/webhook-definition-editor/elsa-webhook-definition-editor-screen)
|
||||
|
||||
### Graph
|
||||
```mermaid
|
||||
graph TD;
|
||||
elsa-studio-webhook-definitions-edit --> elsa-webhook-definition-editor-screen
|
||||
elsa-webhook-definition-editor-screen --> elsa-webhook-definition-editor-notifications
|
||||
elsa-webhook-definition-editor-notifications --> elsa-toast-notification
|
||||
style elsa-studio-webhook-definitions-edit fill:#f9f,stroke:#333,stroke-width:4px
|
||||
```
|
||||
|
||||
----------------------------------------------
|
||||
|
||||
*Built with [StencilJS](https://stenciljs.com/)*
|
||||
|
|
|
|||
|
|
@ -544,7 +544,7 @@ export class ElsaWorkflowDesigner {
|
|||
|
||||
renderActivityBody(displayContext: ActivityDesignDisplayContext) {
|
||||
return (
|
||||
`<div class="elsa-border-t elsa-border-t-solid hidden">
|
||||
`<div class="elsa-border-t elsa-border-t-solid">
|
||||
<div class="elsa-p-6 elsa-text-gray-400 elsa-text-sm">
|
||||
<div class="elsa-mb-2">${!!displayContext.bodyDisplay ? displayContext.bodyDisplay : ''}</div>
|
||||
<div>
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ export class ElsaSingleLineProperty {
|
|||
this.currentValue = e.detail;
|
||||
}
|
||||
|
||||
render() {
|
||||
render() {
|
||||
const propertyDescriptor = this.propertyDescriptor;
|
||||
const propertyModel = this.propertyModel;
|
||||
const propertyName = propertyDescriptor.name;
|
||||
|
|
@ -40,16 +40,22 @@ export class ElsaSingleLineProperty {
|
|||
value = defaultValue ? defaultValue.toString() : undefined;
|
||||
}
|
||||
|
||||
if (readonly)
|
||||
{
|
||||
const defaultSyntax = this.propertyDescriptor.defaultSyntax || SyntaxNames.Literal;
|
||||
this.propertyModel.expressions[defaultSyntax] = value;
|
||||
}
|
||||
|
||||
return (
|
||||
<elsa-property-editor propertyDescriptor={propertyDescriptor}
|
||||
propertyModel={propertyModel}
|
||||
onDefaultSyntaxValueChanged={e => this.onDefaultSyntaxValueChanged(e)}
|
||||
editor-height="2.75em"
|
||||
single-line={true}>
|
||||
{readonly ?
|
||||
<input type="text" id={fieldId} name={fieldName} value={value} disabled class="elsa-block elsa-w-full elsa-min-w-0 elsa-rounded-md sm:elsa-text-sm elsa-border-gray-300"/>
|
||||
:
|
||||
{!readonly ?
|
||||
<input type="text" id={fieldId} name={fieldName} value={value} onChange={e => this.onChange(e)} class="focus:elsa-ring-blue-500 focus:elsa-border-blue-500 elsa-block elsa-w-full elsa-min-w-0 elsa-rounded-md sm:elsa-text-sm elsa-border-gray-300"/>
|
||||
:
|
||||
<input type="text" id={fieldId} name={fieldName} value={value} disabled class="elsa-block elsa-w-full elsa-min-w-0 elsa-rounded-md sm:elsa-text-sm elsa-border-gray-300"/>
|
||||
}
|
||||
</elsa-property-editor>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -7,6 +7,10 @@
|
|||
|
||||
## Dependencies
|
||||
|
||||
### Used by
|
||||
|
||||
- [elsa-webhook-definition-editor-screen](../elsa-webhook-definition-editor-screen)
|
||||
|
||||
### Depends on
|
||||
|
||||
- [elsa-toast-notification](../../../shared/elsa-toast-notification)
|
||||
|
|
@ -15,6 +19,7 @@
|
|||
```mermaid
|
||||
graph TD;
|
||||
elsa-webhook-definition-editor-notifications --> elsa-toast-notification
|
||||
elsa-webhook-definition-editor-screen --> elsa-webhook-definition-editor-notifications
|
||||
style elsa-webhook-definition-editor-notifications fill:#f9f,stroke:#333,stroke-width:4px
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -7,11 +7,56 @@
|
|||
|
||||
## Properties
|
||||
|
||||
| Property | Attribute | Description | Type | Default |
|
||||
| ------------------- | --------- | ----------- | ------------------- | ----------- |
|
||||
| `webhookDefinition` | -- | | `WebhookDefinition` | `undefined` |
|
||||
| Property | Attribute | Description | Type | Default |
|
||||
| ------------------- | ----------------------- | ----------- | ------------------- | ----------- |
|
||||
| `history` | -- | | `RouterHistory` | `undefined` |
|
||||
| `serverUrl` | `server-url` | | `string` | `undefined` |
|
||||
| `webhookDefinition` | -- | | `WebhookDefinition` | `undefined` |
|
||||
| `webhookId` | `webhook-definition-id` | | `string` | `undefined` |
|
||||
|
||||
|
||||
## Methods
|
||||
|
||||
### `getServerUrl() => Promise<string>`
|
||||
|
||||
|
||||
|
||||
#### Returns
|
||||
|
||||
Type: `Promise<string>`
|
||||
|
||||
|
||||
|
||||
### `getWebhookId() => Promise<string>`
|
||||
|
||||
|
||||
|
||||
#### Returns
|
||||
|
||||
Type: `Promise<string>`
|
||||
|
||||
|
||||
|
||||
|
||||
## Dependencies
|
||||
|
||||
### Used by
|
||||
|
||||
- [elsa-studio-webhook-definitions-edit](../../../dashboard/pages/elsa-studio-webhook-definitions-edit)
|
||||
|
||||
### Depends on
|
||||
|
||||
- [elsa-webhook-definition-editor-notifications](../elsa-webhook-definition-editor-notifications)
|
||||
|
||||
### Graph
|
||||
```mermaid
|
||||
graph TD;
|
||||
elsa-webhook-definition-editor-screen --> elsa-webhook-definition-editor-notifications
|
||||
elsa-webhook-definition-editor-notifications --> elsa-toast-notification
|
||||
elsa-studio-webhook-definitions-edit --> elsa-webhook-definition-editor-screen
|
||||
style elsa-webhook-definition-editor-screen fill:#f9f,stroke:#333,stroke-width:4px
|
||||
```
|
||||
|
||||
----------------------------------------------
|
||||
|
||||
*Built with [StencilJS](https://stenciljs.com/)*
|
||||
|
|
|
|||
|
|
@ -100,8 +100,9 @@ export class ElsaActivityEditorModal {
|
|||
const activityModel: ActivityModel = renderProps.activityModel;
|
||||
const inactiveClass = 'elsa-border-transparent elsa-text-gray-500 hover:elsa-text-gray-700 hover:elsa-border-gray-300';
|
||||
const selectedClass = 'elsa-border-blue-500 elsa-text-blue-600';
|
||||
|
||||
debugger
|
||||
return (
|
||||
|
||||
<Host class="elsa-block">
|
||||
<elsa-modal-dialog ref={el => this.dialog = el} >
|
||||
<div slot="content" class="elsa-py-8 elsa-pb-0">
|
||||
|
|
|
|||
|
|
@ -10,10 +10,10 @@ export class HttpEndpointPlugin implements ElsaPlugin {
|
|||
|
||||
onActivityDisplaying(context: ActivityDesignDisplayContext) {
|
||||
const activityModel = context.activityModel;
|
||||
|
||||
|
||||
if (activityModel.type !== 'HttpEndpoint')
|
||||
return;
|
||||
|
||||
|
||||
const props = activityModel.properties || [];
|
||||
const path = props.find(x => x.name == 'Path') || { name: 'Path', expressions: { 'Literal': '', syntax: SyntaxNames.Literal } };
|
||||
const syntax = path.syntax || SyntaxNames.Literal;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
import {ElsaPlugin} from "../services/elsa-plugin";
|
||||
import {eventBus} from '../services/event-bus';
|
||||
import {ActivityDesignDisplayContext, EventTypes, SyntaxNames} from "../models";
|
||||
import {h} from "@stencil/core";
|
||||
|
||||
export class WebhookPlugin implements ElsaPlugin {
|
||||
constructor() {
|
||||
eventBus.on(EventTypes.ActivityDesignDisplaying, this.onActivityDisplaying);
|
||||
}
|
||||
|
||||
onActivityDisplaying(context: ActivityDesignDisplayContext) {
|
||||
const activityModel = context.activityModel;
|
||||
|
||||
if (activityModel.type !== 'Webhook')
|
||||
return;
|
||||
|
||||
const props = activityModel.properties || [];
|
||||
const path = props.find(x => x.name == 'Path') || { name: 'Path', expressions: { 'Literal': '', syntax: SyntaxNames.Literal } };
|
||||
const syntax = path.syntax || SyntaxNames.Literal;
|
||||
context.bodyDisplay = `<p>${path.expressions[syntax]}</p>`;
|
||||
}
|
||||
}
|
||||
|
|
@ -17,6 +17,7 @@ import {SendSignalPlugin} from "../plugins/send-signal-plugin";
|
|||
import {UserTaskPlugin} from "../plugins/user-task-plugin";
|
||||
import {StatePlugin} from "../plugins/state-plugin";
|
||||
import {SendHttpRequestPlugin} from "../plugins/send-http-request-plugin";
|
||||
import {WebhookPlugin} from "../plugins/webhook-plugin";
|
||||
|
||||
export class PluginManager {
|
||||
|
||||
|
|
@ -41,7 +42,8 @@ export class PluginManager {
|
|||
new StatePlugin(),
|
||||
new RunJavascriptPlugin(),
|
||||
new UserTaskPlugin(),
|
||||
new SendEmailPlugin()
|
||||
new SendEmailPlugin(),
|
||||
new WebhookPlugin()
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue