Skip to content

Commit cd41b4a

Browse files
Akanksha	 SinghAkanksha	 Singh
authored andcommitted
feat(core): update workflow for jira action
1 parent d0a1cdb commit cd41b4a

18 files changed

+256
-50
lines changed
Binary file not shown.

projects/workflows-creator/src/lib/builder/group/group.component.html

Lines changed: 84 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,23 @@
5050
</span>
5151
</span>
5252
</div>
53-
<span *ngFor="let node of group.children; let i = index">
53+
<div
54+
*ngFor="let node of group.children; let i = index"
55+
[style.margin-bottom.px]="
56+
node.node.noMultiLine ? node.node.noMultiLine * 32 : null
57+
"
58+
>
5459
<workflow-node
5560
[ngClass]="{'last-node': i === group.children.length - 1}"
5661
[node]="node"
57-
[ngClass]="{'last-node': i === group.children.length - 1}"
5862
[isLast]="i === group.children.length - 1"
5963
[isFirst]="i === 0"
6064
[inputTemplate]="inputs"
6165
[popupTemplate]="nodePopup"
6266
(add)="openPopup(group.nodeType)"
6367
(remove)="onNodeRemove(i)"
6468
></workflow-node>
65-
</span>
69+
</div>
6670

6771
<popper-content #nodePopup>
6872
<div
@@ -81,47 +85,35 @@
8185
<ng-container
8286
*ngIf="!(input.isHidden && input.isHidden(nodeWithInput.node))"
8387
>
84-
{{
85-
(input.prefix.state
86-
? nodeWithInput.node.state.get(input.prefix.state)
87-
: input.prefix) || ''
88-
}}
89-
<div
90-
class="input-text"
91-
[popper]="inputPopper"
92-
[popperShowOnStart]="false"
93-
[popperHideOnClickOutside]="false"
94-
[popperHideOnScroll]="true"
95-
[popperTrigger]="'none'"
96-
[popperPlacement]="'bottom-start'"
97-
[popperApplyClass]="'workflow-popper'"
98-
(click)="onPoperClick($event, inputPopper)"
99-
(mouseover)="showTooltip($event, nodeWithInput, input)"
100-
(mouseout)="hideTooltip()"
101-
>
102-
<span
103-
class="value-text"
104-
*ngIf="input.getValueName(nodeWithInput.node.state)"
105-
title="{{ input.getValueName(nodeWithInput.node.state) }}"
106-
(click)="setInput(input, nodeWithInput)"
107-
>{{ input.getValueName(nodeWithInput.node.state) }}</span
108-
>
109-
<span
110-
class="placeholder-text"
111-
*ngIf="!input.getValueName(nodeWithInput.node.state)"
112-
>
113-
{{
114-
nodeWithInput.node.state.get(input.customPlaceholder?.state) ??
115-
input.placeholder
116-
}}
117-
</span>
118-
</div>
119-
{{
120-
(input.suffix?.state
121-
? nodeWithInput.node.state.get(input.suffix?.state)
122-
: input.suffix) || ''
123-
}}
88+
<ng-container *ngIf="input.nextLine; else defaultInput">
89+
<div class="input-next-line">
90+
<ng-container
91+
*ngTemplateOutlet="
92+
renderInput;
93+
context: {
94+
input: input,
95+
nodeWithInput: nodeWithInput,
96+
inputPopper: inputPopper
97+
}
98+
"
99+
></ng-container>
100+
</div>
101+
</ng-container>
102+
103+
<ng-template #defaultInput>
104+
<ng-container
105+
*ngTemplateOutlet="
106+
renderInput;
107+
context: {
108+
input: input,
109+
nodeWithInput: nodeWithInput,
110+
inputPopper: inputPopper
111+
}
112+
"
113+
></ng-container>
114+
</ng-template>
124115
</ng-container>
116+
125117
<popper-content #inputPopper>
126118
<ng-container
127119
*ngIf="
@@ -154,6 +146,55 @@
154146
</ng-container>
155147
</ng-template>
156148

