mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 10:00:01 -03:30
Create map of strings to be translated
Create map of strings to be translated to StatusLabel closes:https://github.com/ansible/awx/issues/8586
This commit is contained in:
parent
c073583663
commit
c1b2428b5d
@ -1,5 +1,6 @@
|
||||
import 'styled-components/macro';
|
||||
import React from 'react';
|
||||
import { t } from '@lingui/macro';
|
||||
import { oneOf } from 'prop-types';
|
||||
import { Label, Tooltip } from '@patternfly/react-core';
|
||||
import {
|
||||
@ -49,7 +50,18 @@ const icons = {
|
||||
};
|
||||
|
||||
export default function StatusLabel({ status, tooltipContent = '' }) {
|
||||
const label = status.charAt(0).toUpperCase() + status.slice(1);
|
||||
const upperCaseStatus = {
|
||||
success: t`Success`,
|
||||
successful: t`Successful`,
|
||||
failed: t`Failed`,
|
||||
error: t`Error`,
|
||||
running: t`Running`,
|
||||
pending: t`Pending`,
|
||||
waiting: t`Waiting`,
|
||||
disabled: t`Disabled`,
|
||||
canceled: t`Canceled`,
|
||||
};
|
||||
const label = upperCaseStatus[status] || t`Undefined`;
|
||||
const color = colors[status] || 'grey';
|
||||
const Icon = icons[status];
|
||||
|
||||
|
||||
@ -52,6 +52,14 @@ describe('StatusLabel', () => {
|
||||
expect(wrapper.text()).toEqual('Waiting');
|
||||
});
|
||||
|
||||
test('should render disabled', () => {
|
||||
const wrapper = mount(<StatusLabel status="disabled" />);
|
||||
expect(wrapper).toHaveLength(1);
|
||||
expect(wrapper.find('MinusCircleIcon')).toHaveLength(1);
|
||||
expect(wrapper.find('Label').prop('color')).toEqual('grey');
|
||||
expect(wrapper.text()).toEqual('Disabled');
|
||||
});
|
||||
|
||||
test('should render canceled', () => {
|
||||
const wrapper = mount(<StatusLabel status="canceled" />);
|
||||
expect(wrapper).toHaveLength(1);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user