update language and stylign for all warning/danger modals

This commit is contained in:
John Mitchell
2019-04-08 14:10:06 -04:00
parent fa232a94bd
commit 81267c7212
4 changed files with 40 additions and 14 deletions

View File

@@ -4,6 +4,8 @@ import React, { Component } from 'react';
import { withRouter } from 'react-router-dom'; import { withRouter } from 'react-router-dom';
import { i18nMark } from '@lingui/react';
import { withRootDialog } from './RootDialog'; import { withRootDialog } from './RootDialog';
import APIClient from '../api'; import APIClient from '../api';
@@ -37,7 +39,7 @@ class prov extends Component {
} }
history.replace('/login'); history.replace('/login');
setRootDialogMessage({ setRootDialogMessage({
bodyText: 'You have been logged out.', bodyText: i18nMark('You have been logged out.')
}); });
} }
@@ -49,8 +51,8 @@ class prov extends Component {
} }
history.replace('/home'); history.replace('/home');
setRootDialogMessage({ setRootDialogMessage({
title: '404', title: i18nMark('404'),
bodyText: 'Cannot find resource.', bodyText: i18nMark('Cannot find resource.'),
variant: 'warning' variant: 'warning'
}); });
} }

View File

@@ -1,6 +1,7 @@
import React, { Component, Fragment } from 'react'; import React, { Component, Fragment } from 'react';
import { Route, withRouter, Switch } from 'react-router-dom'; import { Route, withRouter, Switch } from 'react-router-dom';
import { i18nMark } from '@lingui/react'; import { i18nMark } from '@lingui/react';
import { Trans } from '@lingui/macro';
import { NetworkProvider } from '../../contexts/Network'; import { NetworkProvider } from '../../contexts/Network';
import { withRootDialog } from '../../contexts/RootDialog'; import { withRootDialog } from '../../contexts/RootDialog';
@@ -62,7 +63,13 @@ class Organizations extends Component {
history.replace('/organizations'); history.replace('/organizations');
setRootDialogMessage({ setRootDialogMessage({
title: '404', title: '404',
bodyText: `Cannot find organization with ID ${newRouteMatch.params.id}.`, bodyText: (
<Trans>
Cannot find organization with ID
<strong>{` ${newRouteMatch.params.id}`}</strong>
.
</Trans>
),
variant: 'warning' variant: 'warning'
}); });
}} }}

View File

@@ -7,7 +7,7 @@ import {
} from '@patternfly/react-core'; } from '@patternfly/react-core';
import { I18n, i18nMark } from '@lingui/react'; import { I18n, i18nMark } from '@lingui/react';
import { t } from '@lingui/macro'; import { t, Trans } from '@lingui/macro';
import { import {
Link Link
@@ -257,16 +257,33 @@ class OrganizationAccessList extends React.Component {
let warningMsg; let warningMsg;
if (type === 'users') { if (type === 'users') {
warningTitle = i18nMark('User Access Removal'); warningTitle = i18nMark('Remove User Access');
warningMsg = i18nMark(`Please confirm that you would like to remove ${roleName} warningMsg = (
access from ${resourceName}.`); <Trans>
Are you sure you want to remove
<b>{` ${roleName} `}</b>
access from
<strong>{` ${resourceName}`}</strong>
?
</Trans>
);
} }
if (type === 'teams') { if (type === 'teams') {
warningTitle = i18nMark('Team Access Removal'); warningTitle = i18nMark('Remove Team Access');
warningMsg = i18nMark(`Please confirm that you would like to remove ${roleName} warningMsg = (
access from the team ${resourceName}. This will affect all <Trans>
members of the team. If you would like to only remove access Are you sure you want to remove
for this particular user, please remove them from the team.`); <b>{` ${roleName} `}</b>
access from
<b>{` ${resourceName}`}</b>
? Doing so affects all members of the team.
<br />
<br />
If you
<b><i> only </i></b>
want to remove access for this particular user, please remove them from the team.
</Trans>
);
} }
this.setState({ this.setState({

View File

@@ -153,7 +153,7 @@ class OrganizationsList extends Component {
handleOpenOrgDeleteModal () { handleOpenOrgDeleteModal () {
const { results, selected } = this.state; const { results, selected } = this.state;
const warningTitle = i18nMark('Delete Organization'); const warningTitle = i18nMark(`Delete Organization${selected.length > 1 ? 's' : ''}`);
const warningMsg = i18nMark('Are you sure you want to delete:'); const warningMsg = i18nMark('Are you sure you want to delete:');
const orgsToDelete = []; const orgsToDelete = [];