All Downloads are FREE. Search and download functionalities are using the official Maven repository.

js.dataexplorer-aggregates.min.js Maven / Gradle / Ivy

(function(e,i){var h=-1;i.dataexplorer=i.dataexplorer||{};var l=i.dataexplorer.aggregates=i.dataexplorer.aggregates||{};l.createAggregatesTable=d;l.updateAggregatesTable=f;var b=new i.RestClient();var a=new i.RestClientV2();function d(){var n=j();var q=e.grep(n,function(r){if(r.isAggregatable){if(r.nillable){return r.fieldType!=="CATEGORICAL"&&r.fieldType!=="XREF"&&r.fieldType!=="MREF"&&r.fieldType!=="CATEGORICAL_MREF"&&r.fieldType!=="ONE_TO_MANY"}return true}return false});if(q.length>0){c(e("#x-aggr-div"),q,"x-aggr-attribute",q[0],true);c(e("#y-aggr-div"),q,"y-aggr-attribute",q.length>1?q[1]:false);e("#distinct-attr-select").empty();if(i.dataexplorer.settings.agg_distinct===false){e("#distinct-attr").hide()}else{e("#distinct-attr").show();if(i.dataexplorer.settings.agg_distinct_overrides&&JSON.parse(i.dataexplorer.settings.agg_distinct_overrides)[k().name]){var o=JSON.parse(i.dataexplorer.settings.agg_distinct_overrides)[k().name];var m=k().attributes[o].label;e("#distinct-attr-select").append(e("

").addClass("form-control-static").text(m))}else{var p=e.grep(n,function(r){return r.nillable!==true});c(e("#distinct-attr-select"),p,"distinct-aggr-attribute",false)}}e("#feature-select-container").show();e("#aggregate-table-container").empty();e(".attribute-dropdown").on("change",function(){f(e("#x-aggr-attribute").val(),e("#y-aggr-attribute").val(),e("#distinct-aggr-attribute").val())});f(e("#x-aggr-attribute").val(),e("#y-aggr-attribute").val(),e("#distinct-aggr-attribute").val())}else{e("#feature-select-container").hide();e("#aggregate-table-container").html("

No aggregable items

")}}function c(n,p,r,m,q){n.empty();if(m&&q){var o=e('');o.append('')}e.each(p,function(){if(this==m){o.append('")}else{o.append('")}});n.append(o);o.select2({width:"100%"})}function f(o,n,m){if(e("#aggregate-table-container").length>0){React.unmountComponentAtNode(e("#aggregate-table-container")[0]);React.render(i.ui.AggregateTable({entity:k().name,x:o,y:n,distinct:m,query:g()}),e("#aggregate-table-container")[0])}}function j(){var m=i.dataexplorer.getSelectedAttributes();var n=k();m=e.grep(m,function(o){return n.attributes[o.name]!==undefined});return i.getAtomicAttributes(m,b)}function k(){return i.dataexplorer.getSelectedEntityMeta()}function g(){return i.dataexplorer.getEntityQuery().q}e(function(){e(document).off(".aggregates");e(document).on("changeAttributeSelection.aggregates",function(n,m){if(i.dataexplorer.getSelectedModule()==="aggregates"){i.dataexplorer.aggregates.createAggregatesTable()}});e(document).on("changeQuery.aggregates",function(q,n){if(i.dataexplorer.getSelectedModule()==="aggregates"){var o=e("#x-aggr-attribute").val();var p=e("#y-aggr-attribute").val();var m=e("#distinct-aggr-attribute").val();i.dataexplorer.aggregates.updateAggregatesTable(o,p,m)}});e(document).on("changeModule.aggregates",function(n,m){if(m==="aggregates"){i.dataexplorer.aggregates.createAggregatesTable()}})})})($,window.top.molgenis=window.top.molgenis||{});




© 2015 - 2024 Weber Informatics LLC | Privacy Policy