Commit 41c4ecbc authored by Maxime Chaillet's avatar Maxime Chaillet

Merge branch 'master' into 'master'

It references #1

Closes #1

See merge request !1
parents bb8aa0da 53c37b01
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/oracle-java8-jdk-amd64">
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="oracle.eclipse.tools.glassfish.lib.system">
<attributes>
<attribute name="owner.project.facets" value="jst.web"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>
node_modules/
bower_components/
.classpath
.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
.recommenders
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# PyDev specific (Python IDE for Eclipse)
*.pydevproject
# CDT-specific (C/C++ Development Tooling)
.cproject
# Java annotation processor (APT)
.factorypath
# PDT-specific (PHP Development Tools)
.buildpath
# sbteclipse plugin
.target
# Tern plugin
.tern-project
# TeXlipse plugin
.texlipse
# STS (Spring Tool Suite)
.springBeans
# Code Recommenders
.recommenders/
# Scala IDE specific (Scala & Java development for Eclipse)
.cache-main
.scala_dependencies
.worksheet
# eclipse project file
.settings/
.classpath
.project
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>detailsFromDOI</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry excluding="**/bower_components/*|**/node_modules/*|**/*.min.js" kind="src" path="WebContent"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
<attributes>
<attribute name="hide" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
<classpathentry kind="output" path=""/>
</classpath>
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="detailsFromDOI">
<wb-resource deploy-path="/" source-path="/WebContent" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>
<property name="context-root" value="detailsFromDOI"/>
<property name="java-output-path" value="/detailsFromDOI/build/classes"/>
</wb-module>
</project-modules>
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<runtime name="GlassFish 4"/>
<fixed facet="wst.jsdt.web"/>
<fixed facet="java"/>
<fixed facet="jst.web"/>
<installed facet="java" version="1.8"/>
<installed facet="jst.web" version="3.1"/>
<installed facet="glassfish.web" version="4.0"/>
<installed facet="wst.jsdt.web" version="1.0"/>
</faceted-project>
org.eclipse.wst.jsdt.launching.baseBrowserLibrary
\ No newline at end of file
module.exports = function(grunt) {
grunt.initConfig({
jshint: {
files: ['Gruntfile.js', 'src/*.js', 'test/**/*.js'],
options: {
globals: {
jQuery: true
}
}
},
watch: {
files: ['<%= jshint.files %>', 'templates/**js'],
tasks: [ 'uglify','dustjs','wiredep']
},
uglify: {
options: {
mangle: true
},
my_target: {
files: {
'min/doi-landing-page.min.js': ['src/*js']
}
}
},
wiredep: {
target: {
src: 'index.html'
}
},
dustjs : {
compile : {
files : {
'min/precompiled.templates.min.js' : [ 'templates/**js' ]
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-wiredep');
grunt.loadNpmTasks('grunt-dustjs');
grunt.registerTask('default', ['jshint', 'dustjs', 'uglify', 'wiredep']);
};
Manifest-Version: 1.0
Class-Path:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app>
<context-root>/detailsFromDOI</context-root>
</glassfish-web-app>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>details from DOI</title>
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script type="text/javascript">
var connection= {
json: "{\"plugin\":\"simple\",\"credentials\":[{\"username\":\"root\"}, {\"password\":\"root\"}]}"
}
var mySessionId="";
$(document).ready(function() {
console.log("Hello. The document is ready.");
$("#doiRequestDiv").hide();
$("#connectButton").click(function() {
console.log("You clicked on Connection button");
// From: http://learn.jquery.com/ajax/jquery-ajax-methods/
// Using the core $.ajax() method
$.ajax({
// The URL for the request
url: "https://linfalcon.esrf.fr:8181/icat/session",
// The data to send (will be converted to a query string)
data: connection,
// Whether this is a POST or GET request
type: "post",
// The type of data we expect back
//dataType : "text",
dataType : "json",
// Code to run if the request succeeds;
// the response is passed to the function
success: function( data ) {
console.log("You received some data!");
mySessionId = data.sessionId;
$("#connectionState").html("Your session ID is " + data.sessionId);
$("#doiRequestDiv").show();
},
// Code to run if the request fails
error: function() {
alert( "Sorry, there was a problem!" );
}
});
});
$("#getDoiButton").click(function() {
console.log("getDoiButton clicked");
var doiRequest = $("#doiId").val();
var myDoiQuery = "select distinct dataCollection from DataCollection dataCollection" +
" where dataCollection.doi='" + doiRequest + "'" +
" include dataCollection.parameters";
$.ajax({
// The URL for the request
url: "https://linfalcon.esrf.fr:8181/icat/entityManager",
// The data to send (will be converted to a query string)
data: {
sessionId: mySessionId,
server : "https://linfalcon.esrf.fr:8181",
query : myDoiQuery
},
type: "GET",
dataType : "json",
success: function( data ) {
console.log("The requested DOI was found !");
// data contains an array
receptionDOIInfo(data);
},
// Code to run if the request fails
error: function() {
alert( "Sorry, error while processing the DOI request !" );
}
});
});
});
function receptionDOIInfo(data){
if (data.length != 0)
{
var doiName = data[0].DataCollection.doi;
var doiId = data[0].DataCollection.id;
var title = data[0].DataCollection.parameters[0].stringValue;
var mintedDate = data[0].DataCollection.parameters[1].dateTimeValue;
var mintedBy = data[0].DataCollection.parameters[2].stringValue;
$("#doiResultDiv").html(
"Received Data : <BR/> " +
"doiName : " + doiName + " <BR/>" +
"doiID : " + doiId + " <BR/>" +
"title : " + title + " <BR/>" +
"mintedDate : " + mintedDate + " <BR/>" +
"mintedBy : " + mintedBy + " <BR/>"
);
} else {
$("#doiResultDiv").html("Sorry, the DOI was not found !" );
};
};
</script>
</head>
<body>
<h1>Salut</h1>
<p>Cliquer sur le bouton pour connexion sur ICAT server.</p>
<button id="connectButton">Connexion</button>
<div id="connectionState"></div>
<div id="doiRequestDiv"> Enter the requested DOI :
<input type="text" id="doiId">
<button id="getDoiButton"> Get it !</button>
</div>
<div id="doiResultDiv"> </div>
</body>
</html>
\ No newline at end of file
{
"name": "ESRF DOI landing page",
"authors": [
"Alejandro De Maria Antolinos <demariaa@esrf.fr>",
"Maxime Chaillet <mchaille@esrf.fr>"
],
"description": "This is the landing page for the DOI at the ESRF",
"main": "index.html",
"moduleType": [],
"keywords": [
"DOI",
"ESRF",
"data",
"science",
"metadata"
],
"license": "MIT",
"homepage": "https://doi.esrf.fr",
"private": true,
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"jquery": "^3.2.1",
"dustjs-linkedin": "^2.7.5",
"bootstrap": "^3.3.7"
}
}
<!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">
<!-- bower:css -->
<!-- endbower -->
</head>
<!-- bower:js -->
<script src="bower_components/jquery/dist/jquery.js"></script>
<script src="bower_components/dustjs-linkedin/dist/dust-full.min.js"></script>
<script src="bower_components/bootstrap/dist/js/bootstrap.js"></script>
<!-- endbower -->
<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 client = new ICATClient();
client.connect("id010100");
});
</script>
</head>
<body>
<div id='main'></div>
</body>
</html>
\ No newline at end of file
function ICATClient(){this.server="https://icat.esrf.fr",this.sessionId=null,this.connection={plugin:"db",credentials:[{username:"reader",password:"reader"}]}}ICATClient.prototype.connect=function(e){var s=this;this.sessionId||$.ajax({url:this.server+"/icat/session",data:{json:JSON.stringify(this.connection)},type:"post",dataType:"json",success:function(n){s.sessionId=n.sessionId,s.getByDOI(e)},error:function(){alert("Sorry, there was a problem!")}})},ICATClient.prototype.getByDOI=function(e){var s="select inv from Investigation inv where inv.name='"+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:s},type:"GET",dataType:"json",success:function(e){console.log(e),dust.render("esrf-landing-page",{investigation:e[0].Investigation,investigationUsers:e[0].Investigation.investigationUsers},function(e,s){$("#main").html(s)})},error:function(){alert("Sorry, error while processing the DOI request !")}})};
\ 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-sm-4\" style=\"background-color:lavender;\">").f(ctx.getPath(true, ["investigation","name"]),ctx,"h").w("</div><div class=\"col-sm-4\" style=\"background-color:lavenderblush;\">.col-sm-4</div><div class=\"col-sm-4\" style=\"background-color:lavender;\">.col-sm-4</div></div>").s(ctx.getPath(true, ["investigationUsers"]),ctx,{"block":body_1},{}).w(" <div class=\"col-sm-12\" style=\"background-color:lavender;\">").f(ctx.getPath(true, ["investigation","summary"]),ctx,"h").w("</div> </div> ");}body_0.__dustBody=!0;function body_1(chk,ctx){return chk.w("<div class=\"row\"><div class=\"col-sm-12\" style=\"background-color:lavender;\">").f(ctx.getPath(true, ["user","name"]),ctx,"h").w("</div> </div>");}body_1.__dustBody=!0;return body_0}(dust));
\ No newline at end of file
{
"name": "doi-landing-page",
"version": "0.0.0",
"description": "",
"main": "Gruntfile.js",
"dependencies": {
"grunt": "^1.0.1",
"grunt-contrib-jshint": "^1.1.0",
"grunt-contrib-watch": "^1.0.0",
"grunt-dust": "^0.9.4",
"grunt-dustjs": "^1.4.0"
},
"devDependencies": {
"grunt": "^1.0.1",
"grunt-contrib-jshint": "^1.1.0"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git@gitlab.esrf.fr:icat/doi-landing-page.git"
},
"author": "",
"license": "ISC"
}
function ICATClient(){
this.server = "https://icat.esrf.fr";
this.sessionId = null;
this.connection = {
plugin : 'db',
credentials : [
{
username : 'reader',
password :'reader'
}
]
};
}
ICATClient.prototype.connect = function(doi){
var _this = this;
if (!this.sessionId){
$.ajax({
url: this.server + "/icat/session",
data: { json : JSON.stringify(this.connection) },
type: "post",
dataType : "json",
success: function( data ) {
_this.sessionId = data.sessionId;
_this.getByDOI(doi);
},
error: function() {
alert( "Sorry, there was a problem!" );
}
});
}
};
ICATClient.prototype.getByDOI = function(doi){
var _this = this;
var query = "select inv from Investigation inv where inv.name='" + doi + "' 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 : query
},
type: "GET",
dataType : "json",
success: function( data ) {
console.log(data);
dust.render('esrf-landing-page',
{
investigation : data[0].Investigation,
investigationUsers : data[0].Investigation.investigationUsers
}, function(err, out) {
$("#main").html(out);
});
},
// Code to run if the request fails
error: function() {
alert( "Sorry, error while processing the DOI request !" );
}
});
};
<div class="container-fluid">
<div class="row">
<div class="col-sm-4" style="background-color:lavender;">{.investigation.name}</div>
<div class="col-sm-4" style="background-color:lavenderblush;">.col-sm-4</div>
<div class="col-sm-4" style="background-color:lavender;">.col-sm-4</div>
</div>
{#.investigationUsers}
<div class="row">
<div class="col-sm-12" style="background-color:lavender;">{.user.name}</div>
</div>
{/.investigationUsers}
<div class="col-sm-12" style="background-color:lavender;">{.investigation.summary}</div>
</div>
\ No newline at end of file
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