Sha256: 55ac26e29c084648b3c15c4a43b9ef566d89dc53488ddd42582d3f747900c87c

Contents?: true

Size: 1.87 KB

Versions: 2

Compression:

Stored size: 1.87 KB

Contents

// var components  = {};
// var globalIds;

function updateNamespace(ns) {
    conjur.app.namespace.currentNamespace = ns;
    // it won't work with reactjs 11.0 -- state should be set from within component
    // components[kind].setState({currentNamespace: ns, members: lists[kind].members(ns)});
}

$(document).ready(function() {
    conjur.initialize();

    _.mixin(_.str.exports());

    // Use delegation to avoid initial DOM selection and allow all matching elements to bubble
    $(document).delegate('a', 'click', function(evt) {
        // Get the anchor href and protcol
        var href = $(this).attr('href');
        var protocol = this.protocol + '//';

        // Ensure the protocol is not part of URL, meaning its relative.
        // Stop the event bubbling to ensure the link will not cause a page refresh.
        if (href.slice(0,protocol.length) !== protocol && href[0] !== '#') {
            evt.preventDefault();

            // Note by using Backbone.history.navigate, router events will not be
            // triggered.  If this is a problem, change this to navigate on your
            // router.
            Backbone.history.navigate(href, {trigger:true});
        }
    });

    conjur.app.router = new conjur.Workspace();

    conjur.app.router.on('all', function(route, router) {
        console.log('router.all', route, conjur.app.flash);

        if (route != 'route') {
            return;
        }

        if (conjur.app.flash) {
            var old = conjur.app.flash;
            conjur.app.flash = null;
            var $flash = $('#flash');
            var $text = $('.text', $flash);
            $text.text(old);
            $flash.show();
        } else {
            $('#flash').hide();
        }
    });

    Backbone.history.start({pushState: true});

    React.renderComponent(conjur.views.NavSearchForm(null), document.getElementById('inlineSearchContainer'));
});

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
conjur-asset-ui-1.3.2 public/js/main.js
conjur-asset-ui-1.3.0 public/js/main.js