From 0ae882e4666613d30b76755a7b9fc2cd3f1f0c8d Mon Sep 17 00:00:00 2001 From: Moeez Ahmed Date: Wed, 24 Jul 2024 07:10:16 +0500 Subject: [PATCH 01/13] integrate code formatter Signed-off-by: Moeez Ahmed --- .../main/pocs/reactWebUI/package-lock.json | 16 +++++++++ .../src/main/pocs/reactWebUI/package.json | 6 +++- .../src/main/pocs/reactWebUI/src/App.js | 31 ++++++++++++---- .../src/main/pocs/reactWebUI/src/App.test.js | 6 ++-- .../reactWebUI/src/Components/HistoryBar.js | 12 +++---- .../src/Contexts/SitesTreeNodeIDContext.js | 12 +++++++ .../pocs/reactWebUI/src/Utilities/req-resp.js | 13 +++++++ .../pocs/reactWebUI/src/Utilities/requests.js | 35 +++++++++---------- .../src/main/pocs/reactWebUI/src/index.js | 14 ++++---- .../main/pocs/reactWebUI/src/setupTests.js | 2 +- 10 files changed, 103 insertions(+), 44 deletions(-) create mode 100644 addOns/webuipoc/src/main/pocs/reactWebUI/src/Contexts/SitesTreeNodeIDContext.js create mode 100644 addOns/webuipoc/src/main/pocs/reactWebUI/src/Utilities/req-resp.js diff --git a/addOns/webuipoc/src/main/pocs/reactWebUI/package-lock.json b/addOns/webuipoc/src/main/pocs/reactWebUI/package-lock.json index cfa0050d986..aabcba4ab6c 100644 --- a/addOns/webuipoc/src/main/pocs/reactWebUI/package-lock.json +++ b/addOns/webuipoc/src/main/pocs/reactWebUI/package-lock.json @@ -28,6 +28,7 @@ "eslint-plugin-react": "^7.34.1", "eslint-plugin-react-hooks": "^4.6.2", "nth-check": ">=2.0.1", + "prettier": "3.3.3", "tailwindcss": "^3.4.3" } }, @@ -16970,6 +16971,21 @@ "node": ">= 0.8.0" } }, + "node_modules/prettier": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", + "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", + "dev": true, + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/pretty-bytes": { "version": "5.6.0", "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.6.0.tgz", diff --git a/addOns/webuipoc/src/main/pocs/reactWebUI/package.json b/addOns/webuipoc/src/main/pocs/reactWebUI/package.json index 9747b03e278..4a9c0997ab9 100644 --- a/addOns/webuipoc/src/main/pocs/reactWebUI/package.json +++ b/addOns/webuipoc/src/main/pocs/reactWebUI/package.json @@ -23,7 +23,8 @@ "build": "PUBLIC_URL=/reactWebUI/ BUILD_PATH=./dist react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject", - "lint": "eslint" + "lint": "eslint", + "format": "prettier --write \"src/**/*.js\"" }, "browserslist": { "production": [ @@ -43,6 +44,9 @@ "eslint-plugin-react": "^7.34.1", "eslint-plugin-react-hooks": "^4.6.2", "nth-check": ">=2.0.1", + "prettier": "3.3.3", "tailwindcss": "^3.4.3" } + + } diff --git a/addOns/webuipoc/src/main/pocs/reactWebUI/src/App.js b/addOns/webuipoc/src/main/pocs/reactWebUI/src/App.js index b688a08e7c0..b63726c312d 100644 --- a/addOns/webuipoc/src/main/pocs/reactWebUI/src/App.js +++ b/addOns/webuipoc/src/main/pocs/reactWebUI/src/App.js @@ -9,11 +9,11 @@ import { sendChildNode } from "./Utilities/requests"; import SearchBar from "./Components/SearchBar/SearchBar"; const App = () => { - return (
+<<<<<<< Updated upstream
@@ -22,23 +22,42 @@ const App = () => {
ID | Method | Host | Path | URI +======= + + + +
+ +
+
+
+ ID | Method | Host | Path | URI +
+>>>>>>> Stashed changes
-
-
-
-

- {/* {childNode && +
+
+

+ {/* {childNode && childNode.map((node) => (

{node.hrefId}

))} */} +
+<<<<<<< Updated upstream
+======= + + +
+ +>>>>>>> Stashed changes
); }; diff --git a/addOns/webuipoc/src/main/pocs/reactWebUI/src/App.test.js b/addOns/webuipoc/src/main/pocs/reactWebUI/src/App.test.js index 1f03afeece5..9382b9ad53b 100644 --- a/addOns/webuipoc/src/main/pocs/reactWebUI/src/App.test.js +++ b/addOns/webuipoc/src/main/pocs/reactWebUI/src/App.test.js @@ -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(); const linkElement = screen.getByText(/learn react/i); expect(linkElement).toBeInTheDocument(); diff --git a/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/HistoryBar.js b/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/HistoryBar.js index 2afd3004e58..8a8ece7ea8d 100644 --- a/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/HistoryBar.js +++ b/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/HistoryBar.js @@ -1,13 +1,9 @@ -import React from 'react' +import React from "react"; function HistoryBar() { - return ( -
- History -
- ) + return
History
; } -export default HistoryBar +export default HistoryBar; -// WIP \ No newline at end of file +// WIP diff --git a/addOns/webuipoc/src/main/pocs/reactWebUI/src/Contexts/SitesTreeNodeIDContext.js b/addOns/webuipoc/src/main/pocs/reactWebUI/src/Contexts/SitesTreeNodeIDContext.js new file mode 100644 index 00000000000..4b0fb8ad549 --- /dev/null +++ b/addOns/webuipoc/src/main/pocs/reactWebUI/src/Contexts/SitesTreeNodeIDContext.js @@ -0,0 +1,12 @@ +import React, { useState, createContext } from "react"; + +export const nodeIDContext = createContext(); + +export const NodeIDProvider = ({ children }) => { + const [nodeID, setNodeID] = useState(0); + return ( + + {children} + + ); +}; diff --git a/addOns/webuipoc/src/main/pocs/reactWebUI/src/Utilities/req-resp.js b/addOns/webuipoc/src/main/pocs/reactWebUI/src/Utilities/req-resp.js new file mode 100644 index 00000000000..35931f22736 --- /dev/null +++ b/addOns/webuipoc/src/main/pocs/reactWebUI/src/Utilities/req-resp.js @@ -0,0 +1,13 @@ +import axios from "axios"; + +const sendMessage = async (id) => { + try { + const response = await axios.get(`/JSON/core/view/message?id=${id}`); + return response.data.message; + } catch (error) { + console.error("Error fetching data:", error); + throw error; + } +}; + +export { sendMessage }; diff --git a/addOns/webuipoc/src/main/pocs/reactWebUI/src/Utilities/requests.js b/addOns/webuipoc/src/main/pocs/reactWebUI/src/Utilities/requests.js index a0622c5af28..b86873324d1 100644 --- a/addOns/webuipoc/src/main/pocs/reactWebUI/src/Utilities/requests.js +++ b/addOns/webuipoc/src/main/pocs/reactWebUI/src/Utilities/requests.js @@ -1,25 +1,24 @@ -import axios from 'axios'; +import axios from "axios"; const sendChildNode = async (url) => { - try { - if (url.length === 0) { - if (process.env.NODE_ENV === "development") { - axios.defaults.baseURL = "http://localhost:1337"; - } else { - axios.defaults.baseURL = ""; - } + try { + if (url.length === 0) { + if (process.env.NODE_ENV === "development") { + axios.defaults.baseURL = "http://localhost:1337"; + } else { + axios.defaults.baseURL = ""; + } - const response = await axios.get('/JSON/core/view/childNodes/'); - return response.data.childNodes; - } else { - const response = await axios.get(`/JSON/core/view/childNodes?url=${url}`); - return response.data.childNodes; - } - } catch (error) { - console.error('Error fetching data:', error); - throw error; + const response = await axios.get("/JSON/core/view/childNodes/"); + return response.data.childNodes; + } else { + const response = await axios.get(`/JSON/core/view/childNodes?url=${url}`); + return response.data.childNodes; } - + } catch (error) { + console.error("Error fetching data:", error); + throw error; + } }; export { sendChildNode }; diff --git a/addOns/webuipoc/src/main/pocs/reactWebUI/src/index.js b/addOns/webuipoc/src/main/pocs/reactWebUI/src/index.js index 1675893a7c6..df86817034b 100644 --- a/addOns/webuipoc/src/main/pocs/reactWebUI/src/index.js +++ b/addOns/webuipoc/src/main/pocs/reactWebUI/src/index.js @@ -1,11 +1,11 @@ -import React from 'react'; -import ReactDOM from 'react-dom/client'; -import './index.css'; -import App from './App'; +import React from "react"; +import ReactDOM from "react-dom/client"; +import "./index.css"; +import App from "./App"; -const root = ReactDOM.createRoot(document.getElementById('root')); +const root = ReactDOM.createRoot(document.getElementById("root")); root.render( - -); \ No newline at end of file + , +); diff --git a/addOns/webuipoc/src/main/pocs/reactWebUI/src/setupTests.js b/addOns/webuipoc/src/main/pocs/reactWebUI/src/setupTests.js index 8f2609b7b3e..1dd407a63ef 100644 --- a/addOns/webuipoc/src/main/pocs/reactWebUI/src/setupTests.js +++ b/addOns/webuipoc/src/main/pocs/reactWebUI/src/setupTests.js @@ -2,4 +2,4 @@ // allows you to do things like: // expect(element).toHaveTextContent(/react/i) // learn more: https://github.com/testing-library/jest-dom -import '@testing-library/jest-dom'; +import "@testing-library/jest-dom"; From 5dc247b2702479c5eab2a14b0d491ba89b124b91 Mon Sep 17 00:00:00 2001 From: Moeez Ahmed <118293110+Moeez905@users.noreply.github.com> Date: Wed, 24 Jul 2024 07:36:18 +0500 Subject: [PATCH 02/13] Update package.json Signed-off-by: Moeez Ahmed <118293110+Moeez905@users.noreply.github.com> --- addOns/webuipoc/src/main/pocs/reactWebUI/package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addOns/webuipoc/src/main/pocs/reactWebUI/package.json b/addOns/webuipoc/src/main/pocs/reactWebUI/package.json index 4a9c0997ab9..0f1b641d2d0 100644 --- a/addOns/webuipoc/src/main/pocs/reactWebUI/package.json +++ b/addOns/webuipoc/src/main/pocs/reactWebUI/package.json @@ -23,8 +23,7 @@ "build": "PUBLIC_URL=/reactWebUI/ BUILD_PATH=./dist react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject", - "lint": "eslint", - "format": "prettier --write \"src/**/*.js\"" + "lint": "eslint" }, "browserslist": { "production": [ From 0739cd300051944394dc433df81dee3a2a63cbf6 Mon Sep 17 00:00:00 2001 From: Moeez Ahmed Date: Wed, 24 Jul 2024 07:47:02 +0500 Subject: [PATCH 03/13] conflicts resolve Signed-off-by: Moeez Ahmed --- .../src/main/pocs/reactWebUI/src/App.js | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/addOns/webuipoc/src/main/pocs/reactWebUI/src/App.js b/addOns/webuipoc/src/main/pocs/reactWebUI/src/App.js index b63726c312d..39c20b00420 100644 --- a/addOns/webuipoc/src/main/pocs/reactWebUI/src/App.js +++ b/addOns/webuipoc/src/main/pocs/reactWebUI/src/App.js @@ -13,7 +13,6 @@ const App = () => {
-<<<<<<< Updated upstream
@@ -22,18 +21,6 @@ const App = () => {
ID | Method | Host | Path | URI -======= - - - -
- -
-
-
- ID | Method | Host | Path | URI -
->>>>>>> Stashed changes
@@ -47,17 +34,10 @@ const App = () => {
-<<<<<<< Updated upstream
-======= - - -
- ->>>>>>> Stashed changes
); }; From 919f30ac239890f379dc3fc9893f5353fc88f694 Mon Sep 17 00:00:00 2001 From: Moeez Ahmed Date: Thu, 25 Jul 2024 09:42:42 +0500 Subject: [PATCH 04/13] configure prettier Signed-off-by: Moeez Ahmed --- addOns/webuipoc/src/main/pocs/reactWebUI/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addOns/webuipoc/src/main/pocs/reactWebUI/package.json b/addOns/webuipoc/src/main/pocs/reactWebUI/package.json index 0f1b641d2d0..9d25032f4af 100644 --- a/addOns/webuipoc/src/main/pocs/reactWebUI/package.json +++ b/addOns/webuipoc/src/main/pocs/reactWebUI/package.json @@ -23,7 +23,8 @@ "build": "PUBLIC_URL=/reactWebUI/ BUILD_PATH=./dist react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject", - "lint": "eslint" + "lint": "eslint", + "format": "prettier --write \"src/**/*.{js,jsx}\"" }, "browserslist": { "production": [ From 591d1460f809fa3134d1f365e4030546d8fa7abb Mon Sep 17 00:00:00 2001 From: Moeez Ahmed Date: Fri, 26 Jul 2024 01:35:29 +0500 Subject: [PATCH 05/13] Wired into CI Signed-off-by: Moeez Ahmed --- .../pocs/reactWebUI/.github/workflows/ci.yml | 16 +++++ .../src/main/pocs/reactWebUI/package.json | 9 ++- .../Components/Accordion/AccordionData.jsx | 70 ++++++++----------- .../src/Components/Header/HeaderBase.jsx | 25 +++---- .../Request-Response/Req-Resp-Bar.jsx | 25 +++---- .../src/Components/SearchBar/SearchBar.jsx | 16 +++-- .../src/Components/Sidebar/Sidebar.jsx | 27 +++---- .../src/Components/Sidebar/SidebarData.jsx | 51 ++++++-------- .../src/Components/SitesTree/SitesTree.jsx | 28 ++++---- 9 files changed, 134 insertions(+), 133 deletions(-) create mode 100644 addOns/webuipoc/src/main/pocs/reactWebUI/.github/workflows/ci.yml diff --git a/addOns/webuipoc/src/main/pocs/reactWebUI/.github/workflows/ci.yml b/addOns/webuipoc/src/main/pocs/reactWebUI/.github/workflows/ci.yml new file mode 100644 index 00000000000..d99d630f233 --- /dev/null +++ b/addOns/webuipoc/src/main/pocs/reactWebUI/.github/workflows/ci.yml @@ -0,0 +1,16 @@ +name: Check Formatting + +on: [push, pull_request] + +jobs: + format: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: '14' + - run: npm install + - run: npm run check-format diff --git a/addOns/webuipoc/src/main/pocs/reactWebUI/package.json b/addOns/webuipoc/src/main/pocs/reactWebUI/package.json index 9d25032f4af..385b001289c 100644 --- a/addOns/webuipoc/src/main/pocs/reactWebUI/package.json +++ b/addOns/webuipoc/src/main/pocs/reactWebUI/package.json @@ -20,11 +20,14 @@ }, "scripts": { "start": "react-scripts start", - "build": "PUBLIC_URL=/reactWebUI/ BUILD_PATH=./dist react-scripts build", + "build": "npm run check-format && PUBLIC_URL=/reactWebUI/ BUILD_PATH=./dist react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject", - "lint": "eslint", - "format": "prettier --write \"src/**/*.{js,jsx}\"" + "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": [ diff --git a/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/Accordion/AccordionData.jsx b/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/Accordion/AccordionData.jsx index 59f29e46210..e047032ce19 100644 --- a/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/Accordion/AccordionData.jsx +++ b/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/Accordion/AccordionData.jsx @@ -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 (
- - { - isAccordionOpen && ( -
-

- { - children.map((child) => ( - - )) - } -

-
- ) - } -
- + {isAccordionOpen && ( +
+

+ {children.map((child) => ( + + ))} +

+
+ )} +
); }; diff --git a/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/Header/HeaderBase.jsx b/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/Header/HeaderBase.jsx index d1a2108427d..3bc6ae6a7a2 100644 --- a/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/Header/HeaderBase.jsx +++ b/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/Header/HeaderBase.jsx @@ -1,17 +1,18 @@ -import React from 'react'; +import React from "react"; const Header = () => { - return ( -
-
-
-
ZAP
- -
- -
+ return ( +
+
+
+
ZAP
+
- ); -} +
+
+ ); +}; export default Header; diff --git a/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/Request-Response/Req-Resp-Bar.jsx b/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/Request-Response/Req-Resp-Bar.jsx index b357a81193a..b61f635d09e 100644 --- a/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/Request-Response/Req-Resp-Bar.jsx +++ b/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/Request-Response/Req-Resp-Bar.jsx @@ -1,36 +1,31 @@ -import React from 'react'; +import React from "react"; function ResponseBar() { return (
- -
- - -
+
+
Request
-
+
-

############

+

############

- - -
+ +
Response
-
+
-

#############

+

#############

- -
+
); } diff --git a/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/SearchBar/SearchBar.jsx b/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/SearchBar/SearchBar.jsx index 1bc4b9b5c70..260bd94e559 100644 --- a/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/SearchBar/SearchBar.jsx +++ b/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/SearchBar/SearchBar.jsx @@ -1,15 +1,19 @@ -import React from 'react'; +import React from "react"; function SearchBar() { return ( -
-
- +
+
+ +
-
); } diff --git a/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/Sidebar/Sidebar.jsx b/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/Sidebar/Sidebar.jsx index 2709aab546a..aec9c029046 100644 --- a/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/Sidebar/Sidebar.jsx +++ b/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/Sidebar/Sidebar.jsx @@ -1,21 +1,24 @@ -import React from 'react'; -import { SidebarData } from './SidebarData'; +import React from "react"; +import { SidebarData } from "./SidebarData"; function Sidebar() { return ( -
-
    +
    +
      {SidebarData.map((val, key) => { return ( -
    • { - window.location.pathname =val.ink - }}> - -
      {val.icon}
      -
      {val.title}
      + window.location.pathname = val.ink; + }} + > +
      + {" "} + {val.icon} +
      +
      {val.title}
    • ); })} diff --git a/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/Sidebar/SidebarData.jsx b/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/Sidebar/SidebarData.jsx index da0a538fdd8..db8cb374ea6 100644 --- a/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/Sidebar/SidebarData.jsx +++ b/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/Sidebar/SidebarData.jsx @@ -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: , - link: "/home" - } , - - { - - icon: , - link: "/home" - } , - - { - - icon: , - 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: , + link: "/home", + }, + + { + icon: , + link: "/home", + }, + + { + icon: , + link: "/home", + }, +]; diff --git a/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/SitesTree/SitesTree.jsx b/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/SitesTree/SitesTree.jsx index 2b2ad382d0d..32d50080ba0 100644 --- a/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/SitesTree/SitesTree.jsx +++ b/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/SitesTree/SitesTree.jsx @@ -1,24 +1,22 @@ -import { useState,useEffect } from "react"; +import { useState, useEffect } from "react"; import Accordion from "../Accordion/AccordionData"; import { sendChildNode } from "../../Utilities/requests"; const SiteTree = () => { - - const [initialSitesTree, setInitialSitesTree] = useState(null) - + const [initialSitesTree, setInitialSitesTree] = useState(null); useEffect(() => { - const fetchData = async () => { - try { - const response = await sendChildNode(""); - setInitialSitesTree(response); - } catch (error) { - console.error("Error fetching data:", error); - } - }; + const fetchData = async () => { + try { + const response = await sendChildNode(""); + setInitialSitesTree(response); + } catch (error) { + console.error("Error fetching data:", error); + } + }; - fetchData(); - }, []); + fetchData(); + }, []); return (
      @@ -32,7 +30,7 @@ const SiteTree = () => {
      {initialSitesTree && initialSitesTree.map((node) => ( - + ))}
    From 120b6c3f39fe7f559f7577d8a05f056aeafcfa2b Mon Sep 17 00:00:00 2001 From: Moeez Ahmed Date: Fri, 26 Jul 2024 01:45:47 +0500 Subject: [PATCH 06/13] .Yml file update for failing build Signed-off-by: Moeez Ahmed --- .../pocs/reactWebUI/.github/workflows/ci.yml | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/addOns/webuipoc/src/main/pocs/reactWebUI/.github/workflows/ci.yml b/addOns/webuipoc/src/main/pocs/reactWebUI/.github/workflows/ci.yml index d99d630f233..c1d91636e4a 100644 --- a/addOns/webuipoc/src/main/pocs/reactWebUI/.github/workflows/ci.yml +++ b/addOns/webuipoc/src/main/pocs/reactWebUI/.github/workflows/ci.yml @@ -1,16 +1,28 @@ name: Check Formatting -on: [push, pull_request] +on: + push: + branches: + - main + pull_request: + branches: + - main jobs: format: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - name: Checkout code + uses: actions/checkout@v3 + - name: Set up Node.js uses: actions/setup-node@v3 with: - node-version: '14' - - run: npm install - - run: npm run check-format + node-version: '20.0.0' + + - name: Install dependencies + run: npm install + + - name: Check formatting with Prettier + run: npm run check-format From 99a2d9533b6c4838822084114172ffcfe9fc6327 Mon Sep 17 00:00:00 2001 From: Moeez Ahmed Date: Fri, 26 Jul 2024 01:54:20 +0500 Subject: [PATCH 07/13] .Yml file update for failing build Signed-off-by: Moeez Ahmed --- .../src/main/pocs/reactWebUI/.github/workflows/ci.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/addOns/webuipoc/src/main/pocs/reactWebUI/.github/workflows/ci.yml b/addOns/webuipoc/src/main/pocs/reactWebUI/.github/workflows/ci.yml index c1d91636e4a..48433273b02 100644 --- a/addOns/webuipoc/src/main/pocs/reactWebUI/.github/workflows/ci.yml +++ b/addOns/webuipoc/src/main/pocs/reactWebUI/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: Check Formatting +name: Lint and Check Formatting on: push: @@ -9,7 +9,7 @@ on: - main jobs: - format: + lint: runs-on: ubuntu-latest steps: @@ -19,10 +19,13 @@ jobs: - name: Set up Node.js uses: actions/setup-node@v3 with: - node-version: '20.0.0' + node-version: '20' - name: Install dependencies run: npm install + - name: Run ESLint + run: npm run lint + - name: Check formatting with Prettier run: npm run check-format From 7baa7d02c1cef0857944567efc22dab12c6b3a94 Mon Sep 17 00:00:00 2001 From: Moeez Ahmed Date: Fri, 26 Jul 2024 02:10:47 +0500 Subject: [PATCH 08/13] .Yml changes Signed-off-by: Moeez Ahmed --- .../webuipoc/src/main/pocs/reactWebUI/.github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addOns/webuipoc/src/main/pocs/reactWebUI/.github/workflows/ci.yml b/addOns/webuipoc/src/main/pocs/reactWebUI/.github/workflows/ci.yml index 48433273b02..e5fb0ead6ee 100644 --- a/addOns/webuipoc/src/main/pocs/reactWebUI/.github/workflows/ci.yml +++ b/addOns/webuipoc/src/main/pocs/reactWebUI/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: - name: Set up Node.js uses: actions/setup-node@v3 with: - node-version: '20' + node-version: '20.0.0' - name: Install dependencies run: npm install From e4f2b03026688f6d6e59bf5841a5015abee37e47 Mon Sep 17 00:00:00 2001 From: Moeez Ahmed Date: Fri, 26 Jul 2024 02:47:20 +0500 Subject: [PATCH 09/13] npm run check-format && revert Signed-off-by: Moeez Ahmed --- addOns/webuipoc/src/main/pocs/reactWebUI/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addOns/webuipoc/src/main/pocs/reactWebUI/package.json b/addOns/webuipoc/src/main/pocs/reactWebUI/package.json index 385b001289c..713e0d2e879 100644 --- a/addOns/webuipoc/src/main/pocs/reactWebUI/package.json +++ b/addOns/webuipoc/src/main/pocs/reactWebUI/package.json @@ -20,7 +20,7 @@ }, "scripts": { "start": "react-scripts start", - "build": "npm run check-format && PUBLIC_URL=/reactWebUI/ BUILD_PATH=./dist react-scripts build", + "build": "PUBLIC_URL=/reactWebUI/ BUILD_PATH=./dist react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject", "lint": "eslint 'src/**/*.{js,jsx,ts,tsx}'", From b27354ba0c8f0b016c2e6d08790fd04fb14c35c4 Mon Sep 17 00:00:00 2001 From: Moeez Ahmed <118293110+Moeez905@users.noreply.github.com> Date: Fri, 26 Jul 2024 02:57:28 +0500 Subject: [PATCH 10/13] Delete addOns/webuipoc/src/main/pocs/reactWebUI/.github/workflows/ci.yml Signed-off-by: Moeez Ahmed <118293110+Moeez905@users.noreply.github.com> --- .../pocs/reactWebUI/.github/workflows/ci.yml | 31 ------------------- 1 file changed, 31 deletions(-) delete mode 100644 addOns/webuipoc/src/main/pocs/reactWebUI/.github/workflows/ci.yml diff --git a/addOns/webuipoc/src/main/pocs/reactWebUI/.github/workflows/ci.yml b/addOns/webuipoc/src/main/pocs/reactWebUI/.github/workflows/ci.yml deleted file mode 100644 index e5fb0ead6ee..00000000000 --- a/addOns/webuipoc/src/main/pocs/reactWebUI/.github/workflows/ci.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Lint and Check Formatting - -on: - push: - branches: - - main - pull_request: - branches: - - main - -jobs: - lint: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Set up Node.js - uses: actions/setup-node@v3 - with: - node-version: '20.0.0' - - - name: Install dependencies - run: npm install - - - name: Run ESLint - run: npm run lint - - - name: Check formatting with Prettier - run: npm run check-format From e142eb5c3dac2f1037f983f1647c520ae50b2e59 Mon Sep 17 00:00:00 2001 From: Moeez Ahmed Date: Fri, 26 Jul 2024 03:04:35 +0500 Subject: [PATCH 11/13] webuipoc.gradle.kts update Signed-off-by: Moeez Ahmed --- addOns/webuipoc/webuipoc.gradle.kts | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/addOns/webuipoc/webuipoc.gradle.kts b/addOns/webuipoc/webuipoc.gradle.kts index d0fbcc96a21..8cc6d720205 100644 --- a/addOns/webuipoc/webuipoc.gradle.kts +++ b/addOns/webuipoc/webuipoc.gradle.kts @@ -16,7 +16,24 @@ val pocsSrcDir = projectDir.resolve("src/main/pocs") val pocsBuildDir = layout.buildDirectory.dir("pocs").get() val pocBuildTasks: MutableList> = mutableListOf() val pocBuildTasksGroup = "ZAP Web UI PoC Build" -for (dir in pocsSrcDir.listFiles()!!) { +b/addOns/webuipoc/webuipoc.gradle.kts + for (dir in pocsSrcDir.listFiles()!!) { + workingDir = dir + args.set(arrayListOf("run", "lint")) + } + val checkFormatTask = + tasks.register("checkFormatPoc$normalizedPocName") { + group = pocBuildTasksGroup + dependsOn(installTask) + workingDir = dir + args.set(arrayListOf("run", "check-format")) + } + tasks.named(LifecycleBasePlugin.CHECK_TASK_NAME) { + dependsOn(lintTask, checkFormatTask) + } + } + } else { + val packageJson = File(dir, "package.json") val outputDir = pocsBuildDir.dir("webuipoc").dir(dir.name) val normalizedPocName = dir.name.capitalized() From a442788ff4ad1fc9e90bb92ea79fa27e95861e47 Mon Sep 17 00:00:00 2001 From: Moeez Ahmed <118293110+Moeez905@users.noreply.github.com> Date: Thu, 1 Aug 2024 19:36:45 +0500 Subject: [PATCH 12/13] Update webuipoc.gradle.kts Signed-off-by: Moeez Ahmed <118293110+Moeez905@users.noreply.github.com> --- addOns/webuipoc/webuipoc.gradle.kts | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/addOns/webuipoc/webuipoc.gradle.kts b/addOns/webuipoc/webuipoc.gradle.kts index 8cc6d720205..d78e9094af6 100644 --- a/addOns/webuipoc/webuipoc.gradle.kts +++ b/addOns/webuipoc/webuipoc.gradle.kts @@ -16,17 +16,16 @@ val pocsSrcDir = projectDir.resolve("src/main/pocs") val pocsBuildDir = layout.buildDirectory.dir("pocs").get() val pocBuildTasks: MutableList> = mutableListOf() val pocBuildTasksGroup = "ZAP Web UI PoC Build" -b/addOns/webuipoc/webuipoc.gradle.kts for (dir in pocsSrcDir.listFiles()!!) { - workingDir = dir - args.set(arrayListOf("run", "lint")) + workingDir = dir + args.set(arrayListOf("run", "lint")) } - val checkFormatTask = - tasks.register("checkFormatPoc$normalizedPocName") { - group = pocBuildTasksGroup - dependsOn(installTask) - workingDir = dir - args.set(arrayListOf("run", "check-format")) + val checkFormatTask = + tasks.register("checkFormatPoc$normalizedPocName") { + group = pocBuildTasksGroup + dependsOn(installTask) + workingDir = dir + args.set(arrayListOf("run", "check-format")) } tasks.named(LifecycleBasePlugin.CHECK_TASK_NAME) { dependsOn(lintTask, checkFormatTask) From 914ce1ec83b4ff7e8635809c165ad30fe52ab3a2 Mon Sep 17 00:00:00 2001 From: Moeez Ahmed <118293110+Moeez905@users.noreply.github.com> Date: Thu, 1 Aug 2024 19:42:35 +0500 Subject: [PATCH 13/13] Update webuipoc.gradle.kts Signed-off-by: Moeez Ahmed <118293110+Moeez905@users.noreply.github.com> --- addOns/webuipoc/webuipoc.gradle.kts | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/addOns/webuipoc/webuipoc.gradle.kts b/addOns/webuipoc/webuipoc.gradle.kts index d78e9094af6..3798e04cd43 100644 --- a/addOns/webuipoc/webuipoc.gradle.kts +++ b/addOns/webuipoc/webuipoc.gradle.kts @@ -16,23 +16,7 @@ val pocsSrcDir = projectDir.resolve("src/main/pocs") val pocsBuildDir = layout.buildDirectory.dir("pocs").get() val pocBuildTasks: MutableList> = mutableListOf() val pocBuildTasksGroup = "ZAP Web UI PoC Build" - for (dir in pocsSrcDir.listFiles()!!) { - workingDir = dir - args.set(arrayListOf("run", "lint")) - } - val checkFormatTask = - tasks.register("checkFormatPoc$normalizedPocName") { - group = pocBuildTasksGroup - dependsOn(installTask) - workingDir = dir - args.set(arrayListOf("run", "check-format")) - } - tasks.named(LifecycleBasePlugin.CHECK_TASK_NAME) { - dependsOn(lintTask, checkFormatTask) - } - } - } else { - +for (dir in pocsSrcDir.listFiles()!!) { val packageJson = File(dir, "package.json") val outputDir = pocsBuildDir.dir("webuipoc").dir(dir.name) val normalizedPocName = dir.name.capitalized() @@ -65,8 +49,15 @@ val pocBuildTasksGroup = "ZAP Web UI PoC Build" workingDir = dir args.set(arrayListOf("run", "lint")) } + val checkFormatTask = + tasks.register("checkFormatPoc$normalizedPocName") { + group = pocBuildTasksGroup + dependsOn(installTask) + workingDir = dir + args.set(arrayListOf("run", "check-format")) + } tasks.named(LifecycleBasePlugin.CHECK_TASK_NAME) { - dependsOn(lintTask) + dependsOn(lintTask, checkFormatTask) } } } else {