Commit d33bb025 by Owen Ryan Ang

For demo

parent 262be6b6
......@@ -32,6 +32,7 @@ export async function generateFields(inputSchema, containerId){
header2.textContent = " ";
header2.classList.add("field-header");
let header3 = document.createElement("h3");
header3.setAttribute('id','counter');
header3.textContent = " ";
header3.classList.add("field-header");
divContainer.appendChild(header1);
......
export const FOLDER_PATH = "/WebGDE-Widgets/ImageViewerWidget/modules/imageViewer";
\ No newline at end of file
export const FOLDER_PATH = "/WebGde-Widgets/ImageViewerWidget/modules/imageViewer";
\ No newline at end of file
import { INVALID_KEYS } from "./config.js"
import { ALLOWED_KPH, INVALID_KEYS } from "./config.js"
let global_start_time = 0
export let global_end_time = 0
export let global_end_time
let key_strokes = 0
let time_spent = 0
let time_start = 0
......@@ -72,17 +72,17 @@ export const startMetricCapture = () => {
}
let pause = document.getElementById("pause");
// let pause = document.getElementById("pause");
pause.onclick = (event) => {
pauseMetricCapture();
/*disableTiffButtons();*/
}
document.addEventListener('keydown', function(event) {
if (event.key === 'Escape' || event.key === 'Esc') {
pauseMetricCapture();
}
});
// pause.onclick = (event) => {
// pauseMetricCapture();
// /*disableTiffButtons();*/
// }
// document.addEventListener('keydown', function(event) {
// if (event.key === 'Escape' || event.key === 'Esc') {
// pauseMetricCapture();
// }
// });
/*window.onclick = (event) => {
......
// Capture Metrics Config
export const INVALID_KEYS = "F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12,PrintScreen,ScrollLock,Pause,PageUp,PageDown,Insert,Delete,Control"
\ No newline at end of file
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 ALLOWED_KPH = 8000;
\ No newline at end of file
......@@ -38,9 +38,9 @@ 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://35.169.23.0:8080"
export const DOMAIN = "http://3.82.122.231:8080"
export const CONTEXTROOT = "gfs-explorer-ws"
export const GFS_URL = "http://3.84.1.163:8080" + "/WebGde/svc/gfs-rest"
export const GFS_URL = "http://3.82.122.231:8080" + "/WebGde/svc/gfs-rest"
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 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
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 = "http://3.84.1.163:8080/bpo/"
export const BPO_URL = "http://3.82.122.231:8080/bpo/"
export const CURRENT_NODE = "Web_GDE_DEV"
export const ENCODING_PASS = "PASS1"
export const NEXT_NODE = "Complete"
......@@ -64,4 +64,4 @@ export const PNG_EXTENSION = ".png"
export const REASON_LIST = "Reason1,Reason2,Reason3,Reason4"
//KEYCLOAK CONFIG
export const REDIRECT_URL = 'http://auth-server/auth/realms/GFS/protocol/openid-connect/logout?redirect_uri=encodedRedirectUri';
window.REDIRECT_URL = 'http://auth-server/auth/realms/GFS/protocol/openid-connect/logout?redirect_uri=encodedRedirectUri';
......@@ -216,3 +216,31 @@ textarea{
align-items: flex-start;
justify-content: flex-start;
}
#counter {
height: 11px;
/* font-size: 22px;
padding: 10px;
position: absolute;
z-index: 1;
right: 199px;
bottom: -6px;
text-shadow:
-1px -1px 0 #000,
0 -1px 0 #000,
1px -1px 0 #000,
1px 0 0 #000,
1px 1px 0 #000,
0 1px 0 #000,
-1px 1px 0 #000,
-1px 0 0 #000; */
}
.green{
color: green;
}
.red{
color: red;
}
\ No newline at end of file
......@@ -17,6 +17,8 @@
<script src="https://cdn.rawgit.com/seikichi/tiff.js/master/tiff.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.8.0/jszip.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.8.0/xlsx.js"></script>
<script src="https://auth.svi.cloud/auth/js/keycloak.js"></script>
<script type="text/javascript" src="./keycloak-login.js"></script>
</head>
<body>
......
......@@ -96,48 +96,18 @@ kc.init(initOptions).then(function (authenticated) {
console.info('Init Error');
});
kc.onAuthSuccess = function () {
if (sessionStorage.getItem("user_id") != null) {
refresh();
} else {
console.log("SuccessFul login");
fetch(getUrlGetWorkersCurrentNode())
.then(function (response) {
return response.json();
})
.then(function (data) {
// console.log(data);
// console.log(kc.tokenParsed['preferred_username']);
processLogin(data['workers'],kc.tokenParsed['preferred_username']);
})
.catch(function (err) {
alert('error: ' + err);
alert('Logging out User');
logoutKeycloak();
});
}
}
//fetch workers
function processLogin(data,user){
kc.onAuthSuccess = async function () {
sessionStorage.setItem("user_id", kc.tokenParsed['email']);
sessionStorage.setItem("token", kc.token);
let isPresent = data.find((worker) => worker.workerId === user);
if(isPresent){
console.log("Worker is present");
const start = async () => {
if (IS_RETRIEVE_FROM_BPO == "Y") {
await initGetElement();
}
init();
}
start();
}else{
alert("User not included in the worker List for the Node");
logoutKeycloak();
}
import('./script.js')
.then(async module => {
await module.startApplication();
})
.catch(error => {
console.error('An error occurred while importing the module:', error);
});
}
const logoutKeycloak = () => {
var logoutOptions = { redirectUri: REDIRECT_URL };
......
......@@ -9,32 +9,32 @@ import { Highlight } from "./WebGde-Widgets/ImageViewerWidget/modules/highlight/
import { BPO } from "./WebGde-Widgets/BPO/getElement.js";
import { DocumentControlWidget } from "./WebGde-Widgets/documentControlWidget/documentControlWidget.js";
import { INDEXED_DB_STORAGE , HIGHLIGHT_OBJECT, IMAGE_VIEWER_OBJECT, INDEXED_DB_NAME, INDEXED_DB_TBL_NAME, setIndexedDBStorage, setHighlightObject, setImageViewerObject, setBPOObject, BPO_OBJECT } from "./WebGde-Widgets/globalVariable.js";
import { searchStringInArray, startMetricCapture, keyArray } from "./WebGde-Widgets/captureMetrics/captureMetrics.js";
document.addEventListener("DOMContentLoaded", async ()=>{
export async function startApplication(){
createLoadingScreen();
await initializeWebGDE();
});
await initializeWebGDE();
}
async function initializeWebGDE(){
sessionStorage.setItem("user_id", "worker1");
// setBPOObject(new BPO());
// let isElement = await BPO_OBJECT.getRandomElement();
// sessionStorage.setItem("user_id", "worker1");
setBPOObject(new BPO());
let isElement = await BPO_OBJECT.getRandomElement();
// if (isElement){
if (isElement){
setIndexedDBStorage(new IndexedDBStorage(INDEXED_DB_NAME, INDEXED_DB_TBL_NAME));
// let urls = JSON.parse(sessionStorage.getItem("dir_files"));
let urls = JSON.parse(sessionStorage.getItem("dir_files"));
let urls = ["https://svicomph-my.sharepoint.com/:i:/g/personal/llizardo_svi_com_ph/EXfLFZAjzPdJvAfoRTgPKa0BuGSNkTGAtgQ22GCuaNPwag?e=raEKQM",
"https://cdn.filestackcontent.com/wcrjf9qPTCKXV3hMXDwK",
"https://images.unsplash.com/photo-1631193079266-4af74b218c86?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwxfDB8MXxyYW5kb218MHx8fHx8fHx8MTY4NjY2MjUwNA&ixlib=rb-4.0.3&q=80&utm_campaign=api-credit&utm_medium=referral&utm_source=unsplash_source&w=1080",
"https://images.unsplash.com/source-404?fit=crop&fm=jpg&h=800&q=60&w=1200",
"https://images.unsplash.com/source-404?fit=crop&fm=jpg&h=800&q=60&w=1200"
];
// let urls = ["https://svicomph-my.sharepoint.com/:i:/g/personal/llizardo_svi_com_ph/EXfLFZAjzPdJvAfoRTgPKa0BuGSNkTGAtgQ22GCuaNPwag?e=raEKQM",
// "https://cdn.filestackcontent.com/wcrjf9qPTCKXV3hMXDwK",
// "https://images.unsplash.com/photo-1631193079266-4af74b218c86?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwxfDB8MXxyYW5kb218MHx8fHx8fHx8MTY4NjY2MjUwNA&ixlib=rb-4.0.3&q=80&utm_campaign=api-credit&utm_medium=referral&utm_source=unsplash_source&w=1080",
// "https://images.unsplash.com/source-404?fit=crop&fm=jpg&h=800&q=60&w=1200",
// "https://images.unsplash.com/source-404?fit=crop&fm=jpg&h=800&q=60&w=1200"
// ];
sessionStorage.setItem("dir_files", JSON.stringify(urls));
......@@ -82,13 +82,14 @@ async function initializeWebGDE(){
let controls = new DocumentControlWidget();
document.getElementById("input-field-container").appendChild(controls.getWidget());
removeLoadingScreen();
/*}else{
init();
}else{
function exitTool() {
logoutKeycloak();
}
removeLoadingScreen();
createModal(exitTool, "No Element Available");
}*/
}
}
......@@ -346,5 +347,18 @@ export function removeLoadingScreen(){
}
function init(){
let started_flag = false;
window.onkeydown = (key) => {
if (!started_flag) {
if (searchStringInArray(`${key.key}`, keyArray) == true || key.ctrlKey && key.key) {
console.log('Invalid key cannot Start');
} else {
started_flag = true;
startMetricCapture();
}
}
}
}
......@@ -22,6 +22,8 @@ h2{
}
h3{
margin-bottom: 20px;
color: white;
text-align: center;
}
.web-gde-container{
......@@ -367,3 +369,30 @@ textarea{
position:relative;
top:-857px;
}
#counter {
height: 11px;
/* font-size: 22px;
padding: 10px;
position: absolute;
z-index: 1;
right: 199px;
bottom: -6px;
text-shadow:
-1px -1px 0 #000,
0 -1px 0 #000,
1px -1px 0 #000,
1px 0 0 #000,
1px 1px 0 #000,
0 1px 0 #000,
-1px 1px 0 #000,
-1px 0 0 #000; */
}
.green{
color: green;
}
.red{
color: red;
}
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