Skip to content

Fix UI issue in routing rules page - present indicative message #660

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

RoeyoOgen
Copy link
Contributor

@RoeyoOgen RoeyoOgen commented Apr 2, 2025

UI Improvements: Fixed bug where banner appears instead of indicative message in routing rules page

Changes

  • Added loading spinner while fetching routing rules
  • Fixed issue where an error banner will appear instead of an indicative message for rules managed by external routing service
  • Fixed issue where an error banner will appear instead of an indicative message for when file in 'rulesConfigPath' is empty

Impact

  • No functional changes to routing rules functionality
  • Improved user experience by eliminating incorrect empty state display

( X) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
( ) Release notes are required, with the following suggested text:

@cla-bot cla-bot bot added the cla-signed label Apr 2, 2025
@RoeyoOgen RoeyoOgen force-pushed the bugfix/fixing_external_service_resource_ui branch 2 times, most recently from 1be2cc6 to f1ba0b0 Compare April 6, 2025 16:42
@RoeyoOgen RoeyoOgen changed the title Fixed bug where banner appears instead of indicative message saying n… Fixed bug where banner appears instead of indicative message in routing rules page Apr 6, 2025
@RoeyoOgen RoeyoOgen requested a review from Copilot April 7, 2025 16:17
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

@andythsu
Copy link
Member

andythsu commented Apr 9, 2025

Quickly skimmed through this. I'm fine with it

@@ -76,6 +77,7 @@ public class GatewayWebAppResource
// TODO Avoid putting mutable objects in fields
private final UIConfiguration uiConfiguration;
private final RoutingRulesManager routingRulesManager;
private final HaGatewayConfiguration haGatewayConfiguration;
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 put mutable object in fields.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Member

Choose a reason for hiding this comment

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

Not yet done. RoutingRulesConfiguration is also mutable objects.

Copy link
Contributor Author

@RoeyoOgen RoeyoOgen Jun 19, 2025

Choose a reason for hiding this comment

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

Do you have an idea of how to inject this otherwise?

The function getRoutingRules is a route so cannot pass params...

They only thought I had was to copy the object

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@andythsu any ideas maybe ?

Copy link
Member

@andythsu andythsu Jun 19, 2025

Choose a reason for hiding this comment

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

maybe extract the fields you want and make them class variables?

in constructor:

isRulesEngineEnabled = routingRules.isRulesEngineEnabled() 
ruleType = routingRules.getRulesType()

notice this is omitted. I don't think we need to add this as it's redundant.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -160,7 +163,7 @@ public Response getDistribution(QueryDistributionRequest query)
Map<String, List<DistributionResponse.LineChart>> lineChartMap = lineChart.stream().collect(Collectors.groupingBy(DistributionResponse.LineChart::getName));
List<DistributionResponse.DistributionChart> distributionChart = lineChartMap.values().stream().map(d -> {
DistributionResponse.DistributionChart dc = new DistributionResponse.DistributionChart();
DistributionResponse.LineChart lc = d.get(0);
DistributionResponse.LineChart lc = d.getFirst();
Copy link
Member

Choose a reason for hiding this comment

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

Please separate a commit. This change is unrelated to "Fixed bug in UI where non indicative banner appears in routing rules page for external service".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

reverted this, as wasn't part of scope

@ebyhr
Copy link
Member

ebyhr commented Apr 19, 2025

Fixed bug in UI where non indicative banner appears in routing rules page for external service

Please avoid the past tense in the commit title. https://trino.io/development/process.html#pull-request-and-commit-guidelines-

@RoeyoOgen RoeyoOgen changed the title Fixed bug where banner appears instead of indicative message in routing rules page Fix: bug where banner appears instead of indicative message in routing rules page Apr 28, 2025
@mosabua
Copy link
Member

mosabua commented Jun 18, 2025

@RoeyoOgen please update commit message to

Fix UI issue in routing rules page

and optionally have more description in the commit message body

@ebyhr @andythsu any other feedback/review comments

@RoeyoOgen RoeyoOgen changed the title Fix: bug where banner appears instead of indicative message in routing rules page Fix UI issue in routing rules page - present indicative message Jun 18, 2025
@RoeyoOgen RoeyoOgen force-pushed the bugfix/fixing_external_service_resource_ui branch from f1ba0b0 to 70f60f0 Compare June 18, 2025 12:47
@RoeyoOgen
Copy link
Contributor Author

@RoeyoOgen please update commit message to

Fix UI issue in routing rules page

and optionally have more description in the commit message body

@ebyhr @andythsu any other feedback/review comments

@mosabua done, lmk if anything else is needed

@@ -17,6 +17,14 @@ export class ClientApi {
if (res.status === 401 || res.status === 403) {
this.authErrorHandler()
}
else if (res.status === 204) {
// handle the case of Response.Status.NO_CONTENT when External Routing Service is used
return { isExternalRouting: true };
Copy link
Member

@andythsu andythsu Jun 19, 2025

Choose a reason for hiding this comment

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

Can we make 204 generic so it's not tied to only thrown by isExternalRouting only? Something like

const resJson = await res.json();
if (resJson.msg.type == "external_routing"){
     return { isExternalRouting: true }
} else{
      return {}
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

why?
204 is only thrown when: isRulesEngineEnabled && ruleType == RulesType.EXTERNAL under /getRoutingRules in GatewayWebAppResource so i don't seem to understand why make it genreric.

also when status === 204, the body will be empty so res.json() will be none

Copy link
Member

Choose a reason for hiding this comment

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

Uh I see. I wanted to make it generic so that we can throw 204 in other scenarios as well. But we can figure it out later if we have a use case for it

setFormApis(new Array(data.length).fill(null));
if (data.isExternalRouting) {
setIsExternalRouting(true);
setRules([]);
Copy link
Member

Choose a reason for hiding this comment

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

rules is default to []. Is this still necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

@@ -81,7 +92,31 @@ export function RoutingRules() {

return (
<div>
Copy link
Member

Choose a reason for hiding this comment

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

is this outer div necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i tried removing it but got to many errors (and i'm not a front end guy to try and untangle this 😅)

Copy link
Member

Choose a reason for hiding this comment

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

You could replace it with <> to avoid adding an extra node to the DOM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will do

@andythsu
Copy link
Member

andythsu commented Jun 19, 2025

@RoeyoOgen please update commit message to
Fix UI issue in routing rules page
and optionally have more description in the commit message body
@ebyhr @andythsu any other feedback/review comments

@mosabua done, lmk if anything else is needed

I see you only changed the PR title but not the commit message. Could you squash your commits and update the message?

I think we can do:
commit title: Fix UI issue in routing rules page
commit body: Present indicative message when external service is used (or something along the line)

@RoeyoOgen RoeyoOgen force-pushed the bugfix/fixing_external_service_resource_ui branch from 826baac to 0805733 Compare June 19, 2025 08:03
@RoeyoOgen
Copy link
Contributor Author

@RoeyoOgen please update commit message to
Fix UI issue in routing rules page
and optionally have more description in the commit message body
@ebyhr @andythsu any other feedback/review comments

@mosabua done, lmk if anything else is needed

I see you only changed the PR title but not the commit message. Could you squash your commits and update the message?

I think we can do: commit title: Fix UI issue in routing rules page commit body: Present indicative message when external service is used (or something along the line)

done

@RoeyoOgen RoeyoOgen requested a review from ebyhr June 24, 2025 06:32
@andythsu
Copy link
Member

lol we can get rid of this (or something along the line) from the commit message. That was just a note for you to come up with anything you like if you don't like my suggestion 🤣

@andythsu
Copy link
Member

overall I think this LGTM. @ytwp wdyt

@RoeyoOgen
Copy link
Contributor Author

RoeyoOgen commented Jun 25, 2025

lol we can get rid of this (or something along the line) from the commit message. That was just a note for you to come up with anything you like if you don't like my suggestion 🤣

oopsie - fixed this :)

Present indicative message when external routing service is used or when no routing rules exist in file based routing
@RoeyoOgen RoeyoOgen force-pushed the bugfix/fixing_external_service_resource_ui branch from 0805733 to 7ccccb7 Compare June 25, 2025 06:13
Copy link
Member

@Chaho12 Chaho12 left a comment

Choose a reason for hiding this comment

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

LGTM. PTAL :)

@RoeyoOgen RoeyoOgen requested a review from andythsu July 13, 2025 09:14
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.

5 participants