149+
<ng-template
150+
#renderInput
151+
let-input="input"
152+
let-nodeWithInput="nodeWithInput"
153+
let-inputPopper="inputPopper"
154+
>
155+
{{
156+
(input.prefix?.state
157+
? nodeWithInput.node.state.get(input.prefix.state)
158+
: input.prefix) || ''
159+
}}
160+
<div
161+
class="input-text"
162+
[popper]="inputPopper"
163+
[popperShowOnStart]="false"
164+
[popperHideOnClickOutside]="false"
165+
[popperHideOnScroll]="true"
166+
[popperTrigger]="'none'"
167+
[popperPlacement]="'bottom-start'"
168+
[popperApplyClass]="'workflow-popper'"
169+
(click)="onPoperClick($event, inputPopper)"
170+
(mouseover)="showTooltip($event, nodeWithInput, input)"
171+
(mouseout)="hideTooltip()"
172+
>
173+
<span
174+
class="value-text"
175+
*ngIf="input.getValueName(nodeWithInput.node.state)"
176+
title="{{ input.getValueName(nodeWithInput.node.state) }}"
177+
(click)="setInput(input, nodeWithInput)"
178+
>
179+
{{ input.getValueName(nodeWithInput.node.state) }}
180+
</span>
181+
<span
182+
class="placeholder-text"
183+
*ngIf="!input.getValueName(nodeWithInput.node.state)"
184+
>
185+
{{
186+
nodeWithInput.node.state.get(input.customPlaceholder?.state) ??
187+
input.placeholder
188+
}}
189+
</span>
190+
</div>
191+
{{
192+
(input.suffix?.state
193+
? nodeWithInput.node.state.get(input.suffix?.state)
194+
: input.suffix) || ''
195+
}}
196+
</ng-template>
197+
157198
<ng-template
158199
#textTemplate
159200
let-callback="callback"

projects/workflows-creator/src/lib/builder/group/group.component.scss

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@
5858
}
5959
}
6060
}
61+
.input-next-line {
62+
display: block;
63+
height: 5px;
64+
}
6165

