padding: var(--gridSize) !important;
}
+.little-padded {
+ padding: calc(var(--gridSize) / 2) !important;
+}
+
.big-padded {
padding: calc(2 * var(--gridSize)) !important;
}
}
.bg-warning {
- background-color: var(--orange);
- color: #fff;
+ background-color: var(--alertBackgroundWarning);
+ color: var(--alertTextWarning);
}
.bg-info {
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+import classNames from 'classnames';
import { find, without } from 'lodash';
import * as React from 'react';
import {
SelectListFilter,
SelectListSearchParams
} from '../../components/controls/SelectList';
+import Tooltip from '../../components/controls/Tooltip';
import QualifierIcon from '../../components/icons/QualifierIcon';
+import WarningIcon from '../../components/icons/WarningIcon';
+import { translate } from '../../helpers/l10n';
import { Application, ApplicationProject } from '../../types/application';
interface Props {
}
return (
- <div className="views-project-item display-flex-center">
- <QualifierIcon className="spacer-right" qualifier="TRK" />
+ <div
+ className={classNames('views-project-item display-flex-center little-padded', {
+ 'bg-warning': !project.accessible
+ })}>
+ {!project.accessible ? (
+ <Tooltip overlay={translate('application_console.project_inaccessible')}>
+ <WarningIcon className="spacer-right" />
+ </Tooltip>
+ ) : (
+ <QualifierIcon className="spacer-right" qualifier="TRK" />
+ )}
<div>
<div title={project.name}>{project.name}</div>
<div className="note">{project.key}</div>
getApplicationProjects: jest.fn().mockResolvedValue({
paging: { pageIndex: 1, pageSize: 3, total: 55 },
projects: [
- { key: 'test1', name: 'test1', selected: false },
- { key: 'test2', name: 'test2', selected: false, disabled: true, includedIn: 'foo' },
- { key: 'test3', name: 'test3', selected: true }
+ { key: 'test1', name: 'test1', accessible: true, selected: false },
+ {
+ key: 'test2',
+ name: 'test2',
+ accessible: false,
+ selected: false,
+ disabled: true,
+ includedIn: 'foo'
+ },
+ { key: 'test3', name: 'test3', accessible: true, selected: true }
]
}),
addProjectToApplication: jest.fn().mockResolvedValue({}),
await waitAndUpdate(wrapper);
expect(wrapper).toMatchSnapshot();
- expect(wrapper.instance().renderElement('test1')).toMatchSnapshot();
- expect(wrapper.instance().renderElement('test2')).toMatchSnapshot();
+ expect(wrapper.instance().renderElement('test1')).toMatchSnapshot('render project: basic');
+ expect(wrapper.instance().renderElement('test2')).toMatchSnapshot('render project: inaccessible');
+ expect(wrapper.instance().renderElement('cheeseburger')).toMatchInlineSnapshot(`""`);
expect(getApplicationProjects).toHaveBeenCalledWith(
expect.objectContaining({
/>
`;
-exports[`should render correctly in application mode 2`] = `
+exports[`should render correctly in application mode: render project: basic 1`] = `
<div
- className="views-project-item display-flex-center"
+ className="views-project-item display-flex-center little-padded"
>
<QualifierIcon
className="spacer-right"
</div>
`;
-exports[`should render correctly in application mode 3`] = `
+exports[`should render correctly in application mode: render project: inaccessible 1`] = `
<div
- className="views-project-item display-flex-center"
+ className="views-project-item display-flex-center little-padded bg-warning"
>
- <QualifierIcon
- className="spacer-right"
- qualifier="TRK"
- />
+ <Tooltip
+ overlay="application_console.project_inaccessible"
+ >
+ <WarningIcon
+ className="spacer-right"
+ />
+ </Tooltip>
<div>
<div
title="test2"
key: string;
name: string;
selected?: boolean;
+ accessible?: boolean;
}
#------------------------------------------------------------------------------
application_console.edit=Edit Application
+application_console.project_inaccessible=You do not have access to this project
application_console.branches=Application Branches
application_console.branches.cannot_access_all_child_projects=You must have access to all projects in this Application in order to administer branches.
application_console.branches.cancel=Cancel