Skip to content

Commit

Permalink
refactor(toolbarFieldExport): sw-2353 move notifications to hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
cdcabrera committed Jun 22, 2024
1 parent 8e277e6 commit ae7e250
Show file tree
Hide file tree
Showing 39 changed files with 1,929 additions and 725 deletions.
6 changes: 5 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,13 @@ REACT_APP_UI_WINDOW_ID=curiosity

REACT_APP_AJAX_TIMEOUT=60000
REACT_APP_AJAX_CACHE=15000
REACT_APP_AJAX_POLL_INTERVAL=15000
REACT_APP_AJAX_POLL_INTERVAL=5000
REACT_APP_SELECTOR_CACHE=120000

REACT_APP_CONFIG_EXPORT_EXPIRE=86400000
REACT_APP_CONFIG_EXPORT_FILENAME=swatch_report_{0}
REACT_APP_CONFIG_EXPORT_SERVICE_NAME_PREFIX=swatch

REACT_APP_CONFIG_SERVICE_LOCALES_COOKIE=rh_locale
REACT_APP_CONFIG_SERVICE_LOCALES_DEFAULT_LNG=en-US
REACT_APP_CONFIG_SERVICE_LOCALES_DEFAULT_LNG_DESC=English
Expand Down
2 changes: 2 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@ REACT_APP_ENV=test

REACT_APP_UI_VERSION=0.0.0.0000000

REACT_APP_AJAX_POLL_INTERVAL=1

REACT_APP_CONFIG_SERVICE_LOCALES=./locales/locales.json
REACT_APP_CONFIG_SERVICE_LOCALES_PATH=./locales/{{lng}}.json
27 changes: 26 additions & 1 deletion public/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,8 @@
},
"curiosity-toolbar": {
"button_displayName": "Search button for name",
"button_yes": "Yes",
"button_no": "No",
"clearFilters": "Reset filters",
"label": "",
"label_billing_provider": "",
Expand Down Expand Up @@ -360,9 +362,32 @@
"label_usage_Development/Test": "Development/Test",
"label_usage_Disaster Recovery": "Disaster Recovery",
"label_usage_Production": "Production",
"notifications_export_completed_description": "Downloading file {{fileName}}",
"notifications_export_completed_description_existing_completed": "{{completed}} completed report(s) are available. Would you like to continue and download?",
"notifications_export_completed_description_existing_completed_one": "{{completed}} completed report is available. Would you like to continue and download?",
"notifications_export_completed_description_existing_completed_other": "{{completed}} completed reports are available. Would you like to continue and download?",
"notifications_export_completed_description_existing_completed_pending": "{{completed}} completed and {{pending}} pending reports are available. Would you like to continue and download?",
"notifications_export_completed_description_existing_pending": "{{pending}} pending report(s) are available. Would you like to continue and download?",
"notifications_export_completed_description_existing_pending_one": "{{pending}} pending report is available. Would you like to continue and download?",
"notifications_export_completed_description_existing_pending_other": "{{pending}} pending reports are available. Would you like to continue and download?",
"notifications_export_completed_descriptionGlobal": "Download in progress",
"notifications_export_completed_descriptionGlobal_one": "{{count}} file download in progress",
"notifications_export_completed_descriptionGlobal_other": "{{count}} file downloads in progress",
"notifications_export_completed_title": "Report ready",
"notifications_export_completed_title_existing": "{{count}} existing report(s) are available",
"notifications_export_completed_title_existing_one": "{{count}} existing report is available",
"notifications_export_completed_title_existing_other": "{{count}} existing reports are available",
"notifications_export_completed_titleGlobal": "Existing report(s) ready",
"notifications_export_completed_titleGlobal_one": "Existing report ready",
"notifications_export_completed_titleGlobal_other": "Existing reports ready",
"notifications_export_error_description": "Closing report generator",
"notifications_export_error_title": "Report failed",
"notifications_export_pending_title": "Generating report in progress",
"notifications_export_pending_titleGlobal": "Continuing reports download",
"placeholder": "Select",
"placeholder_billing_provider": "Select purchased through",
"placeholder_export": "Export",
"placeholder_export": "Export data",
"placeholder_export_loading": "Export data is loading",
"placeholder_granularity": "Select date range",
"placeholder_groupVariant": "Select a variant",
"placeholder_rangedMonthly": "Select a month",
Expand Down
45 changes: 45 additions & 0 deletions src/common/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
* [~setStartOfDay(date)](#Helpers.module_Dates..setStartOfDay) ⇒ <code>Date</code>
* [~setEndOfMonth(date)](#Helpers.module_Dates..setEndOfMonth) ⇒ <code>Date</code>
* [~setRangedDateTime(params)](#Helpers.module_Dates..setRangedDateTime) ⇒ <code>Object</code>
* [~setMillisecondsFromDate(params)](#Helpers.module_Dates..setMillisecondsFromDate) ⇒ <code>Date</code>
* [~getRangedDateTime(granularity)](#Helpers.module_Dates..getRangedDateTime) ⇒ <code>Object</code>
* [~getRangedMonthDateTime(month, defaultLocale)](#Helpers.module_Dates..getRangedMonthDateTime) ⇒ <code>Object</code> \| <code>\*</code> \| <code>undefined</code>

Expand Down Expand Up @@ -193,6 +194,29 @@ Set a date range based on a granularity type.
</tr> </tbody>
</table>

<a name="Helpers.module_Dates..setMillisecondsFromDate"></a>

### Dates~setMillisecondsFromDate(params) ⇒ <code>Date</code>
Set milliseconds from date. Defaults to internal current date.

**Kind**: inner method of [<code>Dates</code>](#Helpers.module_Dates)
<table>
<thead>
<tr>
<th>Param</th><th>Type</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>params</td><td><code>object</code></td><td></td>
</tr><tr>
<td>params.date</td><td><code>Date</code></td><td><p>The date to add milliseconds towards. Defaults to current date.</p>
</td>
</tr><tr>
<td>params.ms</td><td><code>number</code></td><td></td>
</tr> </tbody>
</table>

<a name="Helpers.module_Dates..getRangedDateTime"></a>

### Dates~getRangedDateTime(granularity) ⇒ <code>Object</code>
Expand Down Expand Up @@ -282,6 +306,9 @@ Download the debug log file.
* [~PROD_MODE](#Helpers.module_General..PROD_MODE) : <code>boolean</code>
* [~REVIEW_MODE](#Helpers.module_General..REVIEW_MODE) : <code>boolean</code>
* [~TEST_MODE](#Helpers.module_General..TEST_MODE) : <code>boolean</code>
* [~CONFIG_EXPORT_EXPIRE](#Helpers.module_General..CONFIG_EXPORT_EXPIRE) : <code>string</code>
* [~CONFIG_EXPORT_FILENAME](#Helpers.module_General..CONFIG_EXPORT_FILENAME) : <code>string</code>
* [~CONFIG_EXPORT_SERVICE_NAME_PREFIX](#Helpers.module_General..CONFIG_EXPORT_SERVICE_NAME_PREFIX) : <code>string</code>
* [~UI_DEPLOY_PATH_PREFIX](#Helpers.module_General..UI_DEPLOY_PATH_PREFIX) : <code>string</code>
* [~UI_DEPLOY_PATH_LINK_PREFIX](#Helpers.module_General..UI_DEPLOY_PATH_LINK_PREFIX) : <code>string</code>
* [~UI_DISABLED](#Helpers.module_General..UI_DISABLED) : <code>boolean</code>
Expand Down Expand Up @@ -399,6 +426,24 @@ Associated with using the NPM script "start:proxy". See dotenv config files for
Is test mode active.
Associated with running unit tests. See dotenv config files for activation.

**Kind**: inner constant of [<code>General</code>](#Helpers.module_General)
<a name="Helpers.module_General..CONFIG_EXPORT_EXPIRE"></a>

### General~CONFIG\_EXPORT\_EXPIRE : <code>string</code>
CONFIG export download file expiration.

**Kind**: inner constant of [<code>General</code>](#Helpers.module_General)
<a name="Helpers.module_General..CONFIG_EXPORT_FILENAME"></a>

### General~CONFIG\_EXPORT\_FILENAME : <code>string</code>
CONFIG export download file name. Extension is handled at the service level.

**Kind**: inner constant of [<code>General</code>](#Helpers.module_General)
<a name="Helpers.module_General..CONFIG_EXPORT_SERVICE_NAME_PREFIX"></a>

### General~CONFIG\_EXPORT\_SERVICE\_NAME\_PREFIX : <code>string</code>
CONFIG export "post" download name prefix, for consistency.

**Kind**: inner constant of [<code>General</code>](#Helpers.module_General)
<a name="Helpers.module_General..UI_DEPLOY_PATH_PREFIX"></a>

Expand Down
9 changes: 9 additions & 0 deletions src/common/__tests__/__snapshots__/helpers.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ G {

exports[`Helpers should expose a window object: limited window object 1`] = `
{
"CONFIG_EXPORT_EXPIRE": "86400000",
"CONFIG_EXPORT_FILENAME": "swatch_report_{0}",
"CONFIG_EXPORT_SERVICE_NAME_PREFIX": "swatch",
"DEV_MODE": false,
"PROD_MODE": false,
"REVIEW_MODE": false,
Expand Down Expand Up @@ -55,6 +58,9 @@ exports[`Helpers should expose a window object: limited window object 1`] = `

exports[`Helpers should expose a window object: window object 1`] = `
{
"CONFIG_EXPORT_EXPIRE": "86400000",
"CONFIG_EXPORT_FILENAME": "swatch_report_{0}",
"CONFIG_EXPORT_SERVICE_NAME_PREFIX": "swatch",
"DEV_MODE": false,
"PROD_MODE": false,
"REVIEW_MODE": false,
Expand Down Expand Up @@ -114,6 +120,9 @@ exports[`Helpers should handle use aggregate error, or fallback: emulated aggreg

exports[`Helpers should have specific functions: helpers 1`] = `
{
"CONFIG_EXPORT_EXPIRE": "86400000",
"CONFIG_EXPORT_FILENAME": "swatch_report_{0}",
"CONFIG_EXPORT_SERVICE_NAME_PREFIX": "swatch",
"DEV_MODE": false,
"PROD_MODE": false,
"REVIEW_MODE": false,
Expand Down
24 changes: 24 additions & 0 deletions src/common/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,27 @@ const REVIEW_MODE = process.env.REACT_APP_ENV === 'review';
*/
const TEST_MODE = process.env.REACT_APP_ENV === 'test';

/**
* CONFIG export download file expiration.
*
* @type {string}
*/
const CONFIG_EXPORT_EXPIRE = process.env.REACT_APP_CONFIG_EXPORT_EXPIRE;

/**
* CONFIG export download file name. Extension is handled at the service level.
*
* @type {string}
*/
const CONFIG_EXPORT_FILENAME = process.env.REACT_APP_CONFIG_EXPORT_FILENAME;

/**
* CONFIG export "post" download name prefix, for consistency.
*
* @type {string}
*/
const CONFIG_EXPORT_SERVICE_NAME_PREFIX = process.env.REACT_APP_CONFIG_EXPORT_SERVICE_NAME_PREFIX;

/**
* Apply a path prefix for routing.
* Typically associated with applying a "beta" path prefix. See dotenv config files for updating.
Expand Down Expand Up @@ -463,6 +484,9 @@ const helpers = {
PROD_MODE,
REVIEW_MODE,
TEST_MODE,
CONFIG_EXPORT_EXPIRE,
CONFIG_EXPORT_FILENAME,
CONFIG_EXPORT_SERVICE_NAME_PREFIX,
UI_DEPLOY_PATH_PREFIX,
UI_DEPLOY_PATH_LINK_PREFIX,
UI_DISABLED,
Expand Down
Loading

0 comments on commit ae7e250

Please sign in to comment.