Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SVOM Mission Page #2499

Closed
wants to merge 74 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
112bac3
Bump @architect/plugin-lambda-invoker from 2.0.0 to 2.0.1
dependabot[bot] Jul 22, 2024
794d687
Federal should be lowercase
lpsinger Jul 25, 2024
0c2c799
Bump typescript from 5.5.3 to 5.5.4
dependabot[bot] Jul 29, 2024
e31f795
Bump husky from 9.1.1 to 9.1.3
dependabot[bot] Jul 29, 2024
b67d093
SVOM Mission Page
Vidushi-GitHub Jul 30, 2024
2f6e340
Update app/routes/missions.svom/route.mdx
Vidushi-GitHub Aug 1, 2024
192d8cf
Update app/routes/missions.svom/route.mdx
Vidushi-GitHub Aug 1, 2024
9cef823
news item for circulars over kafka
jracusin Jun 14, 2024
a7a733a
added schema update to announcement
jracusin Jul 29, 2024
b7eee8c
add heartbeat topic
jracusin Jul 29, 2024
2dde491
reorder announcements
jracusin Jul 30, 2024
c538a74
Update app/routes/news._index.mdx
jracusin Jul 30, 2024
81515c3
add link to heartbeat FAQ in announcement (#2500)
jracusin Jul 31, 2024
d5e4f02
Bump lint-staged from 15.2.7 to 15.2.8
dependabot[bot] Aug 5, 2024
e6fa106
Bump isbot from 5.1.13 to 5.1.14
dependabot[bot] Aug 5, 2024
704be8c
Bump @types/node from 20.14.11 to 22.1.0
dependabot[bot] Aug 5, 2024
e184724
Bump the remix group with 6 updates
dependabot[bot] Aug 5, 2024
a931d0a
Bump @opensearch-project/opensearch from 2.10.0 to 2.11.0
dependabot[bot] Aug 5, 2024
280cd9a
Bump autoprefixer from 10.4.19 to 10.4.20
dependabot[bot] Aug 5, 2024
93cee51
Bump the remix group with 6 updates
dependabot[bot] Aug 5, 2024
f2b9079
Add user group management (#2268)
dakota002 Aug 6, 2024
a9afafd
Bump @babel/preset-env from 7.24.8 to 7.25.3
dependabot[bot] Aug 5, 2024
9f7cb71
Bump @playwright/test from 1.45.2 to 1.46.0
dependabot[bot] Aug 5, 2024
30ab6e7
Bump husky from 9.1.3 to 9.1.4
dependabot[bot] Aug 5, 2024
1f63cfc
Bump @nasa-gcn/architect-plugin-search from 1.3.0 to 1.4.0
dependabot[bot] Aug 7, 2024
6d2f492
Bump @testing-library/jest-dom from 6.4.6 to 6.4.8
dependabot[bot] Aug 7, 2024
f29383d
Circulars - Add Documentation for the Circulars Archive Search Functi…
tylerbarna Aug 7, 2024
2ecc104
Refactor duplicate function unmarshallTrigger
lpsinger Aug 7, 2024
4a719b6
Bump @types/node from 22.1.0 to 22.2.0
dependabot[bot] Aug 12, 2024
10bb768
Bump downshift from 9.0.6 to 9.0.8
dependabot[bot] Aug 12, 2024
e2d8e94
updated synonymGroups table-stream with tests (#2505)
Courey Aug 12, 2024
8695d0c
Bump @octokit/rest from 21.0.0 to 21.0.2
dependabot[bot] Aug 19, 2024
ae626cb
Bump the remix group with 6 updates
dependabot[bot] Aug 19, 2024
e449dbc
Bump spin-delay from 2.0.0 to 2.0.1
dependabot[bot] Aug 19, 2024
e82abc1
Bump @types/node from 22.2.0 to 22.5.0
dependabot[bot] Aug 26, 2024
85201cc
Bump micromatch from 4.0.7 to 4.0.8
dependabot[bot] Aug 26, 2024
cb8e07b
Bump isbot from 5.1.14 to 5.1.17
dependabot[bot] Aug 26, 2024
f50e361
Bump unzip-stream from 0.3.1 to 0.3.4
dependabot[bot] Aug 26, 2024
9db490f
Adds docs for user group management
dakota002 Aug 21, 2024
7670c8a
Update app/routes/docs.admin.md
dakota002 Aug 27, 2024
5d54375
Update app/routes/docs.tsx
dakota002 Aug 27, 2024
76df65e
Move the admin tab lower
dakota002 Aug 27, 2024
8d2e0b6
Adds note
dakota002 Aug 28, 2024
baeeae3
Pass codecov token to nodejs CI workflow
lpsinger Sep 3, 2024
ad1f6ff
Pass only necessary secrets to workflow
lpsinger Sep 3, 2024
bf55c04
Bump @playwright/test from 1.46.0 to 1.46.1
dependabot[bot] Sep 2, 2024
e5af1c5
Bump @babel/preset-env from 7.25.3 to 7.25.4
dependabot[bot] Aug 26, 2024
3bc52e6
Puts test message behind a captcha (#2547)
dakota002 Sep 4, 2024
dfc0190
Prefer deduplication when installing packages
lpsinger Sep 4, 2024
484b2e0
Fix broken Circulars hyperlinks by pinning Remix version
lpsinger Sep 4, 2024
91637d1
Add direct dependency on esbuild
lpsinger Sep 4, 2024
a30fce2
Always send new versions of GCN Circulars over Kafka
lpsinger Sep 4, 2024
29091c2
Updates the change request functions to automatically close the corre…
dakota002 Sep 5, 2024
8d1c147
Bump lint-staged from 15.2.8 to 15.2.10
dependabot[bot] Sep 9, 2024
e0f7ee1
Adds option to redistribute email for circulars (#2569)
dakota002 Sep 9, 2024
8fe4360
Bump husky from 9.1.4 to 9.1.6
dependabot[bot] Sep 16, 2024
1fd4c66
Bump @types/node from 22.5.0 to 22.5.5
dependabot[bot] Sep 16, 2024
a3629f6
Bump vite
dependabot[bot] Sep 17, 2024
d512292
clarify conditions for when most_probable_direction is present
jessiethw Sep 13, 2024
acd6398
Bump serve-static and express
dependabot[bot] Sep 16, 2024
7901ced
Set IceCube notice field names in a code font
lpsinger Sep 18, 2024
4c63ea4
Updates the change request form to populate with previously requested…
dakota002 Sep 18, 2024
70062f1
Bump rollup
dependabot[bot] Sep 24, 2024
2daa154
Bump @testing-library/react from 16.0.0 to 16.0.1
dependabot[bot] Sep 23, 2024
f51f32d
Moves the definition of the send function to resolve issues with kafk…
dakota002 Sep 25, 2024
b0991da
correct typo
tylerbarna Sep 25, 2024
62daed7
Bump typescript from 5.5.4 to 5.6.2
dependabot[bot] Sep 30, 2024
92679ad
Bump eslint from 8.56.0 to 8.57.1
dependabot[bot] Sep 30, 2024
2612892
update burstcube status
jracusin Oct 4, 2024
c075dcc
remove unused import
jracusin Oct 7, 2024
10d9648
Bump @types/color-convert from 2.0.1 to 2.0.4
dependabot[bot] Oct 7, 2024
716f6a0
Circulars - Lucene search documentation (#2502)
tylerbarna Oct 9, 2024
6a37732
Add lvk notice unique ID documentation
blaufuss Oct 4, 2024
6ce4341
feedback added
Oct 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ on:
jobs:
node:
uses: nasa-gcn/.github/.github/workflows/node.yml@main
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
playwright:
timeout-minutes: 60
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
prefer-dedupe=true
185 changes: 185 additions & 0 deletions __tests__/table-streams/synonyms.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
import { tables } from '@architect/functions'
import { search } from '@nasa-gcn/architect-functions-search'
import type { DynamoDBRecord } from 'aws-lambda'

import type { Synonym } from '~/routes/synonyms/synonyms.lib'
import { handler } from '~/table-streams/synonyms/index'

const synonymId = 'abcde-abcde-abcde-abcde-abcde'
const eventId = 'GRB 123'
const existingEventId = 'GRB 99999999'

const putData = {
index: 'synonym-groups',
id: synonymId,
body: {
synonymId,
eventIds: [] as string[],
},
}

jest.mock('@nasa-gcn/architect-functions-search', () => ({
search: jest.fn(),
}))

jest.mock('@architect/functions', () => ({
tables: jest.fn(),
}))

const mockIndex = jest.fn()
const mockDelete = jest.fn()
const mockQuery = jest.fn()

const mockStreamEvent = {
Records: [
{
eventID: '1',
eventName: 'INSERT',
eventVersion: '1.0',
eventSource: 'aws:dynamodb',
awsRegion: 'us-west-2',
dynamodb: {
Keys: {
synonymId: {
S: synonymId,
},
eventId: {
S: eventId,
},
},
NewImage: {
synonymId: {
S: synonymId,
},
eventId: {
S: eventId,
},
},
SequenceNumber: '111',
SizeBytes: 26,
StreamViewType: 'NEW_IMAGE',
},
eventSourceARN:
'arn:aws:dynamodb:us-west-2:123456789012:table/synonym-groups/stream/2020-01-01T00:00:00.000',
} as DynamoDBRecord,
],
}

afterEach(() => {
jest.clearAllMocks()
})

describe('testing put synonymGroup table-stream', () => {
test('insert new synonym group', async () => {
const mockItems = [{ synonymId, eventId }]
const mockClient = {
synonyms: {
query: mockQuery,
},
}
mockQuery.mockResolvedValue({ Items: mockItems })
;(tables as unknown as jest.Mock).mockResolvedValue(mockClient)
putData.body.eventIds = [eventId]
;(search as unknown as jest.Mock).mockReturnValue({
index: mockIndex,
delete: mockDelete,
})

await handler(mockStreamEvent)

expect(mockIndex).toHaveBeenCalledWith(putData)
})

test('insert into existing synonym group', async () => {
const mockItems = [
{ synonymId, eventId: existingEventId },
{ synonymId, eventId },
]
const mockClient = {
synonyms: {
query: mockQuery,
},
}
mockQuery.mockResolvedValue({ Items: mockItems })
;(tables as unknown as jest.Mock).mockResolvedValue(mockClient)
putData.body.eventIds = [existingEventId, eventId]
;(search as unknown as jest.Mock).mockReturnValue({
index: mockIndex,
delete: mockDelete,
})

await handler(mockStreamEvent)

expect(mockIndex).toHaveBeenCalledWith(putData)
})

test('insert only once', async () => {
const mockItems = [
{ synonymId, eventId: existingEventId },
{ synonymId, eventId },
]
const mockClient = {
synonyms: {
query: mockQuery,
},
}
mockQuery.mockResolvedValue({ Items: mockItems })
;(tables as unknown as jest.Mock).mockResolvedValue(mockClient)
putData.body.eventIds = [existingEventId, eventId]
;(search as unknown as jest.Mock).mockReturnValue({
index: mockIndex,
delete: mockDelete,
})

await handler(mockStreamEvent)

expect(mockIndex).toHaveBeenCalledWith(putData)
})
})

describe('testing delete synonymGroup table-stream', () => {
test('remove one eventId while leaving others', async () => {
const mockItems = [{ synonymId, eventId: existingEventId }]
const mockClient = {
synonyms: {
query: mockQuery,
},
}
mockQuery.mockResolvedValue({ Items: mockItems })
;(tables as unknown as jest.Mock).mockResolvedValue(mockClient)
mockStreamEvent.Records[0].eventName = 'REMOVE'
putData.body.eventIds = [existingEventId]
;(search as unknown as jest.Mock).mockReturnValue({
index: mockIndex,
delete: mockDelete,
})

await handler(mockStreamEvent)

expect(mockIndex).toHaveBeenCalledWith(putData)
})

test('remove final synonym and delete synonym group', async () => {
const mockItems = [] as Synonym[]
const mockClient = {
synonyms: {
query: mockQuery,
},
}
mockQuery.mockResolvedValue({ Items: mockItems })
;(tables as unknown as jest.Mock).mockResolvedValue(mockClient)
mockStreamEvent.Records[0].eventName = 'REMOVE'
const deleteData = {
index: 'synonym-groups',
id: synonymId,
}
;(search as unknown as jest.Mock).mockReturnValue({
index: mockIndex,
delete: mockDelete,
})

await handler(mockStreamEvent)

expect(mockDelete).toHaveBeenCalledWith(deleteData)
})
})
175 changes: 175 additions & 0 deletions app/components/UserLookup.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
/*!
* Copyright © 2023 United States Government as represented by the
* Administrator of the National Aeronautics and Space Administration.
* All Rights Reserved.
*
* SPDX-License-Identifier: Apache-2.0
*/
import { useFetcher } from '@remix-run/react'

Check warning on line 8 in app/components/UserLookup.tsx

View check run for this annotation

Codecov / codecov/patch

app/components/UserLookup.tsx#L8

Added line #L8 was not covered by tests
import type { action } from 'app/routes/api.users'
import classnames from 'classnames'

Check warning on line 10 in app/components/UserLookup.tsx

View check run for this annotation

Codecov / codecov/patch

app/components/UserLookup.tsx#L10

Added line #L10 was not covered by tests
import type { UseComboboxProps, UseComboboxStateChange } from 'downshift'
import { useCombobox } from 'downshift'
import { debounce } from 'lodash'
import { useCallback, useEffect, useState } from 'react'

Check warning on line 14 in app/components/UserLookup.tsx

View check run for this annotation

Codecov / codecov/patch

app/components/UserLookup.tsx#L12-L14

Added lines #L12 - L14 were not covered by tests

import { formatAuthor } from '~/routes/circulars/circulars.lib'

Check warning on line 16 in app/components/UserLookup.tsx

View check run for this annotation

Codecov / codecov/patch

app/components/UserLookup.tsx#L16

Added line #L16 was not covered by tests

import loaderImage from 'nasawds/src/img/loader.gif'

Check warning on line 18 in app/components/UserLookup.tsx

View check run for this annotation

Codecov / codecov/patch

app/components/UserLookup.tsx#L18

Added line #L18 was not covered by tests

export interface UserLookup {
sub?: string
email: string
name?: string
affiliation?: string
}

interface UserComboBoxProps
extends Omit<
UseComboboxProps<UserLookup>,
'items' | 'onInputValueChange' | 'itemToString'
> {
disabled?: boolean
className?: string
group?: string
onChange?: () => void
}

interface UserComboBoxHandle {
reset?: () => void
}

export function UserLookupComboBox({

Check warning on line 42 in app/components/UserLookup.tsx

View check run for this annotation

Codecov / codecov/patch

app/components/UserLookup.tsx#L42

Added line #L42 was not covered by tests
disabled,
className,
group,
onChange,
// ref,
...props
}: UserComboBoxProps & UserComboBoxHandle) {
const fetcher = useFetcher<typeof action>()
const [items, setItems] = useState<UserLookup[]>([])

Check warning on line 51 in app/components/UserLookup.tsx

View check run for this annotation

Codecov / codecov/patch

app/components/UserLookup.tsx#L50-L51

Added lines #L50 - L51 were not covered by tests

useEffect(() => {

Check warning on line 53 in app/components/UserLookup.tsx

View check run for this annotation

Codecov / codecov/patch

app/components/UserLookup.tsx#L53

Added line #L53 was not covered by tests
setItems(fetcher.data?.users ?? [])
}, [fetcher.data])

if (onChange) onChange()

// eslint-disable-next-line react-hooks/exhaustive-deps
const onInputValueChange = useCallback(

Check warning on line 60 in app/components/UserLookup.tsx

View check run for this annotation

Codecov / codecov/patch

app/components/UserLookup.tsx#L60

Added line #L60 was not covered by tests
debounce(
({ inputValue, isOpen }: UseComboboxStateChange<UserLookup>) => {

Check warning on line 62 in app/components/UserLookup.tsx

View check run for this annotation

Codecov / codecov/patch

app/components/UserLookup.tsx#L62

Added line #L62 was not covered by tests
if (inputValue && isOpen) {
const data = new FormData()
data.set('filter', inputValue.split(' ')[0])
data.set('intent', 'filter')

Check warning on line 66 in app/components/UserLookup.tsx

View check run for this annotation

Codecov / codecov/patch

app/components/UserLookup.tsx#L64-L66

Added lines #L64 - L66 were not covered by tests
data.set('group', group ?? '')
fetcher.submit(data, { method: 'POST', action: '/api/users' })

Check warning on line 68 in app/components/UserLookup.tsx

View check run for this annotation

Codecov / codecov/patch

app/components/UserLookup.tsx#L68

Added line #L68 was not covered by tests
} else {
setItems([])

Check warning on line 70 in app/components/UserLookup.tsx

View check run for this annotation

Codecov / codecov/patch

app/components/UserLookup.tsx#L70

Added line #L70 was not covered by tests
}
},
500,
{ trailing: true }
),
[]
)

const {
reset,
isOpen,
highlightedIndex,
selectedItem,
getMenuProps,
getInputProps,
getItemProps,
getToggleButtonProps,
} = useCombobox<UserLookup>({

Check warning on line 88 in app/components/UserLookup.tsx

View check run for this annotation

Codecov / codecov/patch

app/components/UserLookup.tsx#L88

Added line #L88 was not covered by tests
items,
onInputValueChange,
itemToString(item) {

Check warning on line 91 in app/components/UserLookup.tsx

View check run for this annotation

Codecov / codecov/patch

app/components/UserLookup.tsx#L91

Added line #L91 was not covered by tests
return item ? formatAuthor(item) : ''
},
...props,
})

const loading = fetcher.state === 'submitting'
const pristine = Boolean(selectedItem)

Check warning on line 98 in app/components/UserLookup.tsx

View check run for this annotation

Codecov / codecov/patch

app/components/UserLookup.tsx#L97-L98

Added lines #L97 - L98 were not covered by tests

return (

Check warning on line 100 in app/components/UserLookup.tsx

View check run for this annotation

Codecov / codecov/patch

app/components/UserLookup.tsx#L100

Added line #L100 was not covered by tests
<div
data-testid="combo-box"
data-enhanced="true"
className={classnames('usa-combo-box', className, {
'usa-combo-box--pristine': pristine || loading,
})}
>
<input
autoCapitalize="off"
autoComplete="off"
className="usa-combo-box__input"
disabled={disabled}
{...getInputProps()}
// Funky escape sequence is a zero-width character to prevent Safari
// from attempting to autofill the user's own email address, which
// would be triggered by the presence of the string "email" in the
// placeholder.
placeholder="Name or em&#8203;ail address of user"
/>
<span className="usa-combo-box__clear-input__wrapper" tabIndex={-1}>
<button
type="button"
className="usa-combo-box__clear-input"
aria-label="Clear the select contents"
style={
loading ? { backgroundImage: `url('${loaderImage}')` } : undefined
}
onClick={() => reset()}

Check warning on line 128 in app/components/UserLookup.tsx

View check run for this annotation

Codecov / codecov/patch

app/components/UserLookup.tsx#L128

Added line #L128 was not covered by tests
hidden={(!pristine || disabled) && !loading}
disabled={disabled}
>
&nbsp;
</button>
</span>
<span className="usa-combo-box__input-button-separator">&nbsp;</span>
<span className="usa-combo-box__toggle-list__wrapper" tabIndex={-1}>
<button
type="button"
className="usa-combo-box__toggle-list"
{...getToggleButtonProps()}
>
&nbsp;
</button>
</span>
<ul
{...getMenuProps()}
className="usa-combo-box__list"
role="listbox"
hidden={!isOpen}
>
{isOpen &&
(items.length ? (
items.map((item, index) => (
<li

Check warning on line 154 in app/components/UserLookup.tsx

View check run for this annotation

Codecov / codecov/patch

app/components/UserLookup.tsx#L153-L154

Added lines #L153 - L154 were not covered by tests
key={item.sub}
className={classnames('usa-combo-box__list-option', {
'usa-combo-box__list-option--focused':
index === highlightedIndex,
'usa-combo-box__list-option--selected':
selectedItem?.sub === item.sub,
})}
{...getItemProps({ item, index })}
>
{formatAuthor(item)}
</li>
))
) : (
<li className="usa-combo-box__list-option--no-results">
No results found
</li>
))}
</ul>
</div>
)
}
4 changes: 2 additions & 2 deletions app/email-incoming/circulars/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
} from '~/lib/cognito.server'
import { sendEmail } from '~/lib/email.server'
import { hostname, origin } from '~/lib/env.server'
import { group, putRaw } from '~/routes/circulars/circulars.server'
import { putRaw, submitterGroup } from '~/routes/circulars/circulars.server'

Check warning on line 29 in app/email-incoming/circulars/index.ts

View check run for this annotation

Codecov / codecov/patch

app/email-incoming/circulars/index.ts#L29

Added line #L29 was not covered by tests

interface UserData {
email: string
Expand Down Expand Up @@ -120,7 +120,7 @@
async function getCognitoUserData(
userEmail: string
): Promise<UserData | undefined> {
const users = await listUsersInGroup(group)
const users = await listUsersInGroup(submitterGroup)

Check warning on line 123 in app/email-incoming/circulars/index.ts

View check run for this annotation

Codecov / codecov/patch

app/email-incoming/circulars/index.ts#L123

Added line #L123 was not covered by tests
const Attributes = users.find(
({ Attributes }) =>
extractAttributeRequired(Attributes, 'email') == userEmail
Expand Down
Loading
Loading