Skip to content

Commit 75881df

Browse files
authored
Merge branch 'master' into permalinks
2 parents 2bfa88a + 63cd35a commit 75881df

File tree

5 files changed

+52
-10
lines changed

5 files changed

+52
-10
lines changed

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This is a work-in-progress [Spring Boot](http://projects.spring.io/spring-boot/) MVC application which fetches [Common Workflow Language](http://www.commonwl.org/) files from a Github repository and creates a page for it detailing the main workflow and its inputs, outputs and steps.
44

5-
[![Build Status](https://travis-ci.org/common-workflow-language/cwlviewer.svg?branch=master)](https://travis-ci.org/common-workflow-language/cwlviewer) [![Gitter](https://img.shields.io/gitter/room/gitterHQ/gitter.svg)](https://gitter.im/common-workflow-language/common-workflow-language?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
5+
[![Build Status](https://travis-ci.org/common-workflow-language/cwlviewer.svg?branch=master)](https://travis-ci.org/common-workflow-language/cwlviewer) [![Gitter](https://img.shields.io/gitter/room/gitterHQ/gitter.svg)](https://gitter.im/common-workflow-language/common-workflow-language?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![](https://images.microbadger.com/badges/image/commonworkflowlanguage/cwlviewer.svg)](https://microbadger.com/images/commonworkflowlanguage/cwlviewer "Get your own image badge on microbadger.com") [![Docker image commonworkflowlanguage/cwlviewer](https://images.microbadger.com/badges/version/commonworkflowlanguage/cwlviewer.svg)](https://hub.docker.com/r/commonworkflowlanguage/cwlviewer/ "Get your own version badge on microbadger.com")
66

77

88

@@ -36,13 +36,18 @@ If you change the source code, re-build with `docker-compose build`.
3636

3737
See the [docker-compose.yml](docker-compose.yml) file for details.
3838

39-
If you don't want to use Docker Compose, you can do the equivalent manually with `docker`:
39+
If you don't want to use Docker Compose, you can do the equivalent manually with `docker`
40+
and the [commonworkflowlanguage/cwlviewer](https://hub.docker.com/r/commonworkflowlanguage/cwlviewer/builds/) docker image.
4041

41-
docker build -t cwlviewer .
4242
docker run --name cwlviewer-mongo -p 27017:27017 -d mongo
43-
docker run --name cwlviewer -p 8080:8080 --link cwlviewer-mongo:mongo -d cwlviewer
43+
docker run --name cwlviewer -p 8080:8080 --link cwlviewer-mongo:mongo -d commonworkflowlanguage/cwlviewer
4444
docker logs -f cwlviewer
4545

46+
If you have modified the source code, then you may want to build the docker image locally first:
47+
48+
docker build -t commonworkflowlanguage/cwlviewer .
49+
50+
4651
## Requirement: MongoDB
4752

4853
You will need to have [MongoDB](https://www.mongodb.com/) running,

src/main/java/org/commonwl/viewer/domain/Workflow.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public class Workflow {
4848
// Metadata
4949
@Indexed(unique = true)
5050
private GithubDetails retrievedFrom;
51-
@DateTimeFormat(pattern="MMM d yyyy 'at' hh:mm z")
51+
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss z")
5252
private Date retrievedOn;
5353

5454
// A String which represents the path to a RO bundle

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ body {
2121
padding-top: 61px;
2222
}
2323

24+
.hide {
25+
display: none;
26+
}
27+
2428
:target {
2529
padding-top: 61px;
2630
margin-top: -61px;

src/main/resources/static/js/workflow.js renamed to src/main/resources/static/js/main.js

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,4 +110,36 @@ require(['jquery', 'bootstrap.modal', 'renderer'],
110110
// Stop default button action
111111
event.preventDefault();
112112
});
113-
});
113+
});
114+
115+
/**
116+
* Code for including the link to the Research Object Bundle download
117+
* without refresh once generated
118+
*/
119+
require(['jquery'],
120+
function ($) {
121+
// AJAX function to add download link to page if generated
122+
function getDownloadLink() {
123+
$.ajax({
124+
type: 'HEAD',
125+
url: $('#download').attr('href'),
126+
dataType: "json",
127+
success: function (data) {
128+
$("#generating").addClass("hide");
129+
$("#generated").removeClass("hide");
130+
},
131+
error: function () {
132+
// Retry in 5 seconds if still not generated
133+
setTimeout(function () {
134+
getDownloadLink();
135+
}, 5000)
136+
}
137+
});
138+
}
139+
140+
// If ajaxRequired exists on the page the RO bundle link is not generated
141+
// at time of page load
142+
if ($("#ajaxRequired").length) {
143+
getDownloadLink();
144+
}
145+
});

src/main/resources/templates/workflow.html

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,10 @@ <h2>Workflow: <span th:text="${workflow.label}">Workflow Name</span></h2>
105105
<img id="githubLogo" src="../static/img/GitHub-Mark-32px.png" th:src="@{/img/GitHub-Mark-32px.png}" width="24" height="24" />
106106
</a>
107107
<i>Fetched <span th:text="${{workflow.retrievedOn}}">01/12/16 at 21:00</span></i>
108-
<span th:if="${workflow.roBundle == null}"> - Generating download link&hellip; [<a th:href="@{'/workflows/' + ${workflowURL}}" href="#">Refresh</a>]</span>
109-
<span th:if="${workflow.roBundle != null}">
110-
- <a th:href="@{'/workflows/' + ${workflow.id} + '/download'}" href="#" download="bundle.zip">Download as Research Object Bundle</a>
108+
<span th:if="${workflow.roBundle == null}" id="ajaxRequired"></span>
109+
<span th:class="${workflow.roBundle != null} ? hide : ''" id="generating"> - Generating download link <img alt="loading" src="/img/loading.svg" width="20" height="20" /></span>
110+
<span th:class="${workflow.roBundle == null} ? hide : ''" id="generated">
111+
- <a th:href="@{'/workflows/' + ${workflow.id} + '/download'}" id="download" href="#" download="bundle.zip">Download as Research Object Bundle</a>
111112
<a href="http://www.researchobject.org/" rel="noopener" target="_blank">[?]</a>
112113
</span>
113114
</p>
@@ -173,6 +174,6 @@ <h2>Outputs</h2>
173174

174175
<div th:replace="fragments/footer :: copy"></div>
175176

176-
<script src="/bower_components/requirejs/require.js" data-main="/js/workflow.js"></script>
177+
<script src="/bower_components/requirejs/require.js" data-main="/js/main.js"></script>
177178
</body>
178179
</html>

0 commit comments

Comments
 (0)