Thank you for taking an interest in contributing to CWL Viewer.
The following is a set of guidelines for contribution and helpful tips and resources for working with the code base.
This project and everyone participating in it is governed by the CWL Project Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to leadership@commonwl.org.
Issues for both bug reports and feature requests are welcome. In the case of bug reports, please try to provide a verifiable example on the production instance if this is possible.
Before you submit an issue, please search the issue tracker, maybe an issue for your problem already exists and the discussion might inform you of workarounds readily available.
The preferred workflow for contributing to CWL Viewer is to fork the main repository on GitHub, clone, and develop on a branch. Steps:
-
Fork the project repository by clicking on the 'Fork' button near the top right of the page. This creates a copy of the code under your GitHub user account. For more details on how to fork a repository see this guide.
-
Clone your fork of the cwlviewer repo from your GitHub account to your local disk:
$ git clone git@github.com:YourLogin/cwlviewer.git $ cd cwlviewer
-
Create a
feature
branch to hold your development changes:$ git checkout -b my-feature
Always use a
feature
branch. It's good practice to never work on themaster
branch! -
Develop the feature on your feature branch. Add changed files using
git add
and thengit commit
files:$ git add modified_files $ git commit
to record your changes in Git, then push the changes to your GitHub account with:
$ git push -u origin my-feature
-
Follow these instructions to create a pull request from your fork.
See README.md for details on running the application with dependencies.
The tests can be run using the standard mvn test
command.
This project uses the Maven standard directory layout and is a Model-view-controller application built with Spring Boot.
Packaging is done by feature and all Spring configuration is Java annotation based.
Templates for the view use Thymeleaf, which allows them to be displayed in browsers as static prototypes.
MongoDB is used to store information about Workflow
and QueuedWorkflow
objects using Spring Data JPA.
The application also uses a triple store to keep the RDF representing
workflows (gathered from cwltool's
--print-rdf
functionality).
In general, the controller classes call services which have the main logic for the application. These controllers are:
PageController
- handles basic static pages such as the index and documentationworkflow.WorkflowController
- the main controller class for the applicationworkflow.WorkflowJSONController
- handles API functionalityworkflow.PermalinkController
- handles permalinks with content negotiation for retrieving different formats
Notable services include
workflow.WorkflowService
- Handles workflow related functionalityresearchobject.ROBundleService
- Creates research object bundlesgraphviz.GraphVizService
- A wrapper forcom.github.jabbalaci.graphviz.GraphViz
to generate images from DOT source codegit.GitService
- Builds on JGit to provide Git functionalitycwl.CWLService
- Implements parsing of cwl files
Note: For the async operations, Spring does not support the calling of a method within
the same class (as a proxy needs to kick in to spawn a new thread). For this reason
some extra classes such as researchobject.ROBundleFactory
and cwl.CWLToolRunner
are used when they would otherwise not be required.
-
User fills in the form on the front page. This is represented by
workflow.WorkflowForm
and consists of just a URL to Github/Gitlab, or a URL to a git repository as well as the branch and path of a workflow within the repository. -
This is submitted and picked up by a method in
workflow.WorkflowController
. The form is validated and parsed byworkflow.WorkflowFormValidator
to produce agit.GitDetails
object with a repository URL, branch and path. The MongoDB database is checked for already pendingworkflow.QueuedWorkflow
or createdworkflow.Workflow
objects based on this (but this flow assumes they do not already exist). -
A new
workflow.QueuedWorkflow
object is created by cloning the repository locally (if it does not already exist), checking out the new branch and parsing the file using built-in YAML parsing code. Intermediate visualisations and models are produced which may not yet be complete. -
cwltool is run on the workflow using the
--print-rdf
option to produce the RDF representation. The RDF will be stored in the SPARQL store and queries will extract the information required. Afterwards this is used to construct a Research Object Bundle for the workflow. This is an asynchronous operation so meanwhile... -
The user is redirected to the main workflow page, which will use the
loading
template for now until cwltool has finished running. The background is the intermediate visualisation. An AJAX call repeatedly checks the status of cwltool saved in theworkflow.QueuedWorkflow
object in MongoDB. -
The page either displays an error on the loading page or reloads to view the parsed workflow on the
workflow
template. An AJAX call checks if the Research Object Bundle has been created and adds it to the page when it has.