-
Notifications
You must be signed in to change notification settings - Fork 75
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
Add missing handling API errors on UI #1115
Conversation
9eaf067
to
7798510
Compare
The question is should we let the user finish the action (create a new namespace for example) even if this field isn't mandatory (group field is optional, therefore possibly he could create a new namespace and set this later in the app)? or never let user finish the action and keep the |
c8be045
to
6af5b27
Compare
@jerabekjiri I think we can keep this simple ... the error itself shouldn't stop the user from finishing actions. If the field is required, the group will never be selected, so the user will not be able to save anyway. |
makes sense, fixed :) |
570923f
to
8b25b8e
Compare
@himdel thanks for pointing out mistakes, I completely forgot about l10n here, sorry about that |
No worries, looks like it's all fixed now, not seeing any new issues 👍 :) |
8b25b8e
to
5e4640c
Compare
@himdel Resolved conflicts, could you review one more before merging, please? :) |
5e4640c
to
fb330a3
Compare
I must have messed it up during the conflict resolving, should be fixed and updated now |
(adding this to a few recently updated PRs…) We need CI in this repo that enforces this, but for now please:
|
Issue: AAH-517
277ee51
to
a875e45
Compare
Added |
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 👍
* add group and colleciton-info missing erros * add EE catch alerts * add more catch alerts * fix double alert popup move alerts from local state to context state * catch errors for (my)namespace * catch alerts in editing namespace catch alerts if something goes wrong while editing namespace + add success alert on edit namespace to global context alerts * show alert on load group error * add more context catch alerts * add catch alert on loading token err * remove global alert * drop about modal alerts * add inline form errors to repository modal * add namespace form errors and rename to onError * add namespace form errors * move alerts to collection detail * rollback context alerts to local * add insights alerts * remove disabling button on error * add l10n to alerts * remove dead code * remove useless alert code * remove isDisabled attr Issue: AAH-517 (cherry picked from commit 446c384)
* add group and colleciton-info missing erros * add EE catch alerts * add more catch alerts * fix double alert popup move alerts from local state to context state * catch errors for (my)namespace * catch alerts in editing namespace catch alerts if something goes wrong while editing namespace + add success alert on edit namespace to global context alerts * show alert on load group error * add more context catch alerts * add catch alert on loading token err * remove global alert * drop about modal alerts * add inline form errors to repository modal * add namespace form errors and rename to onError * add namespace form errors * move alerts to collection detail * rollback context alerts to local * add insights alerts * remove disabling button on error * add l10n to alerts * remove dead code * remove useless alert code * remove isDisabled attr Issue: AAH-517 (cherry picked from commit 446c384) Co-authored-by: Jiří Jeřábek <Jerabekjirka@email.cz>
@himdel I'm trying to move this to Done in Jira, and was interested in your thoughts about adding tests for error handling down the line. I think we can stub 500 network responses using https://docs.cypress.io/guides/guides/network-requests#Stub-Responses and then verify that errors appear as they ought to. I don't think it's something that we need to necessarily add to this in order to consider this work |
@hendersonreed Great idea, I agree we should be testing these as well, and stubbing the responses sounds like a perfect solution. (I guess if we should also test a couple of real failure states where we can, but stubbing allows us to test everything.) (I've at least added a link from himdel#1 for now.) |
The error handling was added in ansible#1115, but in this case, this will always error the first time. The expected flow is: * TokenPage loads, componentDidMount runs getOfflineToken() and fails, render displays a "{{ user_token }}" placeholder * user clicks the "Load token" button, loadToken() calls doOffline() which triggers a reload * TokenPage loads, componentDidMount runs getOfflineToken() and succeds, render displays the token If there's a way of doing this without a full page reload, or of telling that doOffline just happened successfully but getOfflineToken still fails, we should keep the error. But I don't know of either right now. (Short of a double redirect maybe.) No-Issue
The error handling was added in ansible#1115, but in this case, this will always error the first time. The expected flow is: * TokenPage loads, componentDidMount runs getOfflineToken() and fails, render displays a "{{ user_token }}" placeholder * user clicks the "Load token" button, loadToken() calls doOffline() which triggers a reload * TokenPage loads, componentDidMount runs getOfflineToken() and succeds, render displays the token If there's a way of doing this without a full page reload, or of telling that doOffline just happened successfully but getOfflineToken still fails, we should keep the error. But I don't know of either right now. (Short of a double redirect maybe.) No-Issue
…or (#1739) The error handling was added in #1115, but in this case, this will always error the first time. The expected flow is: * TokenPage loads, componentDidMount runs getOfflineToken() and fails, render displays a "{{ user_token }}" placeholder * user clicks the "Load token" button, loadToken() calls doOffline() which triggers a reload * TokenPage loads, componentDidMount runs getOfflineToken() and succeds, render displays the token If there's a way of doing this without a full page reload, or of telling that doOffline just happened successfully but getOfflineToken still fails, we should keep the error. But I don't know of either right now. (Short of a double redirect maybe.) No-Issue
the code has been there from the start, only makes sense in insights mode, and unused since ansible#183 used to be just getUser->setState->loadNamespace, before ansible#1115 added error handling, changing to just loadNamespace
the code has been there from the start, only makes sense in insights mode, and unused since ansible#183 used to be just getUser->setState->loadNamespace, before ansible#1115 added error handling, changing to just loadNamespace
the code has been there from the start, only makes sense in insights mode, and unused since ansible#183 used to be just getUser->setState->loadNamespace, before ansible#1115 added error handling, changing to just loadNamespace
* translate sync alert * RepoSelector: move insights mode switch to BaseHeader, fix extra top padding in insights mode because BaseHeader wraps RepoSelector when present, but not rendering is still present * insights-loader: drop older nav event type support (comes from #715, pre-chrome 2.0) * ActiveUserAPI: simplify getUser, return getActiveUser.data * insights-loader: add FeatureFlagsAPI call; move insights and standalone a step closer * UI to use feature flags in insights mode Issue: AAH-1800 * edit-namespace, namespace-form: drop unused userId, extra getUser call the code has been there from the start, only makes sense in insights mode, and unused since #183 used to be just getUser->setState->loadNamespace, before #1115 added error handling, changing to just loadNamespace * InsightsUserType is unused, index.d.ts has a conflicting type for getUser, update and move there * ActiveUserAPI.getUser, getActiveUser - merge into getUser, no users of these functions can really deal with the insights version * insights-loader - drop auth.getUser wait, already happening in api base *before* getUser * remove extra border in collections documentation navitems in insights mode * convert src/loaders/insights/ to typescript * standalone-loader: sort context params * insights-loader: change activeUser to user * loadContext: shared code to load alerts, featureFlags, settings, user * insights-loader: update title using identifyApp instead of document.title as per https://github.com/RedHatInsights/insights-chrome/blob/master/docs/api.md#update-document-title * ActiveAPI: type getToken, simplify promises
Issue: AAH-517
A few Examples of error alerts:
(ignore the alert description "Request failed with status code 403", just for testing purposes :))
show success alert after editing namespace (after the redirect to
namespace-detail
). This wasn't possible before, because of local statealerts
and local componentAlertList
I was thinking maybe it would be a better idea to move from local alerts in every component to push alerts to global state (context) and display it from one place always? in this case I added it to
App
component. As I mentioned before, this would make it easier to show alerts after changing URL (redirecting). What do you think about this? @himdel @ZitaNemeckovaAlso if there's an API error in fetching table list, currently I just show an empty state and display error alert. I guess this might be confusing for users, this would be probably solved by the
500 error screen
, so maybe I should do follow-up PR for that (since we already have UI mockups for it) and later add500 error screen
to all table list responses?