Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;

/**
* Class, that holds configurable attributes of menu item.
Expand All @@ -26,6 +24,7 @@ public class MenuItemBody {

private String menuIcon = "filter_none";
private I18nString menuName;
private List<String> allowedAuthorities = List.of("ROLE_USER");
private Map<String, I18nString> allowedRoles = new HashMap<>();
private Map<String, I18nString> bannedRoles = new HashMap<>();
private boolean useCustomView = false;
Expand Down Expand Up @@ -198,6 +197,7 @@ public ToDataSetOutcome toDataSet(String parentId, String nodePath, Case viewCas
outcome.putDataSetEntry(MenuItemConstants.FIELD_CUSTOM_VIEW_SELECTOR, FieldType.TEXT,
this.customViewSelector);
outcome.putDataSetEntry(MenuItemConstants.FIELD_IS_AUTO_SELECT, FieldType.BOOLEAN, this.isAutoSelect);
outcome.putDataSetEntry(MenuItemConstants.FIELD_ALLOWED_AUTHORITIES, FieldType.MULTICHOICE_MAP, this.allowedAuthorities);
outcome.putDataSetEntryOptions(MenuItemConstants.FIELD_ALLOWED_ROLES, FieldType.MULTICHOICE_MAP, this.allowedRoles);
outcome.putDataSetEntryOptions(MenuItemConstants.FIELD_BANNED_ROLES, FieldType.MULTICHOICE_MAP, this.bannedRoles);
outcome.putDataSetEntry(MenuItemConstants.FIELD_CONFIGURATION_TEMPLATES, FieldType.ENUMERATION_MAP, this.configurationTemplateIdentifier);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public class MenuItemConstants {
public static final String FIELD_IS_FOLDER = "is_folder";
public static final String FIELD_IDENTIFIER = "menu_item_identifier";
public static final String FIELD_APPEND_MENU_ITEM = "append_menu_item_stringId";
public static final String FIELD_ALLOWED_AUTHORITIES = "allowed_authorities";
public static final String FIELD_ALLOWED_ROLES = "allowed_roles";
public static final String FIELD_BANNED_ROLES = "banned_roles";
public static final String FIELD_MENU_NAME = "menu_name";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.netgrif.application.engine.menu.utils.MenuItemUtils;
import com.netgrif.application.engine.petrinet.domain.I18nString;

import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
Expand All @@ -26,16 +27,19 @@ public class MenuItemTemplateHolder {
* The key is the template identifier (String), and the value is the Template instance.
* </p>
*/
private final static Map<String, Template> templates = Map.of(
TabbedCaseViewTemplate.IDENTIFIER, new TabbedCaseViewTemplate(),
TabbedTaskViewTemplate.IDENTIFIER, new TabbedTaskViewTemplate(),
SimpleCaseViewTemplate.IDENTIFIER, new SimpleCaseViewTemplate(),
SimpleTaskViewTemplate.IDENTIFIER, new SimpleTaskViewTemplate(),
SingleTaskViewTemplate.IDENTIFIER, new SingleTaskViewTemplate(),
TabbedTicketViewTemplate.IDENTIFIER, new TabbedTicketViewTemplate(),
CustomViewTemplate.IDENTIFIER, new CustomViewTemplate(),
FolderTemplate.IDENTIFIER, new FolderTemplate()
);
private final static Map<String, Template> templates;

static {
templates = new LinkedHashMap<>();
templates.put(FolderTemplate.IDENTIFIER, new FolderTemplate());
templates.put(TabbedCaseViewTemplate.IDENTIFIER, new TabbedCaseViewTemplate());
templates.put(TabbedTaskViewTemplate.IDENTIFIER, new TabbedTaskViewTemplate());
templates.put(SimpleCaseViewTemplate.IDENTIFIER, new SimpleCaseViewTemplate());
templates.put(SimpleTaskViewTemplate.IDENTIFIER, new SimpleTaskViewTemplate());
templates.put(SingleTaskViewTemplate.IDENTIFIER, new SingleTaskViewTemplate());
templates.put(TabbedTicketViewTemplate.IDENTIFIER, new TabbedTicketViewTemplate());
templates.put(CustomViewTemplate.IDENTIFIER, new CustomViewTemplate());
}


