Commit 0dd54c6c by Owen Ryan Ang

feat: bpo integration

parent 5f7d79bf
......@@ -124,11 +124,12 @@ async function rejectElement() {
export function createRejectWindow(){
let popUpDisplay = document.createElement("div");
popUpDisplay.id = "rejectWindow";
popUpDisplay.classList.add("genericPopup")
popUpDisplay.classList.add("modal-container")
let screenMain = document.createElement('div');
screenMain.id = 'parent_Window';
screenMain.classList.add('parent_Window');
// screenMain.classList.add('modal');
screenMain.classList.add('reject-modal');
document.body.appendChild(screenMain);
var resList = REASON_LIST.split(",");
......@@ -184,8 +185,10 @@ export function createRejectWindow(){
cancelButton.onclick = function () {
document.getElementById("rejectWindow").remove();
rejectButton.disabled = false;
}
}
popUpDisplay.append(screenMain);
popUpDisplay.style.display = "block";
document.body.append(popUpDisplay);
}
......@@ -223,11 +226,13 @@ function setRadioHandler(id){
function checkLabelComponent(textLabel,inputval,checkboxId){
let checkBoxCont = document.createElement('div');
checkBoxCont.id = 'checkBoxCont';
checkBoxCont.classList.add("radio-like-checkbox");
let inp = document.createElement("input");
inp.id = checkboxId;
inp.setAttribute('type', 'radio');
inp.name = "rejectRadio";
inp.classList.add("radioOption");
inp.value = inputval;
inp.style.order = 1;
inp.style.marginTop = 0;
......@@ -298,7 +303,8 @@ function createButtonElem(className, buttonName, icon) {
function saveExceptionToXml(){
var selected = document.querySelector('input[name="rejectRadio"]:checked').value;
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 section;
......
......@@ -115,7 +115,7 @@ function createPrompt(){
let modalContainer = document.createElement("div");
modalContainer.setAttribute("class", "modal-container");
modalContainer.setAttribute("id", "modal-container");
let modal = document.createElement("div");
modal.setAttribute("class", "modal");
modal.setAttribute("id", "modal");
......
......@@ -3,6 +3,7 @@ import { saveForm } from "../DataInputWidget/generateFields.js";
import { checkValidValues, validateInput } from "../DataInputWidget/validateInput.js";
import { uploadFile } from "../FileUpload/fileUpload.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 { Settings } from "./XMLWriter/Global.js";
import { urlGetFile } from "./XMLWriter/WebServices.js";
......@@ -93,22 +94,41 @@ export const submitForm = async (e) => {
}
else {
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": folderPath + "/" + sessionStorage.getItem("recentlySavedFileName") };
console.log(filePath);
let getFile = await fetch(urlGetFile, {
method: "POST",
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(filePath)
});
// await uploadTOGFS(await getFile.text(), sessionStorage.getItem("recentlySavedFileName"));
if(IS_RETRIEVE_FROM_BPO === "N"){
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": folderPath + "/" + sessionStorage.getItem("recentlySavedFileName") };
console.log(filePath);
let getFile = await fetch(urlGetFile, {
method: "POST",
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(filePath)
});
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{
createInfoModal(null, 'OK', 'Error while uploading');
......@@ -147,8 +167,14 @@ export async function batchUpload(Form){
let Nodes = Form.elements;
let file;
let fileName;
let folderName = sessionStorage.getItem("recentlySavedFileNameOnly");
let directory = TEMPORARY_FOLDER + "/" + folderName
let 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++){
if (Nodes[i].name === 'hidden_file_content'){
var fileId = Nodes[i].id; // Get the ID of the current node
......@@ -164,6 +190,7 @@ export async function batchUpload(Form){
}
}
}
}
async function uploadTOGFS(stream, filename){
......
......@@ -10,7 +10,7 @@ export const HIGH_LIGHT_SCHEMA = "./WebGde-Widgets/sample_schema/dbSchema_anno.
export const ROOT_FOLDER = "/WebGde-Widgets";
//this determines if the images will be retrieved from the gfs
export const DOMAIN = "http://54.157.29.8:8080"
export const DOMAIN = "http://54.208.45.179:8080"
export const CONTEXTROOT = "gfs-explorer-ws"
export const GDE_URL = DOMAIN + "/MobileGde/svc/gfs-rest"
export const FOLDER_URL = DOMAIN + "/" + CONTEXTROOT + "/svc/gfs-rest/get-folder?parentPath=/Users/"
......@@ -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"
//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 CURRENT_NODE = "Web GDE"
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 { ROOT_FOLDER } from '../config.js';
import { IS_RETRIEVE_FROM_BPO, ROOT_FOLDER } from '../config.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';
......@@ -8,6 +10,8 @@ export class DocumentControlWidget {
global = {
container: null,
submitBtn: null,
returnBtn: null,
rejectBtn: null
}
constructor() {
......@@ -19,7 +23,6 @@ export class DocumentControlWidget {
this.global.container.id = "TiffButtonRight";
this.global.container.classList.add("ctrl-buttons")
this.global.submitBtn = document.createElement("div");
this.global.submitBtn.title = "Submit";
this.global.submitBtn.classList.add("buttonRightClass");
......@@ -30,9 +33,40 @@ export class DocumentControlWidget {
submitIcon.alt = "Submit";
submitIcon.height = "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();
}
......@@ -48,6 +82,14 @@ export class DocumentControlWidget {
}
}
this.global.returnBtn.onclick = (e) => {
createReturnWindow();
}
this.global.rejectBtn.onclick = (e) => {
createRejectWindow();
}
}
getWidget() {
......@@ -58,4 +100,12 @@ export class DocumentControlWidget {
return this.global.submitBtn;
}
getReturnBtn() {
return this.global.returnBtn;
}
getRejectBtn() {
return this.global.rejectBtn;
}
}
......@@ -126,6 +126,10 @@ export function removeLoadingScreen() {
}
export async function resetGDE(){
// TO-DO
}
function init(){
console.log("Application Started");
}
......
......@@ -477,41 +477,45 @@ span#filename {
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 {
width: fit-content;
display: flex;
text-align: right;
margin-top: 9px;
display: inline-block;
vertical-align: middle;
float: right;
width: 150px;
width: 100%;
padding: 0px;
}
.emphasizeButton {
border: solid 1px black;
border-radius: 2px;
display: inline-block;
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;
background-color: #0057a4;
font-size: 14px;
vertical-align: middle;
padding: 5px 16px;
margin-right: 6px;
cursor: pointer;
transition: color .6s ease-in-out, box-shadow .6s ease-in-out;
}
.normalButton {
display: inline-block;
margin-left: 10px;
color: white;
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;
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;
}
......@@ -960,6 +964,28 @@ span#filename {
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 {
border: 1px solid #000;
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