Saiku更改導出文件的文件名

Saiku查询完数据之后,可以以excel,pdf,csv等格式将数据导出,这里我们来讲一下怎么更改导出的文件名。

找到对应的导出方法所在的js文件: saiku-server\tomcat\webapps\ROOT\js\saiku\views\WorkspaceToolbar.js

这里分别有三个方法导出不同形式的文件:

export_xls

export_csv

export_pdf

我们主要更改里面的filename即可啦!

可以自定义filename,我这里是需要将入参中的日期纳入文件名中,所以我的更改后的export_xls方法如下:(其余两种形式的导出方法也类似)

export_xls: function(event) {
  if(this.workspace.query.name!=undefined){
var filename = this.workspace.query.name.substring(this.workspace.query.name.lastIndexOf('/')+1).slice(0, -5);
var paramsURI = Saiku.URLParams.paramsURI(); //get the param from url
if(paramsURI.startdate != null && paramsURI.startdate != undefined && paramsURI.enddate != null && paramsURI.enddate != undefined){
var datename = (paramsURI.startdate).substring(-1,10).replace(/-/g,'') +"-"+ (paramsURI.enddate).substring(-1,10).replace(/-/g,'');//获取参数中的日期
filename = filename.replace('.','') + datename + ".";//将参数中的日期添加到的文件名中
}
window.location = Settings.REST_URL +
this.workspace.query.url() + "/export/xls/" + this.workspace.query.getProperty('saiku.olap.result.formatter')+"?exportname=" + "\"" + encodeURIComponent(filename)+"xls" + "\"";
  }
  else{
window.location = Settings.REST_URL +
this.workspace.query.url() + "/export/xls/" + this.workspace.query.getProperty('saiku.olap.result.formatter');
} },

需要注意的是我这里更改后的文件名与我的入参有关,主要是因为我这边是将saiku嵌入公司系统使用的,所以用到日期参数。

请求URl如下:(请求中携带入参 startdate与enddate)

http://10.22.33.44:8080/?username=test&password=111&startdate=2019-03-06&enddate=2019-03-18&plugin=false&mode=view#query/open//KPII/bb.saiku

最后这里给出修改后完整的WorkspaceToolbar.js文件

/*
* Copyright 2012 OSBI Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ /**
* The workspace toolbar, and associated actions
*/
var WorkspaceToolbar = Backbone.View.extend({
enabled: false,
events: {
'click a': 'call'
}, initialize: function(args) {
// Keep track of parent workspace
this.workspace = args.workspace; // Maintain `this` in callbacks
_.bindAll(this, "call", "reflect_properties", "run_query",
"swap_axes_on_dropzones", "display_drillthrough","clicked_cell_drillthrough_export",
"clicked_cell_drillacross","clicked_cell_drillthrough","activate_buttons", "switch_to_mdx","post_mdx_transform", "toggle_fields_action", "group_parents");
this.workspace.bind('workspace:toolbar:render', this.translate); // Redraw the toolbar to reflect properties
this.workspace.bind('properties:loaded', this.reflect_properties); // Fire off workspace event
this.workspace.trigger('workspace:toolbar:render', {
workspace: this.workspace
}); // Activate buttons when a new query is created or run
this.workspace.bind('query:new', this.activate_buttons);
this.workspace.bind('query:result', this.activate_buttons); }, activate_buttons: function(args) {
if (args !== null && args.data && args.data.cellset && args.data.cellset.length > 0 ) {
$(args.workspace.toolbar.el).find('.button')
.removeClass('disabled_toolbar'); $(args.workspace.el).find("td.data").removeClass('cellhighlight').unbind('click');
$(args.workspace.el).find(".table_mode").removeClass('on'); } else {
$(args.workspace.toolbar.el).find('.button')
.addClass('disabled_toolbar').removeClass('on');
$(args.workspace.el).find('.fields_list .disabled_toolbar').removeClass('disabled_toolbar');
$(args.workspace.toolbar.el)
.find('.about, .new, .open, .save, .edit, .run,.auto,.non_empty,.toggle_fields,.toggle_sidebar,.switch_to_mdx, .mdx')
.removeClass('disabled_toolbar');
} this.reflect_properties(); }, template: function() {
var template = $("#template-workspace-toolbar").html() || "";
return _.template(template)();
}, render: function() {
$(this.el).html(this.template()); return this;
}, translate: function() {
//Saiku.i18n.translate();
},
call: function(event) {
// Determine callback
event.preventDefault();
var callback = event.target.hash.replace('#', ''); // Attempt to call callback
if (! $(event.target).hasClass('disabled_toolbar') && this[callback]) {
this[callback](event);
} return false;
}, reflect_properties: function() {
var properties = this.workspace.query.model.properties ?
this.workspace.query.model.properties : Settings.QUERY_PROPERTIES; // Set properties appropriately
if (properties['saiku.olap.query.nonempty'] === true) {
$(this.el).find('.non_empty').addClass('on');
}
if (properties['saiku.olap.query.automatic_execution'] === true) {
$(this.el).find('.auto').addClass('on');
} if (properties['saiku.olap.query.drillthrough'] !== true) {
$(this.el).find('.drillthrough, .drillthrough_export').addClass('disabled_toolbar');
} if (properties['org.saiku.query.explain'] !== true) {
$(this.el).find('.explain_query').addClass('disabled_toolbar');
} if (properties['org.saiku.connection.scenario'] !== true) {
$(this.el).find('.query_scenario').addClass('disabled_toolbar');
} else {
$(this.el).find('.query_scenario').removeClass('disabled_toolbar');
$(this.el).find('.drillthrough, .drillthrough_export').addClass('disabled_toolbar');
}
if (properties['saiku.olap.query.limit'] == 'true' || properties['saiku.olap.query.filter'] === true) {
$(this.workspace.el).find('.fields_list_header').addClass('limit');
} if (this.workspace.query.getProperty('saiku.olap.result.formatter') !== "undefined" && this.workspace.query.getProperty('saiku.olap.result.formatter') == "flattened") {
if (! $(this.el).find('.group_parents').hasClass('on')) {
$(this.el).find('.group_parents').addClass('on');
}
}
if ($(this.workspace.el).find( ".workspace_results tbody.ui-selectable" ).length > 0) {
$(this.el).find('.zoom_mode').addClass('on');
} $(this.el).find(".spark_bar, .spark_line").removeClass('on');
$(this.el).find('a.edit').removeClass('disabled_toolbar'); if (Settings.MODE == 'VIEW' || this.workspace.isReadOnly) {
$(this.el).find('a.edit').hide();
$(this.el).find('a.save').hide();
} else {
if (this.workspace.viewState == 'view') {
$(this.el).find('a.edit').removeClass('on');
} else {
$(this.el).find('a.edit').addClass('on');
}
$(this.el).find('a.edit').show('normal');
}
}, new_query: function(event) {
if(typeof ga!= 'undefined'){
ga('send', 'event', 'Toolbar', 'New Query');
}
this.workspace.switch_view_state('edit');
this.workspace.new_query(); return false;
}, edit_query: function(event) {
$(event.target).toggleClass('on'); if ($(event.target).hasClass('on')) {
this.workspace.switch_view_state('edit');
} else {
this.workspace.switch_view_state('view');
}
}, save_query: function(event) {
var self = this;
if (this.workspace.query) {
if (typeof this.editor != "undefined") {
var mdx = this.editor.getValue();
this.workspace.query.model.mdx = mdx;
}
(new SaveQuery({ query: this.workspace.query })).render().open();
}
}, open_query: function(event) {
(new OpenDialog()).render().open();
}, run_query: function(event) {
this.workspace.query.run(true);
}, automatic_execution: function(event) {
// Change property
var newState = !this.workspace.query.getProperty('saiku.olap.query.automatic_execution');
this.workspace.query.setProperty('saiku.olap.query.automatic_execution', newState); if (newState) {
$(event.target).addClass('on');
} else {
$(event.target).removeClass('on');
}
}, toggle_fields: function(event) {
var self = this;
if (event) {
$(this.el).find('.toggle_fields').toggleClass('on');
}
if (!$(this.el).find('.toggle_fields').hasClass('on')) {
this.toggle_fields_action('hide');
} else {
this.toggle_fields_action('show');
} }, toggle_fields_action: function(action, dontAnimate) {
var self = this;
if ( action == 'show' && $('.workspace_editor').is(':visible')) {
return;
} else if ( action == 'hide' && $('.workspace_editor').is(':hidden')) {
return;
}
if (dontAnimate) {
$('.workspace_editor').css('height','');
if ($('.workspace_editor').is(':hidden')) {
$('.workspace_editor').show();
} else {
$('.workspace_editor').hide();
}
return;
} if (action == 'hide') {
$(this.workspace.el).find('.workspace_editor').hide();
} else {
$(this.workspace.el).find('.workspace_editor').show();
} // avoid scrollbar on the right /*
var wf = $('.workspace_editor').height();
if ( action == 'hide') {
var wr = $('.workspace_results').height();
$('.workspace_results').height(wr - wf);
}
$(this.workspace.el).find('.workspace_editor').slideToggle({
queue: false,
progress: function() {
self.workspace.adjust();
},
complete: function() {
if ($('.workspace_editor').is(':hidden')) {
$('.workspace_editor').height(wf);
} else {
$('.workspace_editor').css('height','');
} self.workspace.adjust();
}
}); */
}, about: function() {
(new AboutModal()).render().open();
return false;
}, toggle_sidebar: function() {
this.workspace.toggle_sidebar();
}, // group_parents: function(event) {
// $(event.target).toggleClass('on');
// if ($(event.target).hasClass('on')) {
// this.workspace.query.setProperty('saiku.olap.result.formatter', 'flattened');
// } else {
// this.workspace.query.setProperty('saiku.olap.result.formatter', 'flat');
// }
// this.workspace.query.run();
// }, group_parents: function(event) {
if (event) {
$(event.target).toggleClass('on');
}
// this.$el.find('.group_parents').toggleClass('on')
if (this.$el.find('.group_parents').hasClass('on')) {
this.workspace.query.setProperty('saiku.olap.result.formatter', 'flattened');
} else {
this.workspace.query.setProperty('saiku.olap.result.formatter', 'flat');
}
this.workspace.query.run();
}, non_empty: function(event) {
// Change property
var nonEmpty = !this.workspace.query.getProperty('saiku.olap.query.nonempty');
this.workspace.query.helper.nonEmpty(nonEmpty); this.workspace.query.setProperty('saiku.olap.query.nonempty', nonEmpty); // Toggle state of button
$(event.target).toggleClass('on'); // Run query
this.workspace.query.run();
}, swap_axis: function(event) {
// Swap axes
$(this.workspace.el).find('.workspace_results table').html('');
this.workspace.query.helper.swapAxes();
this.workspace.sync_query();
this.workspace.query.run(true);
}, check_modes: function(source) {
if (typeof source === "undefined" || source === null)
return; if ($(this.workspace.el).find( ".workspace_results tbody.ui-selectable" ).length > 0) {
$(this.workspace.el).find( ".workspace_results tbody" ).selectable( "destroy" );
}
if (!$(source).hasClass('on')) {
$(this.workspace.el).find("td.data").removeClass('cellhighlight').unbind('click');
$(this.workspace.el).find(".table_mode").removeClass('on'); this.workspace.query.run();
} else {
if ($(source).hasClass('drillthrough_export')) {
$(this.workspace.el).find("td.data").addClass('cellhighlight').unbind('click').click(this.clicked_cell_drillthrough_export);
$(this.workspace.el).find(".query_scenario, .drillthrough, .zoom_mode, .drillacross").removeClass('on');
} else if ($(source).hasClass('drillthrough')) {
$(this.workspace.el).find("td.data").addClass('cellhighlight').unbind('click').click(this.clicked_cell_drillthrough);
$(this.workspace.el).find(".query_scenario, .drillthrough_export, .zoom_mode, .drillacross").removeClass('on');
} else if ($(source).hasClass('query_scenario')) {
this.workspace.query.scenario.activate();
$(this.workspace.el).find(".drillthrough, .drillthrough_export, .zoom_mode, .drillacross").removeClass('on');
} else if ($(source).hasClass('drillacross')) {
$(this.workspace.el).find("td.data").addClass('cellhighlight').unbind('click').click(this.clicked_cell_drillacross);
$(this.workspace.el).find(".query_scenario, .drillthrough, .drillthrough_export, .zoom_mode").removeClass('on');
} else if ($(source).hasClass('zoom_mode')) { var self = this;
$(self.workspace.el).find( ".workspace_results tbody" ).selectable({ filter: "td", stop: function( event, ui ) {
var positions = [];
$(self.workspace.el).find( ".workspace_results" ).find('td.ui-selected div').each(function(index, element) {
var p = $(element).attr('rel');
if (p) {
positions.push(p);
}
});
$(self.workspace.el).find( ".workspace_results" ).find('.ui-selected').removeClass('.ui-selected'); positions = _.uniq(positions);
if (positions.length > 0) {
self.workspace.query.action.put("/zoomin", { success: function(model, response) {
self.workspace.query.parse(response);
self.workspace.unblock();
self.workspace.sync_query();
Saiku.ui.unblock();
self.workspace.query.run();
},
data: { selections : JSON.stringify(positions) }
});
}
} });
$(this.workspace.el).find(".drillthrough, .drillthrough_export, .query_scenario, .drillacross, .about").removeClass('on');
}
} },
query_scenario: function(event) {
$(event.target).toggleClass('on');
this.check_modes($(event.target)); },
zoom_mode: function(event) {
$(event.target).toggleClass('on');
this.check_modes($(event.target)); },
drillacross: function(event) {
$(event.target).toggleClass('on');
this.check_modes($(event.target));
},
drillthrough: function(event) {
$(event.target).toggleClass('on');
this.check_modes($(event.target));
}, display_drillthrough: function(model, response) {
this.workspace.table.render({ data: response });
Saiku.ui.unblock();
}, export_drillthrough: function(event) {
$(event.target).toggleClass('on');
this.check_modes($(event.target));
}, clicked_cell_drillacross: function(event) {
$target = $(event.target).hasClass('data') ?
$(event.target).find('div') : $(event.target);
var pos = $target.attr('rel');
(new DrillAcrossModal({
workspace: this.workspace,
title: "Drill Across",
action: "export",
position: pos,
query: this.workspace.query
})).open(); },
clicked_cell_drillthrough_export: function(event) {
$target = $(event.target).hasClass('data') ?
$(event.target).find('div') : $(event.target);
var pos = $target.attr('rel');
(new DrillthroughModal({
workspace: this.workspace,
maxrows: 10000,
title: "Drill-Through to CSV",
action: "export",
position: pos,
query: this.workspace.query
})).open(); }, clicked_cell_drillthrough: function(event) {
$target = $(event.target).hasClass('data') ?
$(event.target).find('div') : $(event.target);
var pos = $target.attr('rel');
(new DrillthroughModal({
workspace: this.workspace,
maxrows: 200,
title: "Drill-Through",
action: "table",
success: this.display_drillthrough,
position: pos,
query: this.workspace.query
})).open(); }, swap_axes_on_dropzones: function(model, response) {
this.workspace.query.parse(response);
this.workspace.unblock();
this.workspace.sync_query();
Saiku.ui.unblock();
/*
$columns = $(this.workspace.drop_zones.el).find('.columns')
.children()
.detach();
$rows = $(this.workspace.drop_zones.el).find('.rows')
.children()
.detach(); $(this.workspace.drop_zones.el).find('.columns').append($rows);
$(this.workspace.drop_zones.el).find('.rows').append($columns);
var rowLimit = $(this.workspace).find('fields_list.ROWS .limit').hasClass('on') | false;
var colLimit = $(this.workspace).find('fields_list.COLUMNS .limit').hasClass('on') | false;
$(this.workspace).find('fields_list.ROWS .limit').removeClass('on');
$(this.workspace).find('fields_list.COLUMNS .limit').removeClass('on');
if (rowLimit) {
$(this.workspace).find('fields_list.COLUMNS .limit').addClass('on');
}
if (colLimit) {
$(this.workspace).find('fields_list.ROWS .limit').addClass('on');
}
*/
this.workspace.unblock();
this.workspace.sync_query();
Saiku.ui.unblock();
}, show_mdx: function(event) {
//this.workspace.query.enrich(); (new MDXModal({ mdx: this.workspace.query.model.mdx })).render().open();
}, workspace_report_titles: function(event) {
(new ReportTitlesModal({ query: this.workspace.query })).render().open();
}, export_xls: function(event) {
if(this.workspace.query.name!=undefined){
var filename = this.workspace.query.name.substring(this.workspace.query.name.lastIndexOf('/')+1).slice(0, -5);
var paramsURI = Saiku.URLParams.paramsURI(); //get the param from url
if(paramsURI.startdate != null && paramsURI.startdate != undefined && paramsURI.enddate != null && paramsURI.enddate != undefined){
var datename = (paramsURI.startdate).substring(-1,10).replace(/-/g,'') +"-"+ (paramsURI.enddate).substring(-1,10).replace(/-/g,'');//获取参数中的日期
filename = filename.replace('.','') + datename + ".";//将参数中的日期添加到下载的文件名中
}
window.location = Settings.REST_URL +
this.workspace.query.url() + "/export/xls/" + this.workspace.query.getProperty('saiku.olap.result.formatter')+"?exportname=" + "\"" + encodeURIComponent(filename)+"xls" + "\"";
}
else{
window.location = Settings.REST_URL +
this.workspace.query.url() + "/export/xls/" + this.workspace.query.getProperty('saiku.olap.result.formatter');
} }, export_csv: function(event) {
if(this.workspace.query.name!=undefined){
var filename = this.workspace.query.name.substring(this.workspace.query.name.lastIndexOf('/')+1).slice(0, -6);
var paramsURI = Saiku.URLParams.paramsURI(); //get the param from url
if(paramsURI.startdate != null && paramsURI.startdate != undefined && paramsURI.enddate != null && paramsURI.enddate != undefined){
var datename = (paramsURI.startdate).substring(-1,10).replace(/-/g,'') +"-"+ (paramsURI.enddate).substring(-1,10).replace(/-/g,'');//获取参数中的日期
filename = filename.replace('.','') + datename + ".";//将参数中的日期添加到下载的文件名中
}
window.location = Settings.REST_URL +
this.workspace.query.url() + "/export/csv/" + this.workspace.query.getProperty('saiku.olap.result.formatter')+"?exportname=" + "\"" + encodeURIComponent(filename) + "\"";
}
else{
window.location = Settings.REST_URL +
this.workspace.query.url() + "/export/csv/" + this.workspace.query.getProperty('saiku.olap.result.formatter');
} }, export_pdf: function(event) {
if(this.workspace.query.name!=undefined){
var filename = this.workspace.query.name.substring(this.workspace.query.name.lastIndexOf('/')+1).slice(0, -6);
var paramsURI = Saiku.URLParams.paramsURI(); //get the param from url
if(paramsURI.startdate != null && paramsURI.startdate != undefined && paramsURI.enddate != null && paramsURI.enddate != undefined){
var datename = (paramsURI.startdate).substring(-1,10).replace(/-/g,'') +"-"+ (paramsURI.enddate).substring(-1,10).replace(/-/g,'');//获取参数中的日期
filename = filename.replace('.','') + datename + ".";//将参数中的日期添加到下载的文件名中
}
window.location = Settings.REST_URL +
this.workspace.query.url() + "/export/pdf/" + this.workspace.query.getProperty('saiku.olap.result.formatter')+"?exportname=" + "\"" + encodeURIComponent(filename) + "\"";
}
else{
window.location = Settings.REST_URL +
this.workspace.query.url() + "/export/pdf/" + this.workspace.query.getProperty('saiku.olap.result.formatter');
}
}, switch_to_mdx: function(event) {
var self = this;
$(this.workspace.el).find('.workspace_fields').addClass('hide');
$(this.el).find('.auto, .query_scenario, .buckets, .non_empty, .swap_axis, .mdx, .switch_to_mdx, .zoom_mode, .drillacross').parent().hide(); if ($(this.workspace.el).find( ".workspace_results tbody.ui-selectable" ).length > 0) {
$(this.workspace.el).find( ".workspace_results tbody" ).selectable( "destroy" );
} $(this.el).find('.run').attr('href','#run_mdx');
$(this.el).find('.run, .save, .open, .new, .edit').removeClass('disabled_toolbar'); if (Settings.MODE != "view" && Settings.MODE != "table" && !this.workspace.isReadOnly) {
$mdx_editor = $(this.workspace.el).find('.mdx_input');
//$mdx_editor.width($(this.el).width()-5);
$(this.workspace.el).find('.workspace_editor .mdx_input, .workspace_editor .editor_info, .workspace_editor').removeClass('hide').show();
this.editor = ace.edit("mdx_editor");
this.editor.setShowPrintMargin(false);
this.editor.setFontSize(11);
this.editor.commands.addCommand({
name: 'runmdx',
bindKey: {win: 'Ctrl-Enter', mac: 'Command-Enter'},
exec: function(editor) {
self.run_mdx();
},
readOnly: true // false if this command should not apply in readOnly mode
}); var showPosition = function() {
var pos = self.editor.getCursorPosition();
$mdx_editor.parent().find('.editor_info').html("  " + (pos.row +1) + ", " + pos.column);
}; this.editor.on('changeSelection', showPosition);
showPosition(); var heightUpdateFunction = function() { // http://stackoverflow.com/questions/11584061/
var max_height = $(document).height() / 3;
var height = Math.floor(max_height / self.editor.renderer.lineHeight);
var screen_length = self.editor.getSession().getScreenLength() > height ? height : self.editor.getSession().getScreenLength();
var newHeight =
(screen_length + 1) *
self.editor.renderer.lineHeight +
self.editor.renderer.scrollBar.getWidth(); $mdx_editor.height(newHeight.toString() + "px");
self.editor.resize();
self.workspace.adjust();
}; var resizeFunction = function() {
var session = self.editor.session;
//$mdx_editor.width($(self.el).width()-5);
self.editor.resize();
session.setUseWrapMode(true);
if(session.getUseWrapMode()) {
var characterWidth = self.editor.renderer.characterWidth;
var contentWidth = self.editor.renderer.scroller.clientWidth; if(contentWidth > 0) {
session.setWrapLimitRange(null, parseInt(contentWidth / characterWidth, 10));
}
}
}; resizeFunction(); heightUpdateFunction(); self.editor.focus();
self.editor.clearSelection();
self.editor.getSession().setValue("");
self.editor.getSession().on('change', heightUpdateFunction);
$(window).resize(resizeFunction); self.editor.on('changeSelection', heightUpdateFunction);
self.editor.on('focus', function(e) { heightUpdateFunction(); return true; });
self.editor.on('blur', function(e) {
if ($(self.workspace.el).find(".mdx_input").height() > 100) {
$(self.workspace.el).find(".mdx_input").height(100);
}
self.editor.resize();
self.workspace.adjust();
return true; }); //this.editor.on('focusout', function(e) { alert('blur'); }); //this.editor.setTheme("ace/theme/crimson_editor");
this.editor.getSession().setMode("ace/mode/text"); } if (this.workspace.dimension_list) {
$(this.workspace.el).find('.sidebar_inner ul li a')
.css({fontWeight: "normal"}).parent('li').removeClass('ui-draggable ui-draggable-disabled ui-state-disabled');
}
this.activate_buttons({ workspace: this.workspace });
$(this.workspace.toolbar.el)
.find('.run')
.removeClass('disabled_toolbar'); $(this.workspace.table.el).empty(); if (this.workspace.timeSeriesFilter) {
$(this.workspace.timeSeriesFilter.el).empty();
} this.workspace.adjust();
this.post_mdx_transform();
}, post_mdx_transform: function() {
var self = this; if (this.workspace.query.model.type !== "MDX") {
//this.workspace.query.enrich();
this.workspace.query.model.queryModel = {};
this.workspace.query.model.type = "MDX";
this.workspace.query.setProperty('saiku.olap.result.formatter', 'flat');
self.workspace.query.helper.model().parameters = {}; }
var mdx = this.workspace.query.model.mdx; if (self.editor) {
self.editor.setValue(mdx,0);
self.editor.clearSelection();
self.editor.focus();
}
$(self.el).find('.group_parents').removeClass('on'); if (Settings.ALLOW_PARAMETERS) { var parameterDetector = function() {
var mdx = self.editor.getValue();
var parameters = [];
if (mdx) {
for (var i = 0, len = mdx.length; i < (len-1); i++ ) {
if (mdx[i] === "$" && mdx[i+1] === "{") {
var param = "";
var closed = false;
for(i = i + 2; i < len; i++) {
if (mdx[i] !== '}') {
param += mdx[i];
} else {
closed = true;
i++;
break;
}
}
if (closed && param && param.length > 0) {
parameters.push(param);
}
}
}
}
var qParams = self.workspace.query.helper.model().parameters;
var newParams = {};
_.each(parameters, function(p) {
if (!qParams[p]) {
newParams[p] = "";
} else {
newParams[p] = qParams[p];
} });
self.workspace.query.helper.model().parameters = newParams;
self.workspace.update_parameters(); }; var lazyDetector = function() { _.delay(parameterDetector, 1000); };
if (self.editor) {
self.editor.getSession().off('change', lazyDetector);
self.editor.getSession().on('change', lazyDetector);
}
self.workspace.update_parameters();
} }, run_mdx: function(event) {
//var mdx = $(this.workspace.el).find(".mdx_input").val();
if ($(this.workspace.el).find(".mdx_input").height() > 100) {
$(this.workspace.el).find(".mdx_input").height(100);
}
this.editor.resize();
var mdx = this.editor.getValue();
this.workspace.query.model.mdx = mdx;
this.workspace.query.run(true);
}, explain_query: function(event) {
var self = this;
var explained = function(model, args) { var explainPlan = "<textarea style='width: " + ($("body").width() - 165) + "px;height:" + ($("body").height() - 175) + "px;'>";
if (args !== null && args.error !== null) {
explainPlan += args.error;
} else if (args.cellset && args.cellset.length === 0) {
explainPlan += "Empty explain plan!";
} else {
explainPlan += args.cellset[1][0].value;
}
explainPlan += "</textarea>"; Saiku.ui.unblock(); var html = '<div id="fancy_results" class="workspace_results" style="overflow:visible"><table>' +
'<tr><th clas="row_header">Explain Plan</th></tr>' +
'<tr><td>' + explainPlan + '</td></tr>' +
'</table></div>'; $.fancybox(html,
{
'autoDimensions' : false,
'autoScale' : false,
'height' : ($("body").height() - 100),
'width' : ($("body").width() - 100),
'transitionIn' : 'none',
'transitionOut' : 'none'
}
);
}; self.workspace.query.action.gett("/explain", { success: explained } ); return false; }
});

  

Saiku更改導出文件的文件名(十九)的更多相关文章

  1. abp(net core)+easyui+efcore实现仓储管理系统——出库管理之一(四十九)

    abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...

  2. abp(net core)+easyui+efcore实现仓储管理系统——出库管理之三(五十二)

    abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统--ABP总体介绍(一) abp(net core)+ ...

  3. abp(net core)+easyui+efcore实现仓储管理系统——出库管理之五(五十四)

    abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统--ABP总体介绍(一) abp(net core)+ ...

  4. abp(net core)+easyui+efcore实现仓储管理系统——出库管理之六(五十五)

    abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统--ABP总体介绍(一) abp(net core)+ ...

  5. Abp(net core)+easyui+efcore实现仓储管理系统——出库管理之七(五十六)

    abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统--ABP总体介绍(一) abp(net core)+ ...

  6. centos MySQL主从配置 ntsysv chkconfig setup命令 配置MySQL 主从 子shell MySQL备份 kill命令 pid文件 discuz!论坛数据库读写分离 双主搭建 mysql.history 第二十九节课

    centos  MySQL主从配置 ntsysv   chkconfig  setup命令  配置MySQL 主从 子shell  MySQL备份  kill命令  pid文件  discuz!论坛数 ...

  7. Linux使用笔记: 定制core dump文件的文件名

    在开发过程中,当一个Linux程序异常退出时,我们可以通过core文件来分析它异常的详细原因.缺省情况下,Linux在程序异常时不产生core文件,要想让程序异常退出时产生core dump文件,需要 ...

  8. IIS:错误: 无法提交配置更改,因为文件已在磁盘上更改

    文件名: \\?\C:\Windows\system32\inetsrv\config\applicationHost.config 错误: 无法提交配置更改,因为文件已在磁盘上更改 通过 Micro ...

  9. Bootstrap入门(二十九)JS插件6:弹出框

    Bootstrap入门(二十九)JS插件6:弹出框 加入小覆盖的内容,像在iPad上,用于存放非主要信息 弹出框是依赖于工具提示插件的,那它也和工具提示是一样的,是需要初始化才能够使用的 首先我们引入 ...

随机推荐

  1. linux普通帐号可以临时切换到root(添加用户到sudoers中)

    一般,进入terminal之后,默认是普通账户能操作的功能,能访问的目录有限,需要临时切换到root账户 那么此时就需要配置sudoers文件,可以让普通用户通过sudo命令临时切换到root账户 首 ...

  2. 解决 js ajax跨域访问报“No 'Access-Control-Allow-Origin' header is present on the requested resource.”错误

    参考页面:https://blog.csdn.net/idomyway/article/details/79572973 如果请求的是PHP页面: header("Access-Contro ...

  3. Linux驱动

    1 驱动分类 常规分类:字符设备.块设备.网络设备 字符设备:一种按字节来访问的设备,字符驱动负责驱动字符设备,这样的驱动通常实现open.close.read和write系统调用.如串口.LED.按 ...

  4. 【python 3】 函数 初识

    函数初识 1.函数的定义.调用.返回值 函数的定义.调用.返回值 def demo(): ## 定义函数 (def + 空格 + 函数名 + () + 冒号) ## 如下为函数体 return a # ...

  5. vue的一些随记

    1.vue中在methods等中使用filters中的过滤器 this.$options.filters[filter](...args)

  6. mybatis-generator 自动生成mapper以及实体类

    研究了一下,感觉也不是特别方便,因为参数很多都是需要手动去配置的,如果在这个jar基础上在改造一下或许更方便一点. 具体实现代码如下: pom.xml <plugin> <group ...

  7. ArcGIS Pro开发Web3D应用(1)——环境搭建与初始实例

    1.搭建环境 1.1 ArcGIS Web3D软件环境 ArcGIS Pro 2.0(必须) ArcGIS for Enterprise 10.5.1 (从10.5开始称呼为Enterprise)包括 ...

  8. (2)OSi模型

    osi七层模型 #(应用层,表示层,会话层) => 应用层 => 表达一个数据信息 # 传输层 port(端口) tcp/udp协议 硬件设备:四层交换机 四层路由器 # 网络层 ip协议 ...

  9. linux指令(1)

    1) date: 日期与秒的转换 (seconds since 1970-01-01 00:00:00 UTC) [root@laas:~]# date --date=2019-12-31 +%s15 ...

  10. dedecmsV5.7织梦后台更新文章,发布时间不自动更新

    问题:dedecmsV5.7后台修改文章的时候,会更新发布时间,需求是不自动更新时间,还是当时的发布时间 解决: 1.修改后台文件夹/templets/archives_edit.htm,articl ...