Sha256: e29034ed4540a669731d6ffba970c7cc4db5771d83d37fcaa31b59ff387907ee

Contents?: true

Size: 676 Bytes

Versions: 64

Compression:

Stored size: 676 Bytes

Contents

import React from 'react';
import { Icon, Spinner } from 'patternfly-react';

const STATUS_ICONS = {
  success: <Icon name="check" />,
  failure: <Icon name="times" />,
  running: <Spinner loading inline size="xs" />,
  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

64 entries across 64 versions & 2 rubygems

Version Path
foreman_rh_cloud-1.0.12 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-2.0.12 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-0.9.11 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-1.0.11 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-2.0.11 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-0.9.10 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-1.0.10 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-2.0.10 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-2.0.9 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-1.0.9 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-0.9.9 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-0.9.8 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-1.0.8 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-2.0.8 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-0.9.7 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-1.0.7 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-2.0.7 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-0.9.6 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-1.0.6 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-2.0.6 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js