Spaces:
Sleeping
Sleeping
Update templates/proposed-GUI.html
Browse files- templates/proposed-GUI.html +274 -87
templates/proposed-GUI.html
CHANGED
|
@@ -84,7 +84,7 @@
|
|
| 84 |
<ul>
|
| 85 |
</ul>
|
| 86 |
</div> -->
|
| 87 |
-
|
| 88 |
<div id ="">
|
| 89 |
<select name="selectproj" class="selectionsProj" id="selectionsProjid" required > </select>
|
| 90 |
</div>
|
|
@@ -176,6 +176,7 @@
|
|
| 176 |
|
| 177 |
</div>
|
| 178 |
<button hidden id="doneebackground" onclick="getSecondData()" > Export Summary </button>
|
|
|
|
| 179 |
<div hidden id ="duplicaterhidden" class="duplicaterclasshidden">
|
| 180 |
<label id="labelArrayId" hidden="until-found"> </label>
|
| 181 |
<select name="measurementscripts" class="measurementselections" id="measurementselectionsid" >
|
|
@@ -347,7 +348,7 @@
|
|
| 347 |
<h2 id="TopTextModal">Warning!</h2>
|
| 348 |
</div>
|
| 349 |
<div class="modal-body">
|
| 350 |
-
<p id="modal-
|
| 351 |
</p>
|
| 352 |
<br>
|
| 353 |
<div class="text-right">
|
|
@@ -367,7 +368,6 @@
|
|
| 367 |
///////////////////////////////////////////////BEGIN JS CODE//////////////////////////////////////////////////
|
| 368 |
PopupElement=document.getElementById('modal-bodyText');
|
| 369 |
|
| 370 |
-
|
| 371 |
// add project names to first dropdown from google sheet
|
| 372 |
firstdropdown=document.getElementsByClassName('selectionsProj')[0];
|
| 373 |
seconddropdown=document.getElementsByClassName('selectionsProjp')[0];
|
|
@@ -541,92 +541,112 @@ $toggle.addEventListener('click', function() {
|
|
| 541 |
console.log(MCTNames)
|
| 542 |
}
|
| 543 |
// }
|
| 544 |
-
|
| 545 |
-
|
| 546 |
var worker = new Worker('../static/API_Refresh_workerJS.js');
|
|
|
|
|
|
|
|
|
|
| 547 |
|
| 548 |
-
worker.onmessage= function(event){
|
| 549 |
|
| 550 |
-
|
| 551 |
-
|
| 552 |
-
|
| 553 |
-
|
| 554 |
-
|
| 555 |
-
|
| 556 |
-
|
| 557 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 558 |
var data=JSON.parse(event.data);
|
| 559 |
-
|
| 560 |
-
|
| 561 |
-
|
| 562 |
-
|
| 563 |
-
|
| 564 |
-
|
| 565 |
-
|
| 566 |
-
|
| 567 |
-
|
| 568 |
-
|
| 569 |
-
|
| 570 |
-
|
| 571 |
-
|
| 572 |
-
|
| 573 |
-
|
| 574 |
-
$.get('/refreshAPIAppendNewTables')
|
| 575 |
-
.success(function(successData){
|
| 576 |
-
if (data[1]===('projectsection'))
|
| 577 |
-
{
|
| 578 |
-
if (firstdropdown.value & seconddropdown.value)
|
| 579 |
-
{
|
| 580 |
-
displayprjnames();
|
| 581 |
-
displayprojsections(firstdropdown.value,seconddropdown.value);
|
| 582 |
-
}
|
| 583 |
-
}
|
| 584 |
-
|
| 585 |
-
else if (data[1]==='project')
|
| 586 |
-
{
|
| 587 |
-
console.log('projjjj')
|
| 588 |
-
displayprjnames();
|
| 589 |
-
}
|
| 590 |
-
else if (data[1]==='part')
|
| 591 |
-
{ if (firstdropdown.value)
|
| 592 |
-
displayprojparts(firstDpwnValue);
|
| 593 |
-
}
|
| 594 |
-
else if (data[1]==='section')
|
| 595 |
{
|
| 596 |
-
|
| 597 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 598 |
}
|
| 599 |
-
|
|
|
|
|
|
|
| 600 |
{
|
| 601 |
-
|
| 602 |
-
|
| 603 |
-
displayprojparts(firstDpwnValue);
|
| 604 |
-
}
|
| 605 |
-
else if (data[1]==='partsection')
|
| 606 |
-
if (firstdropdown.value & seconddropdown.value)
|
| 607 |
{
|
| 608 |
-
|
| 609 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 610 |
}
|
| 611 |
-
|
| 612 |
-
// displayprjnames();
|
| 613 |
-
// }
|
| 614 |
-
document.getElementById('all').style.display='none';
|
| 615 |
-
})
|
| 616 |
-
.error(function(jqXHR, textStatus, errorThrown) {
|
| 617 |
-
PopupElement.textContent='Error occured while retrieving projects. Refresh and try again. If the error continues, please contact the ADR team to fix it. ';
|
| 618 |
-
ShowPopUp();
|
| 619 |
-
});
|
| 620 |
}
|
| 621 |
-
|
| 622 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 623 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 624 |
|
| 625 |
|
| 626 |
-
}
|
| 627 |
}
|
| 628 |
|
| 629 |
|
|
|
|
| 630 |
/*worker.onmessage= function(event){
|
| 631 |
}
|
| 632 |
*/
|
|
@@ -671,18 +691,22 @@ workerDropbox.onmessage= function(event)
|
|
| 671 |
//___________________________________________________________________________________________________________
|
| 672 |
// /*Retrieve MCTNAMES Dictionary from API - Flask*/
|
| 673 |
|
| 674 |
-
|
| 675 |
-
|
| 676 |
-
|
| 677 |
-
|
| 678 |
-
|
| 679 |
-
|
| 680 |
-
|
| 681 |
-
|
| 682 |
-
|
| 683 |
-
|
| 684 |
-
|
| 685 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 686 |
//___________________________________________________________________________________________________________
|
| 687 |
//___________________________________________________________________________________________________________
|
| 688 |
|
|
@@ -931,7 +955,7 @@ var ratioPunit=1;
|
|
| 931 |
//___________________________________________________________________________________________________________
|
| 932 |
//Retrieves list of projects
|
| 933 |
function getproj(){
|
| 934 |
-
|
| 935 |
document.getElementById("all").style.display = "block";
|
| 936 |
var proj = document.getElementsByClassName("selectionsProj")[0];
|
| 937 |
var projectVal=proj.value.toString() //selected project
|
|
@@ -941,6 +965,7 @@ var ratioPunit=1;
|
|
| 941 |
|
| 942 |
var sections = document.getElementsByClassName("selectionsProjs")[0];
|
| 943 |
chooseFirstdrpdwn();
|
|
|
|
| 944 |
$.get( '/getmethod/'+JSON.stringify(projectVal))
|
| 945 |
.success (function(data){
|
| 946 |
document.getElementById("all").style.display = "none";
|
|
@@ -1272,6 +1297,8 @@ function getData(form) {
|
|
| 1272 |
document.getElementById('duplicater').removeAttribute('hidden');
|
| 1273 |
document.getElementById('addicon').style.display='inline-block';
|
| 1274 |
document.getElementById('doneebackground').removeAttribute('hidden');
|
|
|
|
|
|
|
| 1275 |
|
| 1276 |
|
| 1277 |
// clearInterval()
|
|
@@ -1495,6 +1522,7 @@ interval= setInterval( function() {
|
|
| 1495 |
document.getElementById("loading").hidden = true;
|
| 1496 |
document.getElementById('duplicater').removeAttribute('hidden');
|
| 1497 |
document.getElementById('doneebackground').removeAttribute('hidden');
|
|
|
|
| 1498 |
document.getElementById('measureADRbutton').removeAttribute('disabled');
|
| 1499 |
document.getElementById('measureADRbutton').style.cursor='pointer';
|
| 1500 |
document.getElementById('measureADRbutton').style.color = 'white';
|
|
@@ -2294,7 +2322,21 @@ $(selections).on("change", function (e) {
|
|
| 2294 |
get3rddropdown();
|
| 2295 |
})
|
| 2296 |
$(inputs).css('width', '50px');
|
|
|
|
|
|
|
| 2297 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2298 |
//___________________________________________________________________________________________________________
|
| 2299 |
//___________________________________________________________________________________________________________
|
| 2300 |
//___________________________________________________________________________________________________________
|
|
@@ -2680,7 +2722,6 @@ function confirmDialog() {
|
|
| 2680 |
// If cancel btn is clicked , the function cancel() is executed
|
| 2681 |
document.getElementById("cancel").onclick = function(){cancelDialog()};
|
| 2682 |
function cancelDialog() {
|
| 2683 |
-
/* code executed if cancel is clicked */
|
| 2684 |
overlayme.style.display = "none";
|
| 2685 |
}
|
| 2686 |
|
|
@@ -2710,5 +2751,151 @@ function callrefreshDropbox(){
|
|
| 2710 |
});
|
| 2711 |
|
| 2712 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2713 |
</script>
|
| 2714 |
|
|
|
|
| 84 |
<ul>
|
| 85 |
</ul>
|
| 86 |
</div> -->
|
| 87 |
+
<input type="button" id="refreshAPIbutton" title="Refresh data retrieved from MC" value="Refresh data retrieved from MC ">
|
| 88 |
<div id ="">
|
| 89 |
<select name="selectproj" class="selectionsProj" id="selectionsProjid" required > </select>
|
| 90 |
</div>
|
|
|
|
| 176 |
|
| 177 |
</div>
|
| 178 |
<button hidden id="doneebackground" onclick="getSecondData()" > Export Summary </button>
|
| 179 |
+
<button hidden id="summarytoXML" onclick=summary_to_XML() > Summary to XML</button>
|
| 180 |
<div hidden id ="duplicaterhidden" class="duplicaterclasshidden">
|
| 181 |
<label id="labelArrayId" hidden="until-found"> </label>
|
| 182 |
<select name="measurementscripts" class="measurementselections" id="measurementselectionsid" >
|
|
|
|
| 348 |
<h2 id="TopTextModal">Warning!</h2>
|
| 349 |
</div>
|
| 350 |
<div class="modal-body">
|
| 351 |
+
<p id="modal-bodyTextp">Are you sure you want to retrieve information from dropbox. Please note that this process may exceed 30 minutes, depending on the amount of data found in the dropbox and the internet connection.
|
| 352 |
</p>
|
| 353 |
<br>
|
| 354 |
<div class="text-right">
|
|
|
|
| 368 |
///////////////////////////////////////////////BEGIN JS CODE//////////////////////////////////////////////////
|
| 369 |
PopupElement=document.getElementById('modal-bodyText');
|
| 370 |
|
|
|
|
| 371 |
// add project names to first dropdown from google sheet
|
| 372 |
firstdropdown=document.getElementsByClassName('selectionsProj')[0];
|
| 373 |
seconddropdown=document.getElementsByClassName('selectionsProjp')[0];
|
|
|
|
| 541 |
console.log(MCTNames)
|
| 542 |
}
|
| 543 |
// }
|
| 544 |
+
var val=''
|
|
|
|
| 545 |
var worker = new Worker('../static/API_Refresh_workerJS.js');
|
| 546 |
+
postAPIrefreshData()
|
| 547 |
+
function postAPIrefreshData()
|
| 548 |
+
{
|
| 549 |
|
|
|
|
| 550 |
|
| 551 |
+
worker.onmessage= function(event){
|
| 552 |
+
if (firstdropdown.value)
|
| 553 |
+
{
|
| 554 |
+
val='firstonly'
|
| 555 |
+
console.log(val)
|
| 556 |
+
}
|
| 557 |
+
if ((firstdropdown.value) && (seconddropdown.value))
|
| 558 |
+
{
|
| 559 |
+
val='firstSecond'
|
| 560 |
+
console.log(val)
|
| 561 |
+
}
|
| 562 |
+
|
| 563 |
+
if (val=='firstonly')
|
| 564 |
+
worker.postMessage(firstdropdown.value)
|
| 565 |
+
else if (val=='firstSecond')
|
| 566 |
+
{
|
| 567 |
+
worker.postMessage([firstdropdown.value,seconddropdown.value])
|
| 568 |
+
}
|
| 569 |
var data=JSON.parse(event.data);
|
| 570 |
+
console.log(data)
|
| 571 |
+
if (data)
|
| 572 |
+
{
|
| 573 |
+
if (confirm(data[0]+"\n")){
|
| 574 |
+
document.getElementById('all').style.display='block';
|
| 575 |
+
|
| 576 |
+
$.get('/refreshAPIAppendNewTables')
|
| 577 |
+
.success(function(successData){
|
| 578 |
+
if (data[1]==='project')
|
| 579 |
+
{
|
| 580 |
+
// console.log('projjjj')
|
| 581 |
+
// displayprjnames();
|
| 582 |
+
console.log(data[2])
|
| 583 |
+
for (let d=0;d<data[2].length;d++)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 584 |
{
|
| 585 |
+
console.log(data[2][d])
|
| 586 |
+
opt=document.createElement("option");
|
| 587 |
+
opt.textContent=data[2][d];
|
| 588 |
+
opt.text=data[2][d];
|
| 589 |
+
firstdropdown.append(opt);
|
| 590 |
+
PrjNamesArray.push(data[2][d]);
|
| 591 |
}
|
| 592 |
+
}
|
| 593 |
+
else if (data[1]==='part')
|
| 594 |
+
{ if (firstdropdown.value)
|
| 595 |
{
|
| 596 |
+
console.log(data[2])
|
| 597 |
+
for (let d=0;d<data[2].length;d++)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 598 |
{
|
| 599 |
+
console.log(data[2][d])
|
| 600 |
+
opt=document.createElement("option");
|
| 601 |
+
opt.textContent=data[2][d];
|
| 602 |
+
opt.text=data[2][d];
|
| 603 |
+
seconddropdown.append(opt);
|
| 604 |
+
// PrjPartsArray.push(data[2][d]);
|
| 605 |
}
|
| 606 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 607 |
}
|
| 608 |
+
else if (data[1]==='section')
|
| 609 |
+
{
|
| 610 |
+
if ((firstdropdown.value) && (seconddropdown.value))
|
| 611 |
+
{
|
| 612 |
+
console.log(data[2])
|
| 613 |
+
for (let d=0;d<data[2].length;d++)
|
| 614 |
+
{
|
| 615 |
+
console.log(data[2][d])
|
| 616 |
+
opt=document.createElement("option");
|
| 617 |
+
opt.textContent=data[2][d];
|
| 618 |
+
opt.text=data[2][d];
|
| 619 |
+
thirddropdown.append(opt);
|
| 620 |
+
// PrjPartsArray.push(data[2][d]);
|
| 621 |
+
}
|
| 622 |
+
}
|
| 623 |
}
|
| 624 |
+
|
| 625 |
+
document.getElementById('all').style.display='none';
|
| 626 |
+
})
|
| 627 |
+
.error(function(jqXHR, textStatus, errorThrown) {
|
| 628 |
+
PopupElement.textContent='Error occured while retrieving projects. Refresh and try again. If the error continues, please contact the ADR team to fix it. ';
|
| 629 |
+
ShowPopUp();
|
| 630 |
+
});
|
| 631 |
+
|
| 632 |
+
}
|
| 633 |
+
|
| 634 |
+
else{
|
| 635 |
+
worker.terminate()
|
| 636 |
+
}
|
| 637 |
+
|
| 638 |
+
|
| 639 |
+
}
|
| 640 |
+
|
| 641 |
+
// }
|
| 642 |
+
}
|
| 643 |
+
|
| 644 |
|
| 645 |
|
|
|
|
| 646 |
}
|
| 647 |
|
| 648 |
|
| 649 |
+
|
| 650 |
/*worker.onmessage= function(event){
|
| 651 |
}
|
| 652 |
*/
|
|
|
|
| 691 |
//___________________________________________________________________________________________________________
|
| 692 |
// /*Retrieve MCTNAMES Dictionary from API - Flask*/
|
| 693 |
|
| 694 |
+
function getALLMCTNAMES(){
|
| 695 |
+
MCTNames={}
|
| 696 |
+
$.get( '/RetrieveMCTNames/')
|
| 697 |
+
.success (function(data){
|
| 698 |
+
console.log(data)
|
| 699 |
+
MCTNames=data;
|
| 700 |
+
sectionNumber=thirddropdown.value
|
| 701 |
+
MCTNames=MCTNames[sectionNumber.toString().toLowerCase()]
|
| 702 |
+
console.log(MCTNames)
|
| 703 |
+
})
|
| 704 |
+
.error(function(jqXHR, textStatus, errorThrown) {
|
| 705 |
+
PopupElement.textContent='Error occured while retrieving the MC-T Names. Refresh and try again. If the error continues, please contact the ADR team to fix it. ';
|
| 706 |
+
ShowPopUp();
|
| 707 |
+
});
|
| 708 |
+
// return MCTNames
|
| 709 |
+
}
|
| 710 |
//___________________________________________________________________________________________________________
|
| 711 |
//___________________________________________________________________________________________________________
|
| 712 |
|
|
|
|
| 955 |
//___________________________________________________________________________________________________________
|
| 956 |
//Retrieves list of projects
|
| 957 |
function getproj(){
|
| 958 |
+
getALLMCTNAMES();
|
| 959 |
document.getElementById("all").style.display = "block";
|
| 960 |
var proj = document.getElementsByClassName("selectionsProj")[0];
|
| 961 |
var projectVal=proj.value.toString() //selected project
|
|
|
|
| 965 |
|
| 966 |
var sections = document.getElementsByClassName("selectionsProjs")[0];
|
| 967 |
chooseFirstdrpdwn();
|
| 968 |
+
|
| 969 |
$.get( '/getmethod/'+JSON.stringify(projectVal))
|
| 970 |
.success (function(data){
|
| 971 |
document.getElementById("all").style.display = "none";
|
|
|
|
| 1297 |
document.getElementById('duplicater').removeAttribute('hidden');
|
| 1298 |
document.getElementById('addicon').style.display='inline-block';
|
| 1299 |
document.getElementById('doneebackground').removeAttribute('hidden');
|
| 1300 |
+
document.getElementById('summarytoXML').removeAttribute('hidden');
|
| 1301 |
+
|
| 1302 |
|
| 1303 |
|
| 1304 |
// clearInterval()
|
|
|
|
| 1522 |
document.getElementById("loading").hidden = true;
|
| 1523 |
document.getElementById('duplicater').removeAttribute('hidden');
|
| 1524 |
document.getElementById('doneebackground').removeAttribute('hidden');
|
| 1525 |
+
document.getElementById('summarytoXML').removeAttribute('hidden');
|
| 1526 |
document.getElementById('measureADRbutton').removeAttribute('disabled');
|
| 1527 |
document.getElementById('measureADRbutton').style.cursor='pointer';
|
| 1528 |
document.getElementById('measureADRbutton').style.color = 'white';
|
|
|
|
| 2322 |
get3rddropdown();
|
| 2323 |
})
|
| 2324 |
$(inputs).css('width', '50px');
|
| 2325 |
+
//___________________________________________________________________________________________________________
|
| 2326 |
+
//___________________________________________________________________________________________________________
|
| 2327 |
|
| 2328 |
+
function summary_to_XML(){
|
| 2329 |
+
console.log(pdfpath)
|
| 2330 |
+
$.get('/summarytoXML/'+JSON.stringify([pdfpath,tomeasureproj]))
|
| 2331 |
+
.success(function(xmllink){
|
| 2332 |
+
console.log(xmllink)
|
| 2333 |
+
window.open(xmllink)
|
| 2334 |
+
})
|
| 2335 |
+
.error(function(jqXHR, textStatus, errorThrown) {
|
| 2336 |
+
PopupElement.textContent='Error occured while exporting summary to XML. Refresh and try again. If the error continues, please contact the ADR team to fix it. ';
|
| 2337 |
+
ShowPopUp();
|
| 2338 |
+
});
|
| 2339 |
+
}
|
| 2340 |
//___________________________________________________________________________________________________________
|
| 2341 |
//___________________________________________________________________________________________________________
|
| 2342 |
//___________________________________________________________________________________________________________
|
|
|
|
| 2722 |
// If cancel btn is clicked , the function cancel() is executed
|
| 2723 |
document.getElementById("cancel").onclick = function(){cancelDialog()};
|
| 2724 |
function cancelDialog() {
|
|
|
|
| 2725 |
overlayme.style.display = "none";
|
| 2726 |
}
|
| 2727 |
|
|
|
|
| 2751 |
});
|
| 2752 |
|
| 2753 |
}
|
| 2754 |
+
|
| 2755 |
+
|
| 2756 |
+
// Call function when show dialog btn is clicked
|
| 2757 |
+
var overlaymeText = document.getElementById("modal-bodyTextp");
|
| 2758 |
+
document.getElementById("refreshAPIbutton").disabled=false;
|
| 2759 |
+
document.getElementById("refreshAPIbutton").onclick = function()
|
| 2760 |
+
{
|
| 2761 |
+
if (document.getElementById("refreshAPIbutton").disabled==false)
|
| 2762 |
+
{
|
| 2763 |
+
console.log(overlaymeText.textContent)
|
| 2764 |
+
overlaymeText.textContent='This is not a mandatory button. The system already runs at half-hour intervals to update the dropdowns and MC-Templates from the MC. Using this would manually refresh the data retrieved, disregarding the 30-minute interval.';
|
| 2765 |
+
overlayme.style.display = "block";
|
| 2766 |
+
}
|
| 2767 |
+
};
|
| 2768 |
+
// }
|
| 2769 |
+
|
| 2770 |
+
|
| 2771 |
+
document.getElementById("confirm").onclick = function(){confirmDialog()};
|
| 2772 |
+
function confirmDialog() {
|
| 2773 |
+
/* code executed if confirm is clicked */
|
| 2774 |
+
overlayme.style.display = "none";
|
| 2775 |
+
callrefreshAPI();
|
| 2776 |
+
}
|
| 2777 |
+
|
| 2778 |
+
// // If cancel btn is clicked , the function cancel() is executed
|
| 2779 |
+
// document.getElementById("cancel").onclick = function(){cancelDialog()};
|
| 2780 |
+
// function cancelDialog() {
|
| 2781 |
+
// overlayme.style.display = "none";
|
| 2782 |
+
// }
|
| 2783 |
+
function refreshAPIbuutton(dataa){
|
| 2784 |
+
$.get('/refreshAPIAppendNewTables')
|
| 2785 |
+
.success(function(successData){
|
| 2786 |
+
|
| 2787 |
+
if (dataa[1]==='project')
|
| 2788 |
+
{
|
| 2789 |
+
// console.log('projjjj')
|
| 2790 |
+
// displayprjnames();
|
| 2791 |
+
console.log(dataa[2])
|
| 2792 |
+
for (let d=0;d<dataa[2].length;d++)
|
| 2793 |
+
{
|
| 2794 |
+
console.log(dataa[2][d])
|
| 2795 |
+
opt=document.createElement("option");
|
| 2796 |
+
opt.textContent=dataa[2][d];
|
| 2797 |
+
opt.text=dataa[2][d];
|
| 2798 |
+
firstdropdown.append(opt);
|
| 2799 |
+
PrjNamesArray.push(dataa[2][d]);
|
| 2800 |
+
}
|
| 2801 |
+
}
|
| 2802 |
+
else if (dataa[1]==='part')
|
| 2803 |
+
{ if (firstdropdown.value)
|
| 2804 |
+
{
|
| 2805 |
+
console.log(dataa[2])
|
| 2806 |
+
for (let d=0;d<dataa[2].length;d++)
|
| 2807 |
+
{
|
| 2808 |
+
console.log(dataa[2][d])
|
| 2809 |
+
opt=document.createElement("option");
|
| 2810 |
+
opt.textContent=dataa[2][d];
|
| 2811 |
+
opt.text=dataa[2][d];
|
| 2812 |
+
seconddropdown.append(opt);
|
| 2813 |
+
// PrjPartsArray.push(data[2][d]);
|
| 2814 |
+
}
|
| 2815 |
+
}
|
| 2816 |
+
}
|
| 2817 |
+
else if (dataa[1]==='section')
|
| 2818 |
+
{
|
| 2819 |
+
if ((firstdropdown.value) && (seconddropdown.value))
|
| 2820 |
+
{
|
| 2821 |
+
console.log(dataa[2])
|
| 2822 |
+
for (let d=0;d<dataa[2].length;d++)
|
| 2823 |
+
{
|
| 2824 |
+
console.log(dataa[2][d])
|
| 2825 |
+
opt=document.createElement("option");
|
| 2826 |
+
opt.textContent=dataa[2][d];
|
| 2827 |
+
opt.text=dataa[2][d];
|
| 2828 |
+
thirddropdown.append(opt);
|
| 2829 |
+
// PrjPartsArray.push(data[2][d]);
|
| 2830 |
+
}
|
| 2831 |
+
}
|
| 2832 |
+
}
|
| 2833 |
+
|
| 2834 |
+
console.log('DONEEEE')
|
| 2835 |
+
TopTextModal=document.getElementById("TopTextModal");
|
| 2836 |
+
TopTextModal.textContent= "Success!";
|
| 2837 |
+
TopTextModal.style.color='green';
|
| 2838 |
+
PopupElement.textContent='Console is up to date!';
|
| 2839 |
+
ShowPopUp();
|
| 2840 |
+
document.getElementById("refreshAPIbutton").style.cursor='pointer';
|
| 2841 |
+
document.getElementById("refreshAPIbutton").style.backgroundColor = "#1680c7";
|
| 2842 |
+
document.getElementById("refreshAPIbutton").disabled = false;
|
| 2843 |
+
document.getElementById('all').style.display='none';
|
| 2844 |
+
})
|
| 2845 |
+
.error(function(jqXHR, textStatus, errorThrown) {
|
| 2846 |
+
PopupElement.textContent='Error occured while retrieving projects. Refresh and try again. If the error continues, please contact the ADR team to fix it. ';
|
| 2847 |
+
ShowPopUp();
|
| 2848 |
+
});
|
| 2849 |
+
}
|
| 2850 |
+
|
| 2851 |
+
function callrefreshAPI(){
|
| 2852 |
+
console.log('l')
|
| 2853 |
+
document.getElementById("refreshAPIbutton").style.backgroundColor = "gray";
|
| 2854 |
+
document.getElementById("refreshAPIbutton").style.cursor='not-allowed';
|
| 2855 |
+
document.getElementById("refreshAPIbutton").disabled="disabled";
|
| 2856 |
+
if (thirddropdown.value){
|
| 2857 |
+
console.log('yes')
|
| 2858 |
+
$.get( '/RetrieveMCTNames/')
|
| 2859 |
+
.success (function(data){
|
| 2860 |
+
console.log(data)
|
| 2861 |
+
MCTNames=data;
|
| 2862 |
+
// console.log('jjw')
|
| 2863 |
+
sectionNumber=thirddropdown.value;
|
| 2864 |
+
MCTNames=MCTNames[sectionNumber.toString().toLowerCase()]
|
| 2865 |
+
|
| 2866 |
+
// console.log('pn')
|
| 2867 |
+
console.log(MCTNames)
|
| 2868 |
+
})
|
| 2869 |
+
.error(function(jqXHR, textStatus, errorThrown) {
|
| 2870 |
+
PopupElement.textContent='Error occured while retrieving the MC-T Names. Refresh and try again. If the error continues, please contact the ADR team to fix it. ';
|
| 2871 |
+
ShowPopUp();
|
| 2872 |
+
});
|
| 2873 |
+
// return MCTNames
|
| 2874 |
+
}
|
| 2875 |
+
if ((firstdropdown.value) && (seconddropdown.value))
|
| 2876 |
+
{
|
| 2877 |
+
$.getJSON('/refreshAPI', {prjname: firstdropdown.value, prjpart: seconddropdown.value,},function(data11){
|
| 2878 |
+
refreshAPIbuutton(data11)
|
| 2879 |
+
|
| 2880 |
+
})
|
| 2881 |
+
}
|
| 2882 |
+
|
| 2883 |
+
else if (firstdropdown.value)
|
| 2884 |
+
{
|
| 2885 |
+
$.getJSON('/refreshAPI', {prjname: firstdropdown.value, }
|
| 2886 |
+
,function(data11){
|
| 2887 |
+
refreshAPIbuutton(data11)
|
| 2888 |
+
})
|
| 2889 |
+
|
| 2890 |
+
}
|
| 2891 |
+
else if (!firstdropdown.value){
|
| 2892 |
+
$.getJSON('/refreshAPI',function(data11){
|
| 2893 |
+
|
| 2894 |
+
refreshAPIbuutton(data11)
|
| 2895 |
+
|
| 2896 |
+
})
|
| 2897 |
+
}
|
| 2898 |
+
|
| 2899 |
+
}
|
| 2900 |
</script>
|
| 2901 |
|