/** @jsx React.DOM */
/* global conjur, React, ReactBootstrap, _ */
(function(conjur, React, ReactBootstrap, _) {
'use strict';
var TabbedArea = ReactBootstrap.TabbedArea,
TabPane = ReactBootstrap.TabPane,
Tab = conjur.views.mixins.Tab,
AuditBox = window.AuditBox,
RoleLink = conjur.views.RoleLink,
HostLink = conjur.views.HostLink;
var abstractRole = function(expected) {
return function(role) {
var tokens = role.split(':'),
kind = tokens[1],
abstractKinds = ['@', 'layer'],
isAbstract = abstractKinds.indexOf(kind) !== -1;
return isAbstract === expected;
};
};
this.Layer = React.createClass({
mixins: [Tab],
render: function() {
var data = this.props.data;
var hosts = data.layer.hosts.map(function(host) {
return (
);
});
var admins = data.admins.filter(abstractRole(false)).map(function(role) {
return (
);
});
var users = data.users.filter(abstractRole(false)).map(function(role) {
return (
);
});
// TODO: controls to add/remove admins/users/hosts
var overviewTab = (
- Owner
- Created by
);
var adminsTab = (
);
var usersTab = (
);
var hostsTab = (
);
var auditTab = (
);
var permissionsTab = this.permissionsTab(data.layer.roleid),
membershipsTab = this.membershipsTab(data.layer.roleid),
annotationsTab = this.annotationsTab(),
ownedTab = this.ownedTab();
var tabs = _.compact([
overviewTab,
adminsTab,
usersTab,
hostsTab,
ownedTab,
membershipsTab,
permissionsTab,
annotationsTab,
auditTab
]);
return (
Layer {data.layer.id}
{tabs}
);
}
});
}).bind(conjur.views)
(
conjur,
React,
ReactBootstrap,
_
);