Sha256: d80fa9c77a70a75bdab1dbe2fc07d08c0c59157aa8f1d4f6b11995116e335782

Contents?: true

Size: 868 Bytes

Versions: 22

Compression:

Stored size: 868 Bytes

Contents

import React from 'react';
import { ListView } from 'patternfly-react';
import PropTypes from 'prop-types';

import { itemIteratorId } from './helpers';

const wrapWithLink = (template, editPath) => {
  if (template.id && template.canEdit) {
    return (
      <a
        href={editPath.replace(':id', template.id)}
        target="_blank"
        rel="noopener noreferrer"
      >
        {template.name}
      </a>
    );
  }
  return template.name || ' ';
};

const LinkInfoItem = ({ template, editPath, attr }) => (
  <ListView.InfoItem
    key={itemIteratorId(template, attr)}
    className="additional-info-wide"
  >
    {wrapWithLink(template, editPath)}
  </ListView.InfoItem>
);

LinkInfoItem.propTypes = {
  template: PropTypes.object.isRequired,
  editPath: PropTypes.string.isRequired,
  attr: PropTypes.string.isRequired,
};

export default LinkInfoItem;

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
foreman_templates-10.0.2 webpack/components/TemplateSyncResult/components/SyncedTemplate/LinkInfoItem.js
foreman_templates-10.0.1 webpack/components/TemplateSyncResult/components/SyncedTemplate/LinkInfoItem.js
foreman_templates-10.0.0 webpack/components/TemplateSyncResult/components/SyncedTemplate/LinkInfoItem.js
foreman_templates-9.5.1 webpack/components/TemplateSyncResult/components/SyncedTemplate/LinkInfoItem.js
foreman_templates-9.5.0 webpack/components/TemplateSyncResult/components/SyncedTemplate/LinkInfoItem.js
foreman_templates-9.3.3 webpack/components/TemplateSyncResult/components/SyncedTemplate/LinkInfoItem.js
foreman_templates-9.3.2 webpack/components/TemplateSyncResult/components/SyncedTemplate/LinkInfoItem.js
foreman_templates-9.3.1 webpack/components/TemplateSyncResult/components/SyncedTemplate/LinkInfoItem.js
foreman_templates-9.4.0 webpack/components/TemplateSyncResult/components/SyncedTemplate/LinkInfoItem.js
foreman_templates-9.3.0 webpack/components/TemplateSyncResult/components/SyncedTemplate/LinkInfoItem.js
foreman_templates-9.2.0 webpack/components/TemplateSyncResult/components/SyncedTemplate/LinkInfoItem.js
foreman_templates-9.1.0 webpack/components/TemplateSyncResult/components/SyncedTemplate/LinkInfoItem.js
foreman_templates-9.0.2 webpack/components/TemplateSyncResult/components/SyncedTemplate/LinkInfoItem.js
foreman_templates-9.0.1 webpack/components/TemplateSyncResult/components/SyncedTemplate/LinkInfoItem.js
foreman_templates-9.0.0 webpack/components/TemplateSyncResult/components/SyncedTemplate/LinkInfoItem.js
foreman_templates-7.0.7 webpack/components/TemplateSyncResult/components/SyncedTemplate/LinkInfoItem.js
foreman_templates-8.0.0 webpack/components/TemplateSyncResult/components/SyncedTemplate/LinkInfoItem.js
foreman_templates-7.0.6 webpack/components/TemplateSyncResult/components/SyncedTemplate/LinkInfoItem.js
foreman_templates-7.0.5 webpack/components/TemplateSyncResult/components/SyncedTemplate/LinkInfoItem.js
foreman_templates-7.0.4 webpack/components/TemplateSyncResult/components/SyncedTemplate/LinkInfoItem.js