Sha256: daa759ab5ce982d36242538fe589d8df2257ae386b8083ed671f65af512ab430
Contents?: true
Size: 1.16 KB
Versions: 2
Compression:
Stored size: 1.16 KB
Contents
/** @jsx React.DOM */ /** render a link to the role represented by this.props.id Example: <RoleLink id="ci:user:jon"/> */ var RoleLink = React.createClass({ render: function() { var tokens = this.props.id.split(":"); var kind = tokens[1]; var id = tokens[tokens.length-1]; if (tokens.length==1) { // just username kind="user"; id=tokens[0]; } // TODO: shouldn't point to unknown types var href = "/ui/" + conjur.utils.pluralize(kind) + "/" + encodeURIComponent(id); var classes = ["role-link"]; var known_types=['user','group','layer','host','policy']; var kind_is_known = _.contains(known_types, kind); var text = id; if( !this.props.noIcon ) { if (kind_is_known) { classes.push(kind); } else { classes.push('abstract'); // we have no picture for abstract role yet if (text==id) { text=[kind,text].join(":"); // prepend kind to id } } } else if (text==id) { text=[kind,text].join(":"); // prepend kind to id } return <a className={classes.join(' ')} href={href}> {text} </a>; } });
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
conjur-asset-ui-1.3.2 | public/js/views/role.js |
conjur-asset-ui-1.3.0 | public/js/views/role.js |