Fix to default value for various input control types
This commit is contained in:
parent
823eaf8a80
commit
a886fab9b5
|
|
@ -59,6 +59,19 @@ namespace Elsa.Activities.Webhooks.ActivityTypes
|
|||
Traits = ActivityTraits.Trigger,
|
||||
InputProperties = new[]
|
||||
{
|
||||
new ActivityInputDescriptor(
|
||||
nameof(HttpEndpoint.Path),
|
||||
typeof(Microsoft.AspNetCore.Http.PathString),
|
||||
ActivityInputUIHints.SingleLine,
|
||||
"Path",
|
||||
"The relative path that triggers this activity.",
|
||||
null,
|
||||
default,
|
||||
0,
|
||||
webhook.Path,
|
||||
SyntaxNames.Literal,
|
||||
new[] { SyntaxNames.Literal }
|
||||
),
|
||||
new ActivityInputDescriptor(
|
||||
nameof(HttpEndpoint.Methods),
|
||||
typeof(HashSet<string>),
|
||||
|
|
@ -67,10 +80,20 @@ namespace Elsa.Activities.Webhooks.ActivityTypes
|
|||
"Specify what request method this webhook should handle. Leave empty to handle both GET and POST requests",
|
||||
new[] { "GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS", "HEAD" },
|
||||
default,
|
||||
0,
|
||||
"POST",
|
||||
1,
|
||||
new[] { "GET", "POST" },
|
||||
SyntaxNames.Json,
|
||||
new[] { SyntaxNames.Json, SyntaxNames.JavaScript, SyntaxNames.Liquid })
|
||||
new[] { SyntaxNames.Json, SyntaxNames.JavaScript, SyntaxNames.Liquid }
|
||||
)
|
||||
},
|
||||
OutputProperties = new[]
|
||||
{
|
||||
new ActivityOutputDescriptor
|
||||
(
|
||||
"Request",
|
||||
typeof(Models.WebhookRequestModel),
|
||||
"The received HTTP request."
|
||||
)
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Elsa.Activities.Webhooks.Models
|
||||
{
|
||||
public record WebhookRequestModel(Uri Path, string Method, IDictionary<string, string> QueryString, IDictionary<string, string> Headers, object? Body = default)
|
||||
{
|
||||
public T GetBody<T>() => (T)Body!;
|
||||
}
|
||||
}
|
||||
|
|
@ -46,11 +46,17 @@ export class ElsaCheckListProperty {
|
|||
}
|
||||
|
||||
render() {
|
||||
debugger
|
||||
const propertyDescriptor = this.propertyDescriptor;
|
||||
const propertyModel = this.propertyModel;
|
||||
const fieldId = propertyDescriptor.name;
|
||||
const items = this.items;
|
||||
const values = parseJson(this.currentValue) || [];
|
||||
let values = parseJson(this.currentValue) || [];
|
||||
|
||||
if (values.length == 0) {
|
||||
const defaultValue = this.propertyDescriptor.defaultValue;
|
||||
values = defaultValue ? defaultValue : [];
|
||||
}
|
||||
|
||||
return (
|
||||
<elsa-property-editor propertyDescriptor={propertyDescriptor}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ export class ElsaDropdownProperty {
|
|||
|
||||
async componentWillLoad() {
|
||||
const defaultSyntax = this.propertyDescriptor.defaultSyntax || SyntaxNames.Literal;
|
||||
this.currentValue = this.propertyModel.expressions[defaultSyntax] || '';
|
||||
this.currentValue = this.propertyModel.expressions[defaultSyntax] || undefined;
|
||||
this.items = await getSelectListItems(this.serverUrl, this.propertyDescriptor);
|
||||
}
|
||||
|
||||
|
|
@ -33,14 +33,20 @@ export class ElsaDropdownProperty {
|
|||
}
|
||||
|
||||
render() {
|
||||
debugger
|
||||
const propertyDescriptor = this.propertyDescriptor;
|
||||
const propertyModel = this.propertyModel;
|
||||
const propertyName = propertyDescriptor.name;
|
||||
const fieldId = propertyName;
|
||||
const fieldName = propertyName;
|
||||
const currentValue = this.currentValue;
|
||||
let currentValue = this.currentValue;
|
||||
const items = this.items;
|
||||
|
||||
if (currentValue == undefined) {
|
||||
const defaultValue = this.propertyDescriptor.defaultValue;
|
||||
currentValue = defaultValue ? defaultValue.toString() : undefined;
|
||||
}
|
||||
|
||||
return (
|
||||
<elsa-property-editor propertyDescriptor={propertyDescriptor}
|
||||
propertyModel={propertyModel}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ export class ElsaMultiLineProperty {
|
|||
|
||||
componentWillLoad() {
|
||||
const defaultSyntax = this.propertyDescriptor.defaultSyntax || SyntaxNames.Literal;
|
||||
this.currentValue = this.propertyModel.expressions[defaultSyntax] || '';
|
||||
this.currentValue = this.propertyModel.expressions[defaultSyntax] || undefined;
|
||||
}
|
||||
|
||||
getEditorHeight(options: any) {
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ export class ElsaRadioListProperty {
|
|||
items: any[];
|
||||
|
||||
async componentWillLoad() {
|
||||
debugger
|
||||
const defaultSyntax = this.propertyDescriptor.defaultSyntax || SyntaxNames.Literal;
|
||||
this.currentValue = this.propertyModel.expressions[defaultSyntax] || null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,9 +17,9 @@ export class ElsaSingleLineProperty {
|
|||
this.propertyModel.expressions[defaultSyntax] = this.currentValue = input.value;
|
||||
}
|
||||
|
||||
componentWillLoad() {
|
||||
componentWillLoad() {
|
||||
const defaultSyntax = this.propertyDescriptor.defaultSyntax || SyntaxNames.Literal;
|
||||
this.currentValue = this.propertyModel.expressions[defaultSyntax] || '';
|
||||
this.currentValue = this.propertyModel.expressions[defaultSyntax] || undefined;
|
||||
}
|
||||
|
||||
onDefaultSyntaxValueChanged(e: CustomEvent) {
|
||||
|
|
@ -27,6 +27,7 @@ export class ElsaSingleLineProperty {
|
|||
}
|
||||
|
||||
render() {
|
||||
|
||||
const propertyDescriptor = this.propertyDescriptor;
|
||||
const propertyModel = this.propertyModel;
|
||||
const propertyName = propertyDescriptor.name;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ export class ElsaSwitchCasesProperty {
|
|||
syntaxSwitchCount: number = 0;
|
||||
|
||||
async componentWillLoad() {
|
||||
debugger
|
||||
const propertyModel = this.propertyModel;
|
||||
const casesJson = propertyModel.expressions['Switch']
|
||||
this.cases = parseJson(casesJson) || [];
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ export const createElsaClient = function (serverUrl: string): ElsaClient {
|
|||
const response = await httpClient.get<PagedList<WorkflowInstanceSummary>>(`v1/workflow-instances${queryStringText}`);
|
||||
return response.data;
|
||||
},
|
||||
get: async id => {
|
||||
get: async id => {
|
||||
const response = await httpClient.get(`v1/workflow-instances/${id}`);
|
||||
return response.data;
|
||||
},
|
||||
|
|
@ -175,8 +175,8 @@ export const createElsaClient = function (serverUrl: string): ElsaClient {
|
|||
return response.data;
|
||||
}
|
||||
},
|
||||
designerApi: {
|
||||
runtimeSelectItemsApi: {
|
||||
designerApi: {
|
||||
runtimeSelectItemsApi: {
|
||||
get: async (providerTypeName: string, context?: any): Promise<Array<SelectListItem>> => {
|
||||
const response = await httpClient.post('v1/designer/runtime-select-list-items', {providerTypeName: providerTypeName, context: context});
|
||||
return response.data;
|
||||
|
|
|
|||
Loading…
Reference in a new issue