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

[OGUI-1054] Status routes convention #2743

Open
wants to merge 22 commits into
base: dev
Choose a base branch
from

Conversation

mariscalromeroalejandro
Copy link
Collaborator

@mariscalromeroalejandro mariscalromeroalejandro commented Feb 7, 2025

  • branch and/or PR name(s) includes JIRA ID
  • issue has "Fix version" assigned
  • issue "Status" is set to "In review"
  • PR labels are selected
  • FLP integration tests were ran successful

This PR:

  • Removes Consul information from requests to /status.
  • Modifies the /status/framework route to /status/:component, allowing status queries for specific components.
  • Updates the frontend of the about page to support the new routes for fetching the service status.

Copy link
Member

@graduta graduta left a 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'],
Copy link
Member

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?

Copy link
Collaborator Author

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

http.get(
'/status/:component',
statusComponentMiddleware,
statusController.getFrameworkInfo.bind(statusController),
Copy link
Member

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');
Copy link
Member

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

Copy link
Collaborator Author

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) => {
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants