Skip to content

Commit

Permalink
Improved look of approval progress diagram
Browse files Browse the repository at this point in the history
  • Loading branch information
semancik committed Nov 20, 2017
1 parent 89c37a2 commit e750325
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 26 deletions.
Expand Up @@ -28,21 +28,32 @@
<td>
<i wicket:id="currentStageMarker" style="margin-right: 20px" class="fa fa-hand-o-right fa-2x text-danger"></i>
</td>
<!-- TODO: width? -->
<!-- TODO: labels: approval stage, approver, performer -->
<td style="text-align:center">
<div style="border: 1px dotted; border-radius: 10px; padding: 10px; margin: 10px">
<span wicket:id="approvers">
<span wicket:id="approverName" style="border: 1px solid; border-radius: 5px; padding: 5px; margin: 5px"></span>
<span wicket:id="performerName"></span>
<span wicket:id="outcome"></span>
<span wicket:id="junction" style="font-size:120%; margin: 10px"></span>
</span>
<span wicket:id="automatedOutcome"></span>
<div class="process-box">
<div class="box-label">
<span class="process-label" wicket:id="stageName"></span>
<span class="process-outcome" wicket:id="stageOutcome"></span>
</div>
<div class="box-content">
<div class="process-box" wicket:id="approvers">
<div class="box-label">
<span class="process-label" wicket:id="approverName"></span>
<span class="process-outcome" wicket:id="outcome"></span>
</div>

<!-- TODO: enclosure? -->
<div class="box-content">
<span wicket:id="performerName">
</span><span wicket:id="junction" style="font-size:120%; margin: 10px"></span>
</div>

</div>
<span wicket:id="automatedOutcome"></span>
</div>
</div>
</td>
<td style="text-align:center; font-style:italic; padding-left: 30px">
<span wicket:id="stageName"></span>
<span wicket:id="stageOutcome"></span>
</td>
</tr>
</div>
</table>
Expand Down
Expand Up @@ -91,7 +91,8 @@ protected void populateItem(ListItem<ApproverEngagementDto> approversListItem) {
ApproverEngagementDto ae = approversListItem.getModelObject();

// original approver name
approversListItem.add(new Label(ID_APPROVER_NAME, nameOf(ae.getApproverRef())));
approversListItem.add(new Label(ID_APPROVER_NAME,
getApproverLabel("ApprovalProcessExecutionInformationPanel.approver", ae.getApproverRef())));

// outcome
WorkItemOutcomeType outcome = ae.getOutput() != null
Expand Down Expand Up @@ -123,7 +124,7 @@ protected void populateItem(ListItem<ApproverEngagementDto> approversListItem) {

// performer
approversListItem.add(new Label(ID_PERFORMER_NAME,
ae.getCompletedBy() != null ? "(" + nameOf(ae.getCompletedBy()) + ")": ""));
getApproverLabel("ApprovalProcessExecutionInformationPanel.performer", ae.getCompletedBy())));

// junction
Label junctionLabel = new Label(ID_JUNCTION, stage.isFirstDecides() ? "" : " & "); // or "+" for first decides? probably not
Expand All @@ -148,11 +149,7 @@ protected void populateItem(ListItem<ApproverEngagementDto> approversListItem) {
automatedOutcomeLabel.setVisible(stage.getAutomatedCompletionReason() != null);
stagesListItem.add(automatedOutcomeLabel);

stagesListItem.add(new Label(ID_STAGE_NAME,
stage.getStageName() != null || stage.getStageDisplayName() != null
? WfContextUtil.getStageInfo(stageNumber, numberOfStages, stage.getStageName(), stage.getStageDisplayName())
: ApprovalProcessExecutionInformationPanel.this.getString("ApprovalProcessExecutionInformationPanel.stage",
stageNumber, numberOfStages)));
stagesListItem.add(new Label(ID_STAGE_NAME, getStageNameLabel(stage, stageNumber, numberOfStages)));

ApprovalLevelOutcomeType stageOutcome = stage.getOutcome();
ApprovalOutcomeIcon stageOutcomeIcon;
Expand Down Expand Up @@ -180,12 +177,33 @@ protected void populateItem(ListItem<ApproverEngagementDto> approversListItem) {
stageOutcomePanel.add(new VisibleBehaviour(() -> stageOutcomeIcon != ApprovalOutcomeIcon.EMPTY));
stagesListItem.add(stageOutcomePanel);
}

};
add(stagesList);
}

private String nameOf(ObjectReferenceType ref) {
return MiscUtil.emptyIfNull(WebComponentUtil.getName(ref));
}

private String getStageNameLabel(ApprovalStageExecutionInformationDto stage, int stageNumber, int numberOfStages) {
StringBuilder sb = new StringBuilder();
sb.append(getString("ApprovalProcessExecutionInformationPanel.stage"));
if (stage.getStageName() != null || stage.getStageDisplayName() != null) {
sb.append(": ");
sb.append(WfContextUtil.getStageInfo(stageNumber, numberOfStages, stage.getStageName(), stage.getStageDisplayName()));
return sb.toString();
} else {
sb.append(stageNumber).append("/").append(numberOfStages);
return sb.toString();
}
}

private String getApproverLabel(String labelKey, ObjectReferenceType ref) {
if (ref == null) {
return "";
}
StringBuilder sb = new StringBuilder();
sb.append(getString(labelKey));
sb.append(": ");
sb.append(WebComponentUtil.getName(ref));
return sb.toString();
}

}
Expand Up @@ -3781,7 +3781,9 @@ PolicyRule.actionLabel=Action
AbstractAssignmentDetailsPanel.doneButton=Done
ApprovalProcessesPreviewPanel.processRelatedTo=Approval process related to {0}
ApprovalProcessesPreviewPanel.process=Approval process
ApprovalProcessExecutionInformationPanel.stage=Stage {0}/{1}
ApprovalProcessExecutionInformationPanel.approver=Approver
ApprovalProcessExecutionInformationPanel.performer=Performer
ApprovalProcessExecutionInformationPanel.stage=Stage
PageImportResource.title=Import resource definition
AssignmentType.activation=Activation
AssignmentType.lifecycleState=Lifecycle state
Expand Down
Expand Up @@ -3733,7 +3733,9 @@ PolicyRule.actionLabel=Action
AbstractAssignmentDetailsPanel.doneButton=Done
ApprovalProcessesPreviewPanel.processRelatedTo=Approval process related to {0}
ApprovalProcessesPreviewPanel.process=Approval process
ApprovalProcessExecutionInformationPanel.stage=Stage {0}/{1}
ApprovalProcessExecutionInformationPanel.approver=Approver
ApprovalProcessExecutionInformationPanel.performer=Performer
ApprovalProcessExecutionInformationPanel.stage=Stage
PageImportResource.title=Import resource definition
AssignmentType.activation=Activation
AssignmentType.lifecycleState=Lifecycle state
Expand Down
29 changes: 29 additions & 0 deletions gui/admin-gui/src/main/resources/static/less/midpoint-theme.less
Expand Up @@ -1239,4 +1239,33 @@ dd.stacktrace::before {
width: 80px;
padding-left: 10px;
padding-top: 7px;
}

// Process (workflow) diagrams

.process-box {
border: 1px solid;
border-radius: 5px;
padding: 0px;
margin: 10px;

.box-label {
border-bottom: 1px solid;
padding-top: 3px;
padding-bottom: 3px;
font-weight: bold;

.process-label {

}

.process-outcome {
float: right;
}

}

.box-content {
padding: 15px;
}
}
Expand Up @@ -158,7 +158,7 @@ public static String getCompleteStageInfo(WfContextType wfc) {
return sb.toString();
}

private static void appendNumber(Integer stageNumber, Integer stageCount, StringBuilder sb) {
public static void appendNumber(Integer stageNumber, Integer stageCount, StringBuilder sb) {
if (stageNumber != null) {
boolean parentheses = sb.length() > 0;
if (parentheses) {
Expand Down

0 comments on commit e750325

Please sign in to comment.