diff --git a/public/locales/en.json b/public/locales/en.json index b18545cb..187d2524 100644 --- a/public/locales/en.json +++ b/public/locales/en.json @@ -23,6 +23,9 @@ }, "view": { "loading": "Loading...", - "loading_credentials": "Loading credentials..." + "loading_credentials": "Loading credentials...", + "login_error": "Login error", + "login-message_error": "Please <0>login to continue.", + "login_pending": "Logging in..." } } diff --git a/src/components/authentication/__tests__/__snapshots__/authentication.test.js.snap b/src/components/authentication/__tests__/__snapshots__/authentication.test.js.snap index e02ba140..9235b53d 100644 --- a/src/components/authentication/__tests__/__snapshots__/authentication.test.js.snap +++ b/src/components/authentication/__tests__/__snapshots__/authentication.test.js.snap @@ -21,6 +21,7 @@ exports[`Authentication Component should render a non-connected component author "pending": false, } } + t={[Function]} >
- +
+ + + + + +
+ +

- - - - - Login error: + Danger alert: + + t(view.login, {"context":"error"}) +

+
Authentication credentials were not provided . - Please - - login - - to continue. - + t(view.login-message, {"context":"error"}, [object Object]) +
@@ -199,10 +229,8 @@ exports[`Authentication Component should render a non-connected component pendin
-
- Logging in... -
+ + t(view.login, {"context":"pending"}) + `; diff --git a/src/components/authentication/authentication.js b/src/components/authentication/authentication.js index 37ef665c..9373a718 100644 --- a/src/components/authentication/authentication.js +++ b/src/components/authentication/authentication.js @@ -1,12 +1,17 @@ import React from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; -import { Alert, EmptyState } from 'patternfly-react'; +import { Alert, Button, Bullseye } from '@patternfly/react-core'; +import { EmptyState } from 'patternfly-react'; import { Modal, ModalVariant } from '../modal/modal'; import { reduxActions } from '../../redux'; import helpers from '../../common/helpers'; import { PageLayout } from '../pageLayout/pageLayout'; +import { translate } from '../i18n/i18n'; +/** + * Authentication, determine if a user is authorized. + */ class Authentication extends React.Component { componentDidMount() { const { session, authorizeUser } = this.props; @@ -17,7 +22,7 @@ class Authentication extends React.Component { } render() { - const { children, session } = this.props; + const { children, session, t } = this.props; if (session.authorized) { return {children}; @@ -27,7 +32,7 @@ class Authentication extends React.Component { return (
-
Logging in...
+ {t('view.login', { context: 'pending' })} ); } @@ -35,16 +40,13 @@ class Authentication extends React.Component { return ( - - - Login error: {session.errorMessage.replace(/\.$/, '')} - {session.errorMessage && '.'} - {!session.authorized && ( - - Please login to continue. - - )} - + + {session.errorMessage.replace(/\.$/, '')} + {session.errorMessage && '.'} + {!session.authorized && + t('view.login-message', { context: 'error' }, [ +