-
Notifications
You must be signed in to change notification settings - Fork 107
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
base: main
Are you sure you want to change the base?
Fix UI issue in routing rules page - present indicative message #660
Conversation
1be2cc6
to
f1ba0b0
Compare
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.
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
gateway-ha/src/main/java/io/trino/gateway/ha/resource/GatewayWebAppResource.java
Outdated
Show resolved
Hide resolved
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; |
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.
Please don't put mutable object in fields.
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
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.
Not yet done. RoutingRulesConfiguration
is also mutable objects.
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 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
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.
@andythsu any ideas maybe ?
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 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.
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
@@ -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(); |
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.
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".
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.
reverted this, as wasn't part of scope
Please avoid the past tense in the commit title. https://trino.io/development/process.html#pull-request-and-commit-guidelines- |
@RoeyoOgen please update commit message to Fix UI issue in routing rules page and optionally have more description in the commit message body |
f1ba0b0
to
70f60f0
Compare
@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 }; |
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.
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 {}
}
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.
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
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.
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([]); |
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.
rules
is default to []
. Is this still necessary?
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.
removed
@@ -81,7 +92,31 @@ export function RoutingRules() { | |||
|
|||
return ( | |||
<div> |
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.
is this outer div
necessary?
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 tried removing it but got to many errors (and i'm not a front end guy to try and untangle this 😅)
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 could replace it with <> to avoid adding an extra node to the DOM
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.
will do
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: |
826baac
to
0805733
Compare
done |
lol we can get rid of this |
overall I think this LGTM. @ytwp wdyt |
oopsie - fixed this :) |
Present indicative message when external routing service is used or when no routing rules exist in file based routing
0805733
to
7ccccb7
Compare
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.
LGTM. PTAL :)
UI Improvements: Fixed bug where banner appears instead of indicative message in routing rules page
Changes
Impact
( 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: