diff --git a/onix-gui/onix/README.md b/onix-gui/GUI/README.md similarity index 60% rename from onix-gui/onix/README.md rename to onix-gui/GUI/README.md index b701976..5453b9b 100644 --- a/onix-gui/onix/README.md +++ b/onix-gui/GUI/README.md @@ -6,23 +6,28 @@ The GUI for the beckn-onix cli tool. 1. 4 server/instances 2. 4 sub-domains mapped to each instance -3. Local Tunnel - `npm i -g localtunnel` ## User Guide -### Step 1: Run the `start.sh` script +### Step 1: Clone the beckn-onix-gui repo ``` -cd .. && ./start.sh +git clone https://github.com/Mishalabdullah/beckn-onix-gui.git ``` -### Step 2: Accessing the GUI. +### Step 2: Change directory to the nextjs project -You will be getting a URL and password as on output of the script. Open the url in the browser and then -paste the password. +``` +cd onix-gui +``` -### Step 3: Install and setup your network +### Step 3: Run nextjs on port 3005 + +For running the installation script just run this command. The sudo privilages are required when installing packages and configuring the nginx reverse proxy + +``` +sudo ./start.sh +``` Note: Port 3000 is being used by onix, so we're using port 3005 instead. @@ -42,15 +47,6 @@ Contributions are welcome! If you'd like to contribute to the beckn-onix-gui pro The beckn-onix-gui project is licensed under the MIT License. See the LICENSE file for more information. - ## Contact If you have any questions or issues with the beckn-onix-gui project, please don't hesitate to reach out. - -### Made with ❤️ - -built by the [Mulearn Team](https://mulearn.org/) -1. [Mishal Abdullah](https://github.com/Mishalabdullah/) -2. [Aswin Asok](https://github.com/AswinAsok) -3. [Viraj Prabhu ](https://github.com/viraka) -4. [Adasrsh](https://adarshmohanks.framer.website/) diff --git a/onix-gui/onix/app/Infy_Pending.pdf b/onix-gui/GUI/app/Infy_Pending.pdf similarity index 100% rename from onix-gui/onix/app/Infy_Pending.pdf rename to onix-gui/GUI/app/Infy_Pending.pdf diff --git a/onix-gui/onix/app/api/check-layer2/route.js b/onix-gui/GUI/app/api/check-layer2/route.js similarity index 60% rename from onix-gui/onix/app/api/check-layer2/route.js rename to onix-gui/GUI/app/api/check-layer2/route.js index 9ffccdf..1fb27cf 100644 --- a/onix-gui/onix/app/api/check-layer2/route.js +++ b/onix-gui/GUI/app/api/check-layer2/route.js @@ -2,8 +2,9 @@ import { exec } from "child_process"; import { NextResponse } from "next/server"; export async function POST(req) { - const checked = await req.json(); - const containerName = checked.checked ? "bpp-network" : "bap-network"; + const request = await req.json(); + const containerName = request.checked ? "bpp-network" : "bap-network"; + const fileToCheck = request.fileName; const executeShellCommand = (command) => { return new Promise((resolve, reject) => { @@ -13,13 +14,11 @@ export async function POST(req) { reject(error); return; } - if (stderr) { console.error("Error:", stderr); reject(new Error(stderr)); return; } - const output = stdout; console.log("Output:", output); resolve(output); @@ -31,7 +30,6 @@ export async function POST(req) { const containerExists = await executeShellCommand( `docker ps -a --filter "name=${containerName}" --format "{{.Names}}"` ); - if (!containerExists.trim()) { return new NextResponse(`Error: ${containerName} server not present`, { status: 500, @@ -39,14 +37,30 @@ export async function POST(req) { } const result = await executeShellCommand( - `docker exec ${containerName} ls /usr/src/app/schemas/ | grep -v "core" | grep ".yaml" | wc -l` + `docker exec ${containerName} /bin/sh -c "[ -f '/usr/src/app/schemas/${fileToCheck}' ] && echo 'File found' || echo 'File not found'"` ); - - return new NextResponse(result); + if (result.trim() === "File found") { + return NextResponse.json( + { message: true }, + { + status: 200, + } + ); + } else { + return NextResponse.json( + { message: false }, + { + status: 200, + } + ); + } } catch (error) { console.error(`exec error: ${error}`); - return new NextResponse(`Error executing shell command: ${error}`, { - status: 500, - }); + return NextResponse.json( + { message: `Error executing shell command: ${error}` }, + { + status: 500, + } + ); } } diff --git a/onix-gui/onix/app/api/clonning-repo/route.js b/onix-gui/GUI/app/api/clonning-repo/route.js similarity index 100% rename from onix-gui/onix/app/api/clonning-repo/route.js rename to onix-gui/GUI/app/api/clonning-repo/route.js diff --git a/onix-gui/onix/app/api/install-bap/route.js b/onix-gui/GUI/app/api/install-bap/route.js similarity index 92% rename from onix-gui/onix/app/api/install-bap/route.js rename to onix-gui/GUI/app/api/install-bap/route.js index 9236941..2c5fb04 100644 --- a/onix-gui/onix/app/api/install-bap/route.js +++ b/onix-gui/GUI/app/api/install-bap/route.js @@ -47,7 +47,10 @@ export async function startSupportServices() { `docker-compose -f ${pathDir}/install/docker-compose-app.yml up -d redis_db` ); console.log("Result 3:", result3); - + await executeCommand("docker volume create registry_data_volume"); + await executeCommand("docker volume create registry_database_volume"); + await executeCommand("docker volume create gateway_data_volume"); + await executeCommand("docker volume create gateway_database_volume"); return NextResponse.json({ result1, result2, result3 }); } catch (error) { console.error("An error occurred:", error); @@ -91,10 +94,10 @@ export async function POST(req) { const bppSubscriberId = data.subscriberId; const bppSubscriberUrl = data.subscriberUrl; const networkconfigurl = data.networkconfigurl; + let updateBppConfigCommand = `bash ${pathDir}/install/scripts/update_bap_config.sh ${registryUrl} ${bppSubscriberId} ${bppSubscriberUrl} ${networkconfigurl}`; const result1 = await executeCommand(updateBppConfigCommand); console.log("Result 1:", result1); - const result3 = await executeCommand( `docker-compose -f ${pathDir}/install/docker-compose-v2.yml up -d "bap-client"` ); diff --git a/onix-gui/onix/app/api/install-bpp/route.js b/onix-gui/GUI/app/api/install-bpp/route.js similarity index 93% rename from onix-gui/onix/app/api/install-bpp/route.js rename to onix-gui/GUI/app/api/install-bpp/route.js index 9943be4..2ac5ca0 100644 --- a/onix-gui/onix/app/api/install-bpp/route.js +++ b/onix-gui/GUI/app/api/install-bpp/route.js @@ -47,7 +47,10 @@ export async function startSupportServices() { `docker-compose -f ${pathDir}/install/docker-compose-app.yml up -d redis_db` ); console.log("Result 3:", result3); - + await executeCommand("docker volume create registry_data_volume"); + await executeCommand("docker volume create registry_database_volume"); + await executeCommand("docker volume create gateway_data_volume"); + await executeCommand("docker volume create gateway_database_volume"); return NextResponse.json({ result1, result2, result3 }); } catch (error) { console.error("An error occurred:", error); diff --git a/onix-gui/onix/app/api/install-gateway/route.js b/onix-gui/GUI/app/api/install-gateway/route.js similarity index 93% rename from onix-gui/onix/app/api/install-gateway/route.js rename to onix-gui/GUI/app/api/install-gateway/route.js index 46b150b..3545f6e 100644 --- a/onix-gui/onix/app/api/install-gateway/route.js +++ b/onix-gui/GUI/app/api/install-gateway/route.js @@ -64,7 +64,8 @@ export async function POST(req, res) { `bash ${pathDir}/install/scripts/package_manager.sh` ); console.log("Result 1:", result1); - + await executeCommand("docker volume create registry_data_volume"); + await executeCommand("docker volume create registry_database_volume"); const result2 = await executeCommand( ` bash ${pathDir}/install/scripts/update_gateway_details.sh ${data.registryUrl} ${data.gatewayUrl}` ); @@ -75,7 +76,7 @@ export async function POST(req, res) { ); console.log("Result 3:", result3); - const result4 = await executeCommand(`sleep 10`); + const result4 = await executeCommand(`sleep 2`); console.log("Result 4:", result4); const result5 = await executeCommand( diff --git a/onix-gui/GUI/app/api/install-layer2/route.js b/onix-gui/GUI/app/api/install-layer2/route.js new file mode 100644 index 0000000..c795226 --- /dev/null +++ b/onix-gui/GUI/app/api/install-layer2/route.js @@ -0,0 +1,38 @@ +import { exec } from "child_process"; +import { NextResponse } from "next/server"; + +export async function POST(req) { + const request = await req.json(); + const fileURL = request.yamlUrl; + const containerName = request.container; + + const executeShellCommand = (command) => { + return new Promise((resolve, reject) => { + exec(command, (error, stdout, stderr) => { + if (error) { + console.error("Error:", error); + reject(error); + return; + } + if (stderr) { + console.error("Error:", stderr); + reject(new Error(stderr)); + return; + } + const output = stdout; + console.log("Output:", output); + resolve(output); + }); + }); + }; + + try { + await executeShellCommand( + `docker exec ${containerName} wget -P /usr/src/app/schemas/ ${fileURL}` + ); + return NextResponse.json({ status: 200 }); + } catch (error) { + console.error(`exec error: ${error}`); + return NextResponse.json({ status: 500 }); + } +} diff --git a/onix-gui/onix/app/api/install-registry/route.js b/onix-gui/GUI/app/api/install-registry/route.js similarity index 85% rename from onix-gui/onix/app/api/install-registry/route.js rename to onix-gui/GUI/app/api/install-registry/route.js index fbffb7b..70c4102 100644 --- a/onix-gui/onix/app/api/install-registry/route.js +++ b/onix-gui/GUI/app/api/install-registry/route.js @@ -111,6 +111,20 @@ export async function POST(req, res) { await fs.writeFile(tempFile, updatedConfigData); await fs.rename(tempFile, configFile); + await executeCommand("docker volume create registry_data_volume"); + await executeCommand("docker volume create registry_database_volume"); + await executeCommand("docker volume create gateway_data_volume"); + await executeCommand("docker volume create gateway_database_volume"); + await executeCommand( + `docker run --rm -v ${join( + pathDir, + "install", + "registry_data", + "config" + )}:/source -v registry_data_volume:/target busybox sh -c "cp /source/envvars /target/ && cp /source/logger.properties /target/ && cp /source/swf.properties /target/"` + ); + + // Start the registry container await executeCommand( `docker-compose -f ${join( pathDir, diff --git a/onix-gui/onix/app/favicon.ico b/onix-gui/GUI/app/favicon.ico similarity index 100% rename from onix-gui/onix/app/favicon.ico rename to onix-gui/GUI/app/favicon.ico diff --git a/onix-gui/onix/app/globals.css b/onix-gui/GUI/app/globals.css similarity index 100% rename from onix-gui/onix/app/globals.css rename to onix-gui/GUI/app/globals.css diff --git a/onix-gui/onix/app/install/configure/page.js b/onix-gui/GUI/app/install/configure/page.js similarity index 85% rename from onix-gui/onix/app/install/configure/page.js rename to onix-gui/GUI/app/install/configure/page.js index f0749f9..4da2300 100644 --- a/onix-gui/onix/app/install/configure/page.js +++ b/onix-gui/GUI/app/install/configure/page.js @@ -3,7 +3,7 @@ import Link from "next/link"; import styles from "../../page.module.css"; import { Ubuntu_Mono } from "next/font/google"; - +import Image from "next/image"; const ubuntuMono = Ubuntu_Mono({ weight: "400", style: "normal", @@ -28,7 +28,7 @@ export default function Home() { style={{ textDecoration: "underline", color: "white" }} >
- + arrow

Gateway

@@ -37,7 +37,7 @@ export default function Home() { style={{ textDecoration: "underline", color: "white" }} >
- + arrow

BAP Adapter

@@ -46,7 +46,7 @@ export default function Home() { style={{ textDecoration: "underline", color: "white" }} >
- + arrow

BPP Adapter

diff --git a/onix-gui/onix/app/install/create/page.js b/onix-gui/GUI/app/install/create/page.js similarity index 84% rename from onix-gui/onix/app/install/create/page.js rename to onix-gui/GUI/app/install/create/page.js index 14e38e6..0cf9db7 100644 --- a/onix-gui/onix/app/install/create/page.js +++ b/onix-gui/GUI/app/install/create/page.js @@ -3,7 +3,7 @@ import Link from "next/link"; import styles from "../../page.module.css"; import { Ubuntu_Mono } from "next/font/google"; - +import Image from "next/image"; const ubuntuMono = Ubuntu_Mono({ weight: "400", style: "normal", @@ -28,7 +28,7 @@ export default function Home() { style={{ textDecoration: "underline", color: "white" }} >
- + arrow

Gateway

@@ -37,7 +37,7 @@ export default function Home() { className={styles.box} style={{ textDecoration: "underline", color: "white" }} > - + arrow

BAP Adapter

@@ -46,7 +46,7 @@ export default function Home() { className={styles.box} style={{ textDecoration: "underline", color: "white" }} > - + arrow

BPP Adapter

@@ -55,7 +55,7 @@ export default function Home() { style={{ textDecoration: "underline", color: "white" }} >
- + arrow

Registry

diff --git a/onix-gui/onix/app/install/join/page.js b/onix-gui/GUI/app/install/join/page.js similarity index 86% rename from onix-gui/onix/app/install/join/page.js rename to onix-gui/GUI/app/install/join/page.js index 5223af5..619e14b 100644 --- a/onix-gui/onix/app/install/join/page.js +++ b/onix-gui/GUI/app/install/join/page.js @@ -3,7 +3,7 @@ import Link from "next/link"; import styles from "../../page.module.css"; import { Ubuntu_Mono } from "next/font/google"; - +import Image from "next/image"; const ubuntuMono = Ubuntu_Mono({ weight: "400", style: "normal", @@ -32,7 +32,7 @@ export default function Home() { }} >
- + arrow

Gateway

@@ -44,7 +44,7 @@ export default function Home() { }} >
- + arrow

BAP Adapter

@@ -56,7 +56,7 @@ export default function Home() { }} >
- + arrow

BPP Adapter

diff --git a/onix-gui/onix/app/install/local/page.js b/onix-gui/GUI/app/install/local/page.js similarity index 85% rename from onix-gui/onix/app/install/local/page.js rename to onix-gui/GUI/app/install/local/page.js index a698588..7dbd607 100644 --- a/onix-gui/onix/app/install/local/page.js +++ b/onix-gui/GUI/app/install/local/page.js @@ -3,7 +3,7 @@ import Link from "next/link"; import styles from "../../page.module.css"; import { Ubuntu_Mono } from "next/font/google"; - +import Image from "next/image"; const ubuntuMono = Ubuntu_Mono({ weight: "400", style: "normal", @@ -30,7 +30,7 @@ export default function Home() { style={{ textDecoration: "underline", color: "white" }} >
- + arrow

Gateway

@@ -39,7 +39,7 @@ export default function Home() { style={{ textDecoration: "underline", color: "white" }} >
- + arrow

BAP Adapter

@@ -48,7 +48,7 @@ export default function Home() { style={{ textDecoration: "underline", color: "white" }} >
- + arrow

BPP Adapter

diff --git a/onix-gui/onix/app/install/merge/page.js b/onix-gui/GUI/app/install/merge/page.js similarity index 76% rename from onix-gui/onix/app/install/merge/page.js rename to onix-gui/GUI/app/install/merge/page.js index 7e256d9..7391660 100644 --- a/onix-gui/onix/app/install/merge/page.js +++ b/onix-gui/GUI/app/install/merge/page.js @@ -3,7 +3,7 @@ import Link from "next/link"; import styles from "../../page.module.css"; import { Ubuntu_Mono } from "next/font/google"; - +import Image from "next/image"; const ubuntuMono = Ubuntu_Mono({ weight: "400", style: "normal", @@ -15,7 +15,12 @@ export default function Home() { <>
- +

Merge multiple networks

- + arrow

Gateway

@@ -32,7 +37,7 @@ export default function Home() { style={{ textDecoration: "underline", color: "white" }} >
- + arrow

BAP

@@ -41,7 +46,7 @@ export default function Home() { style={{ textDecoration: "underline", color: "white" }} >
- + arrow

BPP

diff --git a/onix-gui/onix/app/install/page.js b/onix-gui/GUI/app/install/page.js similarity index 56% rename from onix-gui/onix/app/install/page.js rename to onix-gui/GUI/app/install/page.js index e104190..a196231 100644 --- a/onix-gui/onix/app/install/page.js +++ b/onix-gui/GUI/app/install/page.js @@ -3,7 +3,7 @@ import Link from "next/link"; import styles from "../page.module.css"; import { Ubuntu_Mono } from "next/font/google"; - +import Image from "next/image"; const ubuntuMono = Ubuntu_Mono({ weight: "400", style: "normal", @@ -33,7 +33,7 @@ export default function Home() { style={{ textDecoration: "underline", color: "white" }} >
- + arrow

Join an existing network

@@ -42,39 +42,10 @@ export default function Home() { style={{ textDecoration: "underline", color: "white" }} >
- + arrow

Create new production network

- -
- -

- Set up a network on your local machine -

-
- - {/* -
- -

Merge multiple networks

-
- - -
- -

Configure Existing Network

-
- */}
diff --git a/onix-gui/onix/app/layout.js b/onix-gui/GUI/app/layout.js similarity index 100% rename from onix-gui/onix/app/layout.js rename to onix-gui/GUI/app/layout.js diff --git a/onix-gui/onix/app/page.js b/onix-gui/GUI/app/page.js similarity index 81% rename from onix-gui/onix/app/page.js rename to onix-gui/GUI/app/page.js index 33f3594..600fc62 100644 --- a/onix-gui/onix/app/page.js +++ b/onix-gui/GUI/app/page.js @@ -1,7 +1,7 @@ import Link from "next/link"; import styles from "./page.module.css"; import { Ubuntu_Mono } from "next/font/google"; - +import Image from "next/image"; const ubuntuMono = Ubuntu_Mono({ weight: "400", style: "normal", @@ -25,25 +25,25 @@ export default function Home() { style={{ textDecoration: "underline", color: "white" }} >
- + arrow

Installation Wizard

-
- + arrow

Network Monitor

- + */}
- + arrow

Layer 2 Tester

diff --git a/onix-gui/onix/app/page.module.css b/onix-gui/GUI/app/page.module.css similarity index 100% rename from onix-gui/onix/app/page.module.css rename to onix-gui/GUI/app/page.module.css diff --git a/onix-gui/onix/app/setup/bap/page.js b/onix-gui/GUI/app/setup/bap/page.js similarity index 98% rename from onix-gui/onix/app/setup/bap/page.js rename to onix-gui/GUI/app/setup/bap/page.js index ff4b4f8..2613e6e 100644 --- a/onix-gui/onix/app/setup/bap/page.js +++ b/onix-gui/GUI/app/setup/bap/page.js @@ -117,7 +117,7 @@ export default function Home() { />
- + {/* */}
- + {/* */}
- + {/* */}
diff --git a/onix-gui/onix/app/setup/registry/page.js b/onix-gui/GUI/app/setup/registry/page.js similarity index 97% rename from onix-gui/onix/app/setup/registry/page.js rename to onix-gui/GUI/app/setup/registry/page.js index 8bc57c2..6fce954 100644 --- a/onix-gui/onix/app/setup/registry/page.js +++ b/onix-gui/GUI/app/setup/registry/page.js @@ -85,7 +85,7 @@ export default function Home() { onChange={handleRegistryUrlChange} />
- + {/* */}
diff --git a/onix-gui/onix/app/template.csv b/onix-gui/GUI/app/template.csv similarity index 100% rename from onix-gui/onix/app/template.csv rename to onix-gui/GUI/app/template.csv diff --git a/onix-gui/GUI/app/yaml-gen/install-yaml/page.js b/onix-gui/GUI/app/yaml-gen/install-yaml/page.js new file mode 100644 index 0000000..22ad80c --- /dev/null +++ b/onix-gui/GUI/app/yaml-gen/install-yaml/page.js @@ -0,0 +1,105 @@ +"use client"; +import SecondaryButton from "@/components/Buttons/SecondaryButton"; +import styles from "../../page.module.css"; +import { Ubuntu_Mono } from "next/font/google"; +import Slider from "@/components/Slider/Slider"; +import PrimaryButton from "@/components/Buttons/PrimaryButton"; +import InputField from "@/components/InputField/InputField"; +import { useState, useCallback } from "react"; +import { toast } from "react-toastify"; + +const ubuntuMono = Ubuntu_Mono({ + weight: "400", + style: "normal", + subsets: ["latin"], +}); + +export default function InstallYaml() { + const [yamlUrl, setYamlUrl] = useState(""); + const [checked, setChecked] = useState(false); + + const container = checked ? "bpp-network" : "bap-network"; + + const handleRegistryUrlChange = (event) => { + setYamlUrl(event.target.value); + }; + + const installYaml = useCallback(async () => { + const toastId = toast.loading("Installing Layer 2 Config file..."); + + try { + const response = await fetch("/api/install-layer2", { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ container, yamlUrl }), + }); + + if (response.ok) { + const data = await response.json(); + console.log(data); + const FileFound = data.message; + if (FileFound == false) { + setShowDownloadLayer2Button(true); + toast.update(toastId, { + render: "No Layer 2 Config Present 🤯", + type: "error", + isLoading: false, + autoClose: 5000, + }); + } else { + toast.update(toastId, { + render: "Yaml File Present 👌", + type: "success", + isLoading: false, + autoClose: 5000, + }); + } + } else { + console.error("Failed to check yaml"); + toast.update(toastId, { + render: "Container Not Found 🤯", + type: "error", + isLoading: false, + autoClose: 5000, + }); + } + } catch (error) { + console.error("An error occurred:", error); + } + }); + + return ( + <> +
+
+ +

Install Yaml

+
+ + +
+ {/* */} + +
+
+
+
+ + ); +} diff --git a/onix-gui/onix/app/yaml-gen/check-yaml/page.js b/onix-gui/GUI/app/yaml-gen/page.js similarity index 59% rename from onix-gui/onix/app/yaml-gen/check-yaml/page.js rename to onix-gui/GUI/app/yaml-gen/page.js index 4ebbcf6..937fa35 100644 --- a/onix-gui/onix/app/yaml-gen/check-yaml/page.js +++ b/onix-gui/GUI/app/yaml-gen/page.js @@ -4,8 +4,9 @@ import { Ubuntu_Mono } from "next/font/google"; import PrimaryButton from "@/components/Buttons/PrimaryButton"; import InputField from "@/components/InputField/InputField"; import Slider from "@/components/Slider/Slider"; -import styles from "../../page.module.css"; +import styles from "../page.module.css"; import { toast } from "react-toastify"; + import Link from "next/link"; const ubuntuMono = Ubuntu_Mono({ @@ -15,14 +16,37 @@ const ubuntuMono = Ubuntu_Mono({ }); export default function CheckYaml() { + const [domainName, setDomainName] = useState(""); + const [versionNumber, setversionNumber] = useState(""); const [checked, setChecked] = useState(false); + const [showDownloadLayer2Button, setShowDownloadLayer2Button] = + useState(false); const [propertyLink, setPropertyLink] = useState(""); const handleYamlChange = (event) => { setPropertyLink(event.target.value); }; + const handledomainNameChange = (event) => { + setDomainName(event.target.value); + }; + const handleVersionChange = (event) => { + setversionNumber(event.target.value); + }; + const nameGenerator = async () => { + const parts = domainName.split(":"); + const domainNameWithoutVersion = parts[0]; + let filename; + if (parts[1] === undefined || parts[1] === "") { + filename = `${domainNameWithoutVersion}_${versionNumber}.yaml`; + } else { + filename = `${domainNameWithoutVersion}_${parts[1]}_${versionNumber}.yaml`; + } + console.log(filename); + return filename; + }; const handleOnclick = async () => { + const fileName = await nameGenerator(); const toastId = toast.loading("Checking for layer2 yaml file"); try { const response = await fetch("/api/check-layer2", { @@ -30,14 +54,14 @@ export default function CheckYaml() { headers: { "Content-Type": "application/json", }, - body: JSON.stringify({ checked }), + body: JSON.stringify({ checked, fileName }), }); if (response.ok) { const data = await response.json(); - const yamlFile = data; - console.log("YAML", yamlFile); - if (yamlFile == 0) { + const FileFound = data.message; + if (FileFound == false) { + setShowDownloadLayer2Button(true); toast.update(toastId, { render: "No Layer 2 Config Present 🤯", type: "error", @@ -89,16 +113,29 @@ export default function CheckYaml() { + + - {/* */}
- +
+ {showDownloadLayer2Button && ( +
+ Download Layer 2 Config +
+ )} diff --git a/onix-gui/onix/components/Buttons/Buttons.module.css b/onix-gui/GUI/components/Buttons/Buttons.module.css similarity index 100% rename from onix-gui/onix/components/Buttons/Buttons.module.css rename to onix-gui/GUI/components/Buttons/Buttons.module.css diff --git a/onix-gui/onix/components/Buttons/PrimaryButton.js b/onix-gui/GUI/components/Buttons/PrimaryButton.js similarity index 100% rename from onix-gui/onix/components/Buttons/PrimaryButton.js rename to onix-gui/GUI/components/Buttons/PrimaryButton.js diff --git a/onix-gui/onix/components/Buttons/SecondaryButton.jsx b/onix-gui/GUI/components/Buttons/SecondaryButton.jsx similarity index 100% rename from onix-gui/onix/components/Buttons/SecondaryButton.jsx rename to onix-gui/GUI/components/Buttons/SecondaryButton.jsx diff --git a/onix-gui/onix/components/InputField/InputField.jsx b/onix-gui/GUI/components/InputField/InputField.jsx similarity index 76% rename from onix-gui/onix/components/InputField/InputField.jsx rename to onix-gui/GUI/components/InputField/InputField.jsx index e20ce98..aac6551 100644 --- a/onix-gui/onix/components/InputField/InputField.jsx +++ b/onix-gui/GUI/components/InputField/InputField.jsx @@ -1,12 +1,12 @@ import React from "react"; import styles from "./InputField.module.css"; -const InputField = ({ label, value, onChange }) => { +const InputField = ({ label, value, onChange, placeholder = "Input Text" }) => { return (
{ - const data = [ - { - ip: "192.168.1.1", - status: "Live", - cpu: "2%", - memory: "18.8 MB", - uptime: "10 days", - }, - { - ip: "10.0.0.1", - status: "404", - cpu: "0%", - memory: "0 MB", - uptime: "5 days", - }, - { - ip: "172.16.0.1", - status: "Live", - cpu: "6%", - memory: "56.4 MB", - uptime: "15 days", - }, - { - ip: "192.0.2.1", - status: "Live", - cpu: "69%", - memory: "648.6 MB", - uptime: "20 days", - }, - { - ip: "198.51.100.1", - status: "404", - cpu: "0%", - memory: "0 MB", - uptime: "3 days", - }, - { - ip: "203.0.113.1", - status: "Live", - cpu: ".4%", - memory: "3.7 MB", - uptime: "8 days", - }, - ]; - return ( -
-
-

- Uptime Network Participants: 10 -

-

- Uptime Network Participants: 10 -

-
-

Dashboard

- - - - - - - - - - - - {data.map((item, index) => ( - - - - - - - - ))} - -
S/NIP / Domain NameStatusCPUMemory
{index + 1}{item.ip}{item.status}{item.cpu}{item.memory}
-
- ); -}; - -export default page; diff --git a/onix-gui/onix/app/monitor/page.js b/onix-gui/onix/app/monitor/page.js deleted file mode 100644 index 5e042e2..0000000 --- a/onix-gui/onix/app/monitor/page.js +++ /dev/null @@ -1,74 +0,0 @@ -"use client"; -import { useState } from "react"; -import InputField from "@/components/InputField/InputField"; -import styles from "../page.module.css"; -import { Ubuntu_Mono } from "next/font/google"; -import SecondaryButton from "@/components/Buttons/SecondaryButton"; -import PrimaryButton from "@/components/Buttons/PrimaryButton"; -import { useRouter } from "next/navigation"; -const ubuntuMono = Ubuntu_Mono({ - weight: "400", - style: "normal", - subsets: ["latin"], -}); - -export default function Home() { - const [registryUrl, setRegistryUrl] = useState(""); - const router = useRouter(); - const handleRegistryUrlChange = (event) => { - setRegistryUrl(event.target.value); - }; - const handleContinue = async () => { - try { - const response = await fetch("/api/get-network-participant", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ registryUrl }), - }); - - if (response.ok) { - const networkParticipantsData = await response.json(); - router.push("/monitor/dashboard"); - // redirecting to the dashboard page - } else { - console.log("error fetching participant data"); - } - } catch (error) { - console.error("Error:", error); - } - }; - - return ( - <> -
-
- - {/*

ONIX{pathname}

*/} -

Network Registry

-
- - {/* */} - {/* */} - {/* */} - -
- {/* */} - -
-
-
-
- - ); -} diff --git a/onix-gui/onix/app/yaml-gen/option/bap/page.js b/onix-gui/onix/app/yaml-gen/option/bap/page.js deleted file mode 100644 index 974a6a9..0000000 --- a/onix-gui/onix/app/yaml-gen/option/bap/page.js +++ /dev/null @@ -1,64 +0,0 @@ -"use client"; - -import InputField from "@/components/InputField/InputField"; -import styles from "../../../page.module.css"; -import { Ubuntu_Mono } from "next/font/google"; -import SecondaryButton from "@/components/Buttons/SecondaryButton"; -import PrimaryButton from "@/components/Buttons/PrimaryButton"; -import { usePathname } from "next/navigation"; -import { useState, useCallback } from "react"; -import Slider from "@/components/Slider/Slider" - -const ubuntuMono = Ubuntu_Mono({ - weight: "400", - style: "normal", - subsets: ["latin"], -}); - - -export default function Bap() { - - const [checked, setChecked] = useState(false); - const [propertyName, setPropertyName] = useState(""); - const [propertyLink, setPropertyLink] = useState(""); - const [propertyOption, setPropertyOption] = useState(""); - - return ( - <> -
-
-

BAP

-
- - - - - - - -
- - -
-
-
-
- - ) -} \ No newline at end of file diff --git a/onix-gui/onix/app/yaml-gen/option/bpp/page.js b/onix-gui/onix/app/yaml-gen/option/bpp/page.js deleted file mode 100644 index c4ff616..0000000 --- a/onix-gui/onix/app/yaml-gen/option/bpp/page.js +++ /dev/null @@ -1,64 +0,0 @@ -"use client"; - -import InputField from "@/components/InputField/InputField"; -import styles from "../../../page.module.css"; -import { Ubuntu_Mono } from "next/font/google"; -import SecondaryButton from "@/components/Buttons/SecondaryButton"; -import PrimaryButton from "@/components/Buttons/PrimaryButton"; -import { usePathname } from "next/navigation"; -import { useState, useCallback } from "react"; -import Slider from "@/components/Slider/Slider" - -const ubuntuMono = Ubuntu_Mono({ - weight: "400", - style: "normal", - subsets: ["latin"], -}); - - -export default function Bpp() { - - const [checked, setChecked] = useState(false); - const [propertyName, setPropertyName] = useState(""); - const [propertyLink, setPropertyLink] = useState(""); - const [propertyOption, setPropertyOption] = useState(""); - - return ( - <> -
-
-

BPP

-
- - - - - - - -
- - -
-
-
-
- - ) -} \ No newline at end of file diff --git a/onix-gui/onix/app/yaml-gen/option/page.js b/onix-gui/onix/app/yaml-gen/option/page.js deleted file mode 100644 index b8a9b35..0000000 --- a/onix-gui/onix/app/yaml-gen/option/page.js +++ /dev/null @@ -1,43 +0,0 @@ -import Link from "next/link"; -import styles from "../../page.module.css"; -import { Ubuntu_Mono } from "next/font/google"; - -const ubuntuMono = Ubuntu_Mono({ - weight: "400", - style: "normal", - subsets: ["latin"], -}); - - -export default function Option() { - return ( - <> -
-
-

Yaml File Generator

-
- -
- -

BAP

-
- - -
- -

BPP

-
- -
- -
-
- - ) -} \ No newline at end of file diff --git a/onix-gui/onix/app/yaml-gen/page.js b/onix-gui/onix/app/yaml-gen/page.js deleted file mode 100644 index 1fcf514..0000000 --- a/onix-gui/onix/app/yaml-gen/page.js +++ /dev/null @@ -1,122 +0,0 @@ -import Link from "next/link"; -import styles from "../page.module.css"; -import { Ubuntu_Mono } from "next/font/google"; -import btnstyles from "@/components/Buttons/Buttons.module.css"; -const ubuntuMono = Ubuntu_Mono({ - weight: "400", - style: "normal", - subsets: ["latin"], -}); - -export default function YamlGen() { - return ( - <> -
-
-

- Yaml File Generator -

-
- -
- -

Search

-
- - -
- -

Select

-
- - -
- -

Init

-
- - -
- -

Confirm

-
- - -
- -

Status

-
- -
-
- -
- -

Track

-
- - -
- -

Cancel

-
- - -
- -

Update

-
- - -
- -

Rating

-
- - -
- -

Support

-
- -
-
- -
- - ); -} diff --git a/onix-gui/onix/next.config.mjs b/onix-gui/onix/next.config.mjs deleted file mode 100644 index 4678774..0000000 --- a/onix-gui/onix/next.config.mjs +++ /dev/null @@ -1,4 +0,0 @@ -/** @type {import('next').NextConfig} */ -const nextConfig = {}; - -export default nextConfig; diff --git a/onix-gui/start.sh b/onix-gui/start.sh index ac2ecd3..4bc740b 100755 --- a/onix-gui/start.sh +++ b/onix-gui/start.sh @@ -1,7 +1,7 @@ #!/bin/bash # Set script variables -PROJECT_DIR="onix" +PROJECT_DIR="GUI" PORT=3005 TUNNEL_SERVICE="lt" @@ -14,6 +14,7 @@ echo "installing Dependencies" echo "Building and starting Next.js app..." npx next build && echo "Builing Web App = True" +sleep 3 npx next start -p "$PORT" > /dev/null 2>&1 & # Wait for the Next.js app to start