-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
Report #1469
Draft
alex-Arc
wants to merge
14
commits into
master
Choose a base branch
from
report
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+272
−18
Draft
Report #1469
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
18b9b9d
create report service
alex-Arc f4ff4d1
write report from runtimeState
alex-Arc a32c10c
use in UI
alex-Arc 6746f65
clear report
alex-Arc cc7735d
update types
alex-Arc c4440bc
clear all from settings menu
alex-Arc a35255c
rearence rightclik menu
alex-Arc 9ce972f
refactor styling
alex-Arc 619ef3c
also report roll events
alex-Arc 72dfd2b
ontime/under time is same colour
alex-Arc 19ace9f
refactor reporter
alex-Arc 0844db1
add target to ontime-refetch
alex-Arc a38027b
remove menu
alex-Arc ce0dc70
fectch only on message from server
alex-Arc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import axios from 'axios'; | ||
import { OntimeReport } from 'ontime-types'; | ||
|
||
import { ontimeQueryClient } from '../../common/queryClient'; | ||
|
||
import { apiEntryUrl, REPORT } from './constants'; | ||
|
||
export const reportUrl = `${apiEntryUrl}/report`; | ||
|
||
/** | ||
* HTTP request to fetch all events | ||
*/ | ||
export async function fetchReport(): Promise<OntimeReport> { | ||
const res = await axios.get(`${reportUrl}/`); | ||
return res.data; | ||
} | ||
|
||
export async function deleteReport(id: string) { | ||
await axios.delete(`${reportUrl}/${id}`); | ||
await ontimeQueryClient.invalidateQueries({ queryKey: REPORT }); | ||
} | ||
|
||
export async function deleteAllReport() { | ||
await axios.delete(`${reportUrl}/all`); | ||
await ontimeQueryClient.invalidateQueries({ queryKey: REPORT }); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { useQuery } from '@tanstack/react-query'; | ||
import { OntimeReport } from 'ontime-types'; | ||
|
||
import { REPORT } from '../api/constants'; | ||
import { fetchReport } from '../api/report'; | ||
|
||
export default function useReport() { | ||
const { data } = useQuery<OntimeReport>({ | ||
queryKey: REPORT, | ||
queryFn: fetchReport, | ||
placeholderData: (previousData, _previousQuery) => previousData, | ||
retry: 5, | ||
retryDelay: (attempt) => attempt * 2500, | ||
networkMode: 'always', | ||
refetchOnMount: false, | ||
enabled: true, | ||
}); | ||
|
||
return { data: data ?? {} }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,7 +46,7 @@ | |
} | ||
|
||
.ahead { | ||
color: $green-500; | ||
color: $playback-ahead; | ||
} | ||
|
||
.behind { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
border-radius: 2px; | ||
|
||
&.over { | ||
color: $playback-negative; | ||
color: $ontime-delay-text; | ||
} | ||
|
||
&.under { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import type { Request, Response } from 'express'; | ||
import type { OntimeReport } from 'ontime-types'; | ||
import * as report from './report.service.js'; | ||
|
||
export async function getAll(_req: Request, res: Response<OntimeReport>) { | ||
res.json(report.generate()); | ||
} | ||
|
||
export async function deleteAll(_req: Request, res: Response<OntimeReport>) { | ||
report.clear(); | ||
res.status(200).send(); | ||
} | ||
|
||
export async function deleteWithId(req: Request, res: Response<OntimeReport>) { | ||
const { eventId } = req.params; | ||
report.clear(eventId); | ||
res.status(200).send(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import express from 'express'; | ||
import { getAll, deleteWithId, deleteAll } from './report.controller.js'; | ||
import { paramsMustHaveEventId } from '../rundown/rundown.validation.js'; | ||
|
||
export const router = express.Router(); | ||
|
||
router.get('/', getAll); | ||
|
||
router.delete('/all', deleteAll); | ||
router.delete('/:eventId', paramsMustHaveEventId, deleteWithId); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we can make this more efficient.
We know that, once an event has run, the report will never change until it runs again
Do you agree? if so, we can find a way together, to only run this once when the event finishes