6266
.input-text {
6367
cursor: pointer;
@@ -66,7 +70,6 @@
6670
text-decoration: inherit;
6771
.placeholder-text {
6872
color: $placeholder-color;
69-
text-transform: lowercase;
7073
}
7174
.value-text {
7275
display: inline-block;

projects/workflows-creator/src/lib/enum.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ export enum EventTypes {
8686

8787
export enum ActionTypes {
8888
ChangeColumnValueAction = 'ChangeColumnValueAction',
89+
CreateJiraIssueAction = 'CreateJiraIssueAction',
8990
SendEmailAction = 'SendEmailAction',
9091
}
9192

@@ -110,6 +111,7 @@ export enum LocalizedStringKeys {
110111
TypeEmail = 'typeEmailLbl',
111112
SelectColumnTooltip = 'selectColumnTooltip',
112113
SetLbl = 'setLbl',
114+
CreateJiraIssue = 'createJiraIssueLbl',
113115
}
114116

115117
export enum IntervalType {
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import {Inject, Injectable} from '@angular/core';
2+
import {ENV} from '../../../../types';
3+
import {CreateStrategy, LinkStrategy} from '../../../../interfaces';
4+
import {ModdleElement} from '../../../../types/bpmn.types';
5+
import {UtilsService} from '../../../utils.service';
6+
import {CREATE_TASK_STRATEGY} from '../../strategies/create';
7+
import {LINK_BASIC_STRATEGY} from '../../strategies/link';
8+
import {ServiceTaskElement} from './service-task.task';
9+
import {ENV_TOKEN} from '../../../../token';
10+
11+
@Injectable()
12+
export class CreateJiraIssue extends ServiceTaskElement {
13+
constructor(
14+
@Inject(CREATE_TASK_STRATEGY)
15+
protected creator: CreateStrategy<ModdleElement>,
16+
@Inject(LINK_BASIC_STRATEGY)
17+
protected linker: LinkStrategy<ModdleElement>,
18+
@Inject(ENV_TOKEN) protected env: ENV,
19+
public utils: UtilsService,
20+
) {
21+
super();
22+
this.attributes = {
23+
...this.attributes,
24+
'camunda:topic': `create-jira-issue-${this.env?.envIdentifier}`,
25+
};
26+
}
27+
name = 'Create a Jira issue';
28+
properties = {};
29+
inputs = {
30+
name: 'jiraConfig',
31+
fields: {
32+
connectAccount: {state: 'jiraAccount'},
33+
selectProject: {state: 'jiraProject'},
34+
selectIssueType: {state: 'jiraIssueType'},
35+
mapFields: {state: 'jiraFieldMapping'},
36+
},
37+
};
38+
outputs = 'jiraIssueOutput';
39+
static identifier = 'CreateJiraIssue';
40+
41+
getIdentifier(): string {
42+
return CreateJiraIssue.identifier;
43+
}
44+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import {CreateJiraIssue} from '../../bpmn/elements/tasks/create-jira-issue.task';
2+
import {BpmnAction} from '../../../types/bpmn.types';
3+
import {LocalizedStringKeys} from '../../../enum';
4+
import {RecordOfAnyType} from '../../../types';
5+
import {
6+
JiraAccountConnectInput,
7+
JiraProjectSelectInput,
8+
JiraIssueTypeSelectInput,
9+
JiraFieldMappingInput,
10+
} from '..';
11+
12+
export class CreateJiraIssueAction extends BpmnAction {
13+
isElseAction: boolean;
14+
groupType: string;
15+
groupId: string;
16+
elements = [CreateJiraIssue.identifier];
17+
name = 'Create a Jira issue';
18+
statement = '';
19+
noMultiLine = 4;
20+
prompts = [
21+
JiraAccountConnectInput.identifier,
22+
JiraProjectSelectInput.identifier,
23+
JiraIssueTypeSelectInput.identifier,
24+
JiraFieldMappingInput.identifier,
25+
];
26+
static identifier = 'CreateJiraIssueAction';
27+
constructor(
28+
localizedStringMap: RecordOfAnyType,
29+
id: string,
30+
groupType: string,
31+
groupId: string,
32+
isElseAction: boolean,
33+
) {
34+
super();
35+
this.id = id;
36+
this.groupType = groupType;
37+
this.groupId = groupId;
38+
this.isElseAction = isElseAction || false;
39+
this.name =
40+
localizedStringMap[LocalizedStringKeys.CreateJiraIssue] ??
41+
'Create a Jira issue';
42+
}
43+
44+
getIdentifier(): string {
45+
return CreateJiraIssueAction.identifier;
46+
}
47+
}

projects/workflows-creator/src/lib/services/statement/inputs/column.input.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export class ColumnInput extends WorkflowPrompt {
99
inputKey = 'column';
1010
listNameField = 'text';
1111
listValueField = 'value';
12-
placeholder = 'Column';
12+
placeholder = 'column';
1313
options = <S extends RecordOfAnyType>(state: State<S>) =>
1414
state.get('columns');
1515
static identifier = 'ColumnInput';

projects/workflows-creator/src/lib/services/statement/inputs/criteria.input.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export class CriteriaInput extends WorkflowPrompt {
99
inputKey = 'column';
1010
listNameField = 'text';
1111
listValueField = 'value';
12-
placeholder = 'Criteria';
12+
placeholder = 'criteria';
1313
options = <S extends RecordOfAnyType>(state: State<S>) =>
1414
state.get('columns');
1515
static identifier = 'CriteriaInput';

projects/workflows-creator/src/lib/services/statement/inputs/email.input.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export class EmailDataInput extends WorkflowPrompt {
99
suffix = '';
1010
typeFunction = () => InputTypes.Email;
1111
inputKey = 'email';
12-
placeholder = 'Email';
12+
placeholder = 'email';
1313
static identifier = 'EmailDataInput';
1414

1515
getIdentifier(): string {

projects/workflows-creator/src/lib/services/statement/inputs/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
export * from './jira-account-connect.input';
2+
export * from './jira-project-select.input';
3+
export * from './jira-issue-type-select.input';
4+
export * from './jira-field-mapping.input';
15
export * from './column.input';
26
export * from './condition.input';
37
export * from './email.input';

0 commit comments

Comments
 (0)