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-2.0.18.1 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-1.0.18 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-2.0.18 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-1.0.17 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-2.0.17 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-2.0.16 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-1.0.16 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-1.0.15 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-2.0.15 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-3.0.14 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-2.0.14 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-1.0.14 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-0.9.14 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-0.9.13.1 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-1.0.13.1 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-2.0.13.1 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-0.9.13 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-1.0.13 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-2.0.13 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-0.9.12 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js