It references issue #9

parent cdf819c1
Pipeline #1630 failed with stages
docker build -t dockcs.esrf.fr/dau/doi:1.0.0-SNAPSHOT .
docker run -p 8092:80 -it 072c966096f2 bash
docker run -p 8092:80 -i -t dockcs.esrf.fr/dau/doi:1.0.0-SNAPSHOT
......@@ -20,11 +20,12 @@ module.exports = function(grunt) {
},
my_target: {
files: {
'min/doi-landing-page.min.js': [
'min/components.min.js': [
'bower_components/jquery/dist/jquery.js',
'bower_components/bootstrap/dist/js/bootstrap.js',
'bower_components/dustjs-linkedin/dist/dust-full.min.js',
'bower_components/dustjs-helpers/dist/dust-helpers.min.js',
'bower_components/dustjs-helpers/dist/dust-helpers.min.js' ],
'min/doi.min.js': [
'src/*js']
}
}
......
/* Sticky footer styles
-------------------------------------------------- */
html {
position: relative;
min-height: 100%;
}
body {
margin-bottom: 60px; /* Margin bottom by footer height */
}
.footer {
position: absolute;
bottom: 0;
width: 100%;
height: 60px; /* Set the fixed height of the footer here */
line-height: 60px; /* Vertically center the text there */
background-color: #f5f5f5;
}
/* Custom page CSS
-------------------------------------------------- */
/* Not required for template or sticky footer method. */
.container {
width: auto;
max-width: 680px;
padding: 0 15px;
}
/* sets the display of the element to flex */
.flex{
display:flex;
}
.doiTitle{
font-size:30px;
}
/* sets the background color as esrf blue*/
.blueBackground{
background-color: #132577 !important;
......
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>details from DOI</title>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
<link rel="stylesheet" href="/min/output.min.css" >
</head>
<script src="/min/doi-landing-page.min.js"></script>
<script src="/min/precompiled.templates.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var params = new URLSearchParams(document.location.search.substring(1));
new ICATClient().connect(params.get("DOI"));
});
$(document).on({
ajaxStart: function(){ $("body").addClass("loading");},
ajaxStop: function() { $("body").removeClass("loading"); }
});
</script>
</head>
<body>
<div id='main' ></div>
<div class="modal"> <!-- nothing to write here --></div>
</body>
</html>
<head>
<meta charset="UTF-8">
<title>ESRF</title>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
<link rel="stylesheet" href="/min/output.min.css" >
</head>
<!--
<script src="/min/doi-landing-page.min.js"></script>
-->
<script src="/min/components.min.js"></script>
<script src="/min/precompiled.templates.min.js"></script>
<script src="/src/doiview.js"></script>
<script src="/src/doicontroller.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var params = new URLSearchParams(document.location.search.substring(1));
var doi;
if (params.get("DOI")){
doi = params.get("DOI");
}
else{
doi = document.location.pathname.substring(1,document.location.pathname.length )
}
new DOIController(new DOIView()).connect(doi);
});
</script>
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-12 col-sm-4 blueBackground" > <img id="logo" style="height:80px;" src="/src/esrfLogo.png"> </img> </div>
<div class="col-12 col-sm-8 blueBackground flex">
<div id="doiPanel" class="col-12 whiteVCenteredFont text-right doiTitle" > </div>
</div>
</div>
</div>
<div id='main' ></div>
<div class="modal">
<!-- nothing to write here -->
</div>
<footer class="footer">
<div class="container-fluid">
<div class="row">
<div class="col-12 col-sm-10" >
<p><a style='font-weight:bold;' href="http://www.esrf.eu">European Synchrotron Radiation Facility</a></p>
</div>
<div class="col-1 col-sm-2">
<p style="font-size:12px;display:block;" >Access to data is governed by the <a href="http://www.esrf.eu/datapolicy">ESRF data policy</a>.</p>
</div>
</div>
</div>
</footer>
</body>
</html>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
function DOIController(e){this.server="https://icat.esrf.fr",this.sessionId=null,this.connection={plugin:"db",credentials:[{username:"reader",password:"reader"}]},this.view=e}function DOIView(){}DOIController.prototype.connect=function(e){var t=this;this.view.setDOI(e),this.sessionId||$.ajax({url:this.server+"/icat/session",data:{json:JSON.stringify(this.connection)},beforeSend:function(){t.view.setLoading("Retrieving data from Server")},complete:function(){t.view.setLoading(!1)},type:"post",dataType:"json",success:function(n){t.sessionId=n.sessionId,t.getByDOI(e),t.view.setLoading(!1)},error:function(){t.view.setLoading(!1)}})},DOIController.prototype.getByDOI=function(e){var t="select inv from Investigation inv where inv.doi='"+e+"' INCLUDE inv.investigationInstruments invInstruments, inv.investigationUsers invUser, invUser.user, invInstruments.instrument";$.ajax({url:this.server+"/icat/entityManager",data:{sessionId:this.sessionId,server:this.server,query:t},type:"GET",dataType:"json",success:function(e){void 0!==e[0]?dust.render("esrf-landing-page",{investigation:e[0].Investigation,investigationUsers:e[0].Investigation.investigationUsers},function(e,t){$("#main").html(t)}):alert("Sorry, the requested DOI was not found.")},error:function(){alert("Sorry, error while processing the request. Please contact the webmaster")}})},DOIView.prototype.setLoading=function(e){0!=e?$("body").addClass("loading"):$("body").removeClass("loading")},DOIView.prototype.setDOI=function(e){$("#doiPanel").html(e)};
\ No newline at end of file
.flex{display:flex}.blueBackground{background-color:#132577!important}.lightRedBackground{background-color:#ffcaca!important}.grayBackground{background-color:#dcdee2}.whiteVCenteredFont{color:#fff;margin-top:auto;margin-bottom:auto}.btn{white-space:normal}.btn-primary:hover{background-color:#5b5a78;border-color:#2b2a48}.btn-primary{border-color:#2b2a48}label{font-weight:700}#logo{height:50px}.modal{display:none;position:fixed;z-index:1000;top:20;left:20;height:100%;width:100%;background:rgba(255,255,255,.8) url(../src/ajax-loader.gif) 50% 50% no-repeat}body.loading{overflow:hidden}body.loading .modal{display:block}
\ No newline at end of file
html{position:relative;min-height:100%}body{margin-bottom:60px}.footer{position:absolute;bottom:0;width:100%;height:60px;line-height:60px;background-color:#f5f5f5}.container{width:auto;max-width:680px;padding:0 15px}.flex{display:flex}.doiTitle{font-size:30px}.blueBackground{background-color:#132577!important}.lightRedBackground{background-color:#ffcaca!important}.grayBackground{background-color:#dcdee2}.whiteVCenteredFont{color:#fff;margin-top:auto;margin-bottom:auto}.btn{white-space:normal}.btn-primary:hover{background-color:#5b5a78;border-color:#2b2a48}.btn-primary{border-color:#2b2a48}label{font-weight:700}#logo{height:50px}.modal{display:none;position:fixed;z-index:1000;top:20;left:20;height:100%;width:100%;background:rgba(255,255,255,.8) url(../src/ajax-loader.gif) 50% 50% no-repeat}body.loading{overflow:hidden}body.loading .modal{display:block}
\ No newline at end of file
(function(dust){dust.register("esrf-landing-page",body_0);function body_0(chk,ctx){return chk.w("<div class=\"container-fluid\"><div class=\"row\"><div class=\"col-12 col-sm-4 blueBackground\" > <img id=\"logo\" src=\"./src/esrfLogo.png\"> </img> </div><div class=\"col-12 col-sm-8 blueBackground flex\"> <div class=\"col-12 whiteVCenteredFont text-right\" > ").f(ctx.getPath(false, ["investigation","doi"]),ctx,"h").w(" </div></div></div><div class=\"row\"><div class=\"col-8\" > <label>Title</label><p class=\"grayBackground\"> ").f(ctx.getPath(false, ["investigation","summary"]),ctx,"h").w(" </p><label> Abstract </label><p class=\"grayBackground\"> </p><p><label> Experimental report </label> <button type=\"button\" class=\"btn btn-primary btn-lg btn-block blueBackground disabled\" style='background-color:#D7D7D7; border:1px solid #D7D7D7;'>Download experimental report </button> </p><p><label> Download data </label><button type=\"button\" class=\"btn btn-primary btn-lg btn-block blueBackground disabled\" style='background-color:#D7D7D7; border:1px solid #D7D7D7;'>Download data </button></p></div><div class=\"col-4\"><div class=\"row\"> <div class=\"col-12\" ><label> Identifier </label><p> ").f(ctx.getPath(false, ["investigation","id"]),ctx,"h").w("</p><label> Authors </label>").s(ctx.getPath(false, ["investigation","investigationUsers"]),ctx,{"block":body_1},{}).w("<label> Publisher </label><p> ESRF </p><label> Publication year </label><p> year </p><label> Proposal number </label><p> ").f(ctx.getPath(false, ["investigation","name"]),ctx,"h").w(" </p> \t</div></div></div></div></div>");}body_0.__dustBody=!0;function body_1(chk,ctx){return chk.h("eq",ctx,{"block":body_2},{"key":ctx.get(["role"], false),"value":"Principal investigator"},"h").h("eq",ctx,{"block":body_3},{"key":ctx.get(["role"], false),"value":"Proposal scientist"},"h");}body_1.__dustBody=!0;function body_2(chk,ctx){return chk.w(" <p>").f(ctx.getPath(true, ["user","fullName"]),ctx,"h").w("</p> ");}body_2.__dustBody=!0;function body_3(chk,ctx){return chk.w("<p>").f(ctx.getPath(true, ["user","fullName"]),ctx,"h").w("</p>");}body_3.__dustBody=!0;return body_0}(dust));
\ No newline at end of file
(function(dust){dust.register("esrf-landing-page",body_0);function body_0(chk,ctx){return chk.w("<div class=\"container-fluid\"><br /><div class=\"row\"><div class=\"col-10\" ><label>Title</label><div class=\"alert alert-dark\" role=\"alert\">").f(ctx.getPath(false, ["investigation","summary"]),ctx,"h").w(" \t\t \t</div><label> Abstract </label><div class=\"alert alert-warning alert-dismissible fade show text-center align-middle\" style=\"height:300px;\" role=\"alert\">There is no abstract associated to this DOI<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\">&times;</span></button></div><p class=\"grayBackground\"> </p><p><label> Experimental report </label> <button type=\"button\" class=\"btn btn-primary btn-lg btn-block blueBackground disabled\" style='background-color:#D7D7D7; border:1px solid #D7D7D7;'>Download experimental report </button> </p><p><label> Download data </label><button type=\"button\" class=\"btn btn-primary btn-lg btn-block blueBackground disabled\" style='background-color:#D7D7D7; border:1px solid #D7D7D7;'>Download data </button></p></div><div class=\"col-2\"><div class=\"row\"><div class=\"col-12\" > <div class=\"card\"><div class=\"card-header\"><label>Authors </label></div><div class=\"card-body text-center\">").s(ctx.getPath(false, ["investigation","investigationUsers"]),ctx,{"block":body_1},{}).w("</div></div><br /><div class=\"card\"><div class=\"card-header\"><label>Publisher </label></div><div class=\"card-body text-center\">ESRF</div></div><br /><div class=\"card\"><div class=\"card-header\"><label>Publication year </label></div><div class=\"card-body text-center\">2020</div></div><br /><div class=\"card\"><div class=\"card-header\"><label>Proposal number </label></div><div class=\"card-body text-center\">").f(ctx.getPath(false, ["investigation","name"]),ctx,"h").w("</div></div> </div></div></div></div>");}body_0.__dustBody=!0;function body_1(chk,ctx){return chk.h("eq",ctx,{"block":body_2},{"key":ctx.get(["role"], false),"value":"Principal investigator"},"h").h("eq",ctx,{"block":body_3},{"key":ctx.get(["role"], false),"value":"Proposal scientist"},"h");}body_1.__dustBody=!0;function body_2(chk,ctx){return chk.w(" ").f(ctx.getPath(true, ["user","fullName"]),ctx,"h");}body_2.__dustBody=!0;function body_3(chk,ctx){return chk.f(ctx.getPath(true, ["user","fullName"]),ctx,"h");}body_3.__dustBody=!0;return body_0}(dust));
\ No newline at end of file
function ICATClient() {
this.server = "https://linfalcon.esrf.fr:8181";
function DOIController(view) {
this.server = "https://icat.esrf.fr";
this.sessionId = null;
this.connection = {
plugin : 'simple',
plugin : 'db',
credentials : [ {
username : 'root',
password : 'root'
username : 'reader',
password : 'reader'
} ]
};
this.view = view;
}
ICATClient.prototype.connect = function (doi) {
var _this = this;
DOIController.prototype.connect = function (doi) {
var _this = this;
this.view.setDOI(doi);
if (!this.sessionId) {
$.ajax({
url : this.server + "/icat/session",
data : {
json : JSON.stringify(this.connection)
},
beforeSend: function() {
_this.view.setLoading("Retrieving data from Server");
},
complete: function(){
_this.view.setLoading(false);
},
type : "post",
dataType : "json",
success : function (data) {
_this.sessionId = data.sessionId;
_this.getByDOI(doi);
_this.view.setLoading(false);
},
error : function () {
alert("Sorry, there was a connexion problem with the server. Please contact the webmaster.");
//alert("Sorry, there was a connexion problem with the server. Please contact the webmaster.");
_this.view.setLoading(false);
}
});
......@@ -36,7 +48,7 @@ ICATClient.prototype.connect = function (doi) {
};
ICATClient.prototype.getByDOI = function (doi) {
DOIController.prototype.getByDOI = function (doi) {
var _this = this;
var query = "select inv from Investigation inv where inv.doi='" +
doi +
......
function DOIView() {
}
DOIView.prototype.setLoading = function (message) {
if (message == false){
$("body").removeClass("loading");
return;
}
$("body").addClass("loading");
};
DOIView.prototype.setDOI = function (doi) {
$("#doiPanel").html(doi);
};
<div class="container-fluid">
<div class="row">
<div class="col-12 col-sm-4 blueBackground" > <img id="logo" src="./src/esrfLogo.png"> </img> </div>
<div class="col-12 col-sm-8 blueBackground flex">
<div class="col-12 whiteVCenteredFont text-right" > {investigation.doi} </div>
</div>
</div>
<div class="row">
<div class="col-8" >
<label>Title</label>
<p class="grayBackground"> {investigation.summary} </p>
<label> Abstract </label>
<p class="grayBackground"> </p>
<p>
<label> Experimental report </label>
<button type="button" class="btn btn-primary btn-lg btn-block blueBackground disabled" style='background-color:#D7D7D7; border:1px solid #D7D7D7;'>Download experimental report </button>
</p>
<p>
<label> Download data </label>
<button type="button" class="btn btn-primary btn-lg btn-block blueBackground disabled" style='background-color:#D7D7D7; border:1px solid #D7D7D7;'>Download data </button>
</p>
</div>
<div class="col-4">
<div class="row">
<div class="col-12" >
<label> Identifier </label>
<p> {investigation.id}</p>
<label> Authors </label>
{#investigation.investigationUsers}
{@eq key=role value="Principal investigator"}
<p>{.user.fullName}</p>
{/eq}
{@eq key=role value="Proposal scientist"}
<p>{.user.fullName}</p>
{/eq}
{/investigation.investigationUsers}
<label> Publisher </label>
<p> ESRF </p>
<label> Publication year </label>
<p> year </p>
<label> Proposal number </label>
<p> {investigation.name} </p>
</div>
</div>
</div>
</div>
</div>
<br />
<div class="row">
<div class="col-10" >
<label>Title</label>
<div class="alert alert-dark" role="alert">
{investigation.summary}
</div>
<label> Abstract </label>
<div class="alert alert-warning alert-dismissible fade show text-center align-middle" style="height:300px;" role="alert">
There is no abstract associated to this DOI
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<p class="grayBackground"> </p>
<p>
<label> Experimental report </label>
<button type="button" class="btn btn-primary btn-lg btn-block blueBackground disabled" style='background-color:#D7D7D7; border:1px solid #D7D7D7;'>Download experimental report </button>
</p>
<p>
<label> Download data </label>
<button type="button" class="btn btn-primary btn-lg btn-block blueBackground disabled" style='background-color:#D7D7D7; border:1px solid #D7D7D7;'>Download data </button>
</p>
</div>
<div class="col-2">
<div class="row">
<div class="col-12" >
<div class="card">
<div class="card-header">
<label>Authors </label>
</div>
<div class="card-body text-center">
{#investigation.investigationUsers}
{@eq key=role value="Principal investigator"}
{.user.fullName}
{/eq}
{@eq key=role value="Proposal scientist"}
{.user.fullName}
{/eq}
{/investigation.investigationUsers}
</div>
</div>
<br />
<div class="card">
<div class="card-header">
<label>Publisher </label>
</div>
<div class="card-body text-center">
ESRF
</div>
</div>
<br />
<div class="card">
<div class="card-header">
<label>Publication year </label>
</div>
<div class="card-body text-center">
2020
</div>
</div>
<br />
<div class="card">
<div class="card-header">
<label>Proposal number </label>
</div>
<div class="card-body text-center">
{investigation.name}
</div>
</div>
</div>
</div>
</div>
</div>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment