Skip to content

Commit

Permalink
Merge branch 'feature/gui-wrapper' of https://github.com/Evolveum/mid…
Browse files Browse the repository at this point in the history
…point into feature/gui-wrapper
  • Loading branch information
katkav committed Jun 6, 2019
2 parents 06db8b7 + 0cdf45d commit 6f47c3f
Show file tree
Hide file tree
Showing 132 changed files with 4,384 additions and 2,638 deletions.
Expand Up @@ -48,6 +48,9 @@ public class ComponentConstants {
public static final QName UI_CASE_TAB_WORKITEMS = new QName(NS_COMPONENTS_PREFIX, "caseTabWorkitems");
public static final String UI_CASE_TAB_WORKITEMS_URL = QNameUtil.qNameToUri(UI_CASE_TAB_WORKITEMS);

public static final QName UI_CASE_TAB_CHILD_CASES = new QName(NS_COMPONENTS_PREFIX, "caseTabChildCases");
public static final String UI_CASE_TAB_CHILD_CASES_URL = QNameUtil.qNameToUri(UI_CASE_TAB_CHILD_CASES);

public static final QName UI_CASE_TAB_APPROVAL = new QName(NS_COMPONENTS_PREFIX, "caseTabApproval");
public static final String UI_CASE_TAB_APPROVAL_URL = QNameUtil.qNameToUri(UI_CASE_TAB_WORKITEMS);

Expand Down
Expand Up @@ -22,6 +22,7 @@
import com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder;
import com.evolveum.midpoint.gui.impl.component.icon.IconCssStyle;
import com.evolveum.midpoint.web.component.MultifunctionalButton;
import com.evolveum.midpoint.web.component.util.VisibleBehaviour;
import com.evolveum.midpoint.xml.ns._public.common.common_3.DisplayType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.IconType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType;
Expand Down Expand Up @@ -165,6 +166,7 @@ protected DisplayType getAdditionalButtonDisplayType(S buttonObject){
return getNewObjectButtonAdditionalDisplayType(buttonObject);
}
};
createNewObjectButton.add(new VisibleBehaviour(() -> isCreateNewObjectEnabled()));
createNewObjectButton.add(AttributeAppender.append("class", "btn-margin-right"));
buttonsList.add(createNewObjectButton);

Expand Down Expand Up @@ -260,6 +262,10 @@ private boolean isRawOrNoFetchOption(Collection<SelectorOptions<GetOperationOpti
return false;
}

protected boolean isCreateNewObjectEnabled(){
return true;
}

