Sha256: 93033579119424878ebb328faea4bbf54c45d655aa1a395579124530165a35e7

Contents?: true

Size: 709 Bytes

Versions: 86

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

86 entries across 86 versions & 1 rubygems

Version Path
foreman_rh_cloud-3.0.28 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-5.0.28 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-4.0.27 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-3.0.26 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-4.0.26 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-4.0.25.1 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-3.0.25 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-4.0.25 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-3.0.24.1 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-4.0.24.1 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-3.0.24 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-4.0.24 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-3.0.23 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-4.0.23 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-3.0.22 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-4.0.22 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-4.0.21.1 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-3.0.21.1 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-3.0.21 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
foreman_rh_cloud-3.0.20 webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js