Skip to content

Commit 9f0321f

Browse files
author
Mark Robinson
committed
Limit vertical size of workflow thumbnails on /workflows
1 parent b3fe044 commit 9f0321f

File tree

3 files changed

+26
-6
lines changed

3 files changed

+26
-6
lines changed

src/main/java/org/commonwl/viewer/web/WorkflowController.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
import com.github.jabbalaci.graphviz.GraphViz;
2323
import org.apache.commons.lang.StringUtils;
24-
import org.apache.jena.ext.com.google.common.collect.Lists;
2524
import org.commonwl.viewer.domain.GithubDetails;
2625
import org.commonwl.viewer.domain.Workflow;
2726
import org.commonwl.viewer.domain.WorkflowForm;
@@ -33,13 +32,10 @@
3332
import org.springframework.beans.factory.annotation.Autowired;
3433
import org.springframework.beans.factory.annotation.Value;
3534
import org.springframework.core.io.FileSystemResource;
36-
import org.springframework.data.domain.Page;
37-
import org.springframework.data.domain.PageRequest;
3835
import org.springframework.data.domain.Pageable;
3936
import org.springframework.data.web.PageableDefault;
4037
import org.springframework.stereotype.Controller;
4138
import org.springframework.ui.Model;
42-
import org.springframework.ui.ModelMap;
4339
import org.springframework.validation.BindingResult;
4440
import org.springframework.web.bind.annotation.*;
4541
import org.springframework.web.servlet.HandlerMapping;
@@ -81,7 +77,7 @@ public WorkflowController(WorkflowFormValidator workflowFormValidator,
8177
* @return The workflows view
8278
*/
8379
@RequestMapping(value="/workflows")
84-
public String listWorkflows(Model model, Pageable pageable) {
80+
public String listWorkflows(Model model, @PageableDefault(size = 10) Pageable pageable) {
8581
model.addAttribute("workflows", workflowRepository.findAllByOrderByRetrievedOnDesc(pageable));
8682
model.addAttribute("pages", pageable);
8783
return "workflows";

src/main/resources/static/css/main.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,11 @@ body {
106106
font-size: 20px;
107107
}
108108

109+
.workflow-thumb {
110+
width:100%;
111+
max-height:300px;
112+
}
113+
109114
#visualisation {
110115
overflow: hidden;
111116
padding: 0;

src/main/resources/templates/workflows.html

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
<!DOCTYPE html>
2+
<!--
3+
~ Licensed to the Apache Software Foundation (ASF) under one
4+
~ or more contributor license agreements. See the NOTICE file
5+
~ distributed with this work for additional information
6+
~ regarding copyright ownership. The ASF licenses this file
7+
~ to you under the Apache License, Version 2.0 (the
8+
~ "License"); you may not use this file except in compliance
9+
~ with the License. You may obtain a copy of the License at
10+
~
11+
~ http://www.apache.org/licenses/LICENSE-2.0
12+
~
13+
~ Unless required by applicable law or agreed to in writing,
14+
~ software distributed under the License is distributed on an
15+
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
~ KIND, either express or implied. See the License for the
17+
~ specific language governing permissions and limitations
18+
~ under the License.
19+
-->
120

221
<html xmlns:th="http://www.thymeleaf.org">
322
<head>
@@ -30,7 +49,7 @@ <h1>Explore Workflows</h1>
3049
<tr th:each="workflow : ${workflows}" th:with="workflowURL=@{'/workflows/github.com/' + ${workflow.retrievedFrom.owner} + '/' + ${workflow.retrievedFrom.repoName} + '/tree/' + ${workflow.retrievedFrom.branch} + '/' + ${workflow.retrievedFrom.path}}">
3150
<td>
3251
<a th:href="${workflowURL}">
33-
<img th:src="@{'/workflows/' + ${workflow.id} + '/graph/svg'}" alt="workflow graph" style="width:100%;"/>
52+
<img class="workflow-thumb" th:src="@{'/workflows/' + ${workflow.id} + '/graph/svg'}" alt="workflow graph" />
3453
</a>
3554
</td>
3655
<td th:text="${workflow.label}"></td>

0 commit comments

Comments
 (0)