Report notifications not useful

Summary:
* adds a button to hide notifications by category
* adds a quick action to report notifications as not helpful
* fixes type of network plugin's notifications to be string instead of number

Reviewed By: jknoxville

Differential Revision: D12999883

fbshipit-source-id: 32be5bde5931cca4a27ab1ad34418300196452cc
This commit is contained in:
Daniel Büchele
2018-11-12 01:47:53 -08:00
committed by Facebook Github Bot
parent bd03f891d0
commit bf7c35387c
2 changed files with 164 additions and 44 deletions

View File

@@ -143,9 +143,11 @@ export default class extends FlipperPlugin<State, *, PersistedState> {
persistedState: PersistedState,
): Array<Notification> => {
const responses = persistedState ? persistedState.responses || [] : [];
// $FlowFixMe Object.values returns Array<mixed>, but we know it is Array<Response>
const r: Array<Response> = Object.values(responses);
return (
// $FlowFixMe Object.values returns Array<mixed>, but we know it is Array<Response>
(Object.values(responses): Array<Response>)
r
// Show error messages for all status codes indicating a client or server error
.filter((response: Response) => response.status >= 400)
.map((response: Response) => ({
@@ -155,7 +157,7 @@ export default class extends FlipperPlugin<State, *, PersistedState> {
'(URL missing)'}" failed. ${response.reason}`,
severity: 'error',
timestamp: response.timestamp,
category: response.status,
category: `HTTP${response.status}`,
action: response.id,
}))
);