From a579dbf70edda493894357b752b82fe4aec988c7 Mon Sep 17 00:00:00 2001 From: Sergio Figueiredo Date: Thu, 26 Oct 2023 15:44:00 +0100 Subject: [PATCH] Edit form Css and AppComponents --- .../src/components/common/Search.tsx | 3 +- .../src/components/dcm/AppComponent.tsx | 54 ++-- .../src/components/demands/DemandEditForm.tsx | 2 +- .../src/components/events/EventsTable.tsx | 232 +++++++++--------- 4 files changed, 147 insertions(+), 144 deletions(-) diff --git a/demand-capacity-mgmt-frontend/src/components/common/Search.tsx b/demand-capacity-mgmt-frontend/src/components/common/Search.tsx index 12484cd0..3e0df4af 100644 --- a/demand-capacity-mgmt-frontend/src/components/common/Search.tsx +++ b/demand-capacity-mgmt-frontend/src/components/common/Search.tsx @@ -22,6 +22,7 @@ import React from 'react'; import Button from 'react-bootstrap/Button'; import Form from 'react-bootstrap/Form'; +import { FaSearch } from 'react-icons/fa'; type DemandsSearchProps = { searchQuery: string; @@ -40,7 +41,7 @@ const DemandsSearch: React.FC = ({ searchQuery, setSearchQue value={searchQuery} onChange={(e) => setSearchQuery(e.target.value)} /> - + ); diff --git a/demand-capacity-mgmt-frontend/src/components/dcm/AppComponent.tsx b/demand-capacity-mgmt-frontend/src/components/dcm/AppComponent.tsx index b0ca3d1b..5c5b6423 100644 --- a/demand-capacity-mgmt-frontend/src/components/dcm/AppComponent.tsx +++ b/demand-capacity-mgmt-frontend/src/components/dcm/AppComponent.tsx @@ -21,10 +21,11 @@ */ import React from 'react'; -import {Route, Routes} from "react-router-dom"; +import { Route, Routes } from "react-router-dom"; import CapacityGroupsProvider from '../../contexts/CapacityGroupsContextProvider'; import DemandContextProvider from '../../contexts/DemandContextProvider'; import EventsContextProvider from '../../contexts/EventsContextProvider'; +import FavoritesContextProvider from "../../contexts/FavoritesContextProvider"; import AuthenticatedRoute from "../../util/AuthenticatedRoute"; import QuickAcessItems from '../common/QuickAcessItems'; import AlertsPage from '../pages/AlertsPage'; @@ -34,18 +35,17 @@ import Home from "../pages/CapacityGroupPage"; import DownStatusPage from '../pages/DownStatusPage'; import ErrorPage from '../pages/ErrorPage'; import EventsPage from "../pages/EventsPage"; +import FavoritesPage from "../pages/FavoritesPage"; import TodoListPage from '../pages/TodoListPage'; import UpStatusPage from '../pages/UpStatusPage'; import Layout from './Layout'; -import FavoritesPage from "../pages/FavoritesPage"; -import FavoritesContextProvider from "../../contexts/FavoritesContextProvider"; const AppComponent: React.FC = () => { return ( - }/> - }/> + } /> + } /> { - - + + - }/> + } /> @@ -68,65 +68,65 @@ const AppComponent: React.FC = () => { - + - }/> + } /> - + - }/> + } /> - + - }/> + } /> - + - }/> + } /> - + - }/> + } /> @@ -134,25 +134,27 @@ const AppComponent: React.FC = () => { - + - }/> + } /> - - - - - + + + + + + + - }/> + } /> ); } diff --git a/demand-capacity-mgmt-frontend/src/components/demands/DemandEditForm.tsx b/demand-capacity-mgmt-frontend/src/components/demands/DemandEditForm.tsx index d7582f6d..cef2d1c4 100644 --- a/demand-capacity-mgmt-frontend/src/components/demands/DemandEditForm.tsx +++ b/demand-capacity-mgmt-frontend/src/components/demands/DemandEditForm.tsx @@ -255,7 +255,7 @@ const EditForm: React.FC = ({ theDemand, onCloseModal }) => { diff --git a/demand-capacity-mgmt-frontend/src/components/events/EventsTable.tsx b/demand-capacity-mgmt-frontend/src/components/events/EventsTable.tsx index 2ae54f5d..fbd617f9 100644 --- a/demand-capacity-mgmt-frontend/src/components/events/EventsTable.tsx +++ b/demand-capacity-mgmt-frontend/src/components/events/EventsTable.tsx @@ -20,8 +20,8 @@ * ******************************************************************************* */ -import React, {useCallback, useContext, useEffect, useMemo, useState} from 'react'; -import {Button, Col, Dropdown, Form, OverlayTrigger, Row, Tooltip} from 'react-bootstrap'; +import React, { useCallback, useContext, useEffect, useMemo, useState } from 'react'; +import { Button, Col, Dropdown, Form, OverlayTrigger, Row, Tooltip } from 'react-bootstrap'; import { FaArchive, FaArrowDown, @@ -36,19 +36,19 @@ import { FaUnlink, FaWrench } from 'react-icons/fa'; -import {EventsContext} from '../../contexts/EventsContextProvider'; -import {EventProp} from '../../interfaces/event_interfaces'; -import DangerConfirmationModal, {ConfirmationAction} from '../common/DangerConfirmationModal'; +import { EventsContext } from '../../contexts/EventsContextProvider'; +import { FavoritesContext } from "../../contexts/FavoritesContextProvider"; +import { EventFavoriteResponse, FavoriteType } from "../../interfaces/Favorite_interface"; +import { EventProp } from '../../interfaces/event_interfaces'; +import DangerConfirmationModal, { ConfirmationAction } from '../common/DangerConfirmationModal'; import Pagination from '../common/Pagination'; -import {EventFavoriteResponse, FavoriteType} from "../../interfaces/Favorite_interface"; -import {FavoritesContext} from "../../contexts/FavoritesContextProvider"; interface EventsTableProps { events: EventProp[]; isArchive: boolean } -const EventsTable: React.FC = ({events, isArchive}) => { +const EventsTable: React.FC = ({ events, isArchive }) => { const eventsContext = useContext(EventsContext)!; const [sortField, setSortField] = useState('timestamp'); const [sortOrder, setSortOrder] = useState<'asc' | 'desc'>('asc'); @@ -59,7 +59,7 @@ const EventsTable: React.FC = ({events, isArchive}) => { const [showDeleteConfirmation, setShowDeleteConfirmation] = useState(false); const [deleteItemId, setDeleteItemId] = useState(null); - const {deleteEventId, deleteArchivedEventId} = useContext(EventsContext)!; + const { deleteEventId, deleteArchivedEventId } = useContext(EventsContext)!; const { addFavorite, fetchFavoritesByType, deleteFavorite } = useContext(FavoritesContext)!; const [favoriteEvents, setFavoriteEvents] = useState([]); @@ -87,13 +87,13 @@ const EventsTable: React.FC = ({events, isArchive}) => { }; const eventTypeIcons: { [key: string]: React.ReactNode } = { - GENERAL_EVENT: , - TODO: , - ALERT: , - STATUS_IMPROVEMENT: , - STATUS_REDUCTION: , - LINKED: , - UN_LINKED: , + GENERAL_EVENT: , + TODO: , + ALERT: , + STATUS_IMPROVEMENT: , + STATUS_REDUCTION: , + LINKED: , + UN_LINKED: , }; @@ -194,109 +194,109 @@ const EventsTable: React.FC = ({events, isArchive}) => {
- - - - - - - - - - - + + + + + + + + + + + - {currentEvents.map((event, index) => ( - - - - - + + + + - - - - - - - ))} + + + ) : '-'} + + + + + + + + ))}
handleSort('timestamp')}> - Timestamp {sortField === 'timestamp' ? (sortOrder === 'asc' ? : - ) : '-'} - handleSort('eventId')}> - Event ID {sortField === 'eventId' ? (sortOrder === 'asc' ? : - ) : '-'} - handleSort('objectId')}> - Object ID {sortField === 'objectId' ? (sortOrder === 'asc' ? : - ) : '-'} - handleSort('eventType')}> - Type {sortField === 'eventType' ? (sortOrder === 'asc' ? : - ) : '-'} - handleSort('objectType')}> - Object Type {sortField === 'objectType' ? (sortOrder === 'asc' ? : - ) : '-'} - handleSort('eventDescription')}> - Description {sortField === 'eventDescription' ? (sortOrder === 'asc' ? : - ) : '-'} - handleSort('userAccount')}> - User {sortField === 'userAccount' ? (sortOrder === 'asc' ? : - ) : '-'} -
handleSort('timestamp')}> + Timestamp {sortField === 'timestamp' ? (sortOrder === 'asc' ? : + ) : '-'} + handleSort('eventId')}> + Event ID {sortField === 'eventId' ? (sortOrder === 'asc' ? : + ) : '-'} + handleSort('objectId')}> + Object ID {sortField === 'objectId' ? (sortOrder === 'asc' ? : + ) : '-'} + handleSort('eventType')}> + Type {sortField === 'eventType' ? (sortOrder === 'asc' ? : + ) : '-'} + handleSort('objectType')}> + Object Type {sortField === 'objectType' ? (sortOrder === 'asc' ? : + ) : '-'} + handleSort('eventDescription')}> + Description {sortField === 'eventDescription' ? (sortOrder === 'asc' ? : + ) : '-'} + handleSort('userAccount')}> + User {sortField === 'userAccount' ? (sortOrder === 'asc' ? : + ) : '-'} +
- toggleFavorite(event.logID)} - size={25} - /> - {new Date(event.timeCreated).toLocaleString()}{event.id}}> - - {event.capacityGroupId !== "null" || event.materialDemandId !== "null" ? ( - - {event.capacityGroupId !== "null" ? event.capacityGroupId : event.materialDemandId} - - } - > -
+ toggleFavorite(event.logID)} + size={25} + /> + {new Date(event.timeCreated).toLocaleString()}{event.id}}> + + {event.capacityGroupId !== "null" || event.materialDemandId !== "null" ? ( + + {event.capacityGroupId !== "null" ? event.capacityGroupId : event.materialDemandId} + + } > - - - - ) : '-'} - {generateOverlay(event)}{event.objectType}{event.eventDescription}{event.userAccount} - - - - - - handleArchiveClick(event)}> Archive - { - navigator.clipboard.writeText(event.id.toString()) - }}> Copy ID - handleDeleteButtonClick(event.id.toString())}> Delete - - -
{generateOverlay(event)}{event.objectType}{event.eventDescription}{event.userAccount} + + + + + + handleArchiveClick(event)}> Archive + { + navigator.clipboard.writeText(event.id.toString()) + }}> Copy ID + handleDeleteButtonClick(event.id.toString())}> Delete + + +