Skip to content

Commit

Permalink
refactor(bannerMessages): sw-884 generic banners (#1094)
Browse files Browse the repository at this point in the history
* bannerMessages, replace with generic banners
* bannerMessagesContext, hooks for remove, add banners
* productView, allow banner messages for all products
* redux, actions, types, reducer, restructure
  • Loading branch information
cdcabrera committed Apr 21, 2023
1 parent 9e7e0f3 commit dc569f9
Show file tree
Hide file tree
Showing 22 changed files with 696 additions and 771 deletions.
6 changes: 1 addition & 5 deletions public/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@
"pending": "Authenticating...",
"maintenanceCopy": "We are currently undergoing scheduled maintenance and will be back shortly. Thank you for your patience."
},
"curiosity-banner": {
"dataMismatchTitle": "Cloud provider mismatch",
"dataMismatchMessage": "There might be inconsistencies between data in the graph and your current systems table. The issue is currently being resolved.",
"dataMismatchMessage_cloudigradeMismatch": "<0>View recommended actions</0> to take in order to improve {{appName}} reporting."
},
"curiosity-banner": {},
"curiosity-graph": {
"cardActionTotal": "{{total}} used",
"cardActionTotal_Cores": "{{total}} core hours used",
Expand Down
102 changes: 94 additions & 8 deletions src/components/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,9 @@ Render banner messages.
<tr>
<td>props</td><td><code>object</code></td>
</tr><tr>
<td>props.messages</td><td><code>Array</code></td>
<td>props.useBannerMessages</td><td><code>function</code></td>
</tr><tr>
<td>props.useGetAppMessages</td><td><code>function</code></td>
<td>props.useRemoveBannerMessages</td><td><code>function</code></td>
</tr> </tbody>
</table>

Expand All @@ -391,10 +391,18 @@ Default props.
<a name="BannerMessages.module_BannerMessagesContext"></a>

## BannerMessagesContext
<a name="BannerMessages.module_BannerMessagesContext..useGetAppMessages"></a>

### BannerMessagesContext~useGetAppMessages(options) ⇒ <code>Object</code>
Get app messages.
* [BannerMessagesContext](#BannerMessages.module_BannerMessagesContext)
* [~useBannerMessages(options)](#BannerMessages.module_BannerMessagesContext..useBannerMessages) ⇒ <code>Object</code>
* [~useRemoveBannerMessages(options)](#BannerMessages.module_BannerMessagesContext..useRemoveBannerMessages) ⇒ <code>function</code>
* [~useSetBannerMessages(options)](#BannerMessages.module_BannerMessagesContext..useSetBannerMessages) ⇒ <code>function</code>
* [~removeBannerMessages](#BannerMessages.module_BannerMessagesContext..removeBannerMessages) : <code>function</code>
* [~setBannerMessages](#BannerMessages.module_BannerMessagesContext..setBannerMessages) : <code>function</code>

<a name="BannerMessages.module_BannerMessagesContext..useBannerMessages"></a>

### BannerMessagesContext~useBannerMessages(options) ⇒ <code>Object</code>
Retrieve, set and remove application banner messages from state.

**Kind**: inner method of [<code>BannerMessagesContext</code>](#BannerMessages.module_BannerMessagesContext)
<table>
Expand All @@ -407,15 +415,93 @@ Get app messages.
<tr>
<td>options</td><td><code>object</code></td>
</tr><tr>
<td>options.getMessageReports</td><td><code>function</code></td>
<td>options.useProduct</td><td><code>function</code></td>
</tr><tr>
<td>options.useSelector</td><td><code>function</code></td>
</tr> </tbody>
</table>

<a name="BannerMessages.module_BannerMessagesContext..useRemoveBannerMessages"></a>

### BannerMessagesContext~useRemoveBannerMessages(options) ⇒ <code>function</code>
Provide a callback for removing application banner messages from state.

**Kind**: inner method of [<code>BannerMessagesContext</code>](#BannerMessages.module_BannerMessagesContext)
<table>
<thead>
<tr>
<th>Param</th><th>Type</th>
</tr>
</thead>
<tbody>
<tr>
<td>options</td><td><code>object</code></td>
</tr><tr>
<td>options.useDispatch</td><td><code>function</code></td>
</tr><tr>
<td>options.useProduct</td><td><code>function</code></td>
</tr><tr>
<td>options.useProductQuery</td><td><code>function</code></td>
<td>options.useBannerMessages</td><td><code>function</code></td>
</tr> </tbody>
</table>

<a name="BannerMessages.module_BannerMessagesContext..useSetBannerMessages"></a>

### BannerMessagesContext~useSetBannerMessages(options) ⇒ <code>function</code>
Provide a callback for setting application banner messages from state.

**Kind**: inner method of [<code>BannerMessagesContext</code>](#BannerMessages.module_BannerMessagesContext)
<table>
<thead>
<tr>
<th>Param</th><th>Type</th>
</tr>
</thead>
<tbody>
<tr>
<td>options</td><td><code>object</code></td>
</tr><tr>
<td>options.useSelectorsResponse</td><td><code>function</code></td>
<td>options.useDispatch</td><td><code>function</code></td>
</tr><tr>
<td>options.useProduct</td><td><code>function</code></td>
</tr><tr>
<td>options.useBannerMessages</td><td><code>function</code></td>
</tr> </tbody>
</table>

<a name="BannerMessages.module_BannerMessagesContext..removeBannerMessages"></a>

### BannerMessagesContext~removeBannerMessages : <code>function</code>
Remove a banner message from state.

**Kind**: inner typedef of [<code>BannerMessagesContext</code>](#BannerMessages.module_BannerMessagesContext)
<table>
<thead>
<tr>
<th>Param</th><th>Type</th>
</tr>
</thead>
<tbody>
<tr>
<td>idTitle</td><td><code>string</code></td>
</tr> </tbody>
</table>

<a name="BannerMessages.module_BannerMessagesContext..setBannerMessages"></a>

### BannerMessagesContext~setBannerMessages : <code>function</code>
Set application messages for banner display

**Kind**: inner typedef of [<code>BannerMessagesContext</code>](#BannerMessages.module_BannerMessagesContext)
<table>
<thead>
<tr>
<th>Param</th><th>Type</th>
</tr>
</thead>
<tbody>
<tr>
<td>messages</td><td><code>Array.&lt;{id: string, message: string, title: string, variant: string}&gt;</code> | <code>Object</code></td>
</tr> </tbody>
</table>

Expand Down
Loading

0 comments on commit dc569f9

Please sign in to comment.