@camunda/linting 3.38.0 → 3.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +75 -75
- package/assets/linting.css +37 -37
- package/lib/Linter.js +202 -202
- package/lib/Resolver.js +31 -31
- package/lib/compiled-config.js +82 -72
- package/lib/modeler/Linting.js +124 -124
- package/lib/modeler/LintingAnnotations.js +95 -95
- package/lib/modeler/OverlayComponent.js +60 -60
- package/lib/modeler/index.js +10 -10
- package/lib/plugins/bpmnLintPlugin.js +10 -10
- package/lib/plugins/index.js +4 -4
- package/lib/utils/error-messages.js +841 -828
- package/lib/utils/properties-panel.js +723 -712
- package/lib/utils/types.js +46 -46
- package/lib/utils/version.js +8 -8
- package/package.json +85 -85
package/lib/Resolver.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
export default class NestedResolver {
|
|
2
|
-
constructor(resolvers) {
|
|
3
|
-
this.resolvers = resolvers.slice().reverse();
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
resolveRule(pkg, ruleName) {
|
|
7
|
-
for (const resolver of this.resolvers) {
|
|
8
|
-
try {
|
|
9
|
-
return resolver.resolveRule(pkg, ruleName);
|
|
10
|
-
} catch (err) {
|
|
11
|
-
|
|
12
|
-
// ignore
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
throw new Error(`unknown rule <${ pkg }/${ ruleName }>`);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
resolveConfig(pkg, configName) {
|
|
20
|
-
for (const resolver of this.resolvers) {
|
|
21
|
-
try {
|
|
22
|
-
return resolver.resolveConfig(pkg, configName);
|
|
23
|
-
} catch (err) {
|
|
24
|
-
|
|
25
|
-
// ignore
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
throw new Error(`unknown config <${ pkg }/${ configName }>`);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
1
|
+
export default class NestedResolver {
|
|
2
|
+
constructor(resolvers) {
|
|
3
|
+
this.resolvers = resolvers.slice().reverse();
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
resolveRule(pkg, ruleName) {
|
|
7
|
+
for (const resolver of this.resolvers) {
|
|
8
|
+
try {
|
|
9
|
+
return resolver.resolveRule(pkg, ruleName);
|
|
10
|
+
} catch (err) {
|
|
11
|
+
|
|
12
|
+
// ignore
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
throw new Error(`unknown rule <${ pkg }/${ ruleName }>`);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
resolveConfig(pkg, configName) {
|
|
20
|
+
for (const resolver of this.resolvers) {
|
|
21
|
+
try {
|
|
22
|
+
return resolver.resolveConfig(pkg, configName);
|
|
23
|
+
} catch (err) {
|
|
24
|
+
|
|
25
|
+
// ignore
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
throw new Error(`unknown config <${ pkg }/${ configName }>`);
|
|
30
|
+
}
|
|
31
|
+
}
|
package/lib/compiled-config.js
CHANGED
|
@@ -48,6 +48,7 @@ const rules = {
|
|
|
48
48
|
"camunda-compat/inclusive-gateway": "error",
|
|
49
49
|
"camunda-compat/link-event": "error",
|
|
50
50
|
"camunda-compat/loop-characteristics": "error",
|
|
51
|
+
"camunda-compat/io-mapping": "error",
|
|
51
52
|
"camunda-compat/message-reference": "error",
|
|
52
53
|
"camunda-compat/no-binding-type": "error",
|
|
53
54
|
"camunda-compat/no-candidate-users": "error",
|
|
@@ -78,6 +79,7 @@ const rules = {
|
|
|
78
79
|
"camunda-compat/user-task-form": "error",
|
|
79
80
|
"camunda-compat/version-tag": "error",
|
|
80
81
|
"camunda-compat/wait-for-completion": "error",
|
|
82
|
+
"start-event-required": "error",
|
|
81
83
|
"ad-hoc-sub-process": "error",
|
|
82
84
|
"event-sub-process-typed-start-event": "error",
|
|
83
85
|
"link-event": "error",
|
|
@@ -175,146 +177,154 @@ import rule_18 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/loop-cha
|
|
|
175
177
|
|
|
176
178
|
cache['bpmnlint-plugin-camunda-compat/loop-characteristics'] = rule_18;
|
|
177
179
|
|
|
178
|
-
import rule_19 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/
|
|
180
|
+
import rule_19 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/io-mapping';
|
|
179
181
|
|
|
180
|
-
cache['bpmnlint-plugin-camunda-compat/
|
|
182
|
+
cache['bpmnlint-plugin-camunda-compat/io-mapping'] = rule_19;
|
|
181
183
|
|
|
182
|
-
import rule_20 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/
|
|
184
|
+
import rule_20 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/message-reference';
|
|
183
185
|
|
|
184
|
-
cache['bpmnlint-plugin-camunda-compat/
|
|
186
|
+
cache['bpmnlint-plugin-camunda-compat/message-reference'] = rule_20;
|
|
185
187
|
|
|
186
|
-
import rule_21 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-
|
|
188
|
+
import rule_21 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-binding-type';
|
|
187
189
|
|
|
188
|
-
cache['bpmnlint-plugin-camunda-compat/no-
|
|
190
|
+
cache['bpmnlint-plugin-camunda-compat/no-binding-type'] = rule_21;
|
|
189
191
|
|
|
190
|
-
import rule_22 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-
|
|
192
|
+
import rule_22 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-candidate-users';
|
|
191
193
|
|
|
192
|
-
cache['bpmnlint-plugin-camunda-compat/no-
|
|
194
|
+
cache['bpmnlint-plugin-camunda-compat/no-candidate-users'] = rule_22;
|
|
193
195
|
|
|
194
|
-
import rule_23 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-
|
|
196
|
+
import rule_23 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-execution-listeners';
|
|
195
197
|
|
|
196
|
-
cache['bpmnlint-plugin-camunda-compat/no-
|
|
198
|
+
cache['bpmnlint-plugin-camunda-compat/no-execution-listeners'] = rule_23;
|
|
197
199
|
|
|
198
|
-
import rule_24 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-
|
|
200
|
+
import rule_24 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-expression';
|
|
199
201
|
|
|
200
|
-
cache['bpmnlint-plugin-camunda-compat/no-
|
|
202
|
+
cache['bpmnlint-plugin-camunda-compat/no-expression'] = rule_24;
|
|
201
203
|
|
|
202
|
-
import rule_25 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-
|
|
204
|
+
import rule_25 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-loop';
|
|
203
205
|
|
|
204
|
-
cache['bpmnlint-plugin-camunda-compat/no-
|
|
206
|
+
cache['bpmnlint-plugin-camunda-compat/no-loop'] = rule_25;
|
|
205
207
|
|
|
206
|
-
import rule_26 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-
|
|
208
|
+
import rule_26 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-multiple-none-start-events';
|
|
207
209
|
|
|
208
|
-
cache['bpmnlint-plugin-camunda-compat/no-
|
|
210
|
+
cache['bpmnlint-plugin-camunda-compat/no-multiple-none-start-events'] = rule_26;
|
|
209
211
|
|
|
210
|
-
import rule_27 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-
|
|
212
|
+
import rule_27 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-priority-definition';
|
|
211
213
|
|
|
212
|
-
cache['bpmnlint-plugin-camunda-compat/no-
|
|
214
|
+
cache['bpmnlint-plugin-camunda-compat/no-priority-definition'] = rule_27;
|
|
213
215
|
|
|
214
|
-
import rule_28 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-
|
|
216
|
+
import rule_28 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-propagate-all-parent-variables';
|
|
215
217
|
|
|
216
|
-
cache['bpmnlint-plugin-camunda-compat/no-
|
|
218
|
+
cache['bpmnlint-plugin-camunda-compat/no-propagate-all-parent-variables'] = rule_28;
|
|
217
219
|
|
|
218
|
-
import rule_29 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-
|
|
220
|
+
import rule_29 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-signal-event-sub-process';
|
|
219
221
|
|
|
220
|
-
cache['bpmnlint-plugin-camunda-compat/no-
|
|
222
|
+
cache['bpmnlint-plugin-camunda-compat/no-signal-event-sub-process'] = rule_29;
|
|
221
223
|
|
|
222
|
-
import rule_30 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-task-
|
|
224
|
+
import rule_30 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-task-schedule';
|
|
223
225
|
|
|
224
|
-
cache['bpmnlint-plugin-camunda-compat/no-task-
|
|
226
|
+
cache['bpmnlint-plugin-camunda-compat/no-task-schedule'] = rule_30;
|
|
225
227
|
|
|
226
|
-
import rule_31 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-
|
|
228
|
+
import rule_31 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-task-listeners';
|
|
227
229
|
|
|
228
|
-
cache['bpmnlint-plugin-camunda-compat/no-
|
|
230
|
+
cache['bpmnlint-plugin-camunda-compat/no-task-listeners'] = rule_31;
|
|
229
231
|
|
|
230
|
-
import rule_32 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-
|
|
232
|
+
import rule_32 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-template';
|
|
231
233
|
|
|
232
|
-
cache['bpmnlint-plugin-camunda-compat/no-
|
|
234
|
+
cache['bpmnlint-plugin-camunda-compat/no-template'] = rule_32;
|
|
233
235
|
|
|
234
|
-
import rule_33 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-
|
|
236
|
+
import rule_33 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-version-tag';
|
|
235
237
|
|
|
236
|
-
cache['bpmnlint-plugin-camunda-compat/no-
|
|
238
|
+
cache['bpmnlint-plugin-camunda-compat/no-version-tag'] = rule_33;
|
|
237
239
|
|
|
238
|
-
import rule_34 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-zeebe-
|
|
240
|
+
import rule_34 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-zeebe-properties';
|
|
239
241
|
|
|
240
|
-
cache['bpmnlint-plugin-camunda-compat/no-zeebe-
|
|
242
|
+
cache['bpmnlint-plugin-camunda-compat/no-zeebe-properties'] = rule_34;
|
|
241
243
|
|
|
242
|
-
import rule_35 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/
|
|
244
|
+
import rule_35 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/no-zeebe-user-task';
|
|
243
245
|
|
|
244
|
-
cache['bpmnlint-plugin-camunda-compat/
|
|
246
|
+
cache['bpmnlint-plugin-camunda-compat/no-zeebe-user-task'] = rule_35;
|
|
245
247
|
|
|
246
|
-
import rule_36 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/
|
|
248
|
+
import rule_36 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/priority-definition';
|
|
247
249
|
|
|
248
|
-
cache['bpmnlint-plugin-camunda-compat/
|
|
250
|
+
cache['bpmnlint-plugin-camunda-compat/priority-definition'] = rule_36;
|
|
249
251
|
|
|
250
|
-
import rule_37 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/
|
|
252
|
+
import rule_37 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/zeebe-user-task';
|
|
251
253
|
|
|
252
|
-
cache['bpmnlint-plugin-camunda-compat/
|
|
254
|
+
cache['bpmnlint-plugin-camunda-compat/zeebe-user-task'] = rule_37;
|
|
253
255
|
|
|
254
|
-
import rule_38 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/
|
|
256
|
+
import rule_38 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/secrets';
|
|
255
257
|
|
|
256
|
-
cache['bpmnlint-plugin-camunda-compat/
|
|
258
|
+
cache['bpmnlint-plugin-camunda-compat/secrets'] = rule_38;
|
|
257
259
|
|
|
258
|
-
import rule_39 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/
|
|
260
|
+
import rule_39 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/sequence-flow-condition';
|
|
259
261
|
|
|
260
|
-
cache['bpmnlint-plugin-camunda-compat/
|
|
262
|
+
cache['bpmnlint-plugin-camunda-compat/sequence-flow-condition'] = rule_39;
|
|
261
263
|
|
|
262
|
-
import rule_40 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/
|
|
264
|
+
import rule_40 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/signal-reference';
|
|
263
265
|
|
|
264
|
-
cache['bpmnlint-plugin-camunda-compat/
|
|
266
|
+
cache['bpmnlint-plugin-camunda-compat/signal-reference'] = rule_40;
|
|
265
267
|
|
|
266
|
-
import rule_41 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/
|
|
268
|
+
import rule_41 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/start-event-form';
|
|
267
269
|
|
|
268
|
-
cache['bpmnlint-plugin-camunda-compat/
|
|
270
|
+
cache['bpmnlint-plugin-camunda-compat/start-event-form'] = rule_41;
|
|
269
271
|
|
|
270
|
-
import rule_42 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/
|
|
272
|
+
import rule_42 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/subscription';
|
|
271
273
|
|
|
272
|
-
cache['bpmnlint-plugin-camunda-compat/
|
|
274
|
+
cache['bpmnlint-plugin-camunda-compat/subscription'] = rule_42;
|
|
273
275
|
|
|
274
|
-
import rule_43 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/task-
|
|
276
|
+
import rule_43 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/task-listener';
|
|
275
277
|
|
|
276
|
-
cache['bpmnlint-plugin-camunda-compat/task-
|
|
278
|
+
cache['bpmnlint-plugin-camunda-compat/task-listener'] = rule_43;
|
|
277
279
|
|
|
278
|
-
import rule_44 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/
|
|
280
|
+
import rule_44 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/task-schedule';
|
|
279
281
|
|
|
280
|
-
cache['bpmnlint-plugin-camunda-compat/
|
|
282
|
+
cache['bpmnlint-plugin-camunda-compat/task-schedule'] = rule_44;
|
|
281
283
|
|
|
282
|
-
import rule_45 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/
|
|
284
|
+
import rule_45 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/timer';
|
|
283
285
|
|
|
284
|
-
cache['bpmnlint-plugin-camunda-compat/
|
|
286
|
+
cache['bpmnlint-plugin-camunda-compat/timer'] = rule_45;
|
|
285
287
|
|
|
286
|
-
import rule_46 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/user-task-
|
|
288
|
+
import rule_46 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/user-task-definition';
|
|
287
289
|
|
|
288
|
-
cache['bpmnlint-plugin-camunda-compat/user-task-
|
|
290
|
+
cache['bpmnlint-plugin-camunda-compat/user-task-definition'] = rule_46;
|
|
289
291
|
|
|
290
|
-
import rule_47 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/
|
|
292
|
+
import rule_47 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/user-task-form';
|
|
291
293
|
|
|
292
|
-
cache['bpmnlint-plugin-camunda-compat/
|
|
294
|
+
cache['bpmnlint-plugin-camunda-compat/user-task-form'] = rule_47;
|
|
293
295
|
|
|
294
|
-
import rule_48 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/
|
|
296
|
+
import rule_48 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/version-tag';
|
|
295
297
|
|
|
296
|
-
cache['bpmnlint-plugin-camunda-compat/
|
|
298
|
+
cache['bpmnlint-plugin-camunda-compat/version-tag'] = rule_48;
|
|
297
299
|
|
|
298
|
-
import rule_49 from 'bpmnlint/rules/
|
|
300
|
+
import rule_49 from 'bpmnlint-plugin-camunda-compat/rules/camunda-cloud/wait-for-completion';
|
|
299
301
|
|
|
300
|
-
cache['bpmnlint/
|
|
302
|
+
cache['bpmnlint-plugin-camunda-compat/wait-for-completion'] = rule_49;
|
|
301
303
|
|
|
302
|
-
import rule_50 from 'bpmnlint/rules/
|
|
304
|
+
import rule_50 from 'bpmnlint/rules/start-event-required';
|
|
303
305
|
|
|
304
|
-
cache['bpmnlint/
|
|
306
|
+
cache['bpmnlint/start-event-required'] = rule_50;
|
|
305
307
|
|
|
306
|
-
import rule_51 from 'bpmnlint/rules/
|
|
308
|
+
import rule_51 from 'bpmnlint/rules/ad-hoc-sub-process';
|
|
307
309
|
|
|
308
|
-
cache['bpmnlint/
|
|
310
|
+
cache['bpmnlint/ad-hoc-sub-process'] = rule_51;
|
|
309
311
|
|
|
310
|
-
import rule_52 from 'bpmnlint/rules/
|
|
312
|
+
import rule_52 from 'bpmnlint/rules/event-sub-process-typed-start-event';
|
|
311
313
|
|
|
312
|
-
cache['bpmnlint/
|
|
314
|
+
cache['bpmnlint/event-sub-process-typed-start-event'] = rule_52;
|
|
313
315
|
|
|
314
|
-
import rule_53 from 'bpmnlint/rules/
|
|
316
|
+
import rule_53 from 'bpmnlint/rules/link-event';
|
|
315
317
|
|
|
316
|
-
cache['bpmnlint/
|
|
318
|
+
cache['bpmnlint/link-event'] = rule_53;
|
|
317
319
|
|
|
318
|
-
import rule_54 from 'bpmnlint/rules/
|
|
320
|
+
import rule_54 from 'bpmnlint/rules/no-duplicate-sequence-flows';
|
|
319
321
|
|
|
320
|
-
cache['bpmnlint/
|
|
322
|
+
cache['bpmnlint/no-duplicate-sequence-flows'] = rule_54;
|
|
323
|
+
|
|
324
|
+
import rule_55 from 'bpmnlint/rules/sub-process-blank-start-event';
|
|
325
|
+
|
|
326
|
+
cache['bpmnlint/sub-process-blank-start-event'] = rule_55;
|
|
327
|
+
|
|
328
|
+
import rule_56 from 'bpmnlint/rules/single-blank-start-event';
|
|
329
|
+
|
|
330
|
+
cache['bpmnlint/single-blank-start-event'] = rule_56;
|
package/lib/modeler/Linting.js
CHANGED
|
@@ -1,124 +1,124 @@
|
|
|
1
|
-
import { getBusinessObject, is } from 'bpmn-js/lib/util/ModelUtil';
|
|
2
|
-
|
|
3
|
-
import { getErrors } from '../utils/properties-panel';
|
|
4
|
-
|
|
5
|
-
export default class Linting {
|
|
6
|
-
constructor(canvas, config, elementRegistry, eventBus, lintingAnnotations, selection) {
|
|
7
|
-
this._canvas = canvas;
|
|
8
|
-
this._elementRegistry = elementRegistry;
|
|
9
|
-
this._eventBus = eventBus;
|
|
10
|
-
this._lintingAnnotations = lintingAnnotations;
|
|
11
|
-
this._selection = selection;
|
|
12
|
-
|
|
13
|
-
this._active = config && config.active || false;
|
|
14
|
-
this._reports = [];
|
|
15
|
-
|
|
16
|
-
eventBus.on('selection.changed', () => this._update());
|
|
17
|
-
|
|
18
|
-
eventBus.on('lintingAnnotations.click', ({ report }) => this.showError(report));
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
showError(report) {
|
|
22
|
-
const {
|
|
23
|
-
id,
|
|
24
|
-
propertiesPanel = {}
|
|
25
|
-
} = report;
|
|
26
|
-
|
|
27
|
-
const selectableElement = this._getSelectableElement(id);
|
|
28
|
-
|
|
29
|
-
if (selectableElement) {
|
|
30
|
-
this._canvas.scrollToElement(selectableElement);
|
|
31
|
-
|
|
32
|
-
if (selectableElement === this._canvas.getRootElement()) {
|
|
33
|
-
this._selection.select();
|
|
34
|
-
} else {
|
|
35
|
-
this._selection.select(selectableElement);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const { entryIds = [] } = propertiesPanel;
|
|
40
|
-
|
|
41
|
-
// TODO(philippfromme): remove timeout once properties panel is fixed
|
|
42
|
-
setTimeout(() => {
|
|
43
|
-
this._eventBus.fire('propertiesPanel.showEntry', {
|
|
44
|
-
id: entryIds[ Math.max(0, entryIds.length - 1) ]
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
setErrors(reports) {
|
|
50
|
-
this._reports = reports;
|
|
51
|
-
|
|
52
|
-
this._update();
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
activate() {
|
|
56
|
-
this._active = true;
|
|
57
|
-
|
|
58
|
-
this._update();
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
deactivate() {
|
|
62
|
-
this._active = false;
|
|
63
|
-
|
|
64
|
-
this._update();
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
isActive() {
|
|
68
|
-
return this._active;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
_update() {
|
|
72
|
-
|
|
73
|
-
// set annotations
|
|
74
|
-
this._lintingAnnotations.setErrors(this.isActive() ? this._reports : []);
|
|
75
|
-
|
|
76
|
-
// set properties panel errors
|
|
77
|
-
const selectedElement = this._getSelectedElement();
|
|
78
|
-
|
|
79
|
-
this._eventBus.fire('propertiesPanel.setErrors', {
|
|
80
|
-
errors: getErrors(this._reports, selectedElement)
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
_getSelectableElement(id) {
|
|
85
|
-
let element = this._elementRegistry.get(id);
|
|
86
|
-
|
|
87
|
-
if (!element) {
|
|
88
|
-
element = this._elementRegistry.filter(element => {
|
|
89
|
-
return is(element, 'bpmn:Participant') && getBusinessObject(element).get('processRef').get('id') === id;
|
|
90
|
-
})[ 0 ];
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return element;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
_getSelectedElement() {
|
|
97
|
-
const selection = this._selection.get();
|
|
98
|
-
|
|
99
|
-
if (!selection || !selection.length) {
|
|
100
|
-
return this._canvas.getRootElement();
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const selectedElement = selection[ 0 ];
|
|
104
|
-
|
|
105
|
-
if (isLabel(selectedElement)) {
|
|
106
|
-
return selectedElement.labelTarget;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
return selectedElement;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
Linting.$inject = [
|
|
114
|
-
'canvas',
|
|
115
|
-
'config.linting',
|
|
116
|
-
'elementRegistry',
|
|
117
|
-
'eventBus',
|
|
118
|
-
'lintingAnnotations',
|
|
119
|
-
'selection'
|
|
120
|
-
];
|
|
121
|
-
|
|
122
|
-
function isLabel(element) {
|
|
123
|
-
return !!element.labelTarget;
|
|
124
|
-
}
|
|
1
|
+
import { getBusinessObject, is } from 'bpmn-js/lib/util/ModelUtil';
|
|
2
|
+
|
|
3
|
+
import { getErrors } from '../utils/properties-panel';
|
|
4
|
+
|
|
5
|
+
export default class Linting {
|
|
6
|
+
constructor(canvas, config, elementRegistry, eventBus, lintingAnnotations, selection) {
|
|
7
|
+
this._canvas = canvas;
|
|
8
|
+
this._elementRegistry = elementRegistry;
|
|
9
|
+
this._eventBus = eventBus;
|
|
10
|
+
this._lintingAnnotations = lintingAnnotations;
|
|
11
|
+
this._selection = selection;
|
|
12
|
+
|
|
13
|
+
this._active = config && config.active || false;
|
|
14
|
+
this._reports = [];
|
|
15
|
+
|
|
16
|
+
eventBus.on('selection.changed', () => this._update());
|
|
17
|
+
|
|
18
|
+
eventBus.on('lintingAnnotations.click', ({ report }) => this.showError(report));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
showError(report) {
|
|
22
|
+
const {
|
|
23
|
+
id,
|
|
24
|
+
propertiesPanel = {}
|
|
25
|
+
} = report;
|
|
26
|
+
|
|
27
|
+
const selectableElement = this._getSelectableElement(id);
|
|
28
|
+
|
|
29
|
+
if (selectableElement) {
|
|
30
|
+
this._canvas.scrollToElement(selectableElement);
|
|
31
|
+
|
|
32
|
+
if (selectableElement === this._canvas.getRootElement()) {
|
|
33
|
+
this._selection.select();
|
|
34
|
+
} else {
|
|
35
|
+
this._selection.select(selectableElement);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const { entryIds = [] } = propertiesPanel;
|
|
40
|
+
|
|
41
|
+
// TODO(philippfromme): remove timeout once properties panel is fixed
|
|
42
|
+
setTimeout(() => {
|
|
43
|
+
this._eventBus.fire('propertiesPanel.showEntry', {
|
|
44
|
+
id: entryIds[ Math.max(0, entryIds.length - 1) ]
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
setErrors(reports) {
|
|
50
|
+
this._reports = reports;
|
|
51
|
+
|
|
52
|
+
this._update();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
activate() {
|
|
56
|
+
this._active = true;
|
|
57
|
+
|
|
58
|
+
this._update();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
deactivate() {
|
|
62
|
+
this._active = false;
|
|
63
|
+
|
|
64
|
+
this._update();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
isActive() {
|
|
68
|
+
return this._active;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
_update() {
|
|
72
|
+
|
|
73
|
+
// set annotations
|
|
74
|
+
this._lintingAnnotations.setErrors(this.isActive() ? this._reports : []);
|
|
75
|
+
|
|
76
|
+
// set properties panel errors
|
|
77
|
+
const selectedElement = this._getSelectedElement();
|
|
78
|
+
|
|
79
|
+
this._eventBus.fire('propertiesPanel.setErrors', {
|
|
80
|
+
errors: getErrors(this._reports, selectedElement)
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
_getSelectableElement(id) {
|
|
85
|
+
let element = this._elementRegistry.get(id);
|
|
86
|
+
|
|
87
|
+
if (!element) {
|
|
88
|
+
element = this._elementRegistry.filter(element => {
|
|
89
|
+
return is(element, 'bpmn:Participant') && getBusinessObject(element).get('processRef').get('id') === id;
|
|
90
|
+
})[ 0 ];
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return element;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
_getSelectedElement() {
|
|
97
|
+
const selection = this._selection.get();
|
|
98
|
+
|
|
99
|
+
if (!selection || !selection.length) {
|
|
100
|
+
return this._canvas.getRootElement();
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const selectedElement = selection[ 0 ];
|
|
104
|
+
|
|
105
|
+
if (isLabel(selectedElement)) {
|
|
106
|
+
return selectedElement.labelTarget;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return selectedElement;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
Linting.$inject = [
|
|
114
|
+
'canvas',
|
|
115
|
+
'config.linting',
|
|
116
|
+
'elementRegistry',
|
|
117
|
+
'eventBus',
|
|
118
|
+
'lintingAnnotations',
|
|
119
|
+
'selection'
|
|
120
|
+
];
|
|
121
|
+
|
|
122
|
+
function isLabel(element) {
|
|
123
|
+
return !!element.labelTarget;
|
|
124
|
+
}
|