/**
Expand Down Expand Up @@ -116,7 +120,9 @@ public static Map<String, I18nString> transformToOptions() {
return templates.entrySet().stream()
.collect(Collectors.toMap(
Map.Entry::getKey,
entry -> entry.getValue().getName()
entry -> entry.getValue().getName(),
(a, b) -> a,
LinkedHashMap::new
));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ public static String findTaskIdInCase(Case useCase, String transId) {
* */
public static boolean isCyclicNodePath(Case folderItem, String destUri) {
String oldNodePath = (String) folderItem.getFieldValue(MenuItemConstants.FIELD_NODE_PATH);
return oldNodePath != null && destUri.contains(oldNodePath);
if (oldNodePath == null || destUri == null) {
return false;
}
return destUri.contains(oldNodePath + "/") || destUri.endsWith(oldNodePath);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,24 @@
<id>show_create_case_button</id>
<title name="show_create_case_button">Show create case button?</title>
<init>true</init>
<event type="set">
<id>0</id>
<actions phase="post">
<action>
trans: t.create_case_btn_settings,
show_create_case_button: f.show_create_case_button,
require_title_in_creation: f.require_title_in_creation,
create_case_button_title: f.create_case_button_title,
create_case_button_icon: f.create_case_button_icon,
create_case_button_icon_preview: f.create_case_button_icon_preview,
banned_nets_in_creation: f.banned_nets_in_creation;

make [require_title_in_creation, create_case_button_title, create_case_button_icon, create_case_button_icon_preview, banned_nets_in_creation], hidden on trans when { !show_create_case_button.value }
make [require_title_in_creation, create_case_button_title, create_case_button_icon, banned_nets_in_creation], editable on trans when { show_create_case_button.value }
make create_case_button_icon_preview, visible on trans when { show_create_case_button.value }
</action>
</actions>
</event>
</data>
<data type="boolean" immediate="true">
<id>require_title_in_creation</id>
Expand Down Expand Up @@ -351,6 +369,20 @@
<id>case_all_allowed_nets</id>
<title name="case_all_allowed_nets">All allowed nets?</title>
<init>true</init>
<event type="set">
<id>0</id>
<actions phase="post">
<action>
trans: t.settings,
case_all_allowed_nets: f.case_all_allowed_nets,
case_allowed_nets: f.case_allowed_nets,
case_inherit_allowed_nets: f.case_inherit_allowed_nets;

make [case_allowed_nets, case_inherit_allowed_nets], hidden on trans when { case_all_allowed_nets.value }
make [case_allowed_nets, case_inherit_allowed_nets], editable on trans when { !case_all_allowed_nets.value }
</action>
</actions>
</event>
</data>
<data type="boolean">
<id>case_inherit_allowed_nets</id>
Expand Down Expand Up @@ -534,7 +566,7 @@
<id>case_show_more_menu</id>
<logic>
<behavior>editable</behavior>
</logic>
</logic>
<layout>
<x>1</x>
<y>0</y>
Expand Down Expand Up @@ -562,7 +594,7 @@
<id>case_empty_content_text</id>
<logic>
<behavior>editable</behavior>
</logic>
</logic>
<layout>
<x>0</x>
<y>1</y>
Expand All @@ -576,7 +608,7 @@
<id>case_empty_content_icon</id>
<logic>
<behavior>editable</behavior>
</logic>
</logic>
<layout>
<x>1</x>
<y>1</y>
Expand All @@ -590,7 +622,7 @@
<id>case_empty_content_icon_preview</id>
<logic>
<behavior>visible</behavior>
</logic>
</logic>
<layout>
<x>2</x>
<y>1</y>
Expand All @@ -604,7 +636,7 @@
<id>case_all_allowed_nets</id>
<logic>
<behavior>editable</behavior>
</logic>
</logic>
<layout>
<x>0</x>
<y>2</y>
Expand All @@ -617,7 +649,7 @@
<dataRef>
<id>case_allowed_nets</id>
<logic>
<behavior>editable</behavior>
<behavior>hidden</behavior>
</logic>
<layout>
<x>1</x>
Expand All @@ -631,8 +663,8 @@
<dataRef>
<id>case_inherit_allowed_nets</id>
<logic>
<behavior>editable</behavior>
</logic>
<behavior>hidden</behavior>
</logic>
<layout>
<x>2</x>
<y>2</y>
Expand Down Expand Up @@ -1063,7 +1095,6 @@
<id>case_headers_sort_mode_active</id>
<logic>
<behavior>editable</behavior>
<behavior>required</behavior>
</logic>
<layout>
<x>0</x>
Expand Down
Loading
Loading