Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
web-ui
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
WEBGDE-Components
web-ui
Commits
fa8b52ea
Commit
fa8b52ea
authored
Oct 09, 2023
by
Jhunel Adam Calub
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
finalize functionality of encode button commit
parent
d6146918
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
63 additions
and
36 deletions
+63
-36
ElementListWidget.js
...ent/WebGde-Widgets/ElementListWidget/ElementListWidget.js
+31
-9
config.js
WebGde/WebContent/WebGde-Widgets/config.js
+3
-2
documentControlWidget.js
...de-Widgets/documentControlWidget/documentControlWidget.js
+12
-4
genericPopup.js
...de/WebContent/WebGde-Widgets/genericPopup/genericPopup.js
+5
-3
script.js
WebGde/WebContent/script.js
+12
-18
No files found.
WebGde/WebContent/WebGde-Widgets/ElementListWidget/ElementListWidget.js
View file @
fa8b52ea
...
...
@@ -11,7 +11,9 @@ export class ElementListWidget {
newButton
:
null
,
encodeButton
:
null
,
selectedElement
:
null
,
workers
:
[]
workers
:
[],
queueIndex
:
null
,
workerId
:
null
};
constructor
(
nodeId
,
containerId
)
{
...
...
@@ -24,8 +26,8 @@ export class ElementListWidget {
document
.
body
.
appendChild
(
this
.
global
.
container
);
}
this
.
workerId
=
sessionStorage
.
getItem
(
"user_id"
);
this
.
init
(
nodeId
,
this
.
workerId
);
this
.
global
.
workerId
=
sessionStorage
.
getItem
(
"user_id"
);
this
.
init
(
nodeId
,
this
.
global
.
workerId
);
}
async
init
(
nodeId
,
workerId
)
{
...
...
@@ -110,6 +112,7 @@ export class ElementListWidget {
deselectAll
();
elementContainer
.
classList
.
add
(
"selected"
);
this
.
global
.
selectedElement
=
element
;
this
.
global
.
queueIndex
=
element
.
queueIndex
;
// <-- Update the queueIndex here
this
.
showExtraDetails
(
element
,
elementContainer
);
this
.
global
.
encodeButton
.
disabled
=
false
;
this
.
global
.
encodeButton
.
classList
.
remove
(
"disabled"
);
...
...
@@ -209,6 +212,7 @@ export class ElementListWidget {
// Retrieve and display the selected element's ID
const
elementId
=
sessionStorage
.
getItem
(
'selectedElementId'
);
sessionStorage
.
setItem
(
"element_id"
,
elementId
);
const
elementIdDiv
=
document
.
createElement
(
'div'
);
elementIdDiv
.
textContent
=
`Element ID:
${
elementId
}
`
;
elementIdDiv
.
classList
.
add
(
'element-id'
);
...
...
@@ -230,10 +234,14 @@ export class ElementListWidget {
// Append the DocumentControlWidget
setDocumentControlObject
(
new
DocumentControlWidget
());
inputContainer
.
appendChild
(
DOCUMENT_CONTROL_OBJECT
.
getWidget
());
}
// Call assignElementToWorker to assign the selected element to the current worker
const
assignResponse
=
await
assignElementToWorker
(
this
.
global
.
workerId
,
this
.
nodeId
,
this
.
global
.
queueIndex
);
if
(
!
assignResponse
.
successful
)
{
console
.
error
(
'Failed to assign element to worker:'
,
assignResponse
);
return
;
}
}
}
async
function
fetchWorkersForNode
(
nodeId
)
{
...
...
@@ -246,9 +254,23 @@ async function fetchElementsForNode(nodeId) {
return
await
response
.
json
();
}
/*await createWebGdeInterface(null);
setDocumentControlObject(new DocumentControlWidget());
document.getElementById("input-field-container").appendChild(DOCUMENT_CONTROL_OBJECT.getWidget());*/
async
function
assignElementToWorker
(
workerId
,
nodeId
,
queueIndex
)
{
const
response
=
await
fetch
(
`
${
API_ROOT
}
/workers/
${
workerId
}
/nodes/
${
nodeId
}
/elements/
${
queueIndex
}
`
);
return
await
response
.
json
();
}
export
function
goBackToElementListViewer
()
{
const
webGdeElement
=
document
.
querySelector
(
'.web-gde-container'
);
if
(
webGdeElement
)
{
webGdeElement
.
remove
();
// This will remove the element and its children
}
else
{
console
.
warn
(
"Element with class 'web-gde-container' not found."
);
}
// Reinstantiate and reinitialize the ElementListWidget
new
ElementListWidget
(
'Web_GDE_DEV'
,
'containerId'
);
}
...
...
WebGde/WebContent/WebGde-Widgets/config.js
View file @
fa8b52ea
...
...
@@ -20,14 +20,15 @@ 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/"
;
export
const
CURRENT_NODE
=
"Mobile
_GDE_DEV"
export
const
CURRENT_NODE
=
"Web
_GDE_DEV"
export
const
ENCODING_PASS
=
"PASS1"
export
const
NEXT_NODE
=
"Complete"
export
const
EXCEPTION_NODE
=
"Exception"
export
const
SHOW_ELEMENT_LIST_VIEWER
=
"Y"
export
const
PDF_EXTENSION
=
".pdf"
export
const
JPG_EXTENSION
=
".jpg"
...
...
WebGde/WebContent/WebGde-Widgets/documentControlWidget/documentControlWidget.js
View file @
fa8b52ea
import
{
createRejectWindow
}
from
'../BPO/rejectElement.js'
;
import
{
createReturnWindow
}
from
'../BPO/returnElement.js'
;
import
{
goBackToElementListViewer
}
from
'../ElementListWidget/ElementListWidget.js'
;
import
{
completeToNextNode
,
submitForm
}
from
'../Submit/submit.js'
;
import
{
IS_RETRIEVE_FROM_BPO
,
ROOT_FOLDER
}
from
'../config.js'
;
import
{
IS_RETRIEVE_FROM_BPO
,
ROOT_FOLDER
,
SHOW_ELEMENT_LIST_VIEWER
}
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'
;
...
...
@@ -60,7 +61,7 @@ export class DocumentControlWidget {
this
.
global
.
returnBtn
.
append
(
returnIcon
);
this
.
global
.
rejectBtn
.
append
(
rejectIcon
);
if
(
IS_RETRIEVE_FROM_BPO
===
"Y"
)
{
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
);
...
...
@@ -78,8 +79,15 @@ export class DocumentControlWidget {
if
(
isSuccessful
)
{
DISPLAY_FIELD_OBJECT
.
clearForm
();
if
(
SHOW_ELEMENT_LIST_VIEWER
===
"Y"
)
{
console
.
log
(
"PUMASOK DITO"
);
createInfoModal
(
goBackToElementListViewer
,
'ok'
,
'Form Submitted.'
);
}
else
{
createInfoModal
(
null
,
'ok'
,
'Form Submitted.'
);
if
(
IS_RETRIEVE_FROM_BPO
===
"Y"
){
}
if
(
IS_RETRIEVE_FROM_BPO
===
"Y"
)
{
let
response
=
await
completeToNextNode
(
sessionStorage
.
getItem
(
"element_id"
));
}
}
...
...
@@ -99,7 +107,7 @@ export class DocumentControlWidget {
return
this
.
global
.
container
;
}
getSubmitBtn
()
{
getSubmitBtn
()
{
return
this
.
global
.
submitBtn
;
}
...
...
WebGde/WebContent/WebGde-Widgets/genericPopup/genericPopup.js
View file @
fa8b52ea
...
...
@@ -54,13 +54,13 @@ export function createModal(okButtonAction, popupTitleText) {
backdropContainer
.
appendChild
(
popupContainer
);
document
.
body
.
appendChild
(
backdropContainer
);
document
.
getElementById
(
"popupContainer"
).
style
.
display
=
"block"
;
document
.
getElementById
(
"okButton"
).
addEventListener
(
"click"
,
function
()
{
document
.
getElementById
(
"okButton"
).
addEventListener
(
"click"
,
function
()
{
document
.
getElementById
(
"backdropContainer"
).
style
.
display
=
"none"
;
if
(
typeof
okButtonAction
===
"function"
)
{
okButtonAction
();
}
});
document
.
getElementById
(
"cancelButton"
).
addEventListener
(
"click"
,
function
()
{
document
.
getElementById
(
"cancelButton"
).
addEventListener
(
"click"
,
function
()
{
document
.
getElementById
(
"backdropContainer"
).
remove
();
});
}
...
...
@@ -126,9 +126,11 @@ export function createInfoModal(okButtonAction, buttonTxt, popupTitleText) {
backdropContainer
.
appendChild
(
popupContainer
);
document
.
body
.
appendChild
(
backdropContainer
);
document
.
getElementById
(
"popupContainer"
).
style
.
display
=
"block"
;
document
.
getElementById
(
"okButton"
).
addEventListener
(
"click"
,
function
()
{
document
.
getElementById
(
"okButton"
).
addEventListener
(
"click"
,
function
()
{
console
.
log
(
"OK Button clicked!"
);
// This will let you know the button was clicked
document
.
getElementById
(
"backdropContainer"
).
style
.
display
=
"none"
;
if
(
typeof
okButtonAction
===
"function"
)
{
console
.
log
(
"YES"
);
okButtonAction
();
}
});
...
...
WebGde/WebContent/script.js
View file @
fa8b52ea
...
...
@@ -44,24 +44,26 @@ async function initializeWebGDE() {
// UNCOMMENTED BY ADAM 9/25/2023
sessionStorage
.
setItem
(
"element_id"
,
"element1"
);
<<<<<<<
WebGde
/
WebContent
/
script
.
js
/* await createWebGdeInterface(null);*/
if
(
SHOW_ELEMENT_LIST_VIEWER
===
"Y"
)
{
/* await createWebGdeInterface(null);*/
setDocumentControlObject
(
new
DocumentControlWidget
());
/* document.getElementById("input-field-container").appendChild(DOCUMENT_CONTROL_OBJECT.getWidget());*/
=======
/* document.getElementById("input-field-container").appendChild(DOCUMENT_CONTROL_OBJECT.getWidget());*/
var
mainLogInScreenContainer
=
document
.
getElementById
(
"logInMainContainer"
);
mainLogInScreenContainer
.
remove
();
removeLoadingScreen
();
new
ElementListWidget
(
'Web_GDE_DEV'
,
'containerId'
);
}
else
{
await
createWebGdeInterface
(
null
);
setDocumentControlObject
(
new
DocumentControlWidget
());
document
.
getElementById
(
"input-field-container"
).
appendChild
(
DOCUMENT_CONTROL_OBJECT
.
getWidget
());
>>>>>>>
WebGde
/
WebContent
/
script
.
js
var
mainLogInScreenContainer
=
document
.
getElementById
(
"logInMainContainer"
);
mainLogInScreenContainer
.
remove
();
removeLoadingScreen
();
// new ElementListWidget('Web_GDE_DEV', 'containerId');
}
}
export
async
function
createWebGdeInterface
(
GDEContainer
)
{
...
...
@@ -142,21 +144,13 @@ export function removeLoadingScreen() {
}
<<<<<<<
WebGde
/
WebContent
/
script
.
js
export
async
function
resetGDE
()
{
// TO-DO
}
function
init
()
{
console
.
log
(
"Application Started"
);
=======
export
async
function
resetGDE
(){
// TO-DO
}
function
init
(){
console
.
log
(
"Application Started"
);
>>>>>>>
WebGde
/
WebContent
/
script
.
js
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment