Commit e5814719 by Owen Ryan Ang

Merge branch 'feature-WG-402' into 'development-mobile'

feat: bpo integration See merge request !67
parents aa4e9def b32256c3
...@@ -124,11 +124,12 @@ async function rejectElement() { ...@@ -124,11 +124,12 @@ async function rejectElement() {
export function createRejectWindow(){ export function createRejectWindow(){
let popUpDisplay = document.createElement("div"); let popUpDisplay = document.createElement("div");
popUpDisplay.id = "rejectWindow"; popUpDisplay.id = "rejectWindow";
popUpDisplay.classList.add("genericPopup") popUpDisplay.classList.add("modal-container")
let screenMain = document.createElement('div'); let screenMain = document.createElement('div');
screenMain.id = 'parent_Window'; screenMain.id = 'parent_Window';
screenMain.classList.add('parent_Window'); // screenMain.classList.add('modal');
screenMain.classList.add('reject-modal');
document.body.appendChild(screenMain); document.body.appendChild(screenMain);
var resList = REASON_LIST.split(","); var resList = REASON_LIST.split(",");
...@@ -184,8 +185,10 @@ export function createRejectWindow(){ ...@@ -184,8 +185,10 @@ export function createRejectWindow(){
cancelButton.onclick = function () { cancelButton.onclick = function () {
document.getElementById("rejectWindow").remove(); document.getElementById("rejectWindow").remove();
rejectButton.disabled = false; rejectButton.disabled = false;
} }
popUpDisplay.append(screenMain); popUpDisplay.append(screenMain);
popUpDisplay.style.display = "block";
document.body.append(popUpDisplay); document.body.append(popUpDisplay);
} }
...@@ -223,11 +226,13 @@ function setRadioHandler(id){ ...@@ -223,11 +226,13 @@ function setRadioHandler(id){
function checkLabelComponent(textLabel,inputval,checkboxId){ function checkLabelComponent(textLabel,inputval,checkboxId){
let checkBoxCont = document.createElement('div'); let checkBoxCont = document.createElement('div');
checkBoxCont.id = 'checkBoxCont'; checkBoxCont.id = 'checkBoxCont';
checkBoxCont.classList.add("radio-like-checkbox");
let inp = document.createElement("input"); let inp = document.createElement("input");
inp.id = checkboxId; inp.id = checkboxId;
inp.setAttribute('type', 'radio'); inp.setAttribute('type', 'radio');
inp.name = "rejectRadio"; inp.name = "rejectRadio";
inp.classList.add("radioOption");
inp.value = inputval; inp.value = inputval;
inp.style.order = 1; inp.style.order = 1;
inp.style.marginTop = 0; inp.style.marginTop = 0;
...@@ -298,7 +303,8 @@ function createButtonElem(className, buttonName, icon) { ...@@ -298,7 +303,8 @@ function createButtonElem(className, buttonName, icon) {
function saveExceptionToXml(){ function saveExceptionToXml(){
var selected = document.querySelector('input[name="rejectRadio"]:checked').value; var selected = document.querySelector('input[name="rejectRadio"]:checked').value;
var elementId = sessionStorage.getItem("element_id"); var elementId = sessionStorage.getItem("element_id");
let urls = JSON.parse(sessionStorage.getItem("dir_files")); let urls = {};
// let urls = JSON.parse(sessionStorage.getItem("dir_files")); TO_DO
let doctype; let doctype;
let section; let section;
......
...@@ -115,7 +115,7 @@ function createPrompt(){ ...@@ -115,7 +115,7 @@ function createPrompt(){
let modalContainer = document.createElement("div"); let modalContainer = document.createElement("div");
modalContainer.setAttribute("class", "modal-container"); modalContainer.setAttribute("class", "modal-container");
modalContainer.setAttribute("id", "modal-container"); modalContainer.setAttribute("id", "modal-container");
let modal = document.createElement("div"); let modal = document.createElement("div");
modal.setAttribute("class", "modal"); modal.setAttribute("class", "modal");
modal.setAttribute("id", "modal"); modal.setAttribute("id", "modal");
......
...@@ -3,6 +3,7 @@ import { saveForm } from "../DataInputWidget/generateFields.js"; ...@@ -3,6 +3,7 @@ import { saveForm } from "../DataInputWidget/generateFields.js";
import { checkValidValues, validateInput } from "../DataInputWidget/validateInput.js"; import { checkValidValues, validateInput } from "../DataInputWidget/validateInput.js";
import { uploadFile } from "../FileUpload/fileUpload.js"; import { uploadFile } from "../FileUpload/fileUpload.js";
import { global_end_time, saveMetrics, stopMetricCapture, setGlobalEndTime, interval } from "../captureMetrics/captureMetrics.js"; import { global_end_time, saveMetrics, stopMetricCapture, setGlobalEndTime, interval } from "../captureMetrics/captureMetrics.js";
import { IS_RETRIEVE_FROM_BPO } from "../config.js";
import { createInfoModal } from "../genericPopup/genericPopup.js"; import { createInfoModal } from "../genericPopup/genericPopup.js";
import { Settings } from "./XMLWriter/Global.js"; import { Settings } from "./XMLWriter/Global.js";
import { urlGetFile } from "./XMLWriter/WebServices.js"; import { urlGetFile } from "./XMLWriter/WebServices.js";
...@@ -93,22 +94,41 @@ export const submitForm = async (e) => { ...@@ -93,22 +94,41 @@ export const submitForm = async (e) => {
} }
else { else {
let response = await WriteForm(e, [], doctype, section); if(IS_RETRIEVE_FROM_BPO === "N"){
await batchUpload(Form); let response = await WriteForm(e, [], doctype, section);
if (response !== false) { await batchUpload(Form);
let folderName = sessionStorage.getItem("recentlySavedFileNameOnly"); if (response !== false) {
let folderPath = TEMPORARY_FOLDER +"/"+ folderName let folderName = sessionStorage.getItem("recentlySavedFileNameOnly");
let filePath = { "filePath": folderPath + "/" + sessionStorage.getItem("recentlySavedFileName") }; let folderPath = TEMPORARY_FOLDER +"/"+ folderName
console.log(filePath); let filePath = { "filePath": folderPath + "/" + sessionStorage.getItem("recentlySavedFileName") };
let getFile = await fetch(urlGetFile, { console.log(filePath);
method: "POST", let getFile = await fetch(urlGetFile, {
headers: { method: "POST",
'Content-Type': 'application/json' headers: {
}, 'Content-Type': 'application/json'
body: JSON.stringify(filePath) },
}); body: JSON.stringify(filePath)
});
// await uploadTOGFS(await getFile.text(), sessionStorage.getItem("recentlySavedFileName")); console.log(await getFile.text());
// await uploadTOGFS(await getFile.text(), sessionStorage.getItem("recentlySavedFileName"));
}else if(IS_RETRIEVE_FROM_BPO === "Y"){
let response = await WriteForm(e, [], doctype, section);
await batchUpload(Form);
if (response !== false) {
let folderName = sessionStorage.getItem("recentlySavedFileNameOnly");
let folderPath = TEMPORARY_FOLDER +"/"+ folderName
let filePath = { "filePath": sessionStorage.getItem("element_file_loc") };
console.log(filePath);
let getFile = await fetch(urlGetFile, {
method: "POST",
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(filePath)
});
}
}
}else{ }else{
createInfoModal(null, 'OK', 'Error while uploading'); createInfoModal(null, 'OK', 'Error while uploading');
...@@ -147,8 +167,14 @@ export async function batchUpload(Form){ ...@@ -147,8 +167,14 @@ export async function batchUpload(Form){
let Nodes = Form.elements; let Nodes = Form.elements;
let file; let file;
let fileName; let fileName;
let folderName = sessionStorage.getItem("recentlySavedFileNameOnly"); let folderName;
let directory = TEMPORARY_FOLDER + "/" + folderName let directory;
if(IS_RETRIEVE_FROM_BPO==="N"){
folderName = sessionStorage.getItem("recentlySavedFileNameOnly");
directory = TEMPORARY_FOLDER + "/" + folderName
} else{
directory = sessionStorage.getItem("element_file_loc")
}
for (var i=0;i<Nodes.length;i++){ for (var i=0;i<Nodes.length;i++){
if (Nodes[i].name === 'hidden_file_content'){ if (Nodes[i].name === 'hidden_file_content'){
var fileId = Nodes[i].id; // Get the ID of the current node var fileId = Nodes[i].id; // Get the ID of the current node
...@@ -164,6 +190,7 @@ export async function batchUpload(Form){ ...@@ -164,6 +190,7 @@ export async function batchUpload(Form){
} }
} }
} }
} }
async function uploadTOGFS(stream, filename){ async function uploadTOGFS(stream, filename){
......
...@@ -10,7 +10,7 @@ export const HIGH_LIGHT_SCHEMA = "./WebGde-Widgets/sample_schema/dbSchema_anno. ...@@ -10,7 +10,7 @@ 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://18.233.158.67:8080" export const DOMAIN = "http://54.208.45.179:8080"
export const CONTEXTROOT = "gfs-explorer-ws" export const CONTEXTROOT = "gfs-explorer-ws"
export const GDE_URL = DOMAIN + "/MobileGde/svc/gfs-rest" export const GDE_URL = DOMAIN + "/MobileGde/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/"
...@@ -20,7 +20,7 @@ export const IS_RETRIEVE_FROM_GFS = "N" ...@@ -20,7 +20,7 @@ export const IS_RETRIEVE_FROM_GFS = "N"
export const INVALID_KEYS = "F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12,PrintScreen,ScrollLock,Pause,PageUp,PageDown,Insert,Delete,Control" export const INVALID_KEYS = "F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12,PrintScreen,ScrollLock,Pause,PageUp,PageDown,Insert,Delete,Control"
//BPO CONFIG //BPO CONFIG
export const IS_RETRIEVE_FROM_BPO = "N" 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 = DOMAIN + "/bpo/"; export const BPO_URL = DOMAIN + "/bpo/";
......
import { createRejectWindow } from '../BPO/rejectElement.js';
import { createReturnWindow } from '../BPO/returnElement.js';
import { submitForm } from '../Submit/submit.js'; import { submitForm } from '../Submit/submit.js';
import { ROOT_FOLDER } from '../config.js'; import { IS_RETRIEVE_FROM_BPO, ROOT_FOLDER } from '../config.js';
import { createInfoModal } from '../genericPopup/genericPopup.js'; import { createInfoModal } from '../genericPopup/genericPopup.js';
import { BPO_OBJECT, DISPLAY_FIELD_OBJECT, DOCUMENT_CONTROL_OBJECT, IMAGE_VIEWER_OBJECT, INDEXED_DB_STORAGE } from '../globalVariable.js'; import { BPO_OBJECT, DISPLAY_FIELD_OBJECT, DOCUMENT_CONTROL_OBJECT, IMAGE_VIEWER_OBJECT, INDEXED_DB_STORAGE } from '../globalVariable.js';
...@@ -8,6 +10,8 @@ export class DocumentControlWidget { ...@@ -8,6 +10,8 @@ export class DocumentControlWidget {
global = { global = {
container: null, container: null,
submitBtn: null, submitBtn: null,
returnBtn: null,
rejectBtn: null
} }
constructor() { constructor() {
...@@ -19,7 +23,6 @@ export class DocumentControlWidget { ...@@ -19,7 +23,6 @@ export class DocumentControlWidget {
this.global.container.id = "TiffButtonRight"; this.global.container.id = "TiffButtonRight";
this.global.container.classList.add("ctrl-buttons") this.global.container.classList.add("ctrl-buttons")
this.global.submitBtn = document.createElement("div"); this.global.submitBtn = document.createElement("div");
this.global.submitBtn.title = "Submit"; this.global.submitBtn.title = "Submit";
this.global.submitBtn.classList.add("buttonRightClass"); this.global.submitBtn.classList.add("buttonRightClass");
...@@ -30,9 +33,40 @@ export class DocumentControlWidget { ...@@ -30,9 +33,40 @@ export class DocumentControlWidget {
submitIcon.alt = "Submit"; submitIcon.alt = "Submit";
submitIcon.height = "32"; submitIcon.height = "32";
submitIcon.width = "32"; submitIcon.width = "32";
this.global.submitBtn.append(submitIcon);
this.global.returnBtn = document.createElement("div");
this.global.returnBtn.title = "Return";
this.global.returnBtn.classList.add("buttonRightClass");
const returnIcon = document.createElement("img");
returnIcon.classList.add("tiffViewerIcons");
returnIcon.src = "." + ROOT_FOLDER + "/documentControlWidget/assets/return_icon.png";
returnIcon.alt = "Return";
returnIcon.height = "32";
returnIcon.width = "32";
this.global.rejectBtn = document.createElement("div");
this.global.rejectBtn.title = "Reject";
this.global.rejectBtn.classList.add("buttonRightClass");
const rejectIcon = document.createElement("img");
rejectIcon.classList.add("tiffViewerIcons");
rejectIcon.src = "." + ROOT_FOLDER + "/documentControlWidget/assets/reject_icon.png";
rejectIcon.alt = "Reject";
rejectIcon.height = "32";
rejectIcon.width = "32";
this.global.container.appendChild(this.global.submitBtn); this.global.submitBtn.append(submitIcon);
this.global.returnBtn.append(returnIcon);
this.global.rejectBtn.append(rejectIcon);
if(IS_RETRIEVE_FROM_BPO === "Y"){
this.global.container.appendChild(this.global.submitBtn);
this.global.container.appendChild(this.global.returnBtn);
this.global.container.appendChild(this.global.rejectBtn);
} else {
this.global.container.appendChild(this.global.submitBtn);
}
this.addEvenListeners(); this.addEvenListeners();
} }
...@@ -48,6 +82,14 @@ export class DocumentControlWidget { ...@@ -48,6 +82,14 @@ export class DocumentControlWidget {
} }
} }
this.global.returnBtn.onclick = (e) => {
createReturnWindow();
}
this.global.rejectBtn.onclick = (e) => {
createRejectWindow();
}
} }
getWidget() { getWidget() {
...@@ -58,4 +100,12 @@ export class DocumentControlWidget { ...@@ -58,4 +100,12 @@ export class DocumentControlWidget {
return this.global.submitBtn; return this.global.submitBtn;
} }
getReturnBtn() {
return this.global.returnBtn;
}
getRejectBtn() {
return this.global.rejectBtn;
}
} }
...@@ -135,8 +135,17 @@ export function removeLoadingScreen() { ...@@ -135,8 +135,17 @@ export function removeLoadingScreen() {
} }
<<<<<<< WebGde/WebContent/script.js
export async function resetGDE(){
// TO-DO
}
function init(){
console.log("Application Started");
=======
function init() { function init() {
console.log("Application Started"); console.log("Application Started");
>>>>>>> WebGde/WebContent/script.js
} }
function testFunction() { function testFunction() {
......
...@@ -477,41 +477,45 @@ span#filename { ...@@ -477,41 +477,45 @@ span#filename {
backdrop-filter: blur(4px); backdrop-filter: blur(4px);
} }
.normalButton {
border: solid 1px black;
width: fit-content;
font-size: 14px;
padding: 4.5px;
height: fit-content;
display: inline-block;
vertical-align: middle;
transition: color .6s ease-in-out, box-shadow .6s ease-in-out;
}
.floatingButtonPanel { .floatingButtonPanel {
width: fit-content; display: flex;
text-align: right; text-align: right;
margin-top: 9px; margin-top: 9px;
display: inline-block; width: 100%;
vertical-align: middle;
float: right;
width: 150px;
padding: 0px; padding: 0px;
} }
.emphasizeButton { .emphasizeButton {
border: solid 1px black; display: inline-block;
border-radius: 2px; flex: 1;
vertical-align: middle;
margin-right: 10px; /* Adjust the spacing between buttons as needed */
padding: 10px 20px; /* Adjust the padding as needed */
border: none;
cursor: pointer;
width: 40%;
background-color: #00a8c0;
color: white;
font-family: OpenSans, sans-serif; font-family: OpenSans, sans-serif;
background-color: #0057a4;
font-size: 14px; font-size: 14px;
vertical-align: middle; cursor: pointer;
padding: 5px 16px; transition: color .6s ease-in-out, box-shadow .6s ease-in-out;
margin-right: 6px; }
.normalButton {
display: inline-block; display: inline-block;
margin-left: 10px; flex: 1;
color: white; vertical-align: middle;
margin-right: 10px; /* Adjust the spacing between buttons as needed */
padding: 10px 20px; /* Adjust the padding as needed */
border: none;
cursor: pointer; cursor: pointer;
background-color: white;
color: blaock;
font-family: OpenSans, sans-serif;
font-size: 14px;
cursor: pointer;
border: 1px solid #000;
transition: color .6s ease-in-out, box-shadow .6s ease-in-out; transition: color .6s ease-in-out, box-shadow .6s ease-in-out;
} }
...@@ -949,6 +953,28 @@ span#filename { ...@@ -949,6 +953,28 @@ span#filename {
margin: 2px; margin: 2px;
} }
.reject-modal{
overflow: auto;
background-color: #fff;
position: absolute;
padding: 15px;
top:15%;
left:10%;
right: 10%;
width: 80%;
height: fit-content;
max-height: 70%;
border-radius: 5px;
/* border: 2px solid #000; */
animation-name: modalTransition;
animation-duration: .4s;
box-shadow: 13px 13px 21px 4px rgba(32,29,29,0.63);
-webkit-box-shadow: 13px 13px 21px 4px rgba(32,29,29,0.63);
-moz-box-shadow: 13px 13px 21px 4px rgba(32,29,29,0.63);
}
.button { .button {
border: 1px solid #000; border: 1px solid #000;
color: #fff; color: #fff;
......
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