From fe8490cded6e99ec37a90e4af12b502280124df5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Konopski?= Date: Fri, 29 Nov 2024 13:05:10 +0100 Subject: [PATCH 1/3] fix: move template group right below documentation group closes https://github.com/camunda/camunda-modeler/issues/4617 --- .../ElementTemplatesPropertiesProvider.js | 2 +- .../ElementTemplatesPropertiesProvider.spec.js | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/cloud-element-templates/properties-panel/ElementTemplatesPropertiesProvider.js b/src/cloud-element-templates/properties-panel/ElementTemplatesPropertiesProvider.js index 8b554359..500ddf55 100644 --- a/src/cloud-element-templates/properties-panel/ElementTemplatesPropertiesProvider.js +++ b/src/cloud-element-templates/properties-panel/ElementTemplatesPropertiesProvider.js @@ -58,7 +58,7 @@ export default class ElementTemplatesPropertiesProvider { }; // (1) Add templates group - addGroupsAfter(ALWAYS_DISPLAYED_GROUPS, groups, [ templatesGroup ]); + addGroupsAfter('documentation', groups, [ templatesGroup ]); let elementTemplate = this._elementTemplates.get(element); diff --git a/test/spec/cloud-element-templates/properties-panel/ElementTemplatesPropertiesProvider.spec.js b/test/spec/cloud-element-templates/properties-panel/ElementTemplatesPropertiesProvider.spec.js index b4815b2d..a081b1c1 100644 --- a/test/spec/cloud-element-templates/properties-panel/ElementTemplatesPropertiesProvider.spec.js +++ b/test/spec/cloud-element-templates/properties-panel/ElementTemplatesPropertiesProvider.spec.js @@ -206,7 +206,7 @@ describe('provider/cloud-element-templates - ElementTemplatesPropertiesProvider' })); - it('should show only general, documentation, and execution listeners group, and template-related entries when entriesVisible is unset', + it('should show only general, documentation, template group and execution listeners group when entriesVisible is unset', inject(async function(elementRegistry, selection) { // given @@ -221,14 +221,14 @@ describe('provider/cloud-element-templates - ElementTemplatesPropertiesProvider' expectOnlyGroups(container, [ 'general', 'documentation', - 'Zeebe__ExecutionListeners', - 'ElementTemplates__Template' + 'ElementTemplates__Template', + 'Zeebe__ExecutionListeners' ]); }) ); - it('should show only general, documentation, and execution listeners group, and template-related entries when entriesVisible=false', + it('should show only general, documentation, template group and execution listeners group when entriesVisible=false', inject(async function(elementRegistry, selection) { // given @@ -243,14 +243,14 @@ describe('provider/cloud-element-templates - ElementTemplatesPropertiesProvider' expectOnlyGroups(container, [ 'general', 'documentation', - 'Zeebe__ExecutionListeners', - 'ElementTemplates__Template' + 'ElementTemplates__Template', + 'Zeebe__ExecutionListeners' ]); }) ); - it('should show only general, documentation, and execution listeners group, and template group when template is unknown', + it('should show only general, documentation, template group and execution listeners group when template is unknown', inject(async function(elementRegistry, selection) { // given @@ -265,8 +265,8 @@ describe('provider/cloud-element-templates - ElementTemplatesPropertiesProvider' expectOnlyGroups(container, [ 'general', 'documentation', - 'Zeebe__ExecutionListeners', - 'ElementTemplates__Template' + 'ElementTemplates__Template', + 'Zeebe__ExecutionListeners' ]); }) ); From 4ee37590d25ec39f5712f3b57d18e2155a1b865c Mon Sep 17 00:00:00 2001 From: Philipp Fromme Date: Mon, 2 Dec 2024 11:02:44 +0100 Subject: [PATCH 2/3] test: verify all always-visible groups --- ...atesPropertiesProvider.entries-visible.bpmn | 18 +++++++++++++----- .../ElementTemplatesPropertiesProvider.spec.js | 16 +++++++++++----- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/test/spec/cloud-element-templates/properties-panel/ElementTemplatesPropertiesProvider.entries-visible.bpmn b/test/spec/cloud-element-templates/properties-panel/ElementTemplatesPropertiesProvider.entries-visible.bpmn index 0073dccf..2cb619b1 100644 --- a/test/spec/cloud-element-templates/properties-panel/ElementTemplatesPropertiesProvider.entries-visible.bpmn +++ b/test/spec/cloud-element-templates/properties-panel/ElementTemplatesPropertiesProvider.entries-visible.bpmn @@ -1,11 +1,19 @@ - + - - + + + + + + - - + + + + + + diff --git a/test/spec/cloud-element-templates/properties-panel/ElementTemplatesPropertiesProvider.spec.js b/test/spec/cloud-element-templates/properties-panel/ElementTemplatesPropertiesProvider.spec.js index a081b1c1..9195fa0c 100644 --- a/test/spec/cloud-element-templates/properties-panel/ElementTemplatesPropertiesProvider.spec.js +++ b/test/spec/cloud-element-templates/properties-panel/ElementTemplatesPropertiesProvider.spec.js @@ -206,7 +206,7 @@ describe('provider/cloud-element-templates - ElementTemplatesPropertiesProvider' })); - it('should show only general, documentation, template group and execution listeners group when entriesVisible is unset', + it('should show only always-visible groups when entriesVisible is unset', inject(async function(elementRegistry, selection) { // given @@ -222,13 +222,14 @@ describe('provider/cloud-element-templates - ElementTemplatesPropertiesProvider' 'general', 'documentation', 'ElementTemplates__Template', + 'multiInstance', 'Zeebe__ExecutionListeners' ]); }) ); - it('should show only general, documentation, template group and execution listeners group when entriesVisible=false', + it('should show only always-visible groups when entriesVisible=false', inject(async function(elementRegistry, selection) { // given @@ -244,13 +245,14 @@ describe('provider/cloud-element-templates - ElementTemplatesPropertiesProvider' 'general', 'documentation', 'ElementTemplates__Template', + 'multiInstance', 'Zeebe__ExecutionListeners' ]); }) ); - it('should show only general, documentation, template group and execution listeners group when template is unknown', + it('should show only always-visible groups when template is unknown', inject(async function(elementRegistry, selection) { // given @@ -266,13 +268,14 @@ describe('provider/cloud-element-templates - ElementTemplatesPropertiesProvider' 'general', 'documentation', 'ElementTemplates__Template', + 'multiInstance', 'Zeebe__ExecutionListeners' ]); }) ); - it('should show all available groups when entriesVisible=true', + it('should show all groups when entriesVisible=true', inject(async function(elementRegistry, selection) { // given @@ -287,10 +290,13 @@ describe('provider/cloud-element-templates - ElementTemplatesPropertiesProvider' const groups = getGroupIds(container); expect(groups).to.contain('general'); - expect(groups).to.contain('ElementTemplates__Template'); expect(groups).to.contain('documentation'); + expect(groups).to.contain('ElementTemplates__Template'); + expect(groups).to.contain('Zeebe__ExecutionListeners'); + expect(groups).to.contain('Zeebe__ExtensionProperties'); }) ); + }); From a6316a78952f7a6a2f41f4ed8412e6b1aa27d996 Mon Sep 17 00:00:00 2001 From: Philipp Fromme Date: Mon, 2 Dec 2024 11:03:06 +0100 Subject: [PATCH 3/3] chore: simplify terminology --- .../ElementTemplatesPropertiesProvider.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cloud-element-templates/properties-panel/ElementTemplatesPropertiesProvider.js b/src/cloud-element-templates/properties-panel/ElementTemplatesPropertiesProvider.js index 500ddf55..40f364cd 100644 --- a/src/cloud-element-templates/properties-panel/ElementTemplatesPropertiesProvider.js +++ b/src/cloud-element-templates/properties-panel/ElementTemplatesPropertiesProvider.js @@ -15,7 +15,7 @@ import { getPropertyValue } from '../util/propertyUtil'; const LOWER_PRIORITY = 300; -const ALWAYS_DISPLAYED_GROUPS = [ +const ALWAYS_VISIBLE_GROUPS = [ 'general', 'documentation', 'multiInstance', @@ -75,7 +75,7 @@ export default class ElementTemplatesPropertiesProvider { // (3) apply entries visible if (getTemplateId(element)) { - groups = filterWithEntriesVisible(elementTemplate || {}, groups); + groups = getVisibleGroups(elementTemplate || {}, groups); } return groups; @@ -145,11 +145,11 @@ function addGroupsAfter(idOrIds, groups, groupsToAdd) { } } -function filterWithEntriesVisible(template, groups) { +function getVisibleGroups(template, groups) { if (!template.entriesVisible) { return groups.filter(group => { return ( - ALWAYS_DISPLAYED_GROUPS.includes(group.id) || + ALWAYS_VISIBLE_GROUPS.includes(group.id) || group.id.startsWith('ElementTemplates__') ); });