Fix that icon components are reused

This commit is contained in:
Sipke Schoorstra 2021-03-10 20:01:20 +01:00
parent 14bf27942a
commit 68675b685a
7 changed files with 48 additions and 39 deletions

View file

@ -2,7 +2,7 @@
export const ActivityIcon = props =>
(
<span class={`rounded-lg inline-flex p-3 bg-light-blue-50 text-light-blue-700 ring-4 ring-white`}>
<span class="rounded-lg inline-flex p-3 bg-light-blue-50 text-light-blue-700 ring-4 ring-white">
<svg class="h-6 w-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" aria-hidden="true">
<path stroke="none" d="M0 0h24v24H0z"/> <polyline points="21 12 17 12 14 20 10 4 7 12 3 12"/>
</svg>

View file

@ -2,7 +2,7 @@
export const BreakIcon = props =>
(
<span class={`rounded-lg inline-flex p-3 bg-green-50 text-green-700 ring-4 ring-white`}>
<span class="rounded-lg inline-flex p-3 bg-green-50 text-green-700 ring-4 ring-white">
<svg class="h-6 w-6" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z"/>
<path d="M14 8v-2a2 2 0 0 0 -2 -2h-7a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2 -2v-2"/>

View file

@ -2,7 +2,7 @@
export const CogIcon = props =>
(
<span class={`rounded-lg inline-flex p-3 bg-light-blue-50 text-light-blue-700 ring-4 ring-white`}>
<span class="rounded-lg inline-flex p-3 bg-light-blue-50 text-light-blue-700 ring-4 ring-white">
<svg class="h-6 w-6" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"/>
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/>

View file

@ -2,7 +2,7 @@
export const IfIcon = props =>
(
<span class={`rounded-lg inline-flex p-3 bg-green-50 text-green-700 ring-4 ring-white`}>
<span class="rounded-lg inline-flex p-3 bg-green-50 text-green-700 ring-4 ring-white">
<svg class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width={2} d="M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/>
</svg>

View file

@ -2,7 +2,7 @@
export const LoopIcon = props =>
(
<span class={`rounded-lg inline-flex p-3 bg-green-50 text-green-700 ring-4 ring-white`}>
<span class="rounded-lg inline-flex p-3 bg-green-50 text-green-700 ring-4 ring-white">
<svg class="h-6 w-6" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z"/>
<path d="M4 12v-3a3 3 0 0 1 3 -3h13m-3 -3l3 3l-3 3"/>

View file

@ -19,6 +19,10 @@ export class RunJavascriptPlugin implements ElsaPlugin {
const outcomes = props.find(x => x.name == 'Outcomes') || { expression: '' };
const expression = outcomes.expression;
context.outcomes = parseJson(expression) || ['Done'];
if(context.outcomes.length == 0)
context.outcomes = ['Done'];
context.bodyDisplay = undefined;
}
}

View file

@ -25,46 +25,51 @@ import {InterruptTriggerIcon} from "../components/icons/interrupt-trigger-icon";
import {CorrelateIcon} from "../components/icons/correlate-icon";
export class ActivityIconProvider {
map: Map<any> = {
'If': <IfIcon/>,
'Fork': <ForkIcon/>,
'Join': <JoinIcon/>,
'For': <LoopIcon/>,
'ForEach': <LoopIcon/>,
'While': <LoopIcon/>,
'ParallelForEach': <LoopIcon/>,
'Break': <BreakIcon/>,
'Switch': <SwitchIcon/>,
'SetVariable': <CogIcon/>,
'SetTransientVariable': <CogIcon/>,
'SetContextId': <CogIcon/>,
'Correlate': <CorrelateIcon/>,
'SetName': <CogIcon/>,
'RunWorkflow': <RunWorkflowIcon/>,
'Timer': <TimerIcon/>,
'StartAt': <TimerIcon/>,
'Cron': <TimerIcon/>,
'ClearTimer': <EraseIcon/>,
'SendSignal': <SendSignalIcon/>,
'SignalReceived': <SignalReceivedIcon/>,
'Finish': <FinishIcon/>,
'InterruptTrigger': <InterruptTriggerIcon/>,
'RunJavaScript': <ScriptIcon/>,
'ReadLine': <ReadLineIcon/>,
'WriteLine': <WriteLineIcon/>,
'HttpEndpoint': <HttpEndpointIcon/>,
'SendHttpRequest': <SendHttpRequestIcon/>,
'WriteHttpResponse': <WriteHttpResponseIcon/>,
'Redirect': <RedirectIcon/>,
'SendEmail': <SendEmailIcon/>
map: Map<() => any> = {
'If': () => <IfIcon/>,
'Fork': () => <ForkIcon/>,
'Join': () => <JoinIcon/>,
'For': () => <LoopIcon/>,
'ForEach': () => <LoopIcon/>,
'While': () => <LoopIcon/>,
'ParallelForEach': () => <LoopIcon/>,
'Break': () => <BreakIcon/>,
'Switch': () => <SwitchIcon/>,
'SetVariable': () => <CogIcon/>,
'SetTransientVariable': () => <CogIcon/>,
'SetContextId': () => <CogIcon/>,
'Correlate': () => <CorrelateIcon/>,
'SetName': () => <CogIcon/>,
'RunWorkflow': () => <RunWorkflowIcon/>,
'Timer': () => <TimerIcon/>,
'StartAt': () => <TimerIcon/>,
'Cron': () => <TimerIcon/>,
'ClearTimer': () => <EraseIcon/>,
'SendSignal': () => <SendSignalIcon/>,
'SignalReceived': () => <SignalReceivedIcon/>,
'Finish': () => <FinishIcon/>,
'InterruptTrigger': () => <InterruptTriggerIcon/>,
'RunJavaScript': () => <ScriptIcon/>,
'ReadLine': () => <ReadLineIcon/>,
'WriteLine': () => <WriteLineIcon/>,
'HttpEndpoint': () => <HttpEndpointIcon/>,
'SendHttpRequest': () => <SendHttpRequestIcon/>,
'WriteHttpResponse': () => <WriteHttpResponseIcon/>,
'Redirect': () => <RedirectIcon/>,
'SendEmail': () => <SendEmailIcon/>
};
register(activityType: string, icon: any) {
register(activityType: string, icon: () => any) {
this.map[activityType] = icon;
}
getIcon(activityType: string): any {
return this.map[activityType];
const provider = this.map[activityType];
if(!provider)
return undefined;
return provider();
}
}