Ejemplo n.º 1
0
 collection.each(function(model, index) {
     var $tab_element = tabs.$("#tab-" + model.id + " .nav-link");
     var $tab_content = tabs.$("#" + model.id);
     var is_current = model.id == tabs.model.get("current");
     assert.ok($tab_content.hasClass("active") == is_current, "Active state of content.");
     assert.ok($tab_element.hasClass("active") == is_current, "Active state of element.");
 });
Ejemplo n.º 2
0
 tabs.$("input.grid-row-select-checkbox[name=id]:checked").each(function() {
     window.console.log($(this).val());
     requests[requests.length] = $.ajax({
         url: `${getAppRoot()}api/datasets/${$(this).val()}`,
         dataType: "json",
         data: {
             data_type: "track_config",
             hda_ldda: tabs.current() == "histories" ? "hda" : "ldda"
         }
     });
 });
Ejemplo n.º 3
0
 _createTabs: function() {
     this.forms = {
         attribute: this._getAttribute(),
         conversion: this._getConversion(),
         datatype: this._getDatatype(),
         permission: this._getPermission()
     };
     var tabs = new Tabs.View();
     tabs.add({
         id: "attribute",
         title: _l("Attributes"),
         icon: "fa fa-bars",
         tooltip: _l("Edit dataset attributes"),
         $el: this.forms.attribute.$el
     });
     tabs.add({
         id: "convert",
         title: _l("Convert"),
         icon: "fa-gear",
         tooltip: _l("Convert to new format"),
         $el: this.forms.conversion.$el
     });
     tabs.add({
         id: "datatype",
         title: _l("Datatypes"),
         icon: "fa-database",
         tooltip: _l("Change data type"),
         $el: this.forms.datatype.$el
     });
     tabs.add({
         id: "permissions",
         title: _l("Permissions"),
         icon: "fa-user",
         tooltip: _l("Permissions"),
         $el: this.forms.permission.$el
     });
     return tabs;
 },
Ejemplo n.º 4
0
QUnit.test("tabs", function(assert) {
    assert.ok($.fn);
    var self = this;
    var tabs = new Tabs.View({});
    var collection = tabs.collection;
    collection.add({ id: "id_a", title: "title_a", icon: "icon_a", $el: "el_a" });
    var _test = function() {
        self.clock.tick(window.WAIT_FADE);
        collection.each(function(model, index) {
            var $tab_element = tabs.$("#tab-" + model.id + " .nav-link");
            var $tab_content = tabs.$("#" + model.id);
            var is_current = model.id == tabs.model.get("current");
            assert.ok($tab_content.hasClass("active") == is_current, "Active state of content.");
            assert.ok($tab_element.hasClass("active") == is_current, "Active state of element.");
        });
    };
    $("body").prepend(tabs.$el);
    _test();
    collection.add({ id: "id_b", title: "title_b", icon: "icon_b", $el: "el_b" });
    _test();
    tabs.collection.get("id_b").set("hidden", true);
    _test();
    collection.add({ id: "id_c", title: "title_c", icon: "icon_c", $el: "el_c" });
    tabs.model.set("current", "id_c");
    _test();
    tabs.collection.get("id_b").set("hidden", false);
    _test();
    tabs.model.set("current", "id_b");
    _test();
    tabs.model.set("visible", false);
    tabs.collection.reset();
    self.clock.tick(window.WAIT_FADE);
    assert.ok(tabs.$el.css("display", "none"), "Everything hidden.");
    tabs.model.set("visible", true);
    self.clock.tick(window.WAIT_FADE);
    assert.ok(tabs.$el.css("display", "block"), "Everything shown.");
    collection.add({ id: "id_c", title: "title_c", icon: "icon_c", $el: "el_c" });
    tabs.model.set("current", "id_c");
    _test();
});
Ejemplo n.º 5
0
 Add: function() {
     var requests = [];
     tabs.$("input.grid-row-select-checkbox[name=id]:checked").each(function() {
         window.console.log($(this).val());
         requests[requests.length] = $.ajax({
             url: `${getAppRoot()}api/datasets/${$(this).val()}`,
             dataType: "json",
             data: {
                 data_type: "track_config",
                 hda_ldda: tabs.current() == "histories" ? "hda" : "ldda"
             }
         });
     });
     // To preserve order, wait until there are definitions for all tracks and then add
     // them sequentially.
     $.when.apply($, requests).then(function() {
         // jQuery always returns an Array for arguments, so need to look at first element
         // to determine whether multiple requests were made and consequently how to
         // map arguments to track definitions.
         var track_defs = arguments[0] instanceof Array ? $.map(arguments, arg => arg[0]) : [arguments[0]];
         success_fn(track_defs);
     });
     Galaxy.modal.hide();
 }
Ejemplo n.º 6
0
var select_datasets = (filters, success_fn) => {
    // history dataset selection tab
    var history_grid = new GridView({
        url_base: `${getAppRoot()}visualization/list_history_datasets`,
        filters: filters,
        embedded: true
    });

    // library dataset selection tab
    var library_grid = new GridView({
        url_base: `${getAppRoot()}visualization/list_library_datasets`,
        embedded: true
    });

    // build tabs
    var tabs = new Tabs.View();
    tabs.add({
        id: "histories",
        title: _l("Histories"),
        $el: $("<div/>").append(history_grid.$el)
    });
    tabs.add({
        id: "libraries",
        title: _l("Libraries"),
        $el: $("<div/>").append(library_grid.$el)
    });

    // modal
    Galaxy.modal.show({
        title: _l("Select datasets for new tracks"),
        body: tabs.$el,
        closing_events: true,
        buttons: {
            Cancel: function() {
                Galaxy.modal.hide();
            },
            Add: function() {
                var requests = [];
                tabs.$("input.grid-row-select-checkbox[name=id]:checked").each(function() {
                    window.console.log($(this).val());
                    requests[requests.length] = $.ajax({
                        url: `${getAppRoot()}api/datasets/${$(this).val()}`,
                        dataType: "json",
                        data: {
                            data_type: "track_config",
                            hda_ldda: tabs.current() == "histories" ? "hda" : "ldda"
                        }
                    });
                });
                // To preserve order, wait until there are definitions for all tracks and then add
                // them sequentially.
                $.when.apply($, requests).then(function() {
                    // jQuery always returns an Array for arguments, so need to look at first element
                    // to determine whether multiple requests were made and consequently how to
                    // map arguments to track definitions.
                    var track_defs = arguments[0] instanceof Array ? $.map(arguments, arg => arg[0]) : [arguments[0]];
                    success_fn(track_defs);
                });
                Galaxy.modal.hide();
            }
        }
    });
};