Commit 5e66b7cb by Lynette Lizardo

bug fix

parent ace4beeb
...@@ -18,8 +18,8 @@ export class BPO { ...@@ -18,8 +18,8 @@ export class BPO {
if (xml.isExisting) { if (xml.isExisting) {
const xmlString = await xml.data.join('').replace('\t', ''); const xmlString = await xml.data.join('').replace('\t', '');
//const lastImage = getXmlLastImage(xmlString); const lastImage = this.getXmlLastImage(xmlString);
console.log("lastImage " + lastImage);
/*sessionStorage.setItem('section', getXmlSection(xmlString)); /*sessionStorage.setItem('section', getXmlSection(xmlString));
sessionStorage.setItem('doctype', getXmlDocType(xmlString));*/ sessionStorage.setItem('doctype', getXmlDocType(xmlString));*/
...@@ -164,6 +164,15 @@ export class BPO { ...@@ -164,6 +164,15 @@ export class BPO {
return null; return null;
} }
} }
getXmlLastImage(xmlString) {
const parser = new DOMParser();
const xmlDoc = parser.parseFromString(xmlString, "text/xml");
let lastRecordIndex = xmlDoc.getElementsByTagName("record").length - 1;
let lastRecord = xmlDoc.getElementsByTagName("record")[lastRecordIndex];
return lastRecord.getElementsByTagName("imagename")[0].childNodes[0].nodeValue;
}
} }
...@@ -187,14 +196,14 @@ function formatDirectory(dir) { ...@@ -187,14 +196,14 @@ function formatDirectory(dir) {
} }
function getXmlLastImage(xmlString) { // function getXmlLastImage(xmlString) {
const parser = new DOMParser(); // const parser = new DOMParser();
const xmlDoc = parser.parseFromString(xmlString, "text/xml"); // const xmlDoc = parser.parseFromString(xmlString, "text/xml");
let lastRecordIndex = xmlDoc.getElementsByTagName("record").length - 1; // let lastRecordIndex = xmlDoc.getElementsByTagName("record").length - 1;
let lastRecord = xmlDoc.getElementsByTagName("record")[lastRecordIndex]; // let lastRecord = xmlDoc.getElementsByTagName("record")[lastRecordIndex];
return lastRecord.getElementsByTagName("imagename")[0].childNodes[0].nodeValue; // return lastRecord.getElementsByTagName("imagename")[0].childNodes[0].nodeValue;
} // }
function getXmlSection(xmlString) { function getXmlSection(xmlString) {
const parser = new DOMParser(); const parser = new DOMParser();
......
...@@ -45,7 +45,7 @@ export async function generateFields(inputSchema, containerId) { ...@@ -45,7 +45,7 @@ export async function generateFields(inputSchema, containerId) {
container.id = "fields"; container.id = "fields";
divContainer.appendChild(container); divContainer.appendChild(container);
container.addEventListener("submit", (e) => submitForm(e)); //container.addEventListener("submit", (e) => submitForm(e));
let doctype = sessionStorage.getItem('doctype'); let doctype = sessionStorage.getItem('doctype');
let section = sessionStorage.getItem('section'); let section = sessionStorage.getItem('section');
...@@ -73,13 +73,13 @@ export async function generateFields(inputSchema, containerId) { ...@@ -73,13 +73,13 @@ export async function generateFields(inputSchema, containerId) {
createSection('Section', container, doctypes, underscoredKey); createSection('Section', container, doctypes, underscoredKey);
const promise = deconstruct(doctypes[sec], container, underscoredSec); const promise = deconstruct(doctypes[sec], container, underscoredSec);
sectionPromises.push(promise); sectionPromises.push(promise);
const submit = document.createElement('input'); // const submit = document.createElement('input');
submit.setAttribute('id', 'submitButton'); // submit.setAttribute('id', 'submitButton');
submit.classList.add("submitButtons"); // submit.classList.add("submitButtons");
submit.classList.add(underscoredSec); // submit.classList.add(underscoredSec);
submit.type = 'submit'; // submit.type = 'submit';
console.log(container); // console.log(container);
container.appendChild(submit); // container.appendChild(submit);
return false return false
} }
}); });
...@@ -100,11 +100,11 @@ export async function generateFields(inputSchema, containerId) { ...@@ -100,11 +100,11 @@ export async function generateFields(inputSchema, containerId) {
createDocTypeDropdown('DocType', container, schema, doctype); createDocTypeDropdown('DocType', container, schema, doctype);
createSection('Section', container, doctypes, underscoredDoctype, section); createSection('Section', container, doctypes, underscoredDoctype, section);
container = await deconstruct(doctypes[section], container, underscoredSection) container = await deconstruct(doctypes[section], container, underscoredSection)
const submit = document.createElement('input') // const submit = document.createElement('input')
submit.classList.add("submitButtons"); // submit.classList.add("submitButtons");
submit.classList.add(underscoredSection); // submit.classList.add(underscoredSection);
submit.type = 'submit' // submit.type = 'submit'
container.appendChild(submit) // container.appendChild(submit)
const fields = sessionStorage.getItem("fields"); const fields = sessionStorage.getItem("fields");
if(fields) { if(fields) {
...@@ -149,11 +149,11 @@ export async function generateFields(inputSchema, containerId) { ...@@ -149,11 +149,11 @@ export async function generateFields(inputSchema, containerId) {
createSection('Section', container, doctypes, underscoredValue); createSection('Section', container, doctypes, underscoredValue);
container = await deconstruct(doctypes[key], container, underscoredKey) container = await deconstruct(doctypes[key], container, underscoredKey)
const submit = document.createElement('input') // const submit = document.createElement('input')
submit.classList.add("submitButtons"); // submit.classList.add("submitButtons");
submit.classList.add(underscoredKey); // submit.classList.add(underscoredKey);
submit.type = 'submit' // submit.type = 'submit'
container.appendChild(submit) // container.appendChild(submit)
break; break;
} }
}); });
...@@ -169,11 +169,11 @@ export async function generateFields(inputSchema, containerId) { ...@@ -169,11 +169,11 @@ export async function generateFields(inputSchema, containerId) {
sessionStorage.setItem("currentSection", underscoredKey); sessionStorage.setItem("currentSection", underscoredKey);
container = await deconstruct(schema[sessionStorage.getItem("currentDoctype").replaceAll("_", " ")][this.value], container, underscoredKey) container = await deconstruct(schema[sessionStorage.getItem("currentDoctype").replaceAll("_", " ")][this.value], container, underscoredKey)
const submit = document.createElement('input') // const submit = document.createElement('input')
submit.classList.add("submitButtons"); // submit.classList.add("submitButtons");
submit.classList.add(underscoredKey); // submit.classList.add(underscoredKey);
submit.type = 'submit' // submit.type = 'submit'
container.appendChild(submit) // container.appendChild(submit)
}); });
...@@ -843,6 +843,7 @@ export async function populateFields(imagePath) { ...@@ -843,6 +843,7 @@ export async function populateFields(imagePath) {
for (let i = 0; i < document.getElementById("Section").options.length; i++) { for (let i = 0; i < document.getElementById("Section").options.length; i++) {
if (document.getElementById("Section").options[i].value == section) { if (document.getElementById("Section").options[i].value == section) {
document.getElementById("Section").options[i].selected = "selected" document.getElementById("Section").options[i].selected = "selected"
section.trigger('change');
} }
} }
......
...@@ -69,17 +69,17 @@ async function createOutputXml(fields, metrics, doctype, section) { ...@@ -69,17 +69,17 @@ async function createOutputXml(fields, metrics, doctype, section) {
body: JSON.stringify(xmlData) body: JSON.stringify(xmlData)
}); });
if (localStorage.getItem("complete") == 1) { if (completenessCheck(await response.text())) {
if (completenessCheck(await response.text())) { let response = await fetch(urlUpdateEob, {
let response = await fetch(urlUpdateEob, { method: "POST",
method: "POST", headers: {
headers: { 'Content-Type': 'application/json'
'Content-Type': 'application/json' },
}, body: JSON.stringify(xmlData)
body: JSON.stringify(xmlData) });
}); await completeToNextNode(elementId);
await completeToNextNode(elementId); sessionStorage.setItem("isElementComplete", true);
}
} }
} }
...@@ -38,9 +38,9 @@ export const HIGH_LIGHT_SCHEMA = "./WebGde-Widgets/sample_schema/dbSchema_anno. ...@@ -38,9 +38,9 @@ export const HIGH_LIGHT_SCHEMA = "./WebGde-Widgets/sample_schema/dbSchema_anno.
export const ROOT_FOLDER = "/WebGde-Widgets"; export const ROOT_FOLDER = "/WebGde-Widgets";
//this determines if the images will be retrieved from the gfs //this determines if the images will be retrieved from the gfs
export const DOMAIN = "http://3.86.87.78:8080" export const DOMAIN = "http://44.211.171.103:8080"
export const CONTEXTROOT = "gfs-explorer-ws" export const CONTEXTROOT = "gfs-explorer-ws"
export const GFS_URL = "http://3.86.87.78:8080" + "/WebGde/svc/gfs-rest" export const GFS_URL = "http://44.211.171.103:8080" + "/WebGde/svc/gfs-rest"
export const FOLDER_URL = DOMAIN + "/" + CONTEXTROOT + "/svc/gfs-rest/get-folder?parentPath=/Users/" export const FOLDER_URL = DOMAIN + "/" + CONTEXTROOT + "/svc/gfs-rest/get-folder?parentPath=/Users/"
export const DOWNLOAD_URL = DOMAIN + "/" + CONTEXTROOT + "/svc/gfs-rest/get-download-link" export const DOWNLOAD_URL = DOMAIN + "/" + CONTEXTROOT + "/svc/gfs-rest/get-download-link"
export const IS_RETRIEVE_FROM_GFS = "N" export const IS_RETRIEVE_FROM_GFS = "N"
...@@ -51,7 +51,7 @@ export const INVALID_KEYS = "F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12,PrintScreen ...@@ -51,7 +51,7 @@ export const INVALID_KEYS = "F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12,PrintScreen
export const IS_RETRIEVE_FROM_BPO = "Y" export const IS_RETRIEVE_FROM_BPO = "Y"
// export const BPO_URL = "http://35.171.20.94:8080/bpo-sqa/" // export const BPO_URL = "http://35.171.20.94:8080/bpo-sqa/"
// export const CURRENT_NODE = "Web GDE" // export const CURRENT_NODE = "Web GDE"
export const BPO_URL = "http://3.86.87.78:8080/bpo/" export const BPO_URL = "http://44.211.171.103:8080/bpo/"
export const CURRENT_NODE = "Web_GDE_DEV" export const CURRENT_NODE = "Web_GDE_DEV"
export const ENCODING_PASS = "PASS1" export const ENCODING_PASS = "PASS1"
export const NEXT_NODE = "Complete" export const NEXT_NODE = "Complete"
......
import { createLoadingScreen, removeLoadingScreen, resetGDE } from '../../script.js'; import { createLoadingScreen, displayNextRecord, removeLoadingScreen, resetGDE } from '../../script.js';
import { createRejectWindow } from '../BPO/rejectElement.js'; import { createRejectWindow } from '../BPO/rejectElement.js';
import { createReturnWindow, returnElementBPO } from '../BPO/returnElement.js'; import { createReturnWindow, returnElementBPO } from '../BPO/returnElement.js';
import { completeToNextNode, submitForm } from '../Submit/submit.js'; import { completeToNextNode, submitForm } from '../Submit/submit.js';
...@@ -126,14 +126,17 @@ export class DocumentControlWidget { ...@@ -126,14 +126,17 @@ export class DocumentControlWidget {
let currentDisplay = parseInt(sessionStorage.getItem("display_counter")); let currentDisplay = parseInt(sessionStorage.getItem("display_counter"));
let totalRecord = JSON.parse(sessionStorage.getItem("dir_files")).length; let totalRecord = JSON.parse(sessionStorage.getItem("dir_files")).length;
if (currentDisplay + 1 === totalRecord) { //if (currentDisplay + 1 === totalRecord) {
if(sessionStorage.getItem("isElementComplete")){
//move element then fetch new element //move element then fetch new element
let response = await completeToNextNode(sessionStorage.getItem("element_id")); //let response = await completeToNextNode(sessionStorage.getItem("element_id"));
createLoadingScreen(); createLoadingScreen();
const metrics = stopMetricCapture();
let eoe_ts = new Date().toLocaleString();
await saveMetrics(metrics, eoe_ts);
if (response.status == 200) { if (response.status == 200) {
if (await BPO_OBJECT.getRandomWaitingElement()) { if (await BPO_OBJECT.getRandomWaitingElement()) {
const metrics = stopMetricCapture();
await saveMetrics(metrics, eoe_ts);
document.getElementById("counter").innerHTML = ""; document.getElementById("counter").innerHTML = "";
clearTimeout(interval); clearTimeout(interval);
resetGDE(); resetGDE();
...@@ -144,13 +147,15 @@ export class DocumentControlWidget { ...@@ -144,13 +147,15 @@ export class DocumentControlWidget {
} }
} else { } else {
document.getElementById("nextRecordImage").click(); // document.getElementById("nextRecordImage").click();
DISPLAY_FIELD_OBJECT.generateFields(); //DISPLAY_FIELD_OBJECT.generateFields();
document.getElementById("input-field-container").appendChild(DOCUMENT_CONTROL_OBJECT.getWidget()); DISPLAY_FIELD_OBJECT.clearForm();
displayNextRecord();
DISPLAY_FIELD_OBJECT.updateHeaderText(0, "User: " + sessionStorage.getItem("user_id")); //document.getElementById("input-field-container").appendChild(DOCUMENT_CONTROL_OBJECT.getWidget());
DISPLAY_FIELD_OBJECT.updateHeaderText(1, "Element ID: " + sessionStorage.getItem("element_id"));
DISPLAY_FIELD_OBJECT.updateHeaderText(2, ""); // DISPLAY_FIELD_OBJECT.updateHeaderText(0, "User: " + sessionStorage.getItem("user_id"));
// DISPLAY_FIELD_OBJECT.updateHeaderText(1, "Element ID: " + sessionStorage.getItem("element_id"));
// DISPLAY_FIELD_OBJECT.updateHeaderText(2, "");
} }
} }
......
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