Skip to content

Commit

Permalink
Fix inconsistent date-times
Browse files Browse the repository at this point in the history
  • Loading branch information
dkuc committed Dec 3, 2021
1 parent 4ff4a8f commit 24416d6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/Components/SigDetailsTable/SigDetailsTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const SigDetailsTable = ({ ruleName, affectedCount }) => {
Offset:${match.stringOffset}
Match Data: ${match.stringData}
Match Identifier: ${match.stringIdentifier}
Match Scan Date: ${new Date(match.scanDate)}
Match Scan Date: ${new Date(match.scanDate).toUTCString()}
${match.metadata ? expandMatchMetadata(JSON.parse(match.metadata)) : ''}
${host.matches.length > 1 && key !== host.matches.length - 1 ? `~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
` : ''}`).join('')}`}
Expand Down
10 changes: 5 additions & 5 deletions src/Components/SysDetailsTable/SysDetailsTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { totalMatchesTitle } from '../Common';
import { useIntl } from 'react-intl';
import { useQuery } from '@apollo/client';

const sortIndices = { 1: 'NAME', 2: 'MATCHES', 3: 'CREATED_AT', 4: 'MATCH_COUNT' };
const sortIndices = { 1: 'NAME', 2: 'LAST_STATUS', 3: 'LAST_MATCH_DATE', 4: 'MATCH_COUNT' };
const orderBy = ({ index, direction }) => `${sortIndices[index]}_${direction === SortByDirection.asc ? 'ASC' : 'DESC'}`;

const tableReducer = (state, action) => {
Expand All @@ -48,7 +48,7 @@ const SysDetailsTable = ({ systemId }) => {
tableVars: {
limit: 10,
offset: 0,
orderBy: 'CREATED_AT_ASC',
orderBy: 'LAST_MATCH_DATE_ASC',
ruleName: '',
systemId
},
Expand Down Expand Up @@ -100,7 +100,7 @@ const SysDetailsTable = ({ systemId }) => {
Offset:${match.stringOffset}
Match Data: ${match.stringData}
Match Identifier: ${match.stringIdentifier}
Match Scan Date: ${new Date(match.scanDate)}
Match Scan Date: ${new Date(match.scanDate).toUTCString()}
${match.metadata ? expandMatchMetadata(JSON.parse(match.metadata)) : ''}
${host.matches.length > 1 && key !== host.matches.length - 1 ? `~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
` : ''}`).join('')}`}
Expand All @@ -114,8 +114,8 @@ ${host.matches.length > 1 && key !== host.matches.length - 1 ? `~~~~~~~~~~~~~~~~
isOpen: false,
cells: [
{ title: <span>{data.name}</span> },
{ title: <StatusLabel isDisabled={data.isDisabled} hasMatch={data.hasMatch} displayMatch /> },
{ title: <DateFormat date={new Date(data.createdAt)} type='onlyDate' /> },
{ title: <StatusLabel isDisabled={data.isDisabled} hasMatch={data.lastStatus} displayMatch /> },
{ title: <DateFormat date={new Date(data.lastMatchDate)} type='onlyDate' /> },
{ title: <span>{data.matchCount?.toLocaleString()}</span> }

]
Expand Down
2 changes: 1 addition & 1 deletion src/Routes/Systems/Details.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const Details = () => {
</GridItem>
<GridItem span={4}>
{detailBlock(intl.formatMessage(messages.lastScan),
<DateFormat date={new Date(sysData.updated)} type="exact" />)}
<DateFormat date={new Date(sysData.lastScanDate)} type="exact" />)}
</GridItem>
<GridItem span={4}>
{detailBlock(totalMatchesTitle({ tooltip: intl.formatMessage(messages.totalMatchesNote),
Expand Down
5 changes: 3 additions & 2 deletions src/operations/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ QuerySysPage($offset: Int = 0, $limit: Int = 10, $orderBy: [HostsOrderBy!], $nam
export const GET_SYSTEMS_DETAILS_PAGE = gql`query QuerySysDetailsPage($name: String) {
hosts(condition: {displayName: $name}) {
nodes {
updated
lastScanDate
displayName
id
lastMatchDate
Expand Down Expand Up @@ -140,7 +140,8 @@ export const GET_SYSTEMS_DETAILS_TABLE_PAGE = gql`query QuerySysDetailsPage(
ruleName: $ruleName
) {
matchCount
createdAt
lastMatchDate
lastStatus
matches {
stringOffset
stringIdentifier
Expand Down

0 comments on commit 24416d6

Please sign in to comment.