protected List<S> getNewObjectInfluencesList(){
return new ArrayList<>();
}
Expand Down
Expand Up @@ -401,7 +401,12 @@ protected Integer load() {
Task task = createSimpleTask(OPERATION_LOAD_WORK_ITEM_COUNT);
S_FilterEntryOrEmpty q = getPrismContext().queryFor(CaseWorkItemType.class);
ObjectQuery query = QueryUtils.filterForAssignees(q, getPrincipal(),
OtherPrivilegesLimitationType.F_APPROVAL_WORK_ITEMS, getRelationRegistry()).build();
OtherPrivilegesLimitationType.F_APPROVAL_WORK_ITEMS, getRelationRegistry())
.and()
.not()
.item(PrismConstants.T_PARENT, CaseType.F_STATE)
.eq(SchemaConstants.CASE_STATE_CLOSED)
.build();
return getModelService().countContainers(CaseWorkItemType.class, query, null, task, task.getResult());
} catch (SchemaException | SecurityViolationException | ExpressionEvaluationException | ObjectNotFoundException | CommunicationException | ConfigurationException e) {
LoggingUtils.logExceptionAsWarning(LOGGER, "Couldn't load work item count", e);
Expand Down Expand Up @@ -1842,29 +1847,15 @@ public String getBubbleLabel() {
};

addMenuItem(item, "PageAdmin.menu.top.cases.listAll", GuiStyleConstants.EVO_CASE_OBJECT_ICON, PageCases.class);
// addMenuItem(item, "PageAdmin.menu.top.cases.approvalCases", PageCasesAll.class);
// addMenuItem(item, "PageAdmin.menu.top.cases.myApprovalCases", PageCasesAll.class);
// addMenuItem(item, "PageAdmin.menu.top.cases.myRequests", PageCasesAll.class);
// addMenuItem(item, "PageAdmin.menu.top.cases.requestsAboutMe", PageCasesAll.class);
// addMenuItem(item, "PageAdmin.menu.top.cases.manualProvisionCases", PageCasesAll.class);
// addMenuItem(item, "PageAdmin.menu.top.cases.myManualProvisionCases", PageCasesAll.class);
addMenuItem(item, "PageAdmin.menu.top.caseWorkItems.listAll", GuiStyleConstants.CLASS_OBJECT_WORK_ITEM_ICON, PageCaseWorkItemsAll.class);
addMenuItem(item, "PageAdmin.menu.top.caseWorkItems.list", PageCaseWorkItemsAllocatedToMe.class);

// addMenuItem(item, "PageAdmin.menu.top.workItems.list", PageWorkItemsAllocatedToMe.class);
// addMenuItem(item, "PageAdmin.menu.top.workItems.listClaimable", PageWorkItemsClaimable.class);
// addMenuItem(item, "PageAdmin.menu.top.workItems.listAttorney", PageAttorneySelection.class);
// addMenuItem(item, "PageAdmin.menu.top.workItems.listAll", PageWorkItemsAll.class);
// addMenuItem(item, "PageAdmin.menu.top.workItems.listProcessInstancesRequestedBy", PageProcessInstancesRequestedBy.class);
// addMenuItem(item, "PageAdmin.menu.top.workItems.listProcessInstancesRequestedFor", PageProcessInstancesRequestedFor.class);
// addMenuItem(item, "PageAdmin.menu.top.workItems.listProcessInstancesAll", PageProcessInstancesAll.class);
// addMenuItem(item, "PageAdmin.menu.top.cases.list", PageCasesAllocatedToMe.class);

createFocusPageViewMenu(item.getItems(), "PageAdmin.menu.top.caseWorkItems.view", PageCaseWorkItem.class);

MenuItem newCaseMenu = new MenuItem(createStringResource("PageAdmin.menu.top.case.new"), GuiStyleConstants.CLASS_PLUS_CIRCLE, PageCase.class, null,
new VisibleEnableBehaviour());
item.getItems().add(newCaseMenu);
//todo for now disable the possibility to create case manually
// MenuItem newCaseMenu = new MenuItem(createStringResource("PageAdmin.menu.top.case.new"), GuiStyleConstants.CLASS_PLUS_CIRCLE, PageCase.class, null,
// new VisibleEnableBehaviour());
// item.getItems().add(newCaseMenu);

return item;
}
Expand Down
Expand Up @@ -43,7 +43,12 @@
import javax.xml.datatype.XMLGregorianCalendar;
import javax.xml.namespace.QName;

import com.evolveum.midpoint.model.api.visualizer.Scene;
import com.evolveum.midpoint.schema.util.*;
import com.evolveum.midpoint.web.component.prism.show.SceneDto;
import com.evolveum.midpoint.web.component.prism.show.SceneUtil;
import com.evolveum.midpoint.web.page.admin.cases.PageCase;
import com.evolveum.midpoint.web.page.admin.workflow.WorkItemDetailsPanel;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.StringUtils;
Expand Down Expand Up @@ -161,10 +166,6 @@
import com.evolveum.midpoint.schema.processor.ResourceSchema;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.schema.result.OperationResultStatus;
import com.evolveum.midpoint.schema.util.LocalizationUtil;
import com.evolveum.midpoint.schema.util.ObjectTypeUtil;
import com.evolveum.midpoint.schema.util.ResourceTypeUtil;
import com.evolveum.midpoint.schema.util.ShadowUtil;
import com.evolveum.midpoint.security.api.AuthorizationConstants;
import com.evolveum.midpoint.security.api.MidPointPrincipal;
import com.evolveum.midpoint.task.api.Task;
Expand Down Expand Up @@ -3859,6 +3860,35 @@ public static <T> List<T> sortDropDownChoices(IModel<? extends List<? extends T>
return sortedList;
}

public static SceneDto createSceneDto(CaseWorkItemType caseWorkItem, PageBase pageBase, String operation){
if (caseWorkItem == null){
return null;
}
return createSceneDto(CaseTypeUtil.getCase(caseWorkItem), pageBase, operation);
}

public static SceneDto createSceneDto(CaseType caseObject, PageBase pageBase, String operation){
if (caseObject == null || caseObject.getWorkflowContext() == null) {
return null;
}
if (!(caseObject.getWorkflowContext().getProcessorSpecificState() instanceof WfPrimaryChangeProcessorStateType)) {
return null;
}
ObjectReferenceType objectRef = caseObject.getObjectRef();
WfPrimaryChangeProcessorStateType state = (WfPrimaryChangeProcessorStateType) caseObject.getWorkflowContext().getProcessorSpecificState();

OperationResult result = new OperationResult(operation);
Task task = pageBase.createSimpleTask(operation);
try {
Scene deltasScene = SceneUtil.visualizeObjectTreeDeltas(state.getDeltasToProcess(), "pageWorkItem.delta",
pageBase.getPrismContext(), pageBase.getModelInteractionService(), objectRef, task, result);
return new SceneDto(deltasScene);
} catch (SchemaException | ExpressionEvaluationException ex){
LOGGER.error("Unable to create delta visualization for case " + caseObject.getName(), ex.getLocalizedMessage());
}
return null;
}

public static String getMidpointCustomSystemName(PageBase pageBase, String defaultSystemNameKey){
DeploymentInformationType deploymentInfo = MidPointApplication.get().getDeploymentInfo();
String subscriptionId = deploymentInfo != null ? deploymentInfo.getSubscriptionIdentifier() : null;
Expand Down
Expand Up @@ -15,6 +15,8 @@
*/
package com.evolveum.midpoint.gui.impl.factory;

import java.io.Serializable;

import javax.annotation.PostConstruct;
import javax.annotation.Priority;

Expand All @@ -36,11 +38,11 @@
*/
@Component
@Priority(1000)
public class ItemPathPanelFactory extends AbstractGuiComponentFactory<ItemPathType> {
public class ItemPathPanelFactory extends AbstractGuiComponentFactory<ItemPathType> implements Serializable {

private static final long serialVersionUID = 1L;

@Autowired private GuiComponentRegistry registry;
@Autowired private transient GuiComponentRegistry registry;

@PostConstruct
public void register() {
Expand Down
Expand Up @@ -76,6 +76,9 @@ public PrismObjectWrapper<O> createObjectWrapper(PrismObject<O> object, ItemStat
}

PrismObjectWrapper<O> objectWrapper = createObjectWrapper(object, status);
if (context.getReadOnly() != null) {
objectWrapper.setReadOnly(context.getReadOnly().booleanValue());
}
context.setShowEmpty(ItemStatus.ADDED == status ? true : false);
PrismContainerValueWrapper<O> valueWrapper = createValueWrapper(objectWrapper, object.getValue(), ItemStatus.ADDED == status ? ValueStatus.ADDED : ValueStatus.NOT_CHANGED, context);
objectWrapper.getValues().add(valueWrapper);
Expand Down
Expand Up @@ -17,7 +17,6 @@
<!DOCTYPE html>
<html xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
<div class="row">
<div wicket:id="labelContainer">
<span wicket:id="label"/>

Expand All @@ -32,6 +31,5 @@
<i class="helpTextIcon" wicket:id="deprecated"/>
<i class="helpTextIcon" wicket:id="experimental"/>
</div>
</div>
</wicket:panel>
</html>
Expand Up @@ -21,18 +21,32 @@
<div class="col-md-3" wicket:id="localizedValueLabel" />
<div wicket:id="localizedValueWithButton" class="input-group">
<div class="pull-left col-md-11" style="padding-right: 0px !important;" wicket:id="localizedValue"/>
<a class="col-md-1" wicket:id="showHideLanguagesLocalized" style="padding-left: 0px !important; height: 30px !important;">
<i class="form-control fa fa-language" style="border-left: none !important; height: 30px !important; background-color:#eee;"></i> 
</a>
<div class="col-md-1" style="padding-left: 0px !important;">
<div class="form-control col-md-12" style="border-left: none !important;height: 30px !important;padding-left: 0px !important; background-color:#eee;">
<i class="fa fa-language" style="float:right;cursor: pointer;" wicket:id="showHideLanguagesLocalized"/>
</div>
</div>
<!-- <a class="col-md-1" wicket:id="showHideLanguagesLocalized" style="padding-left: 0px !important; height: 30px !important;">
<div class="form-control" style="border-left: none !important; height: 30px !important; background-color:#eee;">
<i class="fa fa-language" style="float:right;"/>
</div> 
</a> -->
</div>
</div>
<div wicket:id="originValueContainer" class="row prism-property">
<div class="col-md-3" wicket:id="originValueLabel" />
<div wicket:id="origValueWithButton" class="input-group">
<div class="pull-left col-md-11" style="padding-right: 0px !important;" wicket:id="origValue"/>
<a class="col-md-1" wicket:id="showHideLanguagesOrig" style="padding-left: 0px !important; height: 30px !important;">
<i class="form-control fa fa-language" style="border-left: none !important; height: 30px !important;"></i> 
</a>
<div class="col-md-1" style="padding-left: 0px !important;">
<div class="form-control col-md-12" style="border-left: none !important;height: 30px !important;padding-left: 0px !important;">
<i class="fa fa-language" style="float:right;cursor: pointer;" wicket:id="showHideLanguagesOrig"/>
</div>
</div>
<!-- <a class="col-md-1" wicket:id="showHideLanguagesOrig" style="padding-left: 0px !important; height: 30px !important;">
<div class="form-control" style="border-left: none !important; height: 30px !important;">
<i class="fa fa-language" style="float:right;"/>
</div> 
</a> -->
</div>
</div>
<div wicket:id="fullDataContainer">
Expand Down
Expand Up @@ -115,7 +115,7 @@ public void onClick(AjaxRequestTarget target) {
}
};
showHideLanguagesLocalizedButton.setOutputMarkupId(true);
showHideLanguagesLocalizedButton.add(AttributeAppender.append("style", "cursor: pointer;"));
// showHideLanguagesLocalizedButton.add(AttributeAppender.append("style", "cursor: pointer;"));
localizedValueWithButton.add(showHideLanguagesLocalizedButton);

WebMarkupContainer originValueContainer = new WebMarkupContainer(ID_ORIGIN_VALUE_CONTAINER);
Expand Down Expand Up @@ -309,7 +309,7 @@ public void onClick(AjaxRequestTarget target) {
}
};
showHideLanguagesButton.setOutputMarkupId(true);
showHideLanguagesButton.add(AttributeAppender.append("style", "cursor: pointer;"));
// showHideLanguagesButton.add(AttributeAppender.append("style", "cursor: pointer;"));
origValueWithButton.add(showHideLanguagesButton);

}
Expand Down
Expand Up @@ -275,7 +275,8 @@ public StringResourceModel getTitle() {
@Override
public boolean isVisible(){
return WebComponentUtil.isAuthorized(AuthorizationConstants.AUTZ_UI_CONFIGURATION_URL,
AuthorizationConstants.AUTZ_UI_CONFIGURATION_DEBUG_URL);
AuthorizationConstants.AUTZ_UI_CONFIGURATION_DEBUG_URL) &&
!getObjectWrapper().isReadOnly();
}
});
mainForm.add(editXmlButton);
Expand Down
Expand Up @@ -135,7 +135,7 @@ public class SearchFactory {
SEARCHABLE_OBJECTS.put(CaseWorkItemType.class, Arrays.asList(
ItemPath.create(CaseWorkItemType.F_ASSIGNEE_REF),
ItemPath.create(CaseWorkItemType.F_ORIGINAL_ASSIGNEE_REF),
ItemPath.create(PrismConstants.T_PARENT, CaseType.F_STATE),
// ItemPath.create(PrismConstants.T_PARENT, CaseType.F_STATE),
ItemPath.create(CaseWorkItemType.F_PERFORMER_REF)
));

Expand Down
Expand Up @@ -17,14 +17,14 @@
<!DOCTYPE html>
<html xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
<div class="box" wicket:id="nextStagesContainer">
<div class="box-header">
<h3 class="box-title"><wicket:message key="ItemApprovalPanel.nextStages"/></h3> <i wicket:id="nextStagesHelp" wicket:message="title:TaskWfChildPanel.nextStagesHelp"/>
</div>
<div class="box-body">
<div wicket:id="nextStages" />
</div>
</div>
<!--<div class="box" wicket:id="nextStagesContainer">-->
<!--<div class="box-header">-->
<!--<h3 class="box-title"><wicket:message key="ItemApprovalPanel.nextStages"/></h3> <i wicket:id="nextStagesHelp" wicket:message="title:TaskWfChildPanel.nextStagesHelp"/>-->
<!--</div>-->
<!--<div class="box-body">-->
<!--<div wicket:id="nextStages" />-->
<!--</div>-->
<!--</div>-->
<div class="box" wicket:id="wholeProcessContainer">
<div class="box-header">
<h3 class="box-title"><wicket:message key="ItemApprovalPanel.wholeProcess"/></h3> <i wicket:id="wholeProcessHelp" wicket:message="title:TaskWfChildPanel.wholeProcessHelp"/>
Expand All @@ -33,13 +33,13 @@ <h3 class="box-title"><wicket:message key="ItemApprovalPanel.wholeProcess"/></h3
<div wicket:id="wholeProcess" />
</div>
</div>
<div style="padding-bottom:15px"> <!-- TODO use some css here -->
<span wicket:id="showNextStagesContainer">
<a href="#" wicket:id="showNextStages"><wicket:message key="taskWfChildPanel.showNextStages"/></a> <i wicket:id="showNextStagesHelp" wicket:message="title:TaskWfChildPanel.showNextStagesHelp"/>&nbsp;&nbsp;&nbsp;
</span>
<span wicket:id="showWholeProcessContainer">
<a href="#" wicket:id="showWholeProcess"><wicket:message key="taskWfChildPanel.showWholeProcess"/></a> <i wicket:id="showWholeProcessHelp" wicket:message="title:TaskWfChildPanel.showWholeProcessHelp"/>
</span>
</div>
<!--<div style="padding-bottom:15px"> &lt;!&ndash; TODO use some css here &ndash;&gt;-->
<!--<span wicket:id="showNextStagesContainer">-->
<!--<a href="#" wicket:id="showNextStages"><wicket:message key="taskWfChildPanel.showNextStages"/></a> <i wicket:id="showNextStagesHelp" wicket:message="title:TaskWfChildPanel.showNextStagesHelp"/>&nbsp;&nbsp;&nbsp;-->
<!--</span>-->
<!--<span wicket:id="showWholeProcessContainer">-->
<!--<a href="#" wicket:id="showWholeProcess"><wicket:message key="taskWfChildPanel.showWholeProcess"/></a> <i wicket:id="showWholeProcessHelp" wicket:message="title:TaskWfChildPanel.showWholeProcessHelp"/>-->
<!--</span>-->
<!--</div>-->
</wicket:panel>
</html>

0 comments on commit 6f47c3f

Please sign in to comment.