Skip to content

Commit

Permalink
showing correlation panel for work item
Browse files Browse the repository at this point in the history
  • Loading branch information
skublik committed Feb 25, 2022
1 parent 05a6cfc commit 587fa4f
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,36 @@
-->

<wicket:panel xmlns:wicket="http://wicket.apache.org">
<table class="table table-bordered">
<tr>
<th></th>
<wicket:container wicket:id="headers">
<th><span wicket:id="header"></span></th>
</wicket:container>
</tr>
<tr>
<th>Action</th>
<wicket:container wicket:id="actions">
<td><a class="btn btn-primary btn-sm" wicket:id="action">
<span wicket:id="actionLabel"></span>
</a></td>
</wicket:container>
</tr>
<tr>
<th>Name</th>
<wicket:container wicket:id="names">
<td wicket:id="name"></td>
</wicket:container>
</tr>
<wicket:container wicket:id="rows">
<div class="box box-info">
<table class="table table-bordered table-striped">
<tr>
<th></th>
<wicket:container wicket:id="headers">
<th><span wicket:id="header"></span></th>
</wicket:container>
</tr>
<tr>
<th><span wicket:id="attrName"></span></th>
<wicket:container wicket:id="columns">
<td wicket:id="column"></td>
<th>Action</th>
<wicket:container wicket:id="actions">
<td><a class="btn btn-primary btn-sm" wicket:id="action">
<span wicket:id="actionLabel"></span>
</a></td>
</wicket:container>
</tr>
</wicket:container>
</table>
<tr>
<th>Name</th>
<wicket:container wicket:id="names">
<td wicket:id="name"></td>
</wicket:container>
</tr>
<wicket:container wicket:id="rows">
<tr>
<th><span wicket:id="attrName"></span></th>
<wicket:container wicket:id="columns">
<td wicket:id="column"></td>
</wicket:container>
</tr>
</wicket:container>
</table>
</div>
</wicket:panel>
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

@PanelType(name = "correlationContext")
@PanelInstance(identifier = "correlationContext",
display = @PanelDisplay(label = "PageCase.correlationContextPanel", order = 40))
display = @PanelDisplay(label = "PageCase.correlationContextPanel", order = 1))
public class CorrelationContextPanel extends AbstractObjectMainPanel<CaseType, CaseDetailsModels> {

private static final Trace LOGGER = TraceManager.getTrace(CorrelationContextDto.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
public enum Match {

NOT_APPLICABLE(""),
NONE("bg-red disabled color-palette"),
PARTIAL("bg-yellow disabled color-palette"),
FULL("bg-green disabled color-palette");
NONE("danger disabled color-palette"),
PARTIAL("warning disabled color-palette"),
FULL("success disabled color-palette");

private final String css;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,9 @@ public String getObject() {
}

private boolean isApproveRejectButtonVisible() {
if (CaseTypeUtil.isCorrelationCase(CaseWorkItemUtil.getCase(getCaseWorkItemModelObject()))) {
return false;
}
if (CaseWorkItemUtil.isCaseWorkItemClosed(getModelObject()) ||
CaseWorkItemUtil.isWorkItemClaimable(getModelObject())) {
return false; // checking separately to avoid needless authorization checking
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import com.evolveum.midpoint.gui.api.page.PageBase;
import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.gui.api.util.WebModelServiceUtils;
import com.evolveum.midpoint.gui.impl.page.admin.cases.CaseDetailsModels;
import com.evolveum.midpoint.gui.impl.page.admin.cases.component.CorrelationContextPanel;
import com.evolveum.midpoint.prism.Objectable;
import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.prism.PrismReferenceValue;
Expand Down Expand Up @@ -49,6 +51,7 @@
import org.apache.wicket.markup.html.form.TextArea;
import org.apache.wicket.markup.repeater.RepeatingView;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.PropertyModel;

Expand Down Expand Up @@ -91,6 +94,7 @@ public class WorkItemDetailsPanel extends BasePanel<CaseWorkItemType> {


private IModel<SceneDto> sceneModel;
private LoadableDetachableModel<PrismObject<CaseType>> caseModel;
public WorkItemDetailsPanel(String id, IModel<CaseWorkItemType> caseWorkItemTypeIModel) {
super(id, caseWorkItemTypeIModel);
}
Expand All @@ -115,6 +119,14 @@ protected SceneDto load() {
}
}
};

caseModel = new LoadableDetachableModel<>() {
@Override
protected PrismObject<CaseType> load() {
CaseType parentCase = CaseTypeUtil.getCase(WorkItemDetailsPanel.this.getModelObject());
return parentCase == null ? null : parentCase.asPrismObject();
}
};
}

private void initLayout(){
Expand Down Expand Up @@ -204,6 +216,8 @@ private void initLayout(){
ScenePanel scenePanel = new ScenePanel(ID_DELTAS_TO_APPROVE, sceneModel);
scenePanel.setOutputMarkupId(true);
add(scenePanel);
} else if (CaseTypeUtil.isCorrelationCase(parentCase)) {
add(new CorrelationContextPanel(ID_DELTAS_TO_APPROVE, new CaseDetailsModels(caseModel, getPageBase()), new ContainerPanelConfigurationType()));
} else {
add(new WebMarkupContainer(ID_DELTAS_TO_APPROVE));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@
<cssClass>fa fa-circle-o</cssClass>
</icon>
</display>
<displayOrder>40</displayOrder>
<displayOrder>1</displayOrder>
<panelType>correlationContext</panelType>
<type>c:CaseType</type>
<default>true</default>
</panel>
</objectDetails>
</adminGuiConfiguration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ public static ApprovalStageDefinitionType getCurrentStageDefinition(CaseType aCa
if (aCase == null || aCase.getStageNumber() == null) {
return null;
}
return getStageDefinition(getApprovalContextRequired(aCase), aCase.getStageNumber());
return getStageDefinition(aCase.getApprovalContext(), aCase.getStageNumber());
}

public static int getStageNumberRequired(@NotNull CaseType aCase) {
Expand Down

0 comments on commit 587fa4f

Please sign in to comment.