-
Notifications
You must be signed in to change notification settings - Fork 31
Add Permissions Error Toasts and Input Validation Errors #196
Add Permissions Error Toasts and Input Validation Errors #196
Conversation
…n create/edit input validation fields
@@ -183,7 +183,8 @@ describe('<Main /> panel', () => { | |||
await act(() => promise); | |||
}); | |||
|
|||
test('test error toasts posted', async () => { | |||
// skipping test for now after multiple error toasts created, need to refine mock values and test |
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.
Add a TODO here
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's just one test case, why not do it in this PR
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 you add test in this PR?
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 add in another PR
<div class="euiToast euiToast--danger" id="permissionsMissingErrorToast"> | ||
<p class="euiScreenReaderOnly">A new notification appears</p> | ||
<div class="euiToastHeader euiToastHeader--withBody" aria-label="Notification" data-test-subj="euiToastHeader"> | ||
<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" class="euiIcon euiIcon--medium euiToastHeader__icon" focusable="false" role="img" aria-hidden="true"> | ||
<path fill-rule="evenodd" d="M7.59 10.059L7.35 5.18h1.3L8.4 10.06h-.81zm.394 1.901a.61.61 0 01-.448-.186.606.606 0 01-.186-.444c0-.174.062-.323.186-.446a.614.614 0 01.448-.184c.169 0 .315.06.44.182.124.122.186.27.186.448a.6.6 0 01-.189.446.607.607 0 01-.437.184zM2 14a1 1 0 01-.878-1.479l6-11a1 1 0 011.756 0l6 11A1 1 0 0114 14H2zm0-1h12L8 2 2 13z"></path> | ||
</svg> | ||
<span class="euiToastHeader__title">Error generating report.</span> | ||
</div> | ||
<button type="button" class="euiToast__closeButton" aria-label="Dismiss toast" data-test-subj="toastCloseButton"> | ||
<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" class="euiIcon euiIcon--medium euiIcon-isLoaded" focusable="false" role="img" aria-hidden="true"> | ||
<path d="M7.293 8L3.146 3.854a.5.5 0 11.708-.708L8 7.293l4.146-4.147a.5.5 0 01.708.708L8.707 8l4.147 4.146a.5.5 0 01-.708.708L8 8.707l-4.146 4.147a.5.5 0 01-.708-.708L7.293 8z"></path> | ||
</svg> | ||
</button> | ||
<div class="euiText euiText--small euiToastBody"> | ||
<p>Insufficient permissions. Reach out to your Kibana administrator.</p> | ||
</div> | ||
</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.
Np: define these html code snippet as html files or constants, then import them here when using.
kibana-reports/public/components/report_definitions/edit/edit_report_definition.tsx
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.
Please add test case back or plan another PR to do that soon
Issue #, if available:
N/A
Description of changes:
Added permissions error checks for all API calls to return Permissions Error toasts if the user doesn't have proper permissions. Also added input validation errors on Create/Edit to inform the user if they have fields that are invalid.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.