-
Notifications
You must be signed in to change notification settings - Fork 0
[Refactor] Availability Page to Fetch Data from Backend #33
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
Conversation
… unused SLA helper
…te dependencies in package.json
… update package dependencies
@@ -77,7 +77,7 @@ export function useAvailability(category: Models.ICategory, topic: string) { | |||
const rs = DB.RegionService.find(x => x.Id === service.id); | |||
|
|||
if (!rs) { | |||
log.warn("Service not found.", service); | |||
log.info("Service not found.", service); |
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.
Shouldn't that be a warning?
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.
because it's a hidden service by design if not found.
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.
interface ServiceAvaEntity { | ||
id: number | ||
name: string | ||
availability: AvaliaEntity[] |
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.
AvailEntity?
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.
fix
region: string | ||
} | ||
|
||
interface AvaliaEntity { |
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.
AvailEntity here also
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.
fix
Percentages: Array(6).fill(100) | ||
}))); | ||
|
||
const url = process.env.SD_BACKEND_URL; |
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.
maybe better to extract this type of const from method?
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.
After compiling, it will be statically replaced with a const string and inline.
const url = "https://...";
so, it's fine here, XD
Summary of the Pull Request
This PR focuses on improving the functionality, performance, and maintainability of the application by transitioning the Availability page's data management from real-time computation to fetching data from the backend. The changes include:
Key Changes
Refactor
IStatusContext
andEmptyDB
Histories
to simplify and clean up the data model.Enhanced Subject Retrieval
New Custom Hook:
useAvailability
useAvailability
, to manage service availability data effectively.Updated
CategoryGroup
ComponentuseAvailability
hook for consistency and better data flow.