mirror of
https://github.com/ansible/awx.git
synced 2026-03-11 22:49:32 -02:30
Merge pull request #9903 from nixocio/ui_remove_not_used_code
Remove not used code Remove not used code Reviewed-by: Jake McDermott <yo@jakemcdermott.me>
This commit is contained in:
@@ -1,54 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
import 'styled-components/macro';
|
|
||||||
import styled, { keyframes } from 'styled-components';
|
|
||||||
import { oneOf, string } from 'prop-types';
|
|
||||||
import { CloudIcon } from '@patternfly/react-icons';
|
|
||||||
|
|
||||||
const COLORS = {
|
|
||||||
success: '--pf-global--palette--green-400',
|
|
||||||
syncing: '--pf-global--palette--green-400',
|
|
||||||
error: '--pf-global--danger-color--100',
|
|
||||||
disabled: '--pf-global--disabled-color--200',
|
|
||||||
};
|
|
||||||
|
|
||||||
const Pulse = keyframes`
|
|
||||||
from {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
to {
|
|
||||||
opacity: 1.0;
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
const PulseWrapper = styled.div`
|
|
||||||
animation: ${Pulse} 1.5s linear infinite alternate;
|
|
||||||
`;
|
|
||||||
|
|
||||||
export default function SyncStatusIndicator({ status, title }) {
|
|
||||||
const color = COLORS[status] || COLORS.disabled;
|
|
||||||
|
|
||||||
if (status === 'syncing') {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<PulseWrapper aria-hidden="true">
|
|
||||||
<CloudIcon color={`var(${color})`} title={title} />
|
|
||||||
</PulseWrapper>
|
|
||||||
<span className="pf-screen-reader">{status}</span>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<CloudIcon color={`var(${color})`} title={title} aria-hidden="true" />
|
|
||||||
<span className="pf-screen-reader">{status}</span>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
SyncStatusIndicator.propTypes = {
|
|
||||||
status: oneOf(['success', 'error', 'disabled', 'syncing']).isRequired,
|
|
||||||
title: string,
|
|
||||||
};
|
|
||||||
SyncStatusIndicator.defaultProps = {
|
|
||||||
title: null,
|
|
||||||
};
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
export { default } from './SyncStatusIndicator';
|
|
||||||
@@ -1,12 +1,3 @@
|
|||||||
// TODO: switch to using Lingui i18n for articles
|
|
||||||
export function getArticle(str) {
|
|
||||||
const first = str[0];
|
|
||||||
if ('aeiou'.includes(first)) {
|
|
||||||
return 'an';
|
|
||||||
}
|
|
||||||
return 'a';
|
|
||||||
}
|
|
||||||
|
|
||||||
export const toTitleCase = string => {
|
export const toTitleCase = string => {
|
||||||
if (!string) {
|
if (!string) {
|
||||||
return '';
|
return '';
|
||||||
|
|||||||
@@ -1,21 +1,6 @@
|
|||||||
import { getArticle, toTitleCase } from './strings';
|
import { toTitleCase } from './strings';
|
||||||
|
|
||||||
describe('string utils', () => {
|
describe('string utils', () => {
|
||||||
describe('getArticle', () => {
|
|
||||||
test('should return "a"', () => {
|
|
||||||
expect(getArticle('team')).toEqual('a');
|
|
||||||
expect(getArticle('notification')).toEqual('a');
|
|
||||||
});
|
|
||||||
|
|
||||||
test('should return "an"', () => {
|
|
||||||
expect(getArticle('aardvark')).toEqual('an');
|
|
||||||
expect(getArticle('ear')).toEqual('an');
|
|
||||||
expect(getArticle('interest')).toEqual('an');
|
|
||||||
expect(getArticle('ogre')).toEqual('an');
|
|
||||||
expect(getArticle('umbrella')).toEqual('an');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('toTitleCase', () => {
|
describe('toTitleCase', () => {
|
||||||
test('should upper case each word', () => {
|
test('should upper case each word', () => {
|
||||||
expect(toTitleCase('a_string_of_words')).toEqual('A String Of Words');
|
expect(toTitleCase('a_string_of_words')).toEqual('A String Of Words');
|
||||||
|
|||||||
Reference in New Issue
Block a user