This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -6,7 +6,7 @@ window.nomadEnv = {
//apiRoot: "https://nomad-lab.eu/prod/rae/api/encyclopedia/",
//guiRoot: "https://nomad-lab.eu/prod/rae/encyclopedia/",
guiRoot: "http://localhost:3000/gui/",
apiRoot: "http://localhost:3000/",
apiRoot: "http://localhost:8000/fairdi/nomad/latest/api/encyclopedia/",
userCookieDomain: ".localhost",
guestUserToken: 'eyJhbGciOiJIUzI1NiIsImlhdCI6MTUyMzg4MDE1OSwiZXhwIjoxNjgxNTYwMTU5fQ.ey'+
'JpZCI6ImVuY2d1aSJ9.MsMWQa3IklH7cQTxRaIRSF9q8D_2LD5Fs2-irpWPTp4',
......
......@@ -594,7 +594,7 @@
"similar materials": {
"comment": "",
"link": "https://en.wikipedia.org/wiki/Similarity_search",
"text": "Five materials of the Encyclopedia are shown, that are most similar to the current one in terms of the electronic density of states in the upper valence region. The used fingerprints are based on a modification to those suggested by <a href=\"https://pubs.acs.org/doi/abs/10.1021/cm503507h\" target=\"_blank2\">O. Isayev et al., Chem. Mater. 27 (2015), 735-743</a>. The similarity is measured by the Tanimoto coefficient <i>Tc</i>, which ranges between 0 (not similar) and 1 (identical)."
"text": "At most five materials of the Encyclopedia are shown, that are most similar to the current one in terms of the electronic density of states in the upper valence region. The used fingerprints are based on a modification to those suggested by <a href=\"https://pubs.acs.org/doi/abs/10.1021/cm503507h\" target=\"_blank2\">O. Isayev et al., Chem. Mater. 27 (2015), 735-743</a>. The similarity is measured by the Tanimoto coefficient <i>Tc</i>, which ranges between 0 (not similar) and 1 (identical)."
},
"smearing kind": {
"comment": "specification possible",
......@@ -649,4 +649,4 @@
"num": "space group"
}
}
}
\ No newline at end of file
}
......@@ -205,15 +205,13 @@ sendButton.addEventListener('click', e => {
report.subcategory = subcategoryField.options[subcategoryField.selectedIndex].text;
}
let token = keycloak.token;
util.serverReqPOST(util.getReportURL(materialId), JSON.stringify(report), e => {
if (e.target.status === 204) {
hide();
} else {
validationMsg.innerHTML = "Could not connect to the service. Please check your connection and try again later.";
}
}, token);
});
})
.catch(error => {
console.log(error);
......
......@@ -41,8 +41,6 @@ let searchResults = false;
const IMAGE_DIR = 'img/';
const AUTH_REQUEST_HEADER_GUEST_USER = 'Basic '+ btoa(window.nomadEnv.guestUserToken+':');
const MAT_VIEW = {
'structure' : 'structure',
'electronicstruct': 'electronicstruct',
......@@ -72,8 +70,6 @@ const API_BASE_URL = window.nomadEnv.apiRoot;
// Local variables
let authRequestHeaderValue = AUTH_REQUEST_HEADER_GUEST_USER;
//console.log('user: ANONYMOUS authRequestHeader: ',authRequestHeaderValue);
let userData = null;
......@@ -130,41 +126,33 @@ function getShortCode(id) {
throw "The given identifier could not be shortened as it does not have the right initial length.";
}
function setAuthRequestHeader(userDataP, value){
if (value === undefined) { // default value
authRequestHeaderValue = AUTH_REQUEST_HEADER_GUEST_USER;
userData = null;
//console.log('user: ANONYMOUS authRequestHeader: ',authRequestHeaderValue);
} else{
authRequestHeaderValue = 'Basic '+ btoa(value+':');
userData = userDataP;
//console.log('user',user,'authRequestHeader: ',authRequestHeaderValue);
}
}
function serverReq(url, callback){
var oReq = new XMLHttpRequest();
oReq.addEventListener("load", callback);
oReq.open("GET", url);
//console.log('authRequestHeaderValue: ',authRequestHeaderValue);
oReq.setRequestHeader('Authorization', authRequestHeaderValue);
// Check for authentication
var keycloak = window.keycloak;
if (keycloak.authenticated) {
oReq.setRequestHeader('Authorization', 'Bearer ' + keycloak.token);
}
oReq.send();
return oReq;
}
function serverReqPOST(url, data, callback, token){
function serverReqPOST(url, data, callback){
var oReq = new XMLHttpRequest();
oReq.addEventListener('load', callback);
oReq.open('POST', url);
oReq.setRequestHeader('Content-Type', 'application/json');
if (token !== null) {
oReq.setRequestHeader('Authorization', 'Bearer ' + token);
} else {
oReq.setRequestHeader('Authorization', authRequestHeaderValue);
// Check for authentication
var keycloak = window.keycloak;
if (keycloak.authenticated) {
oReq.setRequestHeader('Authorization', 'Bearer ' + keycloak.token);
}
oReq.send(data);
return oReq;
}
......@@ -443,7 +431,6 @@ module.exports = {
MAT_VIEW: MAT_VIEW,
IMAGE_DIR: IMAGE_DIR,
ELEMENTS: ELEMENTS,
setAuthRequestHeader,
getUserData,
getServerLocation,
authServerReq,
......
......@@ -294,7 +294,7 @@ function parseCookie(userData) {
let userInfoCookie = getCookie('user_info');
if (userInfoCookie !== undefined){
if (userInfoCookie !== undefined) {
let userInfoData = JSON.parse(parseCookie(userInfoCookie));
//console.log('userInfoData: ', userInfoData);
setAppAuthenticated(userInfoData);
......
......@@ -34,8 +34,8 @@ let DataStore = require('./DataStore.js');
let SortingButton = require('./SortingButton.js');
const REPOSITORY_LINK =
'https://repository.nomad-coe.eu/NomadRepository-1.1/views/calculation.zul?pid=';
let guiRoot = window.nomadEnv.guiRoot;
let REPOSITORY_LINK = guiRoot.slice(0, guiRoot.lastIndexOf('/', guiRoot.lastIndexOf('/')-1))+"/gui/entry/id"
const calcTypesMap = new Map([
['single point', 'Single point'],
......@@ -58,7 +58,7 @@ class FilterInGroupsComponent {
this.filtersOn = [];
this.folded = true;
this.element.innerHTML+=`
<div>
<div style="padding: 0rem 2.5rem">
<div style="display: flex; justify-content: flex-end;">
<div class="filter-groups-c-folded" >
<span style="vertical-align: top;">Filtering &nbsp;&nbsp;</span>
......@@ -68,27 +68,25 @@ class FilterInGroupsComponent {
<!--<button class="on">filter</button> -->
</div>
</div>
<div class="filter-groups-c-unfolded" style="display: none">
<div class="filter-groups-c-unfolded" style="display: none; padding-bottom: 1rem">
<table style="width: 100%;">
<thead>
<tr>
<th style="width: 12%;"> </th>
<th style="width: 16%;">
<th style="width: 20%;">
<span>Type</span>
</th>
<th style="width: 18%;">
<th style="width: 20%;">
<span info-sys-data="functional-type">Density functional</span>
</th>
<th style="width: 12%;">
<th style="width: 20%;">
<span info-sys-data="code-name">Code</span>
</th>
<th style="width: 16%;">
<th style="width: 20%;">
<span info-sys-data="pseudopotential-type">Potential</span>
</th>
<th style="width: 11%;">
<th style="width: 20%;">
<span info-sys-data="basis-set-type">Basis set</span>
</th>
<!-- <th style="width: 9%;"> </th> -->
</tr>
</thead>
<tbody>
......@@ -98,7 +96,6 @@ class FilterInGroupsComponent {
</div>
</div>
`;
//this.foldedPanel = this.element.querySelector('.filter-groups-c-folded');
this.unfoldedPanel = this.element.querySelector('.filter-groups-c-unfolded');
this.filterItemsRow = this.element.querySelector('#filter-items-row');
......@@ -108,7 +105,6 @@ class FilterInGroupsComponent {
this.folded = !this.folded;
this.foldBtn.src = (this.folded ? util.IMAGE_DIR+'folded.png' :
util.IMAGE_DIR+'unfolded.png');
//this.foldedPanel.style.display = (this.folded ? 'block' : 'none');
this.unfoldedPanel.style.display = (this.folded ? 'none' : 'block');
});
......@@ -144,7 +140,7 @@ class FilterInGroupsComponent {
if (!lBasicSetMap.has(c.basis_set_type))
lBasicSetMap.set(c.basis_set_type, c.basis_set_type);
});
this.filterItemsRow.innerHTML = '<td></td>'; // calculation Id column
this.filterItemsRow.innerHTML = '';
this.filtersOn = [];
this.addGroupItems(lCalcTypesMap);
this.addGroupItems(lDensityFunctionalMap);
......@@ -227,14 +223,9 @@ class MethodologyDetails extends DetailsViewBase {
<span info-sys-data="basis-set-type">Basis set</span>
<span class="sorting-button"></span>
</th>
<!-- <th style="width: 8%;">
<th style="width: 4%;">
<span info-sys-data="basis-set-type">Link</span>
</th>
<th style="width: 8%;">
<span info-sys-data="basis-set-type">RV</span>
</th> -->
</tr>
</thead>
<tbody>
......@@ -428,7 +419,7 @@ class MethodologyDetails extends DetailsViewBase {
updateMarkedLeaf(leafId){ }
_render(){
_render() {
let html = '';
this.sortedCalcs.forEach( rowCalcData => { //leafId => {
......@@ -443,10 +434,8 @@ class MethodologyDetails extends DetailsViewBase {
let calc = DataStore.getCalc( /*DataStore.getCalcReprIntId(*/rowCalcData.calc_id);
let calcType = rowCalcData.type;
let repositoryLinkHtml = '';
if (calc.calculation_pid !== null && calc.calculation_pid !== undefined)
repositoryLinkHtml =
'<a href="'+REPOSITORY_LINK+calc.calculation_pid+'" target="blank"> '
let repositoryLinkHtml =
`<a href="${REPOSITORY_LINK}/${calc.upload_id}/${calc.calc_id}" target="blank">`
+'<img src="img/download.svg" height="20px" /> </a>';
let materialId = DataStore.getMaterialData().material_id;
......@@ -481,10 +470,11 @@ class MethodologyDetails extends DetailsViewBase {
${calc.basis_set_type}</span>
${getOptValue(calc.basis_set_quality_quantifier)}
</td>
<!--
<td style="padding-top: 8px;padding-bottom: 4px;">${repositoryLinkHtml}
</td>
<!--
<td style="padding-top: 8px;padding-bottom: 4px;">${vrLinkHtml}
</td>-->
......
......@@ -304,7 +304,7 @@ class NavTree {
let calcs = DataStore.getCalculations();
let calcIcon = document.createElement("img");
calcIcon.className = "folder-icon";
calcIcon.src = +util.IMAGE_DIR+"folder.png";
calcIcon.src = util.IMAGE_DIR+"folder.png";
// For the structure view we group calculations
let groups = null;
......
......@@ -172,7 +172,7 @@ class Overview {
Spin <span style='font-size: 1.1em'>⇩</span>
</td>
<td class = "similarity-data-field">
<div style="float: right; padding: 0px 40px 10px 0px; margin-top: 1px;" class="similarity-finder">
<div style="float: right; padding: 0px 50px 10px 0px; margin-top: 1px;" class="similarity-finder">
</div>
</td>
</tr>
......
......@@ -5,11 +5,9 @@ class SimilarityFinder {
constructor() {
this.folded = true;
this.element = document.createElement('span');
//this.element.className = className;
this.element.setAttribute("info-sys-data","similar-materials")
this.element.style = "float : right; border: 2px solid #DDD; padding: 2px 2px 0px 3px;"
this.element.innerHTML+=`
<span style=" vertical-align: 30%;" ><b>Similar materials</b></span>
<span info-sys-data="similar-materials" style="vertical-align: 30%;">Similar materials</span>
<img style="cursor: pointer" src="${util.IMAGE_DIR}folded.png" />
<div class="vr-download-panel" style="position: relative; display: none;">
......@@ -44,23 +42,17 @@ class SimilarityFinder {
}
setSimilarityData(similarityData) {
const dataAsArray = Object.keys(similarityData).map(function(key) {
return {
data: similarityData[key],
key: key
}
})
dataAsArray.sort(function(a, b) {
if (a.data.Tc < b.data.Tc) {
similarityData.sort(function(a, b) {
if (a.value < b.value) {
return 1
} else if (a.data.Tc > b.data.Tc) {
} else if (a.value > b.value) {
return -1
} else {
return 0
}
})
const slicedData = dataAsArray.slice(0,5)
const slicedData = similarityData.slice(0, 5)
const container = document.createElement('table')
container.setAttribute('class','similar-materials-panel-unfolded')
......@@ -72,11 +64,10 @@ class SimilarityFinder {
container.appendChild(sim_table_header)
slicedData.forEach(function(item) {
const material_id = item.key.split(':')[0]
const element = document.createElement('tr')
element.style = "padding: 5px; font-family: 'Arimo', sans-serif; font-size: 10pt; "
const url = `${window.location.toString().replace(/#.*$/, "")}#/material/${material_id}`
element.innerHTML = `<td><a href="${url}" target="_${material_id}" style="color:#777; font-family: 'Arimo', sans-serif; font-size: 10pt;">${util.getSubscriptedFormula(item.data.formula)} (${item.data.space_group_number})</a></td><td>:</td> <td>${item.data.Tc.toPrecision(3)}</td>`
const url = `${window.location.toString().replace(/#.*$/, "")}#/material/${item.material_id}`
element.innerHTML = `<td><a href="${url}" target="_${item.material_id}" style="color:#777; font-family: 'Arimo', sans-serif; font-size: 10pt;">${util.getSubscriptedFormula(item.formula)} (${item.space_group_number})</a></td><td>:</td> <td>${item.value.toPrecision(3)}</td>`
container.appendChild(element)
})
......