From f5622597a246a420a973db4f0631fa74877b3aba Mon Sep 17 00:00:00 2001 From: Ryan Schuhler Date: Mon, 11 Nov 2024 08:08:58 -0800 Subject: [PATCH] LRSD-6992 Refactor --- .../src/common/I18n/Language.json | 2 +- .../src/main.tsx | 4 +- .../SecurityVulnerabilities.tsx} | 7 +- .../components/SVFilter/SVFilter.css | 28 ++ .../components/SVFilter/SVFilter.tsx | 251 +++++++++++++++ .../components/SVFilter}/index.ts | 2 +- .../components/SVSearch/SVSearch.css | 14 + .../components/SVSearch/SVSearch.tsx} | 20 +- .../components/SVSearch/index.ts | 6 + .../components/SVTable/SVTable.css | 31 ++ .../components/SVTable/SVTable.tsx} | 40 +-- .../components/SVTable/index.ts | 6 + .../routes/security-vulnerabilities/index.ts | 6 + .../interfaces/ITicket.ts | 15 + .../SecurityVulnerabilitiesItem.tsx} | 6 +- .../SecurityVulnerabilitiesItem/index.ts | 6 + .../SecurityVulnerabilitiesList.css} | 0 .../SecurityVulnerabilitiesList.tsx} | 227 ++++++++------ .../SecurityVulnerabilitiesList/index.ts | 6 + .../pages/index.tsx | 4 +- .../routes/securityVulnerabilities.routes.tsx | 23 ++ .../routes/security-vulnerability/app.scss | 2 - .../components/Filters/Filters.tsx | 286 ------------------ .../components/Filters/_filter.scss | 30 -- .../components/SearchBar/_search_bar.scss | 10 - .../components/TicketTable/_ticket_table.scss | 33 -- .../components/_components.scss | 3 - .../security-vulnerability/pages/_pages.scss | 1 - .../routes/securityVulnerability.routes.jsx | 20 -- .../security-vulnerability/types/Ticket.ts | 15 - .../frontend-tokens-values.json | 28 +- .../page-definition.json | 2 +- .../09_security-vulnerability/page.json | 3 +- 33 files changed, 580 insertions(+), 557 deletions(-) rename workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/{security-vulnerability/SecurityVulnerability.tsx => security-vulnerabilities/SecurityVulnerabilities.tsx} (78%) create mode 100644 workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/components/SVFilter/SVFilter.css create mode 100644 workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/components/SVFilter/SVFilter.tsx rename workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/{security-vulnerability => security-vulnerabilities/components/SVFilter}/index.ts (77%) create mode 100644 workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/components/SVSearch/SVSearch.css rename workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/{security-vulnerability/components/SearchBar/SearchBar.tsx => security-vulnerabilities/components/SVSearch/SVSearch.tsx} (61%) create mode 100644 workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/components/SVSearch/index.ts create mode 100644 workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/components/SVTable/SVTable.css rename workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/{security-vulnerability/components/TicketTable/TicketTable.tsx => security-vulnerabilities/components/SVTable/SVTable.tsx} (51%) create mode 100644 workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/components/SVTable/index.ts create mode 100644 workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/index.ts create mode 100644 workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/interfaces/ITicket.ts rename workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/{security-vulnerability/pages/SecurityVulnerabilityTicket/SecurityVulnerabilityTicket.tsx => security-vulnerabilities/pages/SecurityVulnerabilitiesItem/SecurityVulnerabilitiesItem.tsx} (89%) create mode 100644 workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/pages/SecurityVulnerabilitiesItem/index.ts rename workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/{security-vulnerability/pages/SecurityVulnerabilityPage/_security_vulnerability_page.scss => security-vulnerabilities/pages/SecurityVulnerabilitiesList/SecurityVulnerabilitiesList.css} (100%) rename workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/{security-vulnerability/pages/SecurityVulnerabilityPage/SecurityVulnerabilityPage.tsx => security-vulnerabilities/pages/SecurityVulnerabilitiesList/SecurityVulnerabilitiesList.tsx} (57%) create mode 100644 workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/pages/SecurityVulnerabilitiesList/index.ts rename workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/{security-vulnerability => security-vulnerabilities}/pages/index.tsx (63%) create mode 100644 workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/pages/routes/securityVulnerabilities.routes.tsx delete mode 100644 workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/app.scss delete mode 100644 workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/components/Filters/Filters.tsx delete mode 100644 workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/components/Filters/_filter.scss delete mode 100644 workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/components/SearchBar/_search_bar.scss delete mode 100644 workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/components/TicketTable/_ticket_table.scss delete mode 100644 workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/components/_components.scss delete mode 100644 workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/pages/_pages.scss delete mode 100644 workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/pages/routes/securityVulnerability.routes.jsx delete mode 100644 workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/types/Ticket.ts diff --git a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/common/I18n/Language.json b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/common/I18n/Language.json index a2c85a35b736e3..6a691acc708842 100644 --- a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/common/I18n/Language.json +++ b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/common/I18n/Language.json @@ -429,8 +429,8 @@ "select-a-file": "Select a file", "select-a-local-file-to-upload-only-one-file-can-be-attached-at-a-time": "Select a local file to upload. Only one file can be attached at a time.", "select-a-server-location-for-your-data-to-be-stored": "Select a server location for your data to be stored.", - "select-an-active-liferay-x-subscription-to-download-the-activation-key": "Select an active Liferay {0} subscription to download the activation key", "select-all": "Select All", + "select-an-active-liferay-x-subscription-to-download-the-activation-key": "Select an active Liferay {0} subscription to download the activation key", "select-team-member": "Select team member", "select-team-members": "Select team member(s)...", "select-the-activation-key-you-want-to-deactivate": "Select the activation key you want to deactivate.", diff --git a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/main.tsx b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/main.tsx index 3e019b13b3606c..a95ce8050f7910 100644 --- a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/main.tsx +++ b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/main.tsx @@ -21,7 +21,7 @@ import AttachmentFileUploader from './routes/attachment-uploader'; import CustomerPortal from './routes/customer-portal'; import Home from './routes/home'; import Onboarding from './routes/onboarding'; -import SecurityVulnerability from './routes/security-vulnerability'; +import SecurityVulnerabilities from './routes/security-vulnerabilities'; const ELEMENT_ID = 'liferay-customer-custom-element'; @@ -30,7 +30,7 @@ const AppRoutes = { home: Home, onboarding: Onboarding, portal: CustomerPortal, - securityVulnerability: SecurityVulnerability, + securityVulnerabilities: SecurityVulnerabilities, }; type Properties = { diff --git a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/SecurityVulnerability.tsx b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/SecurityVulnerabilities.tsx similarity index 78% rename from workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/SecurityVulnerability.tsx rename to workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/SecurityVulnerabilities.tsx index fce66c265fd7ca..af495173668b74 100644 --- a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/SecurityVulnerability.tsx +++ b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/SecurityVulnerabilities.tsx @@ -4,18 +4,17 @@ */ import {BrowserRouter} from 'react-router-dom'; -import './app.scss'; import Pages from './pages'; -const SecurityVulnerability = () => { +const SecurityVulnerabilities = () => { return (
- +
); }; -export default SecurityVulnerability; +export default SecurityVulnerabilities; diff --git a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/components/SVFilter/SVFilter.css b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/components/SVFilter/SVFilter.css new file mode 100644 index 00000000000000..3970bcc5a9dd80 --- /dev/null +++ b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/components/SVFilter/SVFilter.css @@ -0,0 +1,28 @@ +.sv-filter-content { + .custom-control-input { + accent-color:var(--color-action-primary-default); + opacity: 1; + } + + .disabled.sv-clear-button { + color: var(--color-action-neutral-disabled); + } + + .sv-filter-box { + background-color: var(--color-neutral-1); + border-radius: var(--border-radius-lg); + margin-bottom: var(--spacer-3); + padding: var(--spacer-3); + + & label span { + color: var(--color-neutral-10); + font-size: var(--font-size-sm); + } + } + + .sv-select-all-button, .sv-clear-button { + color: var(--color-action-neutral-default); + font-size: var(--font-size-sm); + font-weight: var(--font-weight-semi-bold); + } +} diff --git a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/components/SVFilter/SVFilter.tsx b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/components/SVFilter/SVFilter.tsx new file mode 100644 index 00000000000000..02b772d93e907d --- /dev/null +++ b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/components/SVFilter/SVFilter.tsx @@ -0,0 +1,251 @@ +/** + * SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com + * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06 + */ + +import {Button as ClayButton} from '@clayui/core'; +import {ClayCheckbox, ClayRadio} from '@clayui/form'; +import i18n from '~/common/I18n'; + +import { + IFilterOptions, + IFilters, +} from '../../pages/SecurityVulnerabilitiesList/SecurityVulnerabilitiesList'; + +import './SVFilter.css'; + +interface IProps { + filterOptions: IFilterOptions; + filters: IFilters; + onChange: (filters: IFilters) => void; +} + +const SVFilter = ({filterOptions, filters, onChange}: IProps) => { + const toggleFilterValue = (filter: keyof IFilters, value: string) => { + const currentFilterValues = filters[filter]; + + if (Array.isArray(currentFilterValues)) { + if (currentFilterValues.includes(value)) { + onChange({ + ...filters, + [filter]: currentFilterValues.filter((v) => v !== value), + }); + } + else { + onChange({ + ...filters, + [filter]: [...currentFilterValues, value], + }); + } + } + else { + onChange({ + ...filters, + [filter]: value, + }); + } + }; + + const updateFilterValues = ( + filterKey: keyof IFilters, + values: string[] | null + ) => { + const newFilters = {...filters, [filterKey]: values ?? []}; + onChange({ + ...filters, + ...newFilters, + }); + }; + + return ( +
+
+
{i18n.translate('sort-by')}
+ +
+ {filterOptions.sorts.map((sort) => ( + { + toggleFilterValue('sort', sort); + }} + value={sort} + /> + ))} +
+
+ +
+
{i18n.translate('severity')}
+ +
+ + updateFilterValues('severities', [ + ...filterOptions.severities, + ]) + } + > + {i18n.translate('select-all')} + + + updateFilterValues('severities', null)} + > + {i18n.translate('clear')} + +
+ + {filterOptions.severities.map((severity) => ( + { + toggleFilterValue('severities', severity); + }} + /> + ))} +
+ +
+
{i18n.translate('category')}
+ +
+ + updateFilterValues('categories', [ + ...filterOptions.categories, + ]) + } + > + {i18n.translate('select-all')} + + + updateFilterValues('categories', null)} + > + {i18n.translate('clear')} + +
+ + {filterOptions.categories.map((category) => ( + { + toggleFilterValue('categories', category); + }} + /> + ))} +
+ +
+
{i18n.translate('issue-classification')}
+ +
+ + updateFilterValues('classifications', [ + ...filterOptions.classifications, + ]) + } + > + {i18n.translate('select-all')} + + + + updateFilterValues('classifications', null) + } + > + {i18n.translate('clear')} + +
+ + {filterOptions.classifications.map((classification) => ( + { + toggleFilterValue( + 'classifications', + classification + ); + }} + /> + ))} +
+ +
+
{i18n.translate('affected-version')}
+ +
+ + updateFilterValues('versions', [ + ...filterOptions.versions, + ]) + } + > + {i18n.translate('select-all')} + + + updateFilterValues('versions', null)} + > + {i18n.translate('clear')} + +
+ + {filterOptions.versions.map((version) => ( + { + toggleFilterValue('versions', version); + }} + /> + ))} +
+
+ ); +}; + +export default SVFilter; diff --git a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/index.ts b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/components/SVFilter/index.ts similarity index 77% rename from workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/index.ts rename to workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/components/SVFilter/index.ts index d0ec3e1ddbac37..3674d6027e0677 100644 --- a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/index.ts +++ b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/components/SVFilter/index.ts @@ -3,4 +3,4 @@ * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06 */ -export {default} from './SecurityVulnerability'; +export {default} from './SVFilter'; diff --git a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/components/SVSearch/SVSearch.css b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/components/SVSearch/SVSearch.css new file mode 100644 index 00000000000000..f9d1c84be2c8cd --- /dev/null +++ b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/components/SVSearch/SVSearch.css @@ -0,0 +1,14 @@ +.sv-search { + width: var(--container-max-md); + + .sv-search-icon { + bottom: calc(50% - var(--font-size-base)/2); + font-size: var(--font-size-base); + right: var(--spacer-4); + } + + .sv-search-input { + color: var(--color-neutral-8); + width: 100%; + } +} diff --git a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/components/SearchBar/SearchBar.tsx b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/components/SVSearch/SVSearch.tsx similarity index 61% rename from workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/components/SearchBar/SearchBar.tsx rename to workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/components/SVSearch/SVSearch.tsx index 58249d6448b6ae..a7b62c314a8c4c 100644 --- a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/components/SearchBar/SearchBar.tsx +++ b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/components/SVSearch/SVSearch.tsx @@ -7,22 +7,24 @@ import {ClayInput} from '@clayui/form'; import ClayIcon from '@clayui/icon'; import i18n from '~/common/I18n'; -interface SearchBarProps { - searchTerm: string; - onSearchChange: (term: string) => void; +import './SVSearch.css'; + +interface IProps { + onChange: (term: string) => void; + term: string; } -const SearchBar = ({searchTerm, onSearchChange}: SearchBarProps) => { +const SVSearch = ({onChange, term}: IProps) => { return ( -
+
onSearchChange(event.target.value)} + className="border border-brand-primary-lighten-4 font-weight-semi-bold px-5 py-3 rounded-pill shadow-lg sv-search-input" + onChange={(event) => onChange(event.target.value)} placeholder={i18n.translate( 'search-for-sves-by-keyword-or-cve-id' )} type="text" - value={searchTerm} + value={term} /> { ); }; -export default SearchBar; +export default SVSearch; diff --git a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/components/SVSearch/index.ts b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/components/SVSearch/index.ts new file mode 100644 index 00000000000000..be77818f25538a --- /dev/null +++ b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/components/SVSearch/index.ts @@ -0,0 +1,6 @@ +/** + * SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com + * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06 + */ + +export {default} from './SVSearch'; diff --git a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/components/SVTable/SVTable.css b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/components/SVTable/SVTable.css new file mode 100644 index 00000000000000..e9a0ab898c5ec7 --- /dev/null +++ b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/components/SVTable/SVTable.css @@ -0,0 +1,31 @@ +.sv-table { + & tbody tr:hover { + background-color: var(--color-action-primary-hover-lighten); + } + + & td, & th { + padding: var(--spacer-3); + + &:first-child { + border-radius: var(--border-radius-sm) 0 0 var(--border-radius-sm) !important; + } + + &:last-child { + border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0 !important; + } + } + + & td { + border-width: 0; + color: var(--color-neutral-8); + } + + & thead { + background-color: var(--color-neutral-1); + } + + .ticket-name-link { + font-size: var(--h3-font-size); + font-weight: var(--font-weight-semi-bold); + } +} diff --git a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/components/TicketTable/TicketTable.tsx b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/components/SVTable/SVTable.tsx similarity index 51% rename from workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/components/TicketTable/TicketTable.tsx rename to workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/components/SVTable/SVTable.tsx index 9bc0652721f42f..d81c79ce9eb12f 100644 --- a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/components/TicketTable/TicketTable.tsx +++ b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/components/SVTable/SVTable.tsx @@ -5,39 +5,23 @@ import {Body, Cell, Head, Row, Table} from '@clayui/core'; -interface Ticket { - id: number; - name: string; - category: string[]; - classification: string; - summary: string; - versions: string[]; - severity: string; - date: string; -} +import './SVTable.css'; -interface Column { +interface IColumn { columnKey: string; label: string; } -interface RowData { - [key: string]: string | number | JSX.Element; +interface IRow { + [key: string]: string | number | JSX.Element | undefined; } -interface TicketTableProps { - columns: Column[]; - rows: RowData[]; - tickets: Ticket[]; - filters: { - categories: string[]; - classifications: string; - versions: string[]; - severities: string; - }; +interface IProps { + columns: IColumn[]; + rows: IRow[]; } -const TicketTable = ({columns, rows}: TicketTableProps) => { +const SVTable = ({columns, rows}: IProps) => { return ( { > {columns.map((column) => ( - + {column.label} ))} @@ -59,9 +43,7 @@ const TicketTable = ({columns, rows}: TicketTableProps) => { {columns.map((column) => ( - {column.columnKey === 'prioritySummary' - ? row[column.columnKey] - : row[column.columnKey]} + {row[column.columnKey]} ))} @@ -71,4 +53,4 @@ const TicketTable = ({columns, rows}: TicketTableProps) => { ); }; -export default TicketTable; +export default SVTable; diff --git a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/components/SVTable/index.ts b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/components/SVTable/index.ts new file mode 100644 index 00000000000000..fb15900e6ba4a4 --- /dev/null +++ b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/components/SVTable/index.ts @@ -0,0 +1,6 @@ +/** + * SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com + * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06 + */ + +export {default} from './SVTable'; diff --git a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/index.ts b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/index.ts new file mode 100644 index 00000000000000..e268710d49742a --- /dev/null +++ b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/index.ts @@ -0,0 +1,6 @@ +/** + * SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com + * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06 + */ + +export {default} from './SecurityVulnerabilities'; diff --git a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/interfaces/ITicket.ts b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/interfaces/ITicket.ts new file mode 100644 index 00000000000000..51a028601d95e1 --- /dev/null +++ b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/interfaces/ITicket.ts @@ -0,0 +1,15 @@ +/** + * SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com + * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06 + */ + +export interface ITicket { + category?: string[]; + classification?: string; + date?: string; + id?: number; + name?: string; + severity?: string; + summary?: string; + versions?: string[]; +} diff --git a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/pages/SecurityVulnerabilityTicket/SecurityVulnerabilityTicket.tsx b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/pages/SecurityVulnerabilitiesItem/SecurityVulnerabilitiesItem.tsx similarity index 89% rename from workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/pages/SecurityVulnerabilityTicket/SecurityVulnerabilityTicket.tsx rename to workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/pages/SecurityVulnerabilitiesItem/SecurityVulnerabilitiesItem.tsx index 4f977b7f5d59d8..851bbe943ff811 100644 --- a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/pages/SecurityVulnerabilityTicket/SecurityVulnerabilityTicket.tsx +++ b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/pages/SecurityVulnerabilitiesItem/SecurityVulnerabilitiesItem.tsx @@ -3,11 +3,11 @@ * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06 */ -import {useParams} from 'react-router-dom'; import {useEffect, useState} from 'react'; +import {useParams} from 'react-router-dom'; import i18n from '~/common/I18n'; -const SecurityVulnerabilityTicket = () => { +const SecurityVulnerabilitiesItem = () => { const {id} = useParams(); const [ticket, setTicket] = useState(null); @@ -32,4 +32,4 @@ const SecurityVulnerabilityTicket = () => { ); }; -export default SecurityVulnerabilityTicket; +export default SecurityVulnerabilitiesItem; diff --git a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/pages/SecurityVulnerabilitiesItem/index.ts b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/pages/SecurityVulnerabilitiesItem/index.ts new file mode 100644 index 00000000000000..71b7d249d732d4 --- /dev/null +++ b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/pages/SecurityVulnerabilitiesItem/index.ts @@ -0,0 +1,6 @@ +/** + * SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com + * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06 + */ + +export {default} from './SecurityVulnerabilitiesItem'; diff --git a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/pages/SecurityVulnerabilityPage/_security_vulnerability_page.scss b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/pages/SecurityVulnerabilitiesList/SecurityVulnerabilitiesList.css similarity index 100% rename from workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/pages/SecurityVulnerabilityPage/_security_vulnerability_page.scss rename to workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/pages/SecurityVulnerabilitiesList/SecurityVulnerabilitiesList.css diff --git a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/pages/SecurityVulnerabilityPage/SecurityVulnerabilityPage.tsx b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/pages/SecurityVulnerabilitiesList/SecurityVulnerabilitiesList.tsx similarity index 57% rename from workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/pages/SecurityVulnerabilityPage/SecurityVulnerabilityPage.tsx rename to workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/pages/SecurityVulnerabilitiesList/SecurityVulnerabilitiesList.tsx index 91d3ea4f00a0f7..29c9795724ef31 100644 --- a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/pages/SecurityVulnerabilityPage/SecurityVulnerabilityPage.tsx +++ b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/pages/SecurityVulnerabilitiesList/SecurityVulnerabilitiesList.tsx @@ -3,79 +3,106 @@ * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06 */ -import {useState, useEffect} from 'react'; -import SearchBar from '../../components/SearchBar/SearchBar'; -import TicketTable from '../../components/TicketTable/TicketTable'; -import Filters from '../../components/Filters/Filters'; -import {Ticket} from '../../types/Ticket'; +import {useEffect, useState} from 'react'; +import {Link} from 'react-router-dom'; import i18n from '~/common/I18n'; -import getDateCustomFormat from '~/common/utils/getDateCustomFormat'; import {FORMAT_DATE_TYPES} from '~/common/utils/constants'; -import {Link} from 'react-router-dom'; +import getDateCustomFormat from '~/common/utils/getDateCustomFormat'; + +import SVFilter from '../../components/SVFilter'; +import SVSearch from '../../components/SVSearch'; +import SVTable from '../../components/SVTable'; +import {ITicket} from '../../interfaces/ITicket'; -const SecurityVulnerabilityPage = () => { - const [tickets, setTickets] = useState([]); - const [searchTerm, setSearchTerm] = useState(''); - const [filteredFilters, setFilteredFilters] = useState({ - categories: [] as string[], - classifications: '' as string, - versions: [] as string[], - severities: '' as string, +import './SecurityVulnerabilitiesList.css'; + +export interface IFilterOptions { + categories: string[]; + classifications: string[]; + severities: string[]; + sorts: string[]; + versions: string[]; +} + +export interface IFilters { + categories: string[]; + classifications: string[]; + search: string; + severities: string[]; + sort: string; + versions: string[]; +} + +const SecurityVulnerabilitiesList = () => { + const [tickets, setTickets] = useState([]); + const [filterOptions, setFilterOptions] = useState({ + categories: [], + classifications: [], + severities: [], + sorts: [], + versions: [], + }); + const [filters, setFilters] = useState({ + categories: [], + classifications: [], + search: '', + severities: [], + sort: '', + versions: [], }); - const [sortOrder, setSortOrder] = useState<'newest' | 'oldest'>('newest'); useEffect(() => { const fetchTickets = async () => { - const data: Ticket[] = [ + const data: ITicket[] = [ { - id: 1, - name: 'CVE-2024-38002', category: ['Paas', 'Saas', 'Self-Hosted'], classification: 'Confirmed Vulnerability', + date: '2024-01-01T00:00:00.000Z', + id: 1, + name: 'CVE-2024-38002', + severity: 'Critical', summary: 'Regular users can edit', versions: ['2024.Q4', '2024.Q3'], - severity: 'Critical', - date: '2024-01-01T00:00:00.000Z', }, { - id: 2, - name: 'CVE-2024-38012', category: ['Paas'], classification: 'Ignored', + date: '2024-11-01T00:00:00.000Z', + id: 2, + name: 'CVE-2024-38012', + severity: 'High', summary: 'Regular users can edit', versions: ['2024.Q4', '2024.Q3', '2024.Q2'], - severity: 'High', - date: '2024-11-01T00:00:00.000Z', }, { - id: 3, - name: 'CVE-2024-38022', category: ['Saas'], classification: 'False Positive', + date: '2022-01-01T00:00:00.000Z', + id: 3, + name: 'CVE-2024-38022', + severity: 'Medium', summary: 'Regular users can edit', versions: ['2024.Q4'], - severity: 'Medium', - date: '2022-01-01T00:00:00.000Z', }, { - id: 4, - name: 'CVE-2024-38003', category: ['Saas', 'Self-Hosted'], classification: 'False Positive', + date: '2022-01-01T00:00:00.000Z', + id: 4, + name: 'CVE-2024-38003', + severity: 'Low', summary: 'Regular users can edit', versions: ['2024.Q4', '2024.Q2'], - severity: 'Low', - date: '2022-01-01T00:00:00.000Z', }, { - id: 5, - name: 'CVA-2024-38013', category: ['Paas', 'Docker'], classification: 'Threat Information', + date: '2023-01-01T00:00:00.000Z', + id: 5, + name: 'CVA-2024-38013', + severity: 'None', summary: 'Regular users can edit', versions: ['2024.Q4'], - severity: 'None', - date: '2023-01-01T00:00:00.000Z', }, ]; @@ -85,42 +112,71 @@ const SecurityVulnerabilityPage = () => { fetchTickets(); }, []); - const handleSearchChange = (term: string) => { - setSearchTerm(term); - }; + useEffect(() => { + const fetchFilterOptions = async () => { + const data = { + categories: ['Paas', 'Saas', 'Self-Hosted', 'Docker'], + classifications: [ + 'Confirmed Vulnerability', + 'Ignored', + 'False Positive', + 'Advisory', + 'Threat Information', + ], + severities: ['Critical', 'High', 'Medium', 'Low', 'None'], + sorts: ['Newest', 'Oldest'], + versions: ['2024.Q4', '2024.Q3', '2024.Q2', '2024.Q1'], + }; - const handleFilterChange = (newFilters: any) => { - setFilteredFilters((prevFilters) => ({ + setFilterOptions(data); + }; + + fetchFilterOptions(); + }, []); + + const handleFilterChange = (newFilters: IFilters) => { + setFilters((prevFilters) => ({ ...prevFilters, ...newFilters, })); }; + const handleSearchChange = (term: string) => { + setFilters((prevFilters) => ({ + ...prevFilters, + search: term, + })); + }; + const filteredTickets = tickets .filter((ticket) => { const matchesSearch = - ticket.name.toLowerCase().includes(searchTerm.toLowerCase()) || - ticket.id.toString().includes(searchTerm); + ticket.name + ?.toLowerCase() + .includes(filters.search.toLowerCase()) || + ticket.id?.toString().includes(filters.search); const matchesCategory = - filteredFilters.categories.length === 0 || - ticket.category.some((ticketCategory) => - filteredFilters.categories.includes(ticketCategory) + !filters.categories.length || + ticket.category?.some((ticketCategory) => + filters.categories.includes(ticketCategory) ); const matchesClassification = - filteredFilters.classifications.length === 0 || - filteredFilters.classifications.includes(ticket.classification); + !filters.classifications.length || + filters.classifications.includes( + ticket.classification as string + ); const matchesVersion = - filteredFilters.versions.length === 0 || - ticket.versions.some((ticketVersion) => - filteredFilters.versions.includes(ticketVersion) + !filters.versions.length || + ticket.versions?.some((ticketVersion) => + filters.versions.includes(ticketVersion) ); const matchesSeverity = - filteredFilters.severities.length === 0 || - filteredFilters.severities.includes(ticket.severity); + !filters.severities.length || + filters.severities.includes(ticket.severity as string); return ( matchesSearch && @@ -131,10 +187,10 @@ const SecurityVulnerabilityPage = () => { ); }) .sort((a, b) => { - const dateA = new Date(a.date).getTime(); - const dateB = new Date(b.date).getTime(); + const dateA = new Date(a.date as string).getTime(); + const dateB = new Date(b.date as string).getTime(); - if (sortOrder === 'newest') { + if (filters.sort === 'Newest') { return dateB - dateA; } else { @@ -166,7 +222,13 @@ const SecurityVulnerabilityPage = () => { ]; const rows = filteredTickets.map((ticket) => ({ - id: ticket.id.toString(), + category: ticket.category?.join(', '), + classification: ticket.classification, + date: getDateCustomFormat( + ticket.date, + FORMAT_DATE_TYPES.day2DMonthSYearN + ), + id: ticket.id?.toString(), prioritySummary: (
@@ -175,8 +237,8 @@ const SecurityVulnerabilityPage = () => {
{ticket.name} @@ -185,13 +247,7 @@ const SecurityVulnerabilityPage = () => {
{ticket.summary}
), - category: ticket.category.join(', '), - classification: ticket.classification, - versions: ticket.versions.join(', '), - date: getDateCustomFormat( - ticket.date, - FORMAT_DATE_TYPES.day2DMonthSYearN - ), + versions: ticket.versions?.join(', '), })); return ( @@ -200,49 +256,28 @@ const SecurityVulnerabilityPage = () => {

{i18n.translate('cve-reports')}

-
-
- +
); }; -export default SecurityVulnerabilityPage; +export default SecurityVulnerabilitiesList; diff --git a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/pages/SecurityVulnerabilitiesList/index.ts b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/pages/SecurityVulnerabilitiesList/index.ts new file mode 100644 index 00000000000000..f9647c5949539e --- /dev/null +++ b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/pages/SecurityVulnerabilitiesList/index.ts @@ -0,0 +1,6 @@ +/** + * SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com + * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06 + */ + +export {default} from './SecurityVulnerabilitiesList'; diff --git a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/pages/index.tsx b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/pages/index.tsx similarity index 63% rename from workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/pages/index.tsx rename to workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/pages/index.tsx index ccebb66e5d3a30..09aca02f185f24 100644 --- a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/pages/index.tsx +++ b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/pages/index.tsx @@ -3,10 +3,10 @@ * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06 */ -import SecurityVulnerabilityRoutes from './routes/securityVulnerability.routes'; +import SecurityVulnerabilitiesRoutes from './routes/securityVulnerabilities.routes'; const Pages = () => { - return ; + return ; }; export default Pages; diff --git a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/pages/routes/securityVulnerabilities.routes.tsx b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/pages/routes/securityVulnerabilities.routes.tsx new file mode 100644 index 00000000000000..cf9a0f99d2b99d --- /dev/null +++ b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerabilities/pages/routes/securityVulnerabilities.routes.tsx @@ -0,0 +1,23 @@ +/** + * SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com + * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06 + */ + +import {Route, Routes} from 'react-router-dom'; + +import SecurityVulnerabilitiesItem from '../SecurityVulnerabilitiesItem'; +import SecurityVulnerabilitiesList from '../SecurityVulnerabilitiesList'; + +const SecurityVulnerabilitiesRoutes = () => { + return ( + + } path="/" /> + } + path="/ticket/:id" + /> + + ); +}; + +export default SecurityVulnerabilitiesRoutes; diff --git a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/app.scss b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/app.scss deleted file mode 100644 index 06fc6df2559578..00000000000000 --- a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/app.scss +++ /dev/null @@ -1,2 +0,0 @@ -@use './components/components' as components; -@use './pages/pages' as pages; diff --git a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/components/Filters/Filters.tsx b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/components/Filters/Filters.tsx deleted file mode 100644 index 203416ba6ee6c5..00000000000000 --- a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/components/Filters/Filters.tsx +++ /dev/null @@ -1,286 +0,0 @@ -/** - * SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com - * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06 - */ - -import {useState, useEffect} from 'react'; -import {Button as ClayButton} from '@clayui/core'; -import {ClayCheckbox, ClayRadio} from '@clayui/form'; -import i18n from '~/common/I18n'; - -interface FiltersProps { - categories: string[]; - classifications: string[]; - versions: string[]; - setSortOrder: (sortOrder: 'newest' | 'oldest') => void; - severities: string[]; - sortOrder: 'newest' | 'oldest'; - onFilterChange: (filters: any) => void; -} - -const Filters = ({ - categories, - classifications, - versions, - severities, - setSortOrder, - onFilterChange, - sortOrder, -}: FiltersProps) => { - const [selectedCategories, setSelectedCategories] = useState([]); - const [selectedClassifications, setSelectedClassifications] = useState< - string[] - >([]); - const [selectedVersions, setSelectedVersions] = useState([]); - const [selectedSeverities, setSelectedSeverities] = useState([]); - - const toggleCategory = (category: string) => { - setSelectedCategories((previous) => - previous.includes(category) - ? previous.filter( - (categoryFiltered) => categoryFiltered !== category - ) - : [...previous, category] - ); - }; - - const toggleClassification = (classification: string) => { - setSelectedClassifications((previous) => - previous.includes(classification) - ? previous.filter( - (classificationFiltered) => - classificationFiltered !== classification - ) - : [...previous, classification] - ); - }; - - const toggleVersion = (version: string) => { - setSelectedVersions((previous) => - previous.includes(version) - ? previous.filter( - (versionFiltered) => versionFiltered !== version - ) - : [...previous, version] - ); - }; - - const toggleSeverity = (severity: string) => { - setSelectedSeverities((previous) => - previous.includes(severity) - ? previous.filter( - (severityFiltered) => severityFiltered !== severity - ) - : [...previous, severity] - ); - }; - - const selectAll = ( - type: 'categories' | 'classifications' | 'versions' | 'severities', - items: string[] - ) => { - if (type === 'categories') { - setSelectedCategories(items); - } - else if (type === 'classifications') { - setSelectedClassifications(items); - } - else if (type === 'versions') { - setSelectedVersions(items); - } - else if (type === 'severities') { - setSelectedSeverities(items); - } - - onFilterChange({ - categories: selectedCategories, - classifications: selectedClassifications, - versions: selectedVersions, - severities: selectedSeverities, - sortOrder, - }); - }; - - useEffect(() => { - onFilterChange({ - categories: selectedCategories, - classifications: selectedClassifications, - versions: selectedVersions, - severities: selectedSeverities, - sortOrder, - }); - }, [ - selectedCategories, - selectedClassifications, - selectedVersions, - selectedSeverities, - sortOrder, - ]); - - return ( -
-
-
{i18n.translate('sort-by')}
- -
- setSortOrder('newest')} - /> - setSortOrder('oldest')} - /> -
-
- -
-
{i18n.translate('severity')}
- -
- selectAll('severities', severities)} - > - {i18n.translate('select-all')} - - - setSelectedSeverities([])} - > - {i18n.translate('clear')} - -
- - {severities.map((severity) => ( - toggleSeverity(severity)} - /> - ))} -
- -
-
{i18n.translate('category')}
- -
- selectAll('categories', categories)} - > - {i18n.translate('select-all')} - - - setSelectedCategories([])} - > - {i18n.translate('clear')} - -
- - {categories.map((category) => ( - toggleCategory(category)} - /> - ))} -
- -
-
{i18n.translate('issue-classification')}
- -
- - selectAll('classifications', classifications) - } - > - {i18n.translate('select-all')} - - - setSelectedClassifications([])} - > - {i18n.translate('clear')} - -
- - {classifications.map((classification) => ( - toggleClassification(classification)} - /> - ))} -
- -
-
{i18n.translate('affected-version')}
- -
- selectAll('versions', versions)} - > - {i18n.translate('select-all')} - - - setSelectedVersions([])} - > - {i18n.translate('clear')} - -
- - {versions.map((version) => ( - toggleVersion(version)} - /> - ))} -
-
- ); -}; - -export default Filters; diff --git a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/components/Filters/_filter.scss b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/components/Filters/_filter.scss deleted file mode 100644 index 7ffc3f9328e371..00000000000000 --- a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/components/Filters/_filter.scss +++ /dev/null @@ -1,30 +0,0 @@ -.sv-filter-content { - background-color: #fff; - border-radius: 10px; - width: 18.75rem; - - .sv-clear-button { - color: #959da5; - font-size: 13px; - font-weight: 600; - } - - .sv-filter-box { - background-color: var(--color-neutral-1); - padding: 1rem; - margin-bottom: 1rem; - border-radius: 10px; - - label span { - color: var(--color-neutral-10); - font-size: 13px; - font-weight: 400; - } - } - - .sv-select-all-button { - color: var(--color-action-neutral-default); - font-size: 13px; - font-weight: 600; - } -} diff --git a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/components/SearchBar/_search_bar.scss b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/components/SearchBar/_search_bar.scss deleted file mode 100644 index 971df7ead54379..00000000000000 --- a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/components/SearchBar/_search_bar.scss +++ /dev/null @@ -1,10 +0,0 @@ -.sv-search { - height: 3.5rem; - width: 43.75rem; - - & + .sv-search-icon { - bottom: 1.313rem; - font-size: 1rem; - right: 1.5rem; - } -} diff --git a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/components/TicketTable/_ticket_table.scss b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/components/TicketTable/_ticket_table.scss deleted file mode 100644 index eecd589291e0f8..00000000000000 --- a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/components/TicketTable/_ticket_table.scss +++ /dev/null @@ -1,33 +0,0 @@ -.sv-table { - tbody { - td { - border-style: none; - color: #54555f; - } - - td:first-child { - border-radius: 0.625rem 0 0 0.625rem !important; - } - - td:last-child { - border-radius: 0 0.625rem 0.625rem 0 !important; - } - } - - thead { - background-color: #f7f7f8; - - th:first-child { - border-radius: 0.625rem 0 0 0.625rem !important; - } - - th:last-child { - border-radius: 0 0.625rem 0.625rem 0 !important; - } - } - - .ticket-name-link { - font-size: 1.125rem; - font-weight: 600; - } -} diff --git a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/components/_components.scss b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/components/_components.scss deleted file mode 100644 index edeb936aa2cc87..00000000000000 --- a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/components/_components.scss +++ /dev/null @@ -1,3 +0,0 @@ -@use './Filters/filter' as filter; -@use './SearchBar/search_bar' as searchBar; -@use './TicketTable/ticket_table' as ticketTable; diff --git a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/pages/_pages.scss b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/pages/_pages.scss deleted file mode 100644 index d851714cc11e6d..00000000000000 --- a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/pages/_pages.scss +++ /dev/null @@ -1 +0,0 @@ -@use './SecurityVulnerabilityPage/security_vulnerability_page' as page; diff --git a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/pages/routes/securityVulnerability.routes.jsx b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/pages/routes/securityVulnerability.routes.jsx deleted file mode 100644 index a65d3f6727c4c8..00000000000000 --- a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/pages/routes/securityVulnerability.routes.jsx +++ /dev/null @@ -1,20 +0,0 @@ -/** - * SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com - * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06 - */ - -import { Route, Routes } from 'react-router-dom'; -import SecurityVulnerabilityTicket from '../SecurityVulnerabilityTicket/SecurityVulnerabilityTicket'; -import SecurityVulnerabilityPage from '../SecurityVulnerabilityPage/SecurityVulnerabilityPage'; - -const SecurityVulnerabilityRoutes = () => { - return ( - - } /> - } /> - - ); -}; - -export default SecurityVulnerabilityRoutes; - diff --git a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/types/Ticket.ts b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/types/Ticket.ts deleted file mode 100644 index 001d9a83b8af5b..00000000000000 --- a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-custom-element/src/routes/security-vulnerability/types/Ticket.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com - * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06 - */ - -export interface Ticket { - id: number; - name: string; - category: string[]; - classification: string; - summary: string; - versions: string[]; - severity: string; - date: string; -} diff --git a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-site-initializer-code/site-initializer/style-books/customer-portal/frontend-tokens-values.json b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-site-initializer-code/site-initializer/style-books/customer-portal/frontend-tokens-values.json index 2e5a6abd95601b..bad217d52a2eb4 100644 --- a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-site-initializer-code/site-initializer/style-books/customer-portal/frontend-tokens-values.json +++ b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-site-initializer-code/site-initializer/style-books/customer-portal/frontend-tokens-values.json @@ -1,4 +1,16 @@ { + "borderRadiusLg": { + "cssVariableMapping": "border-radius-lg", + "value": "10px" + }, + "borderRadiusPill": { + "cssVariableMapping": "border-radius-pill", + "value": "48px" + }, + "borderRadiusSm": { + "cssVariableMapping": "border-radius-sm", + "value": "4px" + }, "boxShadowLg": { "cssVariableMapping": "box-shadow-lg", "value": "var(--elevation-fluffy-1) rgba(0, 54, 156, 0.12);" @@ -65,7 +77,7 @@ }, "colorActionNeutralDisabled": { "cssVariableMapping": "color-action-neutral-disabled", - "value": "#2B3A4B80" + "value": "#959DA5" }, "colorActionNeutralHover": { "cssVariableMapping": "color-action-neutral-hover", @@ -317,11 +329,11 @@ }, "colorNeutral1": { "cssVariableMapping": "color-neutral-1", - "value": "#F8F8F9" + "value": "#F7F7F8" }, "colorNeutral10": { "cssVariableMapping": "color-neutral-10", - "value": "#272833" + "value": "#282934" }, "colorNeutral2": { "cssVariableMapping": "color-neutral-2", @@ -345,11 +357,11 @@ }, "colorNeutral7": { "cssVariableMapping": "color-neutral-7", - "value": "#6C6C76" + "value": "#6C6C75" }, "colorNeutral8": { "cssVariableMapping": "color-neutral-8", - "value": "#555660" + "value": "#54555F" }, "colorNeutral9": { "cssVariableMapping": "color-neutral-9", @@ -373,7 +385,7 @@ }, "colorStateErrorLighten2": { "cssVariableMapping": "color-state-error-lighten-2", - "value": "#f8e4e4" + "value": "#FBE3E3" }, "colorStateInfo": { "cssVariableMapping": "color-state-info", @@ -393,7 +405,7 @@ }, "colorStateInfoLighten2": { "cssVariableMapping": "color-state-info-lighten-2", - "value": "#e5e8f1" + "value": "#E6EBF5" }, "colorStateSuccess": { "cssVariableMapping": "color-state-success", @@ -433,7 +445,7 @@ }, "colorStateWarningLighten2": { "cssVariableMapping": "color-state-warning-lighten-2", - "value": "#f3e7e4" + "value": "#F7EAE0" }, "fontFamilyBase": { "cssVariableMapping": "font-family-base", diff --git a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-site-initializer-quickstart/site-initializer/layouts/09_security-vulnerability/page-definition.json b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-site-initializer-quickstart/site-initializer/layouts/09_security-vulnerability/page-definition.json index 4bdcf6fe80307f..95a180dd8781bb 100644 --- a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-site-initializer-quickstart/site-initializer/layouts/09_security-vulnerability/page-definition.json +++ b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-site-initializer-quickstart/site-initializer/layouts/09_security-vulnerability/page-definition.json @@ -25,7 +25,7 @@ "definition": { "widgetInstance": { "widgetConfig": { - "properties": "route=securityVulnerability" + "properties": "route=securityVulnerabilities" }, "widgetName": "[$CLIENT_EXTENSION_ENTRY_ERC:LXC:liferay-customer-custom-element$]" } diff --git a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-site-initializer-quickstart/site-initializer/layouts/09_security-vulnerability/page.json b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-site-initializer-quickstart/site-initializer/layouts/09_security-vulnerability/page.json index 42f4a5a66683f3..5ed08f1368cdd9 100644 --- a/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-site-initializer-quickstart/site-initializer/layouts/09_security-vulnerability/page.json +++ b/workspaces/liferay-customer-workspace/client-extensions/liferay-customer-site-initializer-quickstart/site-initializer/layouts/09_security-vulnerability/page.json @@ -1,7 +1,8 @@ { + "friendlyURL": "/security-vulnerabilities", "hidden": false, "name_i18n": { - "en_US": "Security Vulnerability" + "en_US": "Security Vulnerabilities" }, "permissions": [ {