diff --git a/public/locales/en.json b/public/locales/en.json index 037a5616..00c56059 100644 --- a/public/locales/en.json +++ b/public/locales/en.json @@ -21,6 +21,10 @@ "modal": { "aria-label-default": "Application modal" }, + "refresh-time-button": { + "refreshed": "Refreshed just now", + "refreshed_load": "Refreshed {{refresh}}" + }, "view": { "empty-state_title": "Welcome to {{name}}", "empty-state_description_credentials": "Credentials contain authentication information needed to scan a source. A credential includes a username and a password or SSH key. {{name}} uses SSH to connect to servers on the network and uses credentials to access those servers.", diff --git a/src/components/i18n/__tests__/__snapshots__/i18n.test.js.snap b/src/components/i18n/__tests__/__snapshots__/i18n.test.js.snap index 2c6b19b2..0aabf1f8 100644 --- a/src/components/i18n/__tests__/__snapshots__/i18n.test.js.snap +++ b/src/components/i18n/__tests__/__snapshots__/i18n.test.js.snap @@ -180,6 +180,15 @@ Array [ }, ], }, + Object { + "file": "./src/components/refreshTimeButton/refreshTimeButton.js", + "keys": Array [ + Object { + "key": "refresh-time-button.refreshed", + "match": "t('refresh-time-button.refreshed', { context: lastRefresh && 'load', refresh: lastRefresh && helpers.getTimeDisplayHowLongAgo(lastRefresh)", + }, + ], + }, Object { "file": "./src/components/scans/scans.js", "keys": Array [ diff --git a/src/components/refreshTimeButton/__tests__/__snapshots__/refreshTimeButton.test.js.snap b/src/components/refreshTimeButton/__tests__/__snapshots__/refreshTimeButton.test.js.snap index e7cd742e..ca67d420 100644 --- a/src/components/refreshTimeButton/__tests__/__snapshots__/refreshTimeButton.test.js.snap +++ b/src/components/refreshTimeButton/__tests__/__snapshots__/refreshTimeButton.test.js.snap @@ -2,17 +2,34 @@ exports[`RefreshTimeButton Component should render 1`] = ` `; diff --git a/src/components/refreshTimeButton/refreshTimeButton.js b/src/components/refreshTimeButton/refreshTimeButton.js index 451f13de..5dc1b5de 100644 --- a/src/components/refreshTimeButton/refreshTimeButton.js +++ b/src/components/refreshTimeButton/refreshTimeButton.js @@ -1,7 +1,9 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { Button, Icon } from 'patternfly-react'; +import { Button } from '@patternfly/react-core'; +import { RebootingIcon } from '@patternfly/react-icons'; import { helpers } from '../../common/helpers'; +import { translate } from '../i18n/i18n'; class RefreshTimeButton extends React.Component { pollingInterval = null; @@ -43,13 +45,15 @@ class RefreshTimeButton extends React.Component { } render() { - const { lastRefresh, onRefresh } = this.props; + const { lastRefresh, onRefresh, t } = this.props; return ( - ); @@ -58,11 +62,13 @@ class RefreshTimeButton extends React.Component { RefreshTimeButton.propTypes = { lastRefresh: PropTypes.number, - onRefresh: PropTypes.func.isRequired + onRefresh: PropTypes.func.isRequired, + t: PropTypes.func }; RefreshTimeButton.defaultProps = { - lastRefresh: 0 + lastRefresh: 0, + t: translate }; export { RefreshTimeButton as default, RefreshTimeButton }; diff --git a/src/components/viewToolbar/__tests__/__snapshots__/viewToolbar.test.js.snap b/src/components/viewToolbar/__tests__/__snapshots__/viewToolbar.test.js.snap index 233136c4..0071fb2b 100644 --- a/src/components/viewToolbar/__tests__/__snapshots__/viewToolbar.test.js.snap +++ b/src/components/viewToolbar/__tests__/__snapshots__/viewToolbar.test.js.snap @@ -48,17 +48,34 @@ exports[`ViewPaginationRow Component should render 1`] = ` class="form-group" >