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
mgr/dashboard: new generic HTTP error page component #36715
Conversation
src/pybind/mgr/dashboard/frontend/src/app/core/error/error.component.ts
Outdated
Show resolved
Hide resolved
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.
Nice work, @aaSharma14 ! However, I don't fully agree with some implementation details, as it brings some issues on abstraction and encapsulation (e.g.: for reporting new error messages you have to modify the error component, because input arguments are inferred from the URL/error code, instead of simply passing them).
Other comment, just for the case you're willing to improve a bit further the error management in our front-end, is the clean-up the current error component invocation:
- Now a component basically detects an error condition and explicitly launches a
router.navigate([403])
redirect, and then Angular redirects the browser to the 403 Forbidden... - However, the error page is just an abstraction. Components shouldn't take care about whether an error results in a page redirect, a console trace or an speaker beeping. So my suggestion would be to replace those
navigate
andnavigateByUrl([403])
with something likethrow new ForbiddenError()
(this requires a new custom Javascript Error subclass). By using the AngularErrorHandler()
we can simply catch Error (or exceptions) and redirect them to this genericErrorComponent
, without the need of an explicit redirect.
src/pybind/mgr/dashboard/frontend/src/app/core/error/error.component.ts
Outdated
Show resolved
Hide resolved
src/pybind/mgr/dashboard/frontend/src/app/core/error/error.component.ts
Outdated
Show resolved
Hide resolved
src/pybind/mgr/dashboard/frontend/src/app/app-routing.module.ts
Outdated
Show resolved
Hide resolved
bf520d6
to
e1c8114
Compare
jenkins test dashboard |
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.
Looks like a nice improvement, but I think there is something wrong with the translations.
src/pybind/mgr/dashboard/frontend/src/app/app-routing.module.ts
Outdated
Show resolved
Hide resolved
src/pybind/mgr/dashboard/frontend/src/app/core/error/error.component.html
Outdated
Show resolved
Hide resolved
jenkins test dashboard |
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.
Huge improvement so far, @aaSharma14 !
Things that I'd improve further:
- Single minimal URL for all errors:
/error
without no explicit error code or error message in the URL. - Redirection is a behaviour, a side-effect of the error handling (we could, for example, switch to a pop-up or modal showing the error message). As you have fully decoupled that from components, you no longer need to test for redirection in the unit tests of every component, just in the ErrorComponent ones.
- HTTP error codes in the front-end is just a habit inherited from the times of static websites. Now we have pure front-end code with its own errors and nuances, so let's get rid of HTTP error codes when no back-end HTTP error code is forwarded.
- Let's use instead our set of
DashboardError
classes:DashboardNotFoundError
,DashboardNotAllowedError
. If we still insist on mapping them internally to HTTP error codes, we can store the 40x/50x ones. These classes could (perhaps) also work asdata
param forRoutes
?
src/pybind/mgr/dashboard/frontend/src/app/app-routing.module.ts
Outdated
Show resolved
Hide resolved
src/pybind/mgr/dashboard/frontend/src/app/app-routing.module.ts
Outdated
Show resolved
Hide resolved
...shboard/frontend/src/app/ceph/cluster/prometheus/silence-form/silence-form.component.spec.ts
Outdated
Show resolved
Hide resolved
src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.spec.ts
Outdated
Show resolved
Hide resolved
src/pybind/mgr/dashboard/frontend/src/app/shared/services/js-error-handler.service.ts
Outdated
Show resolved
Hide resolved
src/pybind/mgr/dashboard/frontend/src/app/shared/services/js-error-handler.service.ts
Outdated
Show resolved
Hide resolved
src/pybind/mgr/dashboard/frontend/src/app/app-routing.module.ts
Outdated
Show resolved
Hide resolved
Almost forgot it: for other devels to become aware of this, it'd be great if you could add a brief |
src/pybind/mgr/dashboard/frontend/src/app/core/error/error.component.ts
Outdated
Show resolved
Hide resolved
deb22e7
to
61a8955
Compare
jenkins test dashboard |
src/pybind/mgr/dashboard/frontend/src/app/core/not-found/not-found.component.html
Show resolved
Hide resolved
61a8955
to
4434b4f
Compare
@aaSharma14 found the Patternfly one: it's called empty state! It seems that they're moving away from big blank error pages to inline notification/pop-ups/modals/etc. Design: Different examples: |
2e9305c
to
5a824f0
Compare
5a824f0
to
cd645e7
Compare
cd645e7
to
ea03d1a
Compare
jenkins test make check |
jenkins test dashboard |
jenkins test make check |
@alfonsomthd could you please re-review this PR? Thanks! |
src/pybind/mgr/dashboard/frontend/src/app/core/error/error.component.ts
Outdated
Show resolved
Hide resolved
a5fd365
to
fe6910f
Compare
fe6910f
to
8c2cfd0
Compare
jenkins test dashboard |
jenkins test api |
Added a generic Error component for HTTP Errors such as 404,403,501 Fixes:https://tracker.ceph.com/issues/39128 Signed-off-by: Aashish Sharma <aasharma@redhat.com>
8c2cfd0
to
13900cf
Compare
src/pybind/mgr/dashboard/frontend/src/app/core/error/error.component.html
Outdated
Show resolved
Hide resolved
Added a generic Error component for HTTP Errors such as 404,403,501 Fixes:https://tracker.ceph.com/issues/39128 Signed-off-by: Aashish Sharma <aasharma@redhat.com>
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.
Good work!
Great job, @aaSharma14 ! This has been a tough one 😅 ! |
Thanks @epuertat :) |
NFS/501-
PAGE NOT FOUND-
Added a generic Error component for Errors such as Not Found, Forbidden etc
Fixes:https://tracker.ceph.com/issues/39128
Signed-off-by: Aashish Sharma aasharma@redhat.com
Checklist
Show available Jenkins commands
jenkins retest this please
jenkins test classic perf
jenkins test crimson perf
jenkins test signed
jenkins test make check
jenkins test make check arm64
jenkins test submodules
jenkins test dashboard
jenkins test api
jenkins test docs
jenkins render docs
jenkins test ceph-volume all
jenkins test ceph-volume tox