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-0.9.5 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-1.0.5 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-2.0.5 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-0.9.4.1 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-1.0.4.1 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-1.0.4 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-2.0.4 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-0.9.4 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_inventory_upload-2.0.4.pre.2 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_inventory_upload-2.0.4.pre.1 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_inventory_upload-2.0.3 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_inventory_upload-1.0.3 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_inventory_upload-0.9.2 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_inventory_upload-1.0.2 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_inventory_upload-0.9.1 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_inventory_upload-1.0.1 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_inventory_upload-0.9.0 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_inventory_upload-1.0.0 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_inventory_upload-1.0.0.beta7 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_inventory_upload-1.0.0.beta6 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js