/** @jsx React.DOM */ /* global conjur, React, ReactBootstrap, _ */ (function(conjur, React, ReactBootstrap, _) { 'use strict'; var RoleLink = conjur.views.RoleLink, AuditBox = window.AuditBox, Breadcrumbs = conjur.views.Breadcrumbs, Chart = conjur.views.Chart, ChartHelperMixin = conjur.views.ChartHelperMixin, AnnotationsBox = conjur.views.AnnotationsBox, FoldableAuditSection = conjur.views.FoldableAuditSection; var RevealerBox = React.createClass({ getInitialState: function() { return {revealed: false}; }, handleClick: function() { this.setState({revealed: !this.state.revealed}); }, render: function() { var valToShow = this.state.revealed ? 'SECRET HERE!' : 'Show Value'; return (
{valToShow}
); } }); var Activity = React.createClass({ mixins: [ChartHelperMixin], getDefaultProps: function() { return { options: { legend: { sread: 'Successful reads', supdate: 'Successful updates', fread: 'Failed reads', fupdate: 'Failed updates' }, axis: { y: { label: 'Value' } } } }; }, getDefaultItem: function() { return { sread: 0, supdate: 0, fread: 0, fupdate: 0 }; }, getEventType: function(e) { if (e.action === 'check') { if (e.hasOwnProperty('error') || e.allowed === false) { if (e.privilege === 'execute') { return 'fread'; } else if (e.privilege === 'update') { return 'fupdate'; } } if (!e.hasOwnProperty('error') && e.allowed !== false) { if (e.privilege === 'execute') { return 'sread'; } else if (e.privilege === 'update') { return 'supdate'; } } } return null; }, render: function() { var data = this.getData(this.props.audit); return (

Activity

); } }); var Updaters = React.createClass({ getInitialState: function() { return {showAll: false}; }, handleClick: function(e) { e.preventDefault(); this.setState({showAll: !this.state.showAll}); }, getItems: function() { var items = this.props.data || []; if (!this.state.showAll) { items = _.first(items, 5); } return _.map(items, function(e) { return (
  • ); }); }, render: function() { var items = this.getItems(), msg = this.state.showAll ? 'Show top 5' : 'See all', empty = items.length === 0, lessThan5 = items.length < 5, body = [(

    Updaters

    )]; if (!empty) { body.push( ); } else { body.push(

    There is not any updaters

    ); } if (!lessThan5) { body.push(
    {msg}
    ); } return (
    {body}
    ); } }); var Fetchers = React.createClass({ getInitialState: function() { return {showAll: false}; }, handleClick: function(e) { e.preventDefault(); this.setState({showAll: !this.state.showAll}); }, getItems: function() { var items = this.props.data || []; if (!this.state.showAll) { items = _.first(items, 5); } return _.map(items, function(e) { return (
  • ); }); }, render: function() { var items = this.getItems(), msg = this.state.showAll ? 'Show top 5' : 'See all', empty = items.length === 0, lessThan5 = items.length < 5, body = [(

    Fetchers

    )]; if (!empty) { body.push( ); } else { body.push(

    There is not any fetchers

    ); } if (!lessThan5) { body.push(
    {msg}
    ); } return (
    {body}
    ); } }); var Details = React.createClass({ render: function() { // return (

    Details

    Owner
    Created by
    MIME type
    {this.props.data.variable.mime_type}
    Kind
    {this.props.data.variable.kind}
    Versions
    {this.props.data.variable.version_count}
    ); } }); this.Variable = React.createClass({ render: function() { var resourceId = [ conjur.app.configuration.account, 'variable', this.props.data.variable.id ].join(':'); var elems = [ {url: '/ui/variables', text: 'Variables'}, {url: '', text: this.props.data.variable.id}, {url: '', text: '(owned by ' + this.props.data.variable.ownerid + ')'} ]; return (



    {FoldableAuditSection.updates(this.props.data.audit)}
    {FoldableAuditSection.warnings(this.props.data.audit)}

    Annotations


    ); } }); }).bind(conjur.views) ( conjur, React, ReactBootstrap, _ );