Sha256: 821375c9e9fd5c177fabbf3531de72061ddb78577d6713b9fc96aa69a427b958

Contents?: true

Size: 662 Bytes

Versions: 2

Compression:

Stored size: 662 Bytes

Contents

/** @jsx React.DOM */

/**
 Renders a link to the resource with id given by this.props.data.
 
 Includes a slick little icon for the following kinds:
  TODO which kinds? 
**/
var ResourceLink = React.createClass({
  render: function(){
    var resourceId = this.props.data;
    var tokens = resourceId.split(':');
    var kind = tokens[1];
    var id = tokens[tokens.length - 1];
    var text = this.props.text || id;
    var href = "/ui/" + pluralize(kind) + "/" + encodeURIComponent(id);
    var classes = ['resource-link'];
    if(!this.props.noIcon){
      classes.push(kind);
    }
    return <a className={classes.join(' ')} href={href}>{text}</a>
  }
});

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
conjur-asset-ui-api-1.1.1 public/js/views/resource.js
conjur-asset-ui-api-1.1.0 public/js/views/resource.js