Merge pull request #52 from TheTedAdams/product-errata-bug-fixes

Product errata bug fixes
This commit is contained in:
resf-prow[bot] 2022-10-31 23:06:08 +00:00 committed by GitHub
commit b9ad1adc4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 75 additions and 23 deletions

View File

@ -264,7 +264,7 @@ export const Overview = () => {
</HStack>
<HStack>
<FormControl width="180px" flexShrink={0} flexGrow={1}>
<FormLabel fontSize="sm">After</FormLabel>
<FormLabel fontSize="sm">From</FormLabel>
<Input
type="date"
variant="filled"
@ -297,7 +297,7 @@ export const Overview = () => {
/>
</FormControl>
<FormControl width="180px" flexShrink={0} flexGrow={1}>
<FormLabel fontSize="sm">Before</FormLabel>
<FormLabel fontSize="sm">To</FormLabel>
<Input
type="date"
variant="filled"
@ -321,7 +321,9 @@ export const Overview = () => {
const [year, month, date] = newVal.split('-').map(Number);
setFilterBefore(new Date(year, month - 1, date));
setFilterBefore(
new Date(year, month - 1, date, 23, 59, 59, 59) // Set to 1ms prior to midnight to be inclusive of selected date
);
}}
/>
</FormControl>
@ -404,7 +406,7 @@ export const Overview = () => {
) : (
<Box backgroundColor="white" boxShadow="base">
<TableContainer>
<Table size="sm" variant="striped">
<Table size="sm">
<Thead>
<Tr>
<Th {...stickyProps} width="36px" />
@ -412,12 +414,7 @@ export const Overview = () => {
<Th {...stickyProps}>Synopsis</Th>
<Th {...stickyProps}>Type / Severity</Th>
<Th {...stickyProps}>Products</Th>
<Th {...stickyProps}>
<HStack spacing={1}>
<Text>Issue Date</Text>
<ChevronDownIcon />
</HStack>
</Th>
<Th {...stickyProps}>Issue Date</Th>
</Tr>
</Thead>
<Tbody>
@ -428,12 +425,16 @@ export const Overview = () => {
</Td>
</Tr>
)}
{advisories?.map((a) => (
{advisories?.map((a, idx) => (
<Tr key={a.name}>
<Td textAlign="center" pr={0}>
<Td
backgroundColor={idx % 2 ? 'gray.50' : undefined}
textAlign="center"
pr={0}
>
{severityToBadge(a.severity)}
</Td>
<Td>
<Td backgroundColor={idx % 2 ? 'gray.50' : undefined}>
<Link
className="text-peridot-primary visited:text-purple-500"
to={`/${a.name}`}
@ -441,20 +442,22 @@ export const Overview = () => {
{a.name}
</Link>
</Td>
<Td>
<Td backgroundColor={idx % 2 ? 'gray.50' : undefined}>
{a.synopsis?.replace(
/^(Critical|Important|Moderate|Low): /,
''
)}
</Td>
<Td>
<Td backgroundColor={idx % 2 ? 'gray.50' : undefined}>
{typeToText(a.type)}
{a.type === V1AdvisoryType.Security
? ` / ${severityToText(a.severity)}`
: ''}
</Td>
<Td>{a.affectedProducts?.join(', ')}</Td>
<Td>
<Td backgroundColor={idx % 2 ? 'gray.50' : undefined}>
{a.affectedProducts?.join(', ')}
</Td>
<Td backgroundColor={idx % 2 ? 'gray.50' : undefined}>
{Intl.DateTimeFormat(undefined, {
day: '2-digit',
month: 'short',

View File

@ -30,7 +30,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
import { Box, HStack, Text } from '@chakra-ui/react';
import { Box, HStack, Text, Link as ChakraLink } from '@chakra-ui/react';
import { RESFLogo } from 'common/ui/RESFLogo';
import React from 'react';
import { Route, Switch } from 'react-router';
@ -50,7 +50,7 @@ export const Root = () => {
alignItems="stretch"
>
<Box
background={`linear-gradient(to right, ${COLOR_RESF_GREEN}, ${COLOR_RESF_BLUE})`}
background={`linear-gradient(to bottom right, ${COLOR_RESF_GREEN}, ${COLOR_RESF_BLUE})`}
display="flex"
flexDirection="row"
alignItems="center"
@ -79,6 +79,40 @@ export const Root = () => {
<Route path="/:id" component={ShowErrata} />
</Switch>
</Box>
<Box
px="4"
// backgroundColor="#10859E"
background={`linear-gradient(to top left, ${COLOR_RESF_GREEN}, ${COLOR_RESF_BLUE})`}
color="white"
display="flex"
height="50px"
>
<ChakraLink
href="/api/v2/advisories:rss"
isExternal
display="flex"
alignItems="center"
my="auto"
>
<Box
as="svg"
viewBox="0 0 24 24"
width="18px"
height="18px"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
display="block"
mr={1.5}
>
<path d="M4 11a9 9 0 019 9M4 4a16 16 0 0116 16" />
<circle cx="5" cy="19" r="1" />
</Box>
<span>RSS</span>
</ChakraLink>
</Box>
</Box>
);
};

View File

@ -53,8 +53,15 @@ import {
UnorderedList,
VStack,
} from '@chakra-ui/react';
import { severityToBadge, typeToText } from 'apollo/ui/src/enumToText';
import { V1Advisory } from 'bazel-bin/apollo/proto/v1/client_typescript';
import {
severityToBadge,
severityToText,
typeToText,
} from 'apollo/ui/src/enumToText';
import {
V1Advisory,
V1AdvisoryType,
} from 'bazel-bin/apollo/proto/v1/client_typescript';
import { reqap } from 'common/ui/reqap';
import React, { useState } from 'react';
import { RouteComponentProps } from 'react-router';
@ -239,6 +246,11 @@ export const ShowErrata = (props: ShowErrataProps) => {
<Text>
<b>Type:</b> {typeToText(errata.type)}
</Text>
{errata.type === V1AdvisoryType.Security && (
<Text>
<b>Severity:</b> {severityToText(errata.severity)}
</Text>
)}
<Box>
<Text fontWeight="bold">
Affected Product

View File

@ -31,7 +31,10 @@
*/
import { Box, Tag, TagProps } from '@chakra-ui/react';
import { AdvisorySeverity, V1AdvisoryType } from 'bazel-bin/apollo/proto/v1/client_typescript';
import {
AdvisorySeverity,
V1AdvisoryType,
} from 'bazel-bin/apollo/proto/v1/client_typescript';
import React from 'react';
export const severityToText = (severity?: AdvisorySeverity): string => {
@ -83,7 +86,7 @@ export const severityToBadge = (
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
>
<g fill="#F7941D">
<g fill="#F47B2A">
<path d="M22.2 19.2l-8.8-16c-.2-.3-.5-.6-.8-.7-.3-.1-.7-.1-1.1 0-.3.1-.6.4-.8.7l-8.8 16c-.3.5-.2 1 0 1.5.3.5.8.7 1.3.8h17.7c.3 0 .5-.1.8-.2.2-.1.4-.3.5-.6.2-.4.2-1 0-1.5zm-18.8.6L12 4.3l8.6 15.5H3.4z" />
<path d="M12 15.7c-.2 0-.4.1-.6.2-.2.2-.2.4-.2.6v.8c0 .3.2.6.4.7.3.1.6.1.8 0s.4-.4.4-.7v-.8c0-.2-.1-.4-.2-.6-.2-.1-.4-.2-.6-.2zM11.2 9v5c0 .3.2.6.4.7.3.1.6.1.8 0 .3-.1.4-.4.4-.7V9c0-.3-.2-.6-.4-.7-.3-.1-.6-.1-.8 0s-.4.4-.4.7z" />
</g>