-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
ingress paths are now clickable #7487
ingress paths are now clickable #7487
Conversation
{{ !!ingressRuleFlat?.path?.path ? ingressRuleFlat?.path?.path : '-' }} | ||
<ng-container *ngIf="ingressRuleFlat.path.path"> | ||
<ng-container *ngIf="ingressRuleFlat.host"> | ||
<a href="https://{{ ingressRuleFlat.host }}{{ ingressRuleFlat?.path?.path }}" |
Check warning
Code scanning / CodeQL
Potentially unsafe external link
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.
There is no need to use ?.
as *ngIf
above already checks that. I think it should be in the first changed line.
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'd actually move this logic to the typescript and use a single method to handle path.
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.
Yeah, that would be the best.
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 removed the ?
s.
I considered creating a typescript method (below), but I am not sure we want a method returning raw HTML.
I can change that if you guys prefer, though.
createIngressLink(ingressRuleFlat: IngressRuleFlat): string {
if (ingressRuleFlat.path.path) {
if (ingressRuleFlat.host) {
return '<a href="https://' + ingressRuleFlat.host + ingressRuleFlat.path.path + ' target="_blank">' + ingressRuleFlat.path.path + '</a>';
} else {
return ingressRuleFlat.path.path;
}
} 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.
Use one method for URL, second for label.
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.
It could also return a simple wrapper object with label and URL fields.
Codecov Report
@@ Coverage Diff @@
## master #7487 +/- ##
==========================================
+ Coverage 42.07% 42.09% +0.02%
==========================================
Files 217 217
Lines 12084 12084
Branches 179 179
==========================================
+ Hits 5084 5087 +3
+ Misses 6716 6712 -4
- Partials 284 285 +1 |
0a2d11b
to
7c317f3
Compare
@marcosdiez Any updates? |
3d1c980
to
f441fb6
Compare
@maciaszczykm ready to merge! |
remove unecessary question marks make links safer
f441fb6
to
007482b
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
/approve
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.
There is no need to use
?.
as*ngIf
above already checks that. I think it should be in the first changed line.
Actually, wait.
There should be ?.
in the first *ngIf
: ingressRuleFlat?.path?.path
.
Same for last *ngIf
you've added: !ingressRuleFlat?.path?.path
.
Additionally, to simplify syntax you could use switch instead of ifs or move the code to component like @floreks suggested.
/approve cancel
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: maciaszczykm, marcosdiez The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This is a copy of #7017
![163737717-08e42793-e9e9-4ba5-b349-4a9390c59af4](https://user-images.githubusercontent.com/297498/193049433-cb8b5d06-6350-401e-a28c-88fbe9e92cfb.png)
sample YAML to test