/** @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;
var PubkeyItem = React.createClass({
render: function() {
return (
{this.props.pubkey[0]}
-
{this.props.pubkey[2]}
-
{/* TODO: key fingerprint */}
-
{/* TODO: When added, when last time used */}
{/* TODO: Action buttons */}
);
}
});
var PubkeysList = React.createClass({
render: function() {
var login = this.props.login;
var pubkeysList = this.props.pubkeys.map(function(k, idx, coll) {
var tokens = k.split(' ');
console.log(arguments);
var className = 'b-pubkeys__item list-group-item list-group-item-noborder';
if (idx + 1 !== coll.length) {
className = className + ' b-pubkeys__item--headline';
}
return (
);
});
return (
This is list of SSH public keys associated with user {login}.
);
}
});
var PubkeysHelp = React.createClass({
render: function() {
var ret;
if (React.Children.count(this.props.children) > 0) {
ret = (
{this.props.children}
);
} else {
var login = this.props.login;
ret = (
User {login} have not any pubkey. Use follow command to create one:
$ conjur pubkeys add {login} @id_{login}.pub
);
}
return ret;
}
});
var PubkeysTabContent = React.createClass({
render: function() {
var body;
if (this.props.pubkeys.length > 0) {
body = (
);
} else {
body = (
);
}
return body;
}
});
this.User = React.createClass({
mixins: [Tab],
render: function() {
var user = this.props.data.user;
// TODO: refactor
// TODO: show public keys
// TODO: actions menu (e.g. 'upload public key', 'add annotation')
// TODO: memberships panel
var overviewTab = (
- Created by
- Owner
- Uidnumber
- {user.uidnumber}
);
var auditTab = (
);
var pubkeysTab = (
);
var permissionsTab = this.permissionsTab(user.roleid);
var membershipsTab = this.membershipsTab(user.roleid);
var annotationsTab = this.annotationsTab();
var ownedTab = this.ownedTab();
var tabs = _.compact([
overviewTab,
ownedTab,
membershipsTab,
permissionsTab,
annotationsTab,
pubkeysTab,
auditTab
]);
return (
User {user.login}
{tabs}
);
}
});
}).bind(conjur.views)
(
conjur,
_,
React,
ReactBootstrap
);