Skip to content

Commit

Permalink
addContextPathToModel method instead of model.put
Browse files Browse the repository at this point in the history
  • Loading branch information
xamien committed Jan 16, 2021
1 parent 977f909 commit 7cd5fc7
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/main/java/io/zeebe/monitor/rest/ViewController.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public class ViewController {

@GetMapping("/")
public String index(Map<String, Object> model, Pageable pageable) {
model.put("context-path", base_path);
addContextPathToModel(model);
return workflowList(model, pageable);
}

Expand All @@ -105,8 +105,8 @@ public String workflowList(Map<String, Object> model, Pageable pageable) {

model.put("workflows", workflows);
model.put("count", count);
model.put("context-path", base_path);

addContextPathToModel(model);
addPaginationToModel(model, pageable, count);

return "workflow-list-view";
Expand All @@ -132,7 +132,6 @@ public String workflowDetail(
.findByKey(key)
.orElseThrow(() -> new RuntimeException("No workflow found with key: " + key));

model.put("context-path", base_path);
model.put("workflow", toDto(workflow));
model.put("resource", workflow.getResource());

Expand Down Expand Up @@ -166,6 +165,7 @@ public String workflowDetail(
final var bpmn = Bpmn.readModelFromStream(resourceAsStream);
model.put("instance.bpmnElementInfos", getBpmnElementInfos(bpmn));

addContextPathToModel(model);
addPaginationToModel(model, pageable, count);

return "workflow-detail-view";
Expand Down Expand Up @@ -238,10 +238,10 @@ public String instanceList(Map<String, Object> model, Pageable pageable) {
instances.add(dto);
}

model.put("context-path", base_path);
model.put("instances", instances);
model.put("count", count);

addContextPathToModel(model);
addPaginationToModel(model, pageable, count);

return "instance-list-view";
Expand All @@ -262,7 +262,8 @@ public String instanceDetail(
.ifPresent(workflow -> model.put("resource", workflow.getResource()));

model.put("instance", toInstanceDto(instance));
model.put("context-path", base_path);

addContextPathToModel(model);

return "instance-detail-view";
}
Expand Down Expand Up @@ -660,8 +661,8 @@ public String incidentList(Map<String, Object> model, Pageable pageable) {

model.put("incidents", incidents);
model.put("count", count);
model.put("context-path", base_path);

addContextPathToModel(model);
addPaginationToModel(model, pageable, count);

return "incident-list-view";
Expand Down Expand Up @@ -707,8 +708,8 @@ public String jobList(Map<String, Object> model, Pageable pageable) {

model.put("jobs", dtos);
model.put("count", count);
model.put("context-path", base_path);

addContextPathToModel(model);
addPaginationToModel(model, pageable, count);

return "job-list-view";
Expand Down Expand Up @@ -742,8 +743,8 @@ public String messageList(Map<String, Object> model, Pageable pageable) {

model.put("messages", dtos);
model.put("count", count);
model.put("context-path", base_path);

addContextPathToModel(model);
addPaginationToModel(model, pageable, count);

return "message-list-view";
Expand Down Expand Up @@ -811,6 +812,10 @@ private void addPaginationToModel(
}
}

private void addContextPathToModel(Map<String, Object> model) {
model.put("context-path", base_path);
}

private static class VariableTuple {
private final long scopeKey;
private final String name;
Expand Down

0 comments on commit 7cd5fc7

Please sign in to comment.