Skip to content

Commit

Permalink
export status variable
Browse files Browse the repository at this point in the history
  • Loading branch information
MonPote committed Nov 15, 2024
1 parent 3be4960 commit 56b94a5
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 6 deletions.
10 changes: 10 additions & 0 deletions src/lib/components/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,20 @@ export const queryTimeSpansCodes: QueryTimeSpan[] = [
},
];
export const NAN_STRING = 'NAN';

export const STATUS_CRITICAL = 'critical';
export const STATUS_WARNING = 'warning';
export const STATUS_SUCCESS = 'success';
export const STATUS_HEALTHY = 'healthy';
export const STATUS_INFO = 'info';
export const STATUS_UNKNOWN = 'unknown';
export const STATUS_NONE = 'none';

export type Status =
| 'none'
| 'unknown'
| 'info'
| 'healthy'
| 'success'
| 'warning'
| 'critical';
15 changes: 10 additions & 5 deletions src/lib/components/statuswrapper/Statuswrapper.component.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import * as React from 'react';
import styled, { css } from 'styled-components';

import { Status } from '../constants';
import {
Status,
STATUS_CRITICAL,
STATUS_HEALTHY,
STATUS_UNKNOWN,
STATUS_WARNING,
} from '../constants';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import {
faQuestionCircle,
Expand Down Expand Up @@ -33,16 +39,15 @@ const BadgeStyled = styled(FontAwesomeIcon)`

const getBadgeIcon = (status: Status) => {
switch (status) {
case 'warning':
case STATUS_WARNING:
return faExclamationCircle;

case 'critical':
case STATUS_CRITICAL:
return faTimesCircle;

case 'unknown':
case STATUS_UNKNOWN:
return faQuestionCircle;

case 'healthy':
default:
return null;
}
Expand Down
12 changes: 11 additions & 1 deletion src/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,17 @@ export { Button } from './components/button/Button.component';
export { Checkbox } from './components/checkbox/Checkbox.component';
export { Chips } from './components/chips/Chips.component';
export { Dropdown } from './components/dropdown/Dropdown.component';
export { LOADER_SIZE } from './components/constants';
export {
LOADER_SIZE,
STATUS_CRITICAL,
STATUS_WARNING,
STATUS_SUCCESS,
STATUS_HEALTHY,
STATUS_INFO,
STATUS_UNKNOWN,
STATUS_NONE,
Status,
} from './components/constants';
export { Layout } from './components/layout/Layout.component';
export { Loader } from './components/loader/Loader.component';
export { Modal } from './components/modal/Modal.component';
Expand Down

0 comments on commit 56b94a5

Please sign in to comment.