From 72fe6149c54a2524a9236b4a692a6f6003962bad Mon Sep 17 00:00:00 2001 From: Sergio Figueiredo Date: Fri, 15 Sep 2023 15:10:09 +0100 Subject: [PATCH 01/18] Folder Restructure --- .../capacitygroup/CapacityGroupSumView.tsx | 4 +- .../capacitygroup/CapacityGroupsView.tsx | 6 +-- .../{ => common}/CapacityGroupDetails.tsx | 4 +- .../{ => common}/CompanyOptions.tsx | 2 +- .../components/{ => common}/Pagination.tsx | 0 .../{ => common}/QuickAcessItems.tsx | 6 +-- .../src/components/{ => common}/Search.tsx | 0 .../src/components/{ => common}/TopMenu.tsx | 2 +- .../{ => common}/UnitsofMeasureOptions.tsx | 2 +- .../src/components/demands/DemandAddForm.tsx | 4 +- .../src/components/demands/DemandEditForm.tsx | 4 +- .../src/components/demands/DemandPage.tsx | 6 +-- .../DemandsOverview.tsx} | 8 ++-- .../src/components/menu/Component63.tsx | 43 ------------------- .../src/components/menu/InfoMenu.tsx | 14 +++--- .../CapacityGroupDetailsPage.tsx | 4 +- .../CapacityGroupPage.tsx | 2 +- demand-capacity-mgmt-frontend/src/index.js | 8 ++-- 18 files changed, 38 insertions(+), 81 deletions(-) rename demand-capacity-mgmt-frontend/src/components/{ => common}/CapacityGroupDetails.tsx (90%) rename demand-capacity-mgmt-frontend/src/components/{ => common}/CompanyOptions.tsx (96%) rename demand-capacity-mgmt-frontend/src/components/{ => common}/Pagination.tsx (100%) rename demand-capacity-mgmt-frontend/src/components/{ => common}/QuickAcessItems.tsx (94%) rename demand-capacity-mgmt-frontend/src/components/{ => common}/Search.tsx (100%) rename demand-capacity-mgmt-frontend/src/components/{ => common}/TopMenu.tsx (98%) rename demand-capacity-mgmt-frontend/src/components/{ => common}/UnitsofMeasureOptions.tsx (95%) rename demand-capacity-mgmt-frontend/src/components/{WeeklyView.tsx => demands/DemandsOverview.tsx} (98%) delete mode 100644 demand-capacity-mgmt-frontend/src/components/menu/Component63.tsx rename demand-capacity-mgmt-frontend/src/components/{capacitygroup => pages}/CapacityGroupDetailsPage.tsx (95%) rename demand-capacity-mgmt-frontend/src/components/{capacitygroup => pages}/CapacityGroupPage.tsx (94%) diff --git a/demand-capacity-mgmt-frontend/src/components/capacitygroup/CapacityGroupSumView.tsx b/demand-capacity-mgmt-frontend/src/components/capacitygroup/CapacityGroupSumView.tsx index b4495f37..dcc761b9 100644 --- a/demand-capacity-mgmt-frontend/src/components/capacitygroup/CapacityGroupSumView.tsx +++ b/demand-capacity-mgmt-frontend/src/components/capacitygroup/CapacityGroupSumView.tsx @@ -20,7 +20,7 @@ * ******************************************************************************** */ -import React, { useContext, useState, useEffect } from 'react'; +import React, { useContext, useState } from 'react'; import '../../../src/index.css'; import { DemandCategoryContext } from '../../contexts/DemandCategoryProvider'; import { OverlayTrigger, Tooltip } from 'react-bootstrap'; @@ -105,7 +105,7 @@ const CapacityGroupSumView: React.FC = ({ capacityGroup }) => { // Object to store the demand values based on year, month, and week type DemandValuesMap = Record>>; - let [demandValuesMap, setDemandValuesMap] = useState({}); + let [demandValuesMap] = useState({}); //Mapping of categories const idToNumericIdMap: Record = {}; diff --git a/demand-capacity-mgmt-frontend/src/components/capacitygroup/CapacityGroupsView.tsx b/demand-capacity-mgmt-frontend/src/components/capacitygroup/CapacityGroupsView.tsx index 6c147f94..9612fd84 100644 --- a/demand-capacity-mgmt-frontend/src/components/capacitygroup/CapacityGroupsView.tsx +++ b/demand-capacity-mgmt-frontend/src/components/capacitygroup/CapacityGroupsView.tsx @@ -23,11 +23,11 @@ import React, { useContext, useState, useMemo } from 'react'; import { Form, Col, Row, Button, OverlayTrigger, Tooltip,Dropdown } from 'react-bootstrap'; import { CapacityGroupContext } from '../../contexts/CapacityGroupsContextProvider'; -import Pagination from '../Pagination'; +import Pagination from '../common/Pagination'; import CapacityGroupsTable from './CapacityGroupsTable'; -import Search from '../Search'; +import Search from '../common/Search'; import '../../index.css'; -import { FaCopy, FaEllipsisH, FaEllipsisV, FaSearch } from 'react-icons/fa'; +import { FaCopy, FaEllipsisV, FaSearch } from 'react-icons/fa'; const CapacityGroupsList: React.FC = () => { // to do clean /const [selectedCapacityGroup, setSelectedCapacityGroup] = useState(null); diff --git a/demand-capacity-mgmt-frontend/src/components/CapacityGroupDetails.tsx b/demand-capacity-mgmt-frontend/src/components/common/CapacityGroupDetails.tsx similarity index 90% rename from demand-capacity-mgmt-frontend/src/components/CapacityGroupDetails.tsx rename to demand-capacity-mgmt-frontend/src/components/common/CapacityGroupDetails.tsx index 7320dc88..ff8c90e5 100644 --- a/demand-capacity-mgmt-frontend/src/components/CapacityGroupDetails.tsx +++ b/demand-capacity-mgmt-frontend/src/components/common/CapacityGroupDetails.tsx @@ -20,8 +20,8 @@ * ******************************************************************************** */ -import CapacityGroupsList from "./capacitygroup/CapacityGroupsView"; -import CapacityGroupContext from "../contexts/CapacityGroupsContextProvider"; +import CapacityGroupsList from "../capacitygroup/CapacityGroupsView"; +import CapacityGroupContext from "../../contexts/CapacityGroupsContextProvider"; function CapacityGroupDetails() { diff --git a/demand-capacity-mgmt-frontend/src/components/CompanyOptions.tsx b/demand-capacity-mgmt-frontend/src/components/common/CompanyOptions.tsx similarity index 96% rename from demand-capacity-mgmt-frontend/src/components/CompanyOptions.tsx rename to demand-capacity-mgmt-frontend/src/components/common/CompanyOptions.tsx index 7ab7c7cf..76859c5b 100644 --- a/demand-capacity-mgmt-frontend/src/components/CompanyOptions.tsx +++ b/demand-capacity-mgmt-frontend/src/components/common/CompanyOptions.tsx @@ -21,7 +21,7 @@ */ import React, { useContext } from 'react'; -import { CompanyContext } from '../contexts/CompanyContextProvider'; +import { CompanyContext } from '../../contexts/CompanyContextProvider'; interface CompanyOptionsProps { selectedCompanyName: string; diff --git a/demand-capacity-mgmt-frontend/src/components/Pagination.tsx b/demand-capacity-mgmt-frontend/src/components/common/Pagination.tsx similarity index 100% rename from demand-capacity-mgmt-frontend/src/components/Pagination.tsx rename to demand-capacity-mgmt-frontend/src/components/common/Pagination.tsx diff --git a/demand-capacity-mgmt-frontend/src/components/QuickAcessItems.tsx b/demand-capacity-mgmt-frontend/src/components/common/QuickAcessItems.tsx similarity index 94% rename from demand-capacity-mgmt-frontend/src/components/QuickAcessItems.tsx rename to demand-capacity-mgmt-frontend/src/components/common/QuickAcessItems.tsx index d33e064d..2b210f84 100644 --- a/demand-capacity-mgmt-frontend/src/components/QuickAcessItems.tsx +++ b/demand-capacity-mgmt-frontend/src/components/common/QuickAcessItems.tsx @@ -23,9 +23,9 @@ import { FaChartLine, FaLink } from 'react-icons/fa'; import { FcComboChart } from 'react-icons/fc'; import { Modal, Button } from 'react-bootstrap'; import { useState } from 'react'; -import DemandsPage from './demands/DemandPage'; -import DemandContextProvider from '../contexts/DemandContextProvider'; -import '../index.css'; +import DemandsPage from '../demands/DemandPage'; +import DemandContextProvider from '../../contexts/DemandContextProvider'; +import '../../index.css'; function QuickAcessItems() { diff --git a/demand-capacity-mgmt-frontend/src/components/Search.tsx b/demand-capacity-mgmt-frontend/src/components/common/Search.tsx similarity index 100% rename from demand-capacity-mgmt-frontend/src/components/Search.tsx rename to demand-capacity-mgmt-frontend/src/components/common/Search.tsx diff --git a/demand-capacity-mgmt-frontend/src/components/TopMenu.tsx b/demand-capacity-mgmt-frontend/src/components/common/TopMenu.tsx similarity index 98% rename from demand-capacity-mgmt-frontend/src/components/TopMenu.tsx rename to demand-capacity-mgmt-frontend/src/components/common/TopMenu.tsx index 1dcd019d..04b025e2 100644 --- a/demand-capacity-mgmt-frontend/src/components/TopMenu.tsx +++ b/demand-capacity-mgmt-frontend/src/components/common/TopMenu.tsx @@ -24,7 +24,7 @@ import Container from 'react-bootstrap/Container'; import Nav from 'react-bootstrap/Nav'; import Navbar from 'react-bootstrap/Navbar'; import { FiSettings,FiLogOut } from 'react-icons/fi'; -import InfoMenu from "./menu/InfoMenu"; +import InfoMenu from "../menu/InfoMenu"; function TopMenuLinks() { diff --git a/demand-capacity-mgmt-frontend/src/components/UnitsofMeasureOptions.tsx b/demand-capacity-mgmt-frontend/src/components/common/UnitsofMeasureOptions.tsx similarity index 95% rename from demand-capacity-mgmt-frontend/src/components/UnitsofMeasureOptions.tsx rename to demand-capacity-mgmt-frontend/src/components/common/UnitsofMeasureOptions.tsx index 4d5240f1..c4336a71 100644 --- a/demand-capacity-mgmt-frontend/src/components/UnitsofMeasureOptions.tsx +++ b/demand-capacity-mgmt-frontend/src/components/common/UnitsofMeasureOptions.tsx @@ -21,7 +21,7 @@ */ import React, { useContext } from 'react'; -import { UnitsofMeasureContext } from '../contexts/UnitsOfMeasureContextProvider'; +import { UnitsofMeasureContext } from '../../contexts/UnitsOfMeasureContextProvider'; interface UnitsOfMeasureOptionsProps { selectedUnitMeasureId: string; diff --git a/demand-capacity-mgmt-frontend/src/components/demands/DemandAddForm.tsx b/demand-capacity-mgmt-frontend/src/components/demands/DemandAddForm.tsx index 91d031b3..552c52cd 100644 --- a/demand-capacity-mgmt-frontend/src/components/demands/DemandAddForm.tsx +++ b/demand-capacity-mgmt-frontend/src/components/demands/DemandAddForm.tsx @@ -26,9 +26,9 @@ import { DemandContext } from '../../contexts/DemandContextProvider'; import DemandCategoryContextProvider from '../../contexts/DemandCategoryProvider'; import DemandCategoryOptions from './DemandCategoryOptions'; import CompanyContextProvider from '../../contexts/CompanyContextProvider'; -import CompanyOptions from '../CompanyOptions'; +import CompanyOptions from '../common/CompanyOptions'; import UnitsofMeasureContextContextProvider from '../../contexts/UnitsOfMeasureContextProvider'; -import UnitsOfMeasureOptions from '../UnitsofMeasureOptions'; +import UnitsOfMeasureOptions from '../common/UnitsofMeasureOptions'; import { Demand } from '../../interfaces/demand_interfaces'; import '../../App.css'; diff --git a/demand-capacity-mgmt-frontend/src/components/demands/DemandEditForm.tsx b/demand-capacity-mgmt-frontend/src/components/demands/DemandEditForm.tsx index f14d47a1..15268379 100644 --- a/demand-capacity-mgmt-frontend/src/components/demands/DemandEditForm.tsx +++ b/demand-capacity-mgmt-frontend/src/components/demands/DemandEditForm.tsx @@ -23,8 +23,8 @@ import React, { useContext, useState, useEffect } from 'react'; import { Form, Button, Col, Row } from 'react-bootstrap'; import { DemandContext } from '../../contexts/DemandContextProvider'; import { Demand, DemandSeriesValue, DemandProp, DemandSeries } from '../../interfaces/demand_interfaces'; -import CompanyOptions from '../CompanyOptions'; -import UnitsOfMeasureOptions from '../UnitsofMeasureOptions'; +import CompanyOptions from '../common/CompanyOptions'; +import UnitsOfMeasureOptions from '../common/UnitsofMeasureOptions'; import Spinner from 'react-bootstrap/Spinner'; import { FiSave } from 'react-icons/fi'; diff --git a/demand-capacity-mgmt-frontend/src/components/demands/DemandPage.tsx b/demand-capacity-mgmt-frontend/src/components/demands/DemandPage.tsx index 3d0074f0..ade0eba9 100644 --- a/demand-capacity-mgmt-frontend/src/components/demands/DemandPage.tsx +++ b/demand-capacity-mgmt-frontend/src/components/demands/DemandPage.tsx @@ -23,9 +23,9 @@ import React, { useContext, useState, useMemo, useCallback } from 'react'; import { Modal, Button, Form, Col, Row, Breadcrumb, Dropdown } from 'react-bootstrap'; import { DemandProp, DemandSeries, DemandSeriesValue } from '../../interfaces/demand_interfaces'; -import Pagination from '../Pagination'; +import Pagination from '../common/Pagination'; import DemandsTable from './DemandsTable'; -import DemandsSearch from '../Search'; +import DemandsSearch from '../common/Search'; import EditForm from './DemandEditForm'; import { FaEllipsisV, FaSearch} from 'react-icons/fa'; import AddForm from './DemandAddForm'; @@ -33,7 +33,7 @@ import { DemandContext } from '../../contexts/DemandContextProvider'; import UnitsofMeasureContextContextProvider from '../../contexts/UnitsOfMeasureContextProvider'; import DemandCategoryContextProvider from '../../contexts/DemandCategoryProvider'; import CompanyContextProvider from '../../contexts/CompanyContextProvider'; -import WeeklyView from '../WeeklyView'; +import WeeklyView from './DemandsOverview'; const DemandsPage: React.FC = () => { const [showEditModal, setIsEditModalOpen] = useState(false); diff --git a/demand-capacity-mgmt-frontend/src/components/WeeklyView.tsx b/demand-capacity-mgmt-frontend/src/components/demands/DemandsOverview.tsx similarity index 98% rename from demand-capacity-mgmt-frontend/src/components/WeeklyView.tsx rename to demand-capacity-mgmt-frontend/src/components/demands/DemandsOverview.tsx index bfe0fb98..b1f59f73 100644 --- a/demand-capacity-mgmt-frontend/src/components/WeeklyView.tsx +++ b/demand-capacity-mgmt-frontend/src/components/demands/DemandsOverview.tsx @@ -21,11 +21,11 @@ */ import React, { useContext, useState, useEffect } from 'react'; -import '../../src/index.css'; -import { DemandCategoryContext } from '../contexts/DemandCategoryProvider'; -import { Demand, DemandCategory, DemandProp, DemandSeriesValue, MaterialDemandSery } from '../interfaces/demand_interfaces'; +import '../../index.css'; +import { DemandCategoryContext } from '../../contexts/DemandCategoryProvider'; +import { Demand, DemandCategory, DemandProp, DemandSeriesValue, MaterialDemandSery } from '../../interfaces/demand_interfaces'; import { Button, ButtonGroup, ToggleButton, OverlayTrigger, Tooltip } from 'react-bootstrap'; -import { DemandContext } from '../contexts/DemandContextProvider'; +import { DemandContext } from '../../contexts/DemandContextProvider'; import moment from 'moment'; import 'moment-weekday-calc'; diff --git a/demand-capacity-mgmt-frontend/src/components/menu/Component63.tsx b/demand-capacity-mgmt-frontend/src/components/menu/Component63.tsx deleted file mode 100644 index aa865839..00000000 --- a/demand-capacity-mgmt-frontend/src/components/menu/Component63.tsx +++ /dev/null @@ -1,43 +0,0 @@ -/* - * ******************************************************************************* - * Copyright (c) 2023 BMW AG - * Copyright (c) 2023 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License, Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - * ******************************************************************************** - */ - -import Nav from "react-bootstrap/Nav"; -import {FaArrowDown, FaArrowUp, FaStar} from "react-icons/fa"; - -function Component63() { - - return ( - <> - - - - ); -} - -export default Component63; \ No newline at end of file diff --git a/demand-capacity-mgmt-frontend/src/components/menu/InfoMenu.tsx b/demand-capacity-mgmt-frontend/src/components/menu/InfoMenu.tsx index b7bb9dd3..72ff6108 100644 --- a/demand-capacity-mgmt-frontend/src/components/menu/InfoMenu.tsx +++ b/demand-capacity-mgmt-frontend/src/components/menu/InfoMenu.tsx @@ -21,8 +21,8 @@ */ import Nav from "react-bootstrap/Nav"; -import {FaArrowDown, FaArrowUp, FaStar} from "react-icons/fa"; -import {useInfoMenu } from "../../contexts/InfoMenuContextProvider"; +import { FaArrowDown, FaArrowUp, FaStar } from "react-icons/fa"; +import { useInfoMenu } from "../../contexts/InfoMenuContextProvider"; function InfoMenu() { const { data } = useInfoMenu(); @@ -31,28 +31,28 @@ function InfoMenu() { return ( <>