Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webuipoc: integrate code formatter #5601

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
16 changes: 16 additions & 0 deletions addOns/webuipoc/src/main/pocs/reactWebUI/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion addOns/webuipoc/src/main/pocs/reactWebUI/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@
"build": "PUBLIC_URL=/reactWebUI/ BUILD_PATH=./dist react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"lint": "eslint"
"lint": "eslint 'src/**/*.{js,jsx,ts,tsx}'",
"format": "prettier --write 'src/**/*.{js,jsx,ts,tsx}'",
"check-format": "prettier --check 'src/**/*.{js,jsx,ts,tsx}'"


},
"browserslist": {
"production": [
Expand All @@ -43,6 +47,9 @@
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^4.6.2",
"nth-check": ">=2.0.1",
"prettier": "3.3.3",
thc202 marked this conversation as resolved.
Show resolved Hide resolved
"tailwindcss": "^3.4.3"
}


}
11 changes: 5 additions & 6 deletions addOns/webuipoc/src/main/pocs/reactWebUI/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { sendChildNode } from "./Utilities/requests";
import SearchBar from "./Components/SearchBar/SearchBar";

const App = () => {

return (
<div className="flex mt-16 overflow-auto">
<HeaderBase />
Expand All @@ -23,16 +22,16 @@ const App = () => {
<div className=" w-1/3 p-4 font-serif text-center ">
ID | Method | Host | Path | URI
</div>
</div>
<div className="flex flex-row justify-center text-center">
<div className=" p-4">
<p className="font-mono "></p>
{/* {childNode &&
<div className="flex flex-row justify-center text-center">
<div className=" p-4">
<p className="font-mono "></p>
{/* {childNode &&
childNode.map((node) => (
<p className="" key={childNode}>
{node.hrefId}
</p>
))} */}
</div>
</div>
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions addOns/webuipoc/src/main/pocs/reactWebUI/src/App.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { render, screen } from '@testing-library/react';
import App from './App';
import { render, screen } from "@testing-library/react";
import App from "./App";

test('renders learn react link', () => {
test("renders learn react link", () => {
render(<App />);
const linkElement = screen.getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,57 +1,47 @@
import React, { useState } from "react";

const Accordion = ({ site, fetchChildren }) => {
const [isAccordionOpen, setAccordionOpen] = useState(false);
const [children, setChildren] = useState([])
const [isAccordionOpen, setAccordionOpen] = useState(false);
const [children, setChildren] = useState([]);

const handleExpand = async () => {
if (isAccordionOpen == false && site.isLeaf == false) {
const childNodes = await fetchChildren(site.name)
setChildren(childNodes)
}
setAccordionOpen(!isAccordionOpen);
const handleExpand = async () => {
if (isAccordionOpen == false && site.isLeaf == false) {
const childNodes = await fetchChildren(site.name);
setChildren(childNodes);
}

setAccordionOpen(!isAccordionOpen);
};

return (
<div className="py-1 w-[380px]">
<button
onClick={handleExpand}
className="flex justify-between w-full"
>

<button onClick={handleExpand} className="flex justify-between w-full">
<span className="pl-2">
{site.isLeaf? (
<span className="mr-3">-</span>
) : (
<>
{!isAccordionOpen ? (
<span className="mr-3">▶</span>
) : (
<span className="mr-3">▼</span>
)}
</>
)}
{site.isLeaf ? (
<span className="mr-3">-</span>
) : (
<>
{!isAccordionOpen ? (
<span className="mr-3">▶</span>
) : (
<span className="mr-3">▼</span>
)}
</>
)}
<span className="" key={site}>
{site.name}
</span>
</span>
</button>
{
isAccordionOpen && (
<div>
<p className="text-blue-200 break-all">
{
children.map((child) => (
<Accordion site={child} fetchChildren={fetchChildren}/>
))
}
</p>
</div>
)
}
</div>

{isAccordionOpen && (
<div>
<p className="text-blue-200 break-all">
{children.map((child) => (
<Accordion site={child} fetchChildren={fetchChildren} />
))}
</p>
</div>
)}
</div>
);
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import React from 'react';
import React from "react";

const Header = () => {
return (
<div className="fixed top-0 h-16 left-0 w-full bg-gray-900 text-white z-10">
<div className="px-4 py-4">
<div className="flex justify-between items-center">
<div className="text-xl font-bold">ZAP</div>
<button className="px-3 py-1 bg-green-600 text-white font-bold ounded-md hover:bg-blue-600">Login</button>
</div>

</div>
return (
<div className="fixed top-0 h-16 left-0 w-full bg-gray-900 text-white z-10">
<div className="px-4 py-4">
<div className="flex justify-between items-center">
<div className="text-xl font-bold">ZAP</div>
<button className="px-3 py-1 bg-green-600 text-white font-bold ounded-md hover:bg-blue-600">
Login
</button>
</div>
);
}
</div>
</div>
);
};

export default Header;
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import React from 'react'
import React from "react";

function HistoryBar() {
return (
<div className="w-full bg-gray-400 text-white h-[250px]">
History
</div>
)
return <div className="w-full bg-gray-400 text-white h-[250px]">History</div>;
}

export default HistoryBar
export default HistoryBar;

// WIP
// WIP
Original file line number Diff line number Diff line change
@@ -1,36 +1,31 @@
import React from 'react';
import React from "react";

function ResponseBar() {
return (
<div className="w-full bg-gray-600 text-white mt-2">

<div className="flex flex-row mr-2">


<div className='h-[594px] w-1/2 ml-2 bg-gray-700 rounded-lg'>
<div className="flex flex-row mr-2">
<div className="h-[594px] w-1/2 ml-2 bg-gray-700 rounded-lg">
<div className="flex flex-row text-center justify-center ">
<div className="w-1/3 p-4 font-serif text-center">Request</div>
</div>
</div>
<div className="flex justify-center text-center">
<div className="p-4">
<p className='font-mono'>############</p>
<p className="font-mono">############</p>
</div>
</div>
</div>


<div className='h-[594px] w-1/2 ml-2 bg-gray-700 rounded-lg'>

<div className="h-[594px] w-1/2 ml-2 bg-gray-700 rounded-lg">
<div className="flex flex-row text-center justify-center">
<div className="w-1/3 p-4 font-serif text-center">Response</div>
</div>
</div>
<div className="flex justify-center text-center">
<div className="p-4">
<p className='font-mono'>#############</p>
<p className="font-mono">#############</p>
</div>
</div>
</div>

</div>
</div>
</div>
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import React from 'react';
import React from "react";

function SearchBar() {
return (
<div class="w-full mx-auto bg-gray-600 overflow-hidden p-4">
<div class="flex items-center border border-black overflow-hidden">
<input type="text" placeholder="Search..." class="text-black w-full py-2 px-3 focus:outline-none" />
<div class="w-full mx-auto bg-gray-600 overflow-hidden p-4">
<div class="flex items-center border border-black overflow-hidden">
<input
type="text"
placeholder="Search..."
class="text-black w-full py-2 px-3 focus:outline-none"
/>
<button class="bg-blue-500 hover:bg-blue-600 text-white px-4 py-2">
Search
Search
</button>
</div>
</div>
</div>
);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
import React from 'react';
import { SidebarData } from './SidebarData';
import React from "react";
import { SidebarData } from "./SidebarData";

function Sidebar() {
return (
<div className='Sidebar w-10 bg-gray-800 '>
<ul className='SidebarList h-auto p-0 w-full '>
<div className="Sidebar w-10 bg-gray-800 ">
<ul className="SidebarList h-auto p-0 w-full ">
{SidebarData.map((val, key) => {
return (
<li
key={key}
className="row w-full h-10 text-white list-none m-0 flex items-center justify-left hover:bg-gray-700"
<li
key={key}
className="row w-full h-10 text-white list-none m-0 flex items-center justify-left hover:bg-gray-700"
onClick={() => {
window.location.pathname =val.ink
}}>

<div className='SidebarIcon flex justify-center items-center ml-2' > {val.icon}</div>
<div className='SidebarTitle ml-2'> {val.title}</div>
window.location.pathname = val.ink;
}}
>
<div className="SidebarIcon flex justify-center items-center ml-2">
{" "}
{val.icon}
</div>
<div className="SidebarTitle ml-2"> {val.title}</div>
</li>
);
})}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,21 @@
import React from 'react';
import HomeIcon from '@mui/icons-material/Home';
import SettingsIcon from '@mui/icons-material/Settings';
import HighlightOffIcon from '@mui/icons-material/HighlightOff';


export const SidebarData = [

{

icon: <HomeIcon />,
link: "/home"
} ,

{

icon: <SettingsIcon />,
link: "/home"
} ,

{

icon: <HighlightOffIcon />,
link: "/home"
}



]

import React from "react";
import HomeIcon from "@mui/icons-material/Home";
import SettingsIcon from "@mui/icons-material/Settings";
import HighlightOffIcon from "@mui/icons-material/HighlightOff";

export const SidebarData = [
{
icon: <HomeIcon />,
link: "/home",
},

{
icon: <SettingsIcon />,
link: "/home",
},

{
icon: <HighlightOffIcon />,
link: "/home",
},
];
Loading
Loading