Skip to content

Commit f2b4e91

Browse files
committed
Edit Github form to also mention Gitlab
1 parent 7454d66 commit f2b4e91

File tree

6 files changed

+37
-78
lines changed

6 files changed

+37
-78
lines changed

src/main/java/org/commonwl/view/workflow/WorkflowForm.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,27 +21,27 @@
2121

2222
/**
2323
* Represents the submission form on the main page to create a new workflow
24-
* Currently just contains a github URL
24+
* Currently just contains a Github or Gitlab URL
2525
*/
2626
public class WorkflowForm {
2727

28-
private String githubURL;
28+
private String url;
2929

3030
public WorkflowForm() {}
3131

32-
public WorkflowForm(String githubURL) {
33-
if (githubURL != null) {
34-
this.githubURL = trimTrailingSlashes(githubURL);
32+
public WorkflowForm(String url) {
33+
if (url != null) {
34+
this.url = trimTrailingSlashes(url);
3535
}
3636
}
3737

38-
public String getGithubURL() {
39-
return githubURL;
38+
public String getUrl() {
39+
return url;
4040
}
4141

42-
public void setGithubURL(String githubURL) {
43-
if (githubURL != null) {
44-
this.githubURL = trimTrailingSlashes(githubURL);
42+
public void setUrl(String url) {
43+
if (url != null) {
44+
this.url = trimTrailingSlashes(url);
4545
}
4646
}
4747

src/main/java/org/commonwl/view/workflow/WorkflowFormValidator.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,24 +59,24 @@ public GithubDetails validateAndParse(WorkflowForm form, Errors e) {
5959
// If not null and isn't just whitespace
6060
if (!e.hasErrors()) {
6161
// Check for valid CWL file
62-
GithubDetails githubInfo = githubService.detailsFromFileURL(form.getGithubURL());
62+
GithubDetails githubInfo = githubService.detailsFromFileURL(form.getUrl());
6363
if (githubInfo != null) {
6464
try {
6565
// Downloads the workflow file to check for existence
6666
if (githubService.downloadFile(githubInfo) != null) {
6767
return githubInfo;
6868
}
6969
} catch (IOException ex) {
70-
logger.error("Given URL " + form.getGithubURL() + " was not a .cwl file");
70+
logger.error("Given URL " + form.getUrl() + " was not a .cwl file");
7171
e.rejectValue("githubURL", "githubURL.missingWorkflow", "Workflow was not found at the given Github URL");
7272
}
7373
} else {
7474
// Check for valid Github directory
75-
githubInfo = githubService.detailsFromDirURL(form.getGithubURL());
75+
githubInfo = githubService.detailsFromDirURL(form.getUrl());
7676
if (githubInfo != null) {
7777
return githubInfo;
7878
} else {
79-
logger.error("The Github URL " + form.getGithubURL() + " is not valid");
79+
logger.error("The Github URL " + form.getUrl() + " is not valid");
8080
e.rejectValue("githubURL", "githubURL.invalid", "You must enter a valid Github URL to a .cwl file");
8181
}
8282
}

src/main/resources/static/css/main-20170616.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ body {
8080
padding-top: 20px;
8181
}
8282

83-
#githubURL {
83+
#url {
8484
background: url("/img/GitHub-Mark-32px.png") no-repeat scroll 7px 4px;
8585
background-size: 25px 25px;
8686
padding-left: 45px;

src/main/resources/static/js/main.js

Lines changed: 0 additions & 39 deletions
This file was deleted.

src/main/resources/templates/index.html

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -44,31 +44,31 @@ <h1>Common Workflow Language Viewer</h1>
4444
<div class="alert alert-info">
4545
<p>Want to generate visualisations in build scripts or from another automated process? Find out about <a href="/apidocs" alt="API Documentation">our API</a></p>
4646
</div>
47+
<div class="alert alert-grey">
48+
<strong>Don't know what to view?</strong> Try these from <i>common-workflow-language/workflows</i>:
49+
<a href="/workflows/github.com/common-workflow-language/workflows/tree/master/workflows/compile/compile1.cwl">compile</a>,
50+
<a href="/workflows/github.com/common-workflow-language/workflows/tree/master/workflows/make-to-cwl/dna.cwl">make-to-cwl</a>,
51+
<a href="/workflows/github.com/common-workflow-language/workflows/tree/master/workflows/lobSTR/lobSTR-workflow.cwl">lobSTR</a>,
52+
<a href="/workflows/github.com/common-workflow-language/workflows/tree/master/workflows/scidap/bam-genomecov-bigwig-rna-dutp.cwl">scidap</a>
53+
or <a href="/workflows">explore the collection</a>
54+
</div>
4755

4856
<hr/>
4957

50-
<h2>Workflow from Github URL</h2>
51-
<p>Provide a Github link to the workflow here</p>
58+
<h2>Workflow from Github/Gitlab URL</h2>
59+
<p>Provide a Github or Gitlab link to the workflow here</p>
5260
<form id="add" action="#" th:action="@{/workflows}" th:object="${workflowForm}" method="POST">
5361
<div class="alert alert-danger" th:if="${errors} != null and ${errors.hasErrors()}">
5462
<div th:each="error : ${errors.getAllErrors()}">
5563
<strong>Error:</strong> <span th:text="${error.getDefaultMessage()}">Error message here</span>
5664
</div>
5765
</div>
58-
<div class="alert alert-danger" th:if="${#fields.hasErrors('githubURL')}">
59-
<strong>Error:</strong> <span th:errors="*{githubURL}">Error message here</span>
60-
</div>
61-
<div class="alert alert-grey">
62-
<strong>Don't know what to view?</strong> Try these from <i>common-workflow-language/workflows</i>:
63-
<a class="example" href="https://github.com/common-workflow-language/workflows/tree/master/workflows/compile/compile1.cwl">compile</a>,
64-
<a class="example" href="https://github.com/common-workflow-language/workflows/tree/master/workflows/make-to-cwl/dna.cwl">make-to-cwl</a>,
65-
<a class="example" href="https://github.com/common-workflow-language/workflows/tree/master/workflows/lobSTR/lobSTR-workflow.cwl">lobSTR</a>,
66-
<a class="example" href="https://github.com/common-workflow-language/workflows/tree/master/workflows/scidap/bam-genomecov-bigwig-rna-dutp.cwl">scidap</a>
67-
or <a href="/workflows">explore the collection</a>
66+
<div class="alert alert-danger" th:if="${#fields.hasErrors('url')}">
67+
<strong>Error:</strong> <span th:errors="*{url}">Error message here</span>
6868
</div>
6969
<div class="input-group">
70-
<label for="githubURL" class="sr-only">Github URL</label>
71-
<input type="text" class="form-control" placeholder="Github URL" id="githubURL" name="githubURL" th:field="*{githubURL}" th:value="${formURL}" required="true" />
70+
<label for="url" class="sr-only">Github or Gitlab URL</label>
71+
<input type="text" class="form-control" placeholder="Github or Gitlab URL" id="url" name="url" th:field="*{url}" th:value="${formURL}" required="true" />
7272
<span class="input-group-btn">
7373
<button class="btn btn-primary" type="submit">Parse Workflow</button>
7474
</span>
@@ -85,11 +85,11 @@ <h2>Workflow from Git Details</h2>
8585
<strong>Error:</strong> <span th:text="${error.getDefaultMessage()}">Error message here</span>
8686
</div>
8787
</div>
88-
<div class="alert alert-danger" th:if="${#fields.hasErrors('githubURL')}">
89-
<strong>Error:</strong> <span th:errors="*{githubURL}">Error message here</span>
88+
<div class="alert alert-danger" th:if="${#fields.hasErrors('url')}">
89+
<strong>Error:</strong> <span th:errors="*{url}">Error message here</span>
9090
</div>
9191
<label for="repoURL">Repository URL</label>
92-
<input type="text" class="form-control" placeholder="Repository URL (HTTPS)" id="repoURL" name="repoURL" th:field="*{githubURL}" th:value="${formURL}" required="true" />
92+
<input type="text" class="form-control" placeholder="Repository URL (HTTPS)" id="repoURL" name="repoURL" th:field="*{url}" th:value="${formURL}" required="true" />
9393
<div class="row" style="margin-top:10px;margin-bottom:10px;">
9494
<div class="col-md-6">
9595
<label for="branch">Branch Name/Commit ID</label>
@@ -107,7 +107,5 @@ <h2>Workflow from Git Details</h2>
107107
</div>
108108

109109
<div th:replace="fragments/footer :: copy"></div>
110-
111-
<script src="/bower_components/requirejs/require.js" data-main="/js/main.js"></script>
112110
</body>
113111
</html>

src/test/java/org/commonwl/view/workflow/WorkflowFormTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@ public class WorkflowFormTest {
3030
* Test for the form stripping unnecessary trailing slashes from directory URLs
3131
*/
3232
@Test
33-
public void getGithubURL() throws Exception {
33+
public void getURL() throws Exception {
3434

3535
String unchangedURL = "https://github.com/common-workflow-language/workflows/tree/master/workflows/compile";
3636
WorkflowForm testForm = new WorkflowForm(unchangedURL);
37-
assertEquals(unchangedURL, testForm.getGithubURL());
37+
assertEquals(unchangedURL, testForm.getUrl());
3838

3939
WorkflowForm testForm2 = new WorkflowForm("https://github.com/common-workflow-language/workflows/tree/master/workflows/compile/");
40-
assertEquals("https://github.com/common-workflow-language/workflows/tree/master/workflows/compile", testForm2.getGithubURL());
40+
assertEquals("https://github.com/common-workflow-language/workflows/tree/master/workflows/compile", testForm2.getUrl());
4141

42-
testForm2.setGithubURL("https://github.com/common-workflow-language/workflows/tree/master/workflows/make-to-cwl/////");
43-
assertEquals("https://github.com/common-workflow-language/workflows/tree/master/workflows/make-to-cwl", testForm2.getGithubURL());
42+
testForm2.setUrl("https://github.com/common-workflow-language/workflows/tree/master/workflows/make-to-cwl/////");
43+
assertEquals("https://github.com/common-workflow-language/workflows/tree/master/workflows/make-to-cwl", testForm2.getUrl());
4444

4545
}
4646

0 commit comments

Comments
 (0)