-
Notifications
You must be signed in to change notification settings - Fork 13
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
[OGUI-1054] Status routes convention #2743
base: dev
Are you sure you want to change the base?
[OGUI-1054] Status routes convention #2743
Conversation
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 think components
is not a descriptive enough name, perhaps integrated services
or something like this might be better. What do you think?
@@ -38,6 +38,8 @@ function buildPublicConfig(config) { | |||
REFRESH_MIN_INTERVAL: config?.consul?.refreshRate?.min || 10, | |||
REFRESH_MAX_INTERVAL: config?.consul?.refreshRate?.max || 120, | |||
CONSUL_SERVICE: config.consul ? true : false, | |||
ABOUT_COMPONENTS: ['qcg', 'qc', 'ccdb'], |
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.
Given that we have an enum for this, would it not be better to use that instead of hardcoding the values here?
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.
You’re right! I have a bad memory, and I had forgotten that I had already created an enum for the integrated services
QualityControl/lib/api.js
Outdated
http.get( | ||
'/status/:component', | ||
statusComponentMiddleware, | ||
statusController.getFrameworkInfo.bind(statusController), |
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 believe the method name here has two issues:
- name is not representative, you are retrieving the status of a component which is defined in the URL
- for controllers, let's try to keep the convention of also ending in
handler
as name
export const statusComponentMiddleware = (req, res, next) => { | ||
try { | ||
if (!req.params.component) { | ||
throw new InvalidInputError('Component parameter is missing'); |
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.
If there is a missing component
parameter, the URL will not be matched on this API route.
Thus, this if will never be triggered and it is unused code
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.
done
this.item = RemoteData.failure(result.message); | ||
try { | ||
const results = {}; | ||
await Promise.all(components.map(async (component) => { |
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.
Do I understand correctly that these are just migration changes and the changes for front-end will come in a future PR?
Because in these changes, the status cards will still be loaded all at one time compared to the requirement of the ticket to load independently
…ure/OGUI-1054/status-routes-convention
…ure/OGUI-1054/status-routes-convention
This PR: