/** @jsx React.DOM */
var Layer = React.createClass({
mixins: [conjur.views.mixins.Tab],
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
}.bind(this));
var admins = this.props.data.admins.filter(abstractRole(false)).map(function (role) {
return
;
}.bind(this));
var users = this.props.data.users.filter(abstractRole(false)).map(function (role) {
return
;
}.bind(this));
// TODO: controls to add/remove admins/users/hosts
var overview_tab =
- Owner
- Created by
;
var admins_tab =
;
var users_tab =
;
var hosts_tab =
;
var audit_tab=
;
var permissions_tab = this.permissions_tab(layer.roleid);
var memberships_tab = this.memberships_tab(layer.roleid);
var annotations_tab = this.annotations_tab();
var owned_tab = this.owned_tab();
var tabs = _.compact( [overview_tab, admins_tab, users_tab, hosts_tab,
owned_tab, memberships_tab, permissions_tab,
annotations_tab,
audit_tab
] );
return (
Layer {layer.id}
{tabs}
);
}
});