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

add mission table #2884

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

jracusin
Copy link
Contributor

Description

Adds mission table summarizing all Notice producer missions including their mission status, GCN classic archive or if they're available in GCN Kafka. It also moves archival missions to an archival side menu sub page.

Related Issue(s)

Resolves #2849 and #2850

@jracusin
Copy link
Contributor Author

Screenshot 2025-02-11 at 3 23 32 PM

Copy link

codecov bot commented Feb 11, 2025

Codecov Report

Attention: Patch coverage is 0% with 32 lines in your changes missing coverage. Please review.

Project coverage is 5.92%. Comparing base (8774529) to head (be01fcf).
Report is 15 commits behind head on main.

Files with missing lines Patch % Lines
app/components/SelectedAlertShortcutLink.tsx 0.00% 13 Missing ⚠️
app/root.tsx 0.00% 7 Missing ⚠️
app/routes/user.email.edit.tsx 0.00% 5 Missing ⚠️
app/routes/quickstart.alerts.tsx 0.00% 3 Missing ⚠️
...ents/NoticeTypeCheckboxes/NoticeTypeCheckboxes.tsx 0.00% 2 Missing ⚠️
app/components/NoticeTypeCheckboxes/Notices.ts 0.00% 1 Missing ⚠️
app/routes/missions.tsx 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##            main   #2884      +/-   ##
========================================
- Coverage   5.93%   5.92%   -0.02%     
========================================
  Files        171     173       +2     
  Lines       4329    4356      +27     
  Branches     474     486      +12     
========================================
+ Hits         257     258       +1     
- Misses      4070    4096      +26     
  Partials       2       2              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dakota002
Copy link
Contributor

dakota002 commented Feb 11, 2025

@jracusin I added those links, please try it locally as well and let me know if there is anything you want me to change. From your branch, you should be able to just run git pull and get my changes. I already see how I can refactor this a bit too

@jracusin
Copy link
Contributor Author

Screenshot 2025-02-18 at 3 28 41 PM

@jracusin jracusin marked this pull request as ready for review February 18, 2025 20:30
@@ -165,6 +174,10 @@ export function useRecaptchaSiteKey() {
return useLoaderDataRoot()?.recaptchaSiteKey
}

export function WithCredentials() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

React hooks should have names that start with use:

Suggested change
export function WithCredentials() {
export function useCredentials() {

Comment on lines +123 to +129
let publicConsumerCredential
if (user) {
const machine = await ClientCredentialVendingMachine.create(request)
publicConsumerCredential = (await machine.getClientCredentials())?.find(
(x) => x.scope == 'gcn.nasa.gov/kafka-public-consumer'
)?.client_id
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oof. This will result in Cognito API calls for loading any page at all. I don't think that this is acceptable from a performance perspective.

destination: 'quickstart' | 'email'
otherAlerts?: string[] // Alerts specifically under the 'Other' tab, since they can't be generically selected as all
}) {
const userCredentials = WithCredentials()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't pre-select a client ID for the user.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is necessary, at least if the point of this component is to be a shortcut to the prefilled alerts page. Otherwise this may as well just be a link to the streaming quickstart

Comment on lines +25 to +28
? otherAlerts?.map((alert) => `&alerts=${alert}`).join('')
: (format == 'text' ? NoticeTypes[alertKey] : JsonNoticeTypes[alertKey])
?.map((alert) => `&alerts=${alert}`)
.join('')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please construct the URL search params using URLSearchParams rather than with string formatting, so that there is not question of whether we have correctly escaped everything.

@@ -0,0 +1,134 @@
export const NoticeTypes = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears to be copy-pasted from NoticeTypeCheckboxes. It is fine to factor this data into a separate file, but please remove one copy or the other.

Comment on lines +9 to +19
export default function SelectedAlertShortcutLink({
alertKey,
format,
otherAlerts,
destination,
}: {
alertKey: string
format: 'json' | 'text'
destination: 'quickstart' | 'email'
otherAlerts?: string[] // Alerts specifically under the 'Other' tab, since they can't be generically selected as all
}) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is actually not much code shared in common among the various if statement branches. Would this be cleaner as several different components?

Lots of if statements are often a hint that inheritance or function composition may be a beneficial refactoring.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add license header.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add license header.

Comment on lines +79 to +98
useFeature('SVOM') && (
<NavLink key="svom" to="svom">
SVOM
</NavLink>
),
<>
<NavLink key="archival" to="archival">
Archival
</NavLink>
<SideNavSub
base="archival"
items={[
<NavLink key="agile" to="agile">
AGILE
</NavLink>,
<NavLink key="burstcube" to="burstcube">
BurstCube
</NavLink>,
]}
/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the current page highlighting to work, you'll need to move the archival missions' URL paths from, e.g., /missions/burstcube to /missions/archival/burstcube. Please do that, and add /missions/burstcube as a permanent redirect to /missions/archival/burstcube.

Since this move is pretty cut-and-dry but the shortcut links are not (see above), I suggest doing the move and adding the archival mission submenu in its own separate PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is separated out into PR #2913.

@jracusin jracusin changed the title add mission table and archival mission sub menu add mission table Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add table of mission status for Notices
3 participants