Commit 1a65bd81 by Jhunel Adam Calub

add functionality for encode button

parent e5814719
...@@ -86,8 +86,8 @@ body { ...@@ -86,8 +86,8 @@ body {
color: #7d7d7d; color: #7d7d7d;
} }
/* Buttons */ /* Specific styles for the encode button */
button { #encode-btn {
padding: 1rem 2rem; padding: 1rem 2rem;
border: none; border: none;
border-radius: 50px; border-radius: 50px;
...@@ -98,22 +98,48 @@ button { ...@@ -98,22 +98,48 @@ button {
transition: background-color 0.3s ease, transform 0.1s ease; transition: background-color 0.3s ease, transform 0.1s ease;
} }
button:active { #encode-btn:active {
transform: scale(0.95); transform: scale(0.95);
} }
button.encode:hover, #encode-btn:hover {
button.encode:active {
background-color: #0056b3; background-color: #0056b3;
} }
button.new { #encode-btn:active {
background-color: #28a745; background-color: #0056b3;
}
/* Style for disabled encode button */
#encode-btn.disabled {
background-color: #9fb3c8;
/* Grayed out color */
cursor: not-allowed;
}
/* Specific styles for the new button */
#new-btn {
padding: 1rem 2rem;
border: none;
border-radius: 50px;
font-size: 1rem;
color: #fff;
background-color: #007bff;
/* Green color */
cursor: pointer;
transition: background-color 0.3s ease, transform 0.1s ease;
}
#new-btn:active {
transform: scale(0.95);
}
#new-btn:hover {
background-color: #0056b3;
} }
button.new:hover, #new-btn:active {
button.new:active { background-color: #0056b3;
background-color: #218838;
} }
.button-container { .button-container {
...@@ -124,10 +150,7 @@ button.new:active { ...@@ -124,10 +150,7 @@ button.new:active {
gap: 2rem; gap: 2rem;
} }
button.disabled {
background-color: #ccc;
cursor: not-allowed;
}
/* Media Queries */ /* Media Queries */
@media (max-width: 768px) { @media (max-width: 768px) {
......
const API_ROOT = "http://18.233.158.67:8080/bpo/req"; import { createWebGdeInterface } from '../../script.js';
import { DocumentControlWidget } from "../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, DISPLAY_FIELD_OBJECT, setDisplayFieldObject, activateGDE, setDocumentControlObject, DOCUMENT_CONTROL_OBJECT, IS_GDE_ACTIVATED } from "../globalVariable.js";
const API_ROOT = "http://52.207.220.74:8080/bpo/req";
export class ElementListWidget { export class ElementListWidget {
global = { global = {
...@@ -75,6 +80,7 @@ export class ElementListWidget { ...@@ -75,6 +80,7 @@ export class ElementListWidget {
// Initialize the encode button as disabled // Initialize the encode button as disabled
this.global.encodeButton = document.createElement("button"); this.global.encodeButton = document.createElement("button");
this.global.encodeButton.textContent = "ENCODE"; this.global.encodeButton.textContent = "ENCODE";
this.global.encodeButton.id = "encode-btn";
this.global.encodeButton.disabled = true; this.global.encodeButton.disabled = true;
this.global.encodeButton.classList.add("disabled"); this.global.encodeButton.classList.add("disabled");
...@@ -122,13 +128,16 @@ export class ElementListWidget { ...@@ -122,13 +128,16 @@ export class ElementListWidget {
return; return;
} }
if (this.global.selectedElement) { if (this.global.selectedElement) {
this.handleEncodeClick(this.global.selectedElement); this.handleEncodeLogic(); // Only invoke this method
} }
}); });
buttonContainer.appendChild(this.global.encodeButton); buttonContainer.appendChild(this.global.encodeButton);
const newButton = document.createElement("button"); const newButton = document.createElement("button");
newButton.id = "new-btn";
newButton.textContent = "NEW"; newButton.textContent = "NEW";
newButton.addEventListener("click", () => this.handleNewClick()); newButton.addEventListener("click", () => this.handleNewClick());
buttonContainer.appendChild(newButton); buttonContainer.appendChild(newButton);
...@@ -181,6 +190,50 @@ export class ElementListWidget { ...@@ -181,6 +190,50 @@ export class ElementListWidget {
} }
} }
async handleEncodeLogic() {
// Store the selected element's details in the session storage
if (this.global.selectedElement) {
sessionStorage.setItem('selectedElementId', this.global.selectedElement.elementId);
sessionStorage.setItem('selectedElementExtraDetails', JSON.stringify(this.global.selectedElement.extraDetails));
}
// Remove the current container from the DOM
this.global.container.remove();
// Continue with the original logic
await createWebGdeInterface(null);
// Create and style a new container for the selected element's details
const detailsContainer = document.createElement('div');
detailsContainer.classList.add('details-container');
// Retrieve and display the selected element's ID
const elementId = sessionStorage.getItem('selectedElementId');
const elementIdDiv = document.createElement('div');
elementIdDiv.textContent = `Element ID: ${elementId}`;
elementIdDiv.classList.add('element-id');
detailsContainer.appendChild(elementIdDiv);
// Retrieve and display the selected element's extra details
const extraDetails = JSON.parse(sessionStorage.getItem('selectedElementExtraDetails'));
for (const [key, value] of Object.entries(extraDetails)) {
const detailDiv = document.createElement('div');
detailDiv.textContent = `${key}: ${value}`;
detailDiv.classList.add('extra-detail');
detailsContainer.appendChild(detailDiv);
}
// Insert the details container above the input container in the DOM
const inputContainer = document.getElementById("input-field-container");
inputContainer.parentElement.insertBefore(detailsContainer, inputContainer);
// Append the DocumentControlWidget
setDocumentControlObject(new DocumentControlWidget());
inputContainer.appendChild(DOCUMENT_CONTROL_OBJECT.getWidget());
}
} }
async function fetchWorkersForNode(nodeId) { async function fetchWorkersForNode(nodeId) {
...@@ -193,6 +246,10 @@ async function fetchElementsForNode(nodeId) { ...@@ -193,6 +246,10 @@ async function fetchElementsForNode(nodeId) {
return await response.json(); return await response.json();
} }
/*await createWebGdeInterface(null);
setDocumentControlObject(new DocumentControlWidget());
document.getElementById("input-field-container").appendChild(DOCUMENT_CONTROL_OBJECT.getWidget());*/
...@@ -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://54.208.45.179:8080" export const DOMAIN = "http://52.207.220.74: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/"
......
...@@ -45,9 +45,9 @@ async function initializeWebGDE() { ...@@ -45,9 +45,9 @@ async function initializeWebGDE() {
// UNCOMMENTED BY ADAM 9/25/2023 // UNCOMMENTED BY ADAM 9/25/2023
/*await createWebGdeInterface(null);*/ /* await createWebGdeInterface(null);*/
setDocumentControlObject(new DocumentControlWidget()); 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"); var mainLogInScreenContainer = document.getElementById("logInMainContainer");
mainLogInScreenContainer.remove(); mainLogInScreenContainer.remove();
...@@ -57,7 +57,7 @@ async function initializeWebGDE() { ...@@ -57,7 +57,7 @@ async function initializeWebGDE() {
} }
async function createWebGdeInterface(GDEContainer) { export async function createWebGdeInterface(GDEContainer) {
let gdeContainer = document.createElement("div"); let gdeContainer = document.createElement("div");
gdeContainer.setAttribute("class", "container web-gde-container"); gdeContainer.setAttribute("class", "container web-gde-container");
...@@ -135,19 +135,15 @@ export function removeLoadingScreen() { ...@@ -135,19 +135,15 @@ export function removeLoadingScreen() {
} }
<<<<<<< WebGde/WebContent/script.js export async function resetGDE() {
export async function resetGDE(){ // TO-DO
// 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() {
try { try {
let doctype; let doctype;
......
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