Commit 9d8f86f9 authored by Lauri Himanen's avatar Lauri Himanen
Browse files

Fixed issue with subpage dropdown.

parent 57bd7d76
Pipeline #79030 skipped with stage
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -133,8 +133,8 @@ function show(pageStatus){
overviewEStructCalcs = pageStatus.eStructCalcs;
// Show/hide some dropdown list options
eStructOption.style.display = (DataStore.hasElecStructureData ? 'block' : 'none');
thermalOption.style.display = (DataStore.hasThermalData ? 'block' : 'none');
eStructOption.style.display = (DataStore.hasElecStructureData() ? 'block' : 'none');
thermalOption.style.display = (DataStore.hasThermalData() ? 'block' : 'none');
_setCurrentPage(pageStatus.pageId);
......
......@@ -104,10 +104,10 @@ class Breadcrumb {
let self = this;
function adjustDropdownOptions() {
let esOption = self.detailsDropDown.querySelector('option[value="electronicstruct"]');
if (!DataStore.hasElecStructureData) self.detailsDropDown.removeChild(esOption);
if (!DataStore.hasElecStructureData()) self.detailsDropDown.removeChild(esOption);
let thOption = self.detailsDropDown.querySelector('option[value="thermalprops"]');
if (!DataStore.hasThermalData) self.detailsDropDown.removeChild(thOption);
if (!DataStore.hasThermalData()) self.detailsDropDown.removeChild(thOption);
// Remove because we want it's executed once
self.detailsDropDown.removeEventListener('focus', adjustDropdownOptions);
}
......
......@@ -31,7 +31,7 @@ let representatives;
let idealizedStructure;
let calcMap = new Map();
let ready = false;
let hasThermalData, hasElecStructureData;
let hasThermal, hasElecStructure;
function setMaterialData(dataFromAPI){
materialData = dataFromAPI;
......@@ -64,6 +64,13 @@ function setCalculations(calcsFromAPI){
for (let i = 0; i < calcs.length; i++) {
calcMap.set(calcs[i].calc_id, calcs[i]);
}
// Check what type of information is available
let calcWithBS = representatives.electronic_band_structure;
let calcWithDOS = representatives.electronic_dos;
let calcWithHeat = representatives.thermodynamical_properties;
hasElecStructure = (calcWithBS !== undefined || calcWithDOS !== undefined);
hasThermal = calcWithHeat !== undefined;
}
function getRepresentatives() {
......@@ -157,26 +164,14 @@ function getGroupLeafId(calcId){
return leafId;
}
/*
function hasThermalData(bool){
hasThermalData = bool;
}
function setHasThermalData(bool){
hasThermalData = bool;
return hasThermal;
}
function hasElecStructureData(bool){
hasThermalData = bool;
return hasElecStructure;
}
function setHasElecStructureData(bool){
hasElecStructureData = bool;
}*/
// EXPORTS
module.exports = { getRepresentatives, setMaterialData, getMaterialData, getCalculations, getCalc,
......
......@@ -400,7 +400,6 @@ class SummaryByFunctionalsComponent{
this.functionalTabs.querySelector('[data-tab="'+this.functional+'"]')
.className = 'tab';
this.functional = e.target.getAttribute('data-tab');
console.log(this.functional);
this.functionalTabs.querySelector('[data-tab="'+this.functional+'"]')
.className = 'tab-selected';
this._setData();
......
......@@ -49,10 +49,12 @@ function buildCalcTree(calcs, calcsInGroups, view) {
} else // New code name
functionalMap.set(codeNameTrimed, [prefix+groupId]);
} else { // New functional
let newFunctionalMap = new Map();
newFunctionalMap.set(codeNameTrimed, [prefix+groupId]);
calcTree.set(functionalType, newFunctionalMap);
} else { // New functional, not build if value is unavailable
if (functionalType !== "unavailable") {
let newFunctionalMap = new Map();
newFunctionalMap.set(codeNameTrimed, [prefix+groupId]);
calcTree.set(functionalType, newFunctionalMap);
}
}
}
});
......
......@@ -441,17 +441,13 @@ class Overview {
this.code.append(container2);
InfoSys.addToInfoSystem(this.code);
if (calcWithBS === undefined && calcWithDOS === undefined) {
DataStore.hasElecStructureData = false;
} else {
if (DataStore.hasElecStructureData()) {
document.getElementById('e-structure-ov').style.display = 'block';
let isReady = () => {
if (this.dosLoaded && this.bsLoaded) {
document.getElementById('e-structure-ov').style.visibility = 'visible';
}
};
DataStore.hasElecStructureData = true;
if (this.bandPlotter === null){
this.bandPlotter= new BSPlotter();
......@@ -509,9 +505,8 @@ class Overview {
}
}
if (calcWithHeat === undefined) {
if (!DataStore.hasThermalData()) {
document.getElementById('thermal-props-ov').style.display = 'none';
DataStore.hasThermalData = false;
} else {
document.getElementById('thermal-props-ov').style.display = 'block';
DataStore.hasThermalData = true;
......
Supports Markdown
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