Sha256: 93033579119424878ebb328faea4bbf54c45d655aa1a395579124530165a35e7

Contents?: true

Size: 709 Bytes

Versions: 84

Compression:

Stored size: 709 Bytes

Contents

import React from 'react';
import { Spinner } from '@patternfly/react-core';
import { CheckIcon, TimesIcon } from '@patternfly/react-icons';

const STATUS_ICONS = {
  success: <CheckIcon />,
  failure: <TimesIcon />,
  running: <Spinner size="sm" />,
  unknown: <span>--</span>,
};

export const getStatusIconByRegex = status => {
  if (!status || status === 'unknown') {
    return STATUS_ICONS.unknown;
  }

  const statusCopy = status.toLowerCase();
  if (statusCopy.indexOf('exit 0') !== -1) {
    return STATUS_ICONS.success;
  }

  if (
    statusCopy.indexOf('running') !== -1 ||
    statusCopy.indexOf('restarting') !== -1
  ) {
    return STATUS_ICONS.running;
  }

  return STATUS_ICONS.failure;
};

Version data entries

84 entries across 84 versions & 1 rubygems

Version Path
foreman_rh_cloud-3.0.18 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-3.0.17 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-3.0.16 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-3.0.15 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js