Sha256: d0d2bc98f468d0907682d9924e9e24cf4faa1b3992d06d6ddbeab4a368457382

Contents?: true

Size: 1.32 KB

Versions: 1

Compression:

Stored size: 1.32 KB

Contents

var React = require('react');

var ResourceLink = require('../generic/resource_link'),
    RoleLink = require('../generic/role_link');

export default React.createClass({
    displayName: 'SearchResultItem',

    render() {
        return (
          <div className="item">
            <h4>{this.titleLink()}</h4>
            <div className="details">
              <strong> ID: </strong>
              <ResourceLink id={this.props.data.id}
                            noIcon="true" />
              <strong> Owner: </strong>
              <RoleLink id={this.props.data.owner}
                        noIcon="true" />
            </div>
            <div className="comment">
              {this.commentText()}
            </div>
          </div>
        );
    },

    commentText() {
        var annots = this.annotationsMap();

        return annots.description || '';
    },

    titleLink() {
        var annots = this.annotationsMap();

        return (
          <ResourceLink id={this.props.data.id} text={annots.name} />
        );
    },

    annotationsMap() {
        if (this._annotationsMap) {
            return this._annotationsMap;
        }

        var map = this._annotationsMap = {};

        (this.props.data.annotations || []).forEach(function(a) {
            map[a.name] = a.value;
        });

        return map;
    }
});

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
conjur-asset-ui-1.6.0 app/src/components/search/result_item.js