Skip to content
This repository has been archived by the owner on Jan 17, 2022. It is now read-only.

Commit

Permalink
Add version number to bottom of page
Browse files Browse the repository at this point in the history
  • Loading branch information
Marius Wöste committed Feb 1, 2018
1 parent 74f0ea1 commit 93a64f3
Show file tree
Hide file tree
Showing 5 changed files with 158 additions and 2 deletions.
5 changes: 5 additions & 0 deletions build.gradle
Expand Up @@ -38,10 +38,15 @@ if (!hasProperty('mainClass')) {
ext.mainClass = 'de.imi.marw.viper.main.Main'
}

def getVersionName() {
return "git describe --tags".execute(null, new File(""+projectDir)).text.trim()
}

//create a single Jar with all dependencies
task fatJar(type: Jar) {
manifest {
attributes 'Implementation-Title': 'Main',
'Implementation-Version': getVersionName(),
'Main-Class': 'de.imi.marw.viper.main.Main'
}
baseName = project.name + '-all'
Expand Down
113 changes: 113 additions & 0 deletions public/css/spacing.css
@@ -0,0 +1,113 @@
/* Copyright (c) 2017 Marius Wöste
*
* This file is part of VIPER.
*
* VIPER is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* VIPER is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with VIPER. If not, see <http://www.gnu.org/licenses/>.
*
*/

.no-margin {
margin: 0;
}

.no-padding {
padding: 0;
}

/*
* Stolen directly from https://stackoverflow.com/questions/32233489/does-bootstrap-have-builtin-padding-and-margin-classes
*/
.padding-xs { padding: .25em; }
.padding-sm { padding: .5em; }
.padding-md { padding: 1em; }
.padding-lg { padding: 1.5em; }
.padding-xl { padding: 3em; }

.padding-x-xs { padding: .25em 0; }
.padding-x-sm { padding: .5em 0; }
.padding-x-md { padding: 1em 0; }
.padding-x-lg { padding: 1.5em 0; }
.padding-x-xl { padding: 3em 0; }

.padding-y-xs { padding: 0 .25em; }
.padding-y-sm { padding: 0 .5em; }
.padding-y-md { padding: 0 1em; }
.padding-y-lg { padding: 0 1.5em; }
.padding-y-xl { padding: 0 3em; }

.padding-top-xs { padding-top: .25em; }
.padding-top-sm { padding-top: .5em; }
.padding-top-md { padding-top: 1em; }
.padding-top-lg { padding-top: 1.5em; }
.padding-top-xl { padding-top: 3em; }

.padding-right-xs { padding-right: .25em; }
.padding-right-sm { padding-right: .5em; }
.padding-right-md { padding-right: 1em; }
.padding-right-lg { padding-right: 1.5em; }
.padding-right-xl { padding-right: 3em; }

.padding-bottom-xs { padding-bottom: .25em; }
.padding-bottom-sm { padding-bottom: .5em; }
.padding-bottom-md { padding-bottom: 1em; }
.padding-bottom-lg { padding-bottom: 1.5em; }
.padding-bottom-xl { padding-bottom: 3em; }

.padding-left-xs { padding-left: .25em; }
.padding-left-sm { padding-left: .5em; }
.padding-left-md { padding-left: 1em; }
.padding-left-lg { padding-left: 1.5em; }
.padding-left-xl { padding-left: 3em; }

.margin-xs { margin: .25em; }
.margin-sm { margin: .5em; }
.margin-md { margin: 1em; }
.margin-lg { margin: 1.5em; }
.margin-xl { margin: 3em; }

.margin-x-xs { margin: .25em 0; }
.margin-x-sm { margin: .5em 0; }
.margin-x-md { margin: 1em 0; }
.margin-x-lg { margin: 1.5em 0; }
.margin-x-xl { margin: 3em 0; }

.margin-y-xs { margin: 0 .25em; }
.margin-y-sm { margin: 0 .5em; }
.margin-y-md { margin: 0 1em; }
.margin-y-lg { margin: 0 1.5em; }
.margin-y-xl { margin: 0 3em; }

.margin-top-xs { margin-top: .25em; }
.margin-top-sm { margin-top: .5em; }
.margin-top-md { margin-top: 1em; }
.margin-top-lg { margin-top: 1.5em; }
.margin-top-xl { margin-top: 3em; }

.margin-right-xs { margin-right: .25em; }
.margin-right-sm { margin-right: .5em; }
.margin-right-md { margin-right: 1em; }
.margin-right-lg { margin-right: 1.5em; }
.margin-right-xl { margin-right: 3em; }

.margin-bottom-xs { margin-bottom: .25em; }
.margin-bottom-sm { margin-bottom: .5em; }
.margin-bottom-md { margin-bottom: 1em; }
.margin-bottom-lg { margin-bottom: 1.5em; }
.margin-bottom-xl { margin-bottom: 3em; }

.margin-left-xs { margin-left: .25em; }
.margin-left-sm { margin-left: .5em; }
.margin-left-md { margin-left: 1em; }
.margin-left-lg { margin-left: 1.5em; }
.margin-left-xl { margin-left: 3em; }
12 changes: 12 additions & 0 deletions public/index.html
Expand Up @@ -30,6 +30,7 @@
<link href="bower_components/angularjs-slider/dist/rzslider.min.css" rel="stylesheet">
<link href="bower_components/angular-ui-select/dist/select.min.css" rel="stylesheet">
<link href="css/main.css" rel="stylesheet">
<link href="css/spacing.css" rel="stylesheet">
<!-- endbuild -->

<!-- build:js assets/js/scripts.min.js -->
Expand Down Expand Up @@ -82,5 +83,16 @@

<div ng-view>
</div>

<hr class="no-padding no-margin">

<div class="row margin-bottom-sm margin-top-sm">

<div class="col-sm-12 text-center text-muted">
VIPER {{ viperMainCtrl.versionName }}
</div>

</div>

</body>
</html>
20 changes: 18 additions & 2 deletions public/viper/main.js
Expand Up @@ -27,13 +27,29 @@ var module = angular.module('de.imi.marw.viper',
'ui.bootstrap'
]
)
.controller('ViperMainController', [ '$location', 'VariantTableService',
function($location, VariantTableService) {
.controller('ViperMainController', [ '$location', 'VariantTableService', '$http',
function($location, VariantTableService, $http) {
var Ctrl = this;

Ctrl.versionName = '';

Ctrl.init = init;
Ctrl.getCurrentRoute = getCurrentRoute;
Ctrl.saveProgress = saveProgress;

Ctrl.init();

function init() {

$http.get('api/version')
.then(function (res) {

Ctrl.versionName = res.data;

});

}

function getCurrentRoute() {
return $location.path();
}
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/de/imi/marw/viper/api/ViperServer.java
Expand Up @@ -34,6 +34,7 @@
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import spark.Route;
import spark.Spark;

import static spark.Spark.*;
Expand Down Expand Up @@ -122,6 +123,8 @@ private void setupTableApi() {

path("/api", () -> {

get("/version", (req, res) -> getViperVersion());

path("/variant-table", new TableRoutes(variantTableCluster, gson, config));

path("/snapshots", new SnapshotRoutes(igv, variantTableCluster, gson, config));
Expand Down Expand Up @@ -149,4 +152,11 @@ private IGVVisualizer setupIGV() {
this.config.getXvfbHeight(),
this.config.getIgvMaxMemory());
}

private String getViperVersion() {

String version = getClass().getPackage().getImplementationVersion();

return version == null ? "DEV" : version;
}
}

0 comments on commit 93a64f3

Please sign in to comment.