Sha256: b14fbb97831bb0b88e41a01ac9aea7200f119485d5cf4ff0ec7cb1b59dc42a3d

Contents?: true

Size: 1.64 KB

Versions: 1

Compression:

Stored size: 1.64 KB

Contents

/** @jsx React.DOM */

var Layer = React.createClass({
  render: function() {
    function abstractRole(expected) {
      return function(role) {
        var tokens = role.split(':');
        var kind = tokens[1];
        var abstractKinds = [ '@', 'layer' ];
        var isAbstract = abstractKinds.indexOf(kind) !== -1;
        return isAbstract === expected;
      }
    }
    
    var layer = this.props.data.layer;
       
    var hosts = layer.hosts.map(function (host) {
      return <li>
        <HostLink data={host} />
      </li>
    }.bind(this));
    var admins = this.props.data.admins.filter(abstractRole(false)).map(function (role) {
      return <RoleLink id={role}/>;
    }.bind(this));
    var users = this.props.data.users.filter(abstractRole(false)).map(function (role) {
      return <RoleLink id={role}/>
    }.bind(this));
    
    return (
      <div className="group">
        <h2>Layer {layer.id}</h2>
        
        <dl>
          <dt>Owner</dt>
          <dd><RoleLink id={layer.ownerid}/></dd>
          <dt>Admins</dt>
          <dd>
            <ul>
              {admins}
            </ul>
          </dd>
          <dt>Users</dt>
          <dd>
            <ul>
              {users}
            </ul>
          </dd>
          <dt>Hosts</dt>
          <dd>
            <ul>
              {hosts}
            </ul>
          </dd>
        </dl>
        <OwnedResources owned={this.props.data.owned} /> 
        <Permissions owned={this.props.data.owned} role={layer.roleid}/>
        <div className="audit auditLayer">
          <AuditBox roles={[layer.roleid]} resources={[layer.resource_identifier]}/>
        </div>
      </div>
    );
  }
});

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
conjur-asset-ui-api-1.2.0 public/js/views/layer.js