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

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

There is a newer version: 8.4.5
Show newest version
$.when($,window.top.molgenis=window.top.molgenis||{},molgenis.getPluginSettings()).then(function(f,y,u){var s=y.dataexplorer=y.dataexplorer||{};s.getSelectedEntityMeta=z;s.getSelectedAttributes=v;s.getSelectedAttributesTree=H;s.getEntityQuery=d;s.createHeader=n;s.setGenomeAttributes=m;s.getPosAttribute=t;s.getChromosomeAttribute=l;s.getIdentifierAttribute=b;s.getPatientAttribute=k;s.getSelectedModule=o;var q=new y.RestClient();var h=null;var F={};var g=[];var C={};var A=null;var G=[];var w;var B;var a;var i;if(u[1]!=="success"){y.createAlert([{message:"An error occurred initializing the data explorer."}],"error")}var E=u[0];s.settings=E;var x={entity:null,query:null,attrs:null,mod:null,hideselect:"false"};var e;function o(){return e.mod}function z(){return h}function v(){return g}function H(){return C}function d(){return c()}function j(M,L,J){var K=[];K.push('");K.push('
');f.each(M,function(){K.push('
Loading...
')});K.push("
");J.html(K.join(""))}function p(L,K){var J=f("#feature-selection");J.tree({entityMetaData:L,selectedAttributes:K,onAttributesSelect:function(M){g=J.tree("getSelectedAttributes");C=J.tree("getSelectedAttributesTree");f(document).trigger("changeAttributeSelection",{attributes:g,attributesTree:C,totalNrAttributes:Object.keys(L.attributes).length})},onAttributeClick:function(M){f(document).trigger("clickAttribute",{attribute:M})}})}function n(J){f("#entity-class-name").html(J.label);if(J.description){var K=f('');K.html(abbreviate(J.description,E.header_abbreviate));K.attr("data-title",J.description);f("#entity-class-description").html(K.tooltip())}else{f("#entity-class-description").html("")}}function D(M){var J;var K=z().attributes;var N=M.split(",");for(var L in N){J=K[N[L]];if(J!==undefined){break}}return J}function m(M,J,L,K){w=D(M);B=D(J);a=D(L);i=D(K)}function t(){return w}function l(){return B}function b(){return a}function k(){return i}function c(){var K={q:[]};if(A){if(/\S/.test(A)){var P=/^\s*(?:chr)?([\d]{1,2}|X|Y|MT|XY):([\d]+)(?:-([\d]+)+)?\s*$/g;if(P&&A.match(P)&&B!==undefined&&w!==undefined){var M=P.exec(A);if(M[3]===undefined){var L=M[1];var J=M[2];K.q=[{operator:"NESTED",nestedRules:[{field:B.name,operator:"EQUALS",value:L}]},{operator:"AND"},{operator:"NESTED",nestedRules:[{field:w.name,operator:"EQUALS",value:J}]}]}else{if(M[3]){var L=M[1];var O=M[2];var N=M[3];if(parseInt(O,10)>parseInt(N,10)){y.createAlert([{message:"The start position of the queried range is larger than the stop position. Please check the search query."}],"warning")}else{f(".alerts").empty()}K.q=[{operator:"NESTED",nestedRules:[{operator:"NESTED",nestedRules:[{field:B.name,operator:"EQUALS",value:L}]}]},{operator:"AND"},{operator:"NESTED",nestedRules:[{field:w.name,operator:"GREATER_EQUAL",value:O},{operator:"AND"},{field:w.name,operator:"LESS_EQUAL",value:N}]}]}}}else{K.q.push({operator:"SEARCH",value:A})}}}f.each(F,function(Q,R){var S=R.createQueryRule();if(S){if(K.q.length>0){K.q.push({operator:"AND"})}K.q.push(S)}});return K}function I(){f.get(y.getContextUrl()+"/copy?entity="+e.entity).done(function(K){if(K===true){f("#copy-data-btn").removeClass("hidden")}else{f("#copy-data-btn").addClass("hidden")}});var J=q.getAsync("/api/v1/"+e.entity+"/meta",{expand:["attributes"]},function(K){h=K;s.createHeader(K);f.each(K.attributes,function(L,M){M.expanded=false;if(e.attrs===undefined||e.attrs===null){if(M.fieldType!=="COMPOUND"){g.push(M)}}else{if(e.attrs==="none"){g=[]}else{f.each(e.attrs,function(N,O){if(M.name===O){g.push(M)}})}}});C={};f.each(g,function(L,N){var M=N.name;var O=N.expanded===true?{"*":null}:null;C[M]=O});p(K,g);if(E.launch_wizard===true){s.filter.wizard.openFilterWizardModal(K,F)}});f.get(y.getContextUrl()+"/modules?entity="+e.entity).done(function(N){var L=f("#module-nav");G=N.modules;j(N.modules,e.entity,L);var M;if(e.mod){M=f('a[data-toggle="tab"][data-target="#tab-'+e.mod+'"]',L)}else{M=f('a[data-toggle="tab"]',L).first()}e.mod=M.data("id");f.when(J).done(function(){M.tab("show")});function K(){f("#selectors").removeClass("col-md-3").addClass("hidden");f("#modules").removeClass("col-md-9").addClass("col-md-12");f("#toggleSelectorsIcon").removeClass("glyphicon glyphicon-resize-horizontal").addClass("glyphicon glyphicon-resize-small")}function O(){f("#selectors").addClass("col-md-3").removeClass("hidden");f("#modules").removeClass("col-md-12").addClass("col-md-9");f("#toggleSelectorsIcon").removeClass("glyphicon glyphicon-resize-small").addClass("glyphicon glyphicon-resize-horizontal")}f("#toggleSelectors").on("click",function(){if(f("#selectors").hasClass("hidden")){O()}else{K()}})});f("#observationset-search").focus()}function r(){var L={};for(var K in e){if(e.hasOwnProperty(K)){var N=e[K];if(N){L[K]=N}}}if(e.query){delete L.query;for(var J=0;J0){React.unmountComponentAtNode(f("#data-table-container")[0])}f("#feature-filters p").remove();f("#observationset-search").val("");f("#data-table-pager").empty();f.each(G,function(){f(document).off("."+this.id)});I()});f(document).on("changeModule",function(N,M){e.mod=M;r()});f(document).on("changeAttributeSelection",function(N,M){if(M.attributes.length===0){e.attrs="none"}else{if(M.attributes.length===M.totalNrAttributes){e.attrs=null}else{e.attrs=f.map(M.attributes,function(O){return O.name})}}r()});f(document).on("updateAttributeFilters",function(N,M){f.each(M.filters,function(){if(this.isEmpty()){delete F[this.attribute.href]}else{F[this.attribute.href]=this}});s.filter.createFilterQueryUserReadableList(F);f(document).trigger("changeQuery",c())});f(document).on("removeAttributeFilter",function(N,M){delete F[M.attributeUri];s.filter.createFilterQueryUserReadableList(F);f(document).trigger("changeQuery",c())});f(document).on("clickAttribute",function(O,N){var M=N.attribute;if(M.fieldType!=="COMPOUND"&&(!M.refEntity||!M.parent)){s.filter.dialog.openFilterModal(N.attribute,F[N.attribute.href])}});var K=f("#plugin-container");if(f("#dataset-select").length>0){f("#dataset-select").select2({width:"resolve"});f("#dataset-select").change(function(){f(document).trigger("changeEntity",f(this).val())})}f("#observationset-search").change(function(M){A=f(this).val().trim();f(document).trigger("changeQuery",c())});f("#search-clear-button").click(function(){f("#observationset-search").val("");f("#observationset-search").change()});f("#filter-wizard-btn").click(function(){s.filter.wizard.openFilterWizardModal(h,F)});f("#module-nav").on("click","ul.nav > li > a",function(M){f(document).trigger("changeModule",f(this).data("id"))});f(K).on("click",".feature-filter-edit",function(N){N.preventDefault();var M=F[f(this).data("href")];s.filter.dialog.openFilterModal(M.attribute,M)});f(K).on("click",".feature-filter-remove",function(M){M.preventDefault();f(document).trigger("removeAttributeFilter",{attributeUri:f(this).data("href")})});f("#delete-data-btn").on("click",function(){bootbox.confirm("Are you sure you want to delete all data for this entity?",function(M){if(M){f.ajax("/api/v1/"+h.name,{type:"DELETE"}).done(function(){document.location.href="/menu/main/dataexplorer?entity="+h.name})}})});f("#copy-data-btn").on("click",function(){bootbox.prompt({title:"

Copy entity ["+h.label+']

Please enter a new entity name.
  • Use max 30 characters.
  • Only letters (a-z, A-Z), digits (0-9), underscores (_) and hashes (#) are allowed.

By pushing the ok button you will create an new entity with copied data.
',value:h.label+"_",callback:function(M){if(M!==null){f.ajax({headers:{Accept:"application/json","Content-Type":"application/json"},type:"POST",url:"/api/v2/copy/"+h.name,data:JSON.stringify({newEntityName:M}),dataType:"json",success:function(N){document.location.href="/menu/main/dataexplorer?entity="+N}})}}})});f("#delete-data-metadata-btn").on("click",function(){bootbox.confirm("Are you sure you want to delete all data and metadata for this entity?",function(M){if(M){f.ajax("/api/v1/"+h.name+"/meta",{type:"DELETE"}).done(function(){document.location.href="/menu/main/dataexplorer"})}})});function L(){if(!e.entity){e.entity=f("#dataset-select option:not(:empty)").first().val()}f("#dataset-select").select2("val",e.entity);if(e.hideselect==="true"){f("#dataset-select-container").addClass("hidden")}else{f("#dataset-select-container").removeClass("hidden")}if(e.query){for(var M=0;M0){var J=window.location.search.substring(1);if(J.length>0){e=f.deparam(J)}}else{e=x}window.onpopstate=function(M){if(M.state!==null){e=M.state;L()}};L()})});





© 2015 - 2025 Weber Informatics LLC | Privacy Policy