import Tooltip from '../../components/controls/Tooltip';
import ModalForm from '../../components/common/modal-form';
import SelectList from '../../components/SelectList';
+import CoverageRating from '../../components/ui/CoverageRating';
+import DuplicationsRating from '../../components/ui/DuplicationsRating';
+import Level from '../../components/ui/Level';
const exposeLibraries = () => {
window.moment = moment;
Modal,
Tooltip,
Select,
+ CoverageRating,
+ DuplicationsRating,
+ Level,
// deprecated, used in Governance
ModalForm_deprecated: ModalForm,
SelectList
const SIZE_TO_WIDTH_MAPPING = {
small: 16,
normal: 24,
- big: 40
+ big: 40,
+ huge: 60
};
const SIZE_TO_THICKNESS_MAPPING = {
small: 2,
normal: 3,
- big: 3
+ big: 3,
+ huge: 4
};
export default class CoverageRating extends React.PureComponent {
props: {
value: number | string,
- size?: 'small' | 'normal' | 'big',
+ size?: 'small' | 'normal' | 'big' | 'huge',
muted?: boolean
};
border-width: 3px;
}
+.duplications-rating-huge {
+ width: 60px;
+ height: 60px;
+ border-width: 4px;
+ border-radius: 30px;
+}
+
.duplications-rating-muted {
border-color: #bdbdbd !important;
}
height: 12px;
}
+.duplications-rating-huge.duplications-rating-B:after {
+ width: 18px;
+ height: 18px;
+}
+
.duplications-rating-C {
border-color: #eabe06;
}
height: 16px;
}
+.duplications-rating-huge.duplications-rating-C:after {
+ width: 24px;
+ height: 24px;
+}
+
.duplications-rating-D {
border-color: #ed7d20;
}
height: 24px;
}
+.duplications-rating-huge.duplications-rating-D:after {
+ width: 36px;
+ height: 36px;
+}
+
.duplications-rating-E {
border-color: #d4333f;
}
width: 28px;
height: 28px;
}
+
+.duplications-rating-huge.duplications-rating-E:after {
+ width: 42px;
+ height: 42px;
+}
export default class DuplicationsRating extends React.PureComponent {
props: {
value: number,
- size?: 'small' | 'normal' | 'big',
+ size?: 'small' | 'normal' | 'big' | 'huge',
muted?: boolean
};
const className = classNames('duplications-rating', {
'duplications-rating-small': size === 'small',
'duplications-rating-big': size === 'big',
+ 'duplications-rating-huge': size === 'huge',
'duplications-rating-muted': muted,
'duplications-rating-A': inRange(value, 0, 3),
'duplications-rating-B': inRange(value, 3, 5),
export default class Level extends React.PureComponent {
static propTypes = {
+ className: PropTypes.string,
level: PropTypes.oneOf(['ERROR', 'WARN', 'OK']).isRequired,
small: PropTypes.bool,
muted: PropTypes.bool
render() {
const formatted = formatMeasure(this.props.level, 'LEVEL');
- const className = classNames('level', 'level-' + this.props.level, {
+ const className = classNames(this.props.className, 'level', 'level-' + this.props.level, {
'level-small': this.props.small,
'level-muted': this.props.muted
});