Skip to content

Commit 8c2beb1

Browse files
authored
Merge pull request #3255 from Cookiezaurs/master
Fixes for dbviewer table export
2 parents 551cdcc + 256c851 commit 8c2beb1

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

plugins/dbviewer/frontend/public/javascripts/countly.views.js

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*global countlyGlobal, store, hljs, countlyDBviewer, app, countlyCommon, CV, countlyVue, CountlyHelpers, moment _*/
1+
/*global countlyGlobal, store, hljs, countlyDBviewer, app, countlyCommon, CV, countlyVue, CountlyHelpers,_*/
22

33
(function() {
44
var FEATURE_NAME = 'dbviewer';
@@ -178,13 +178,18 @@
178178
this.tableStore.dispatch("fetchDbviewerTable", {_silent: !force});
179179
},
180180
getExportQuery: function() {
181+
182+
var sort = "";
183+
if (this.sortEnabled) {
184+
sort = JSON.stringify(this.preparedSortObject);
185+
}
181186
var apiQueryData = {
182187
api_key: countlyGlobal.member.api_key,
183188
app_id: countlyCommon.ACTIVE_APP_ID,
184-
filename: "DBViewer" + moment().format("DD-MMM-YYYY"),
189+
//filename: "DBViewer" + moment().format("DD-MMM-YYYY"), - using passed filename from form
185190
projection: JSON.stringify(this.preparedProjectionFields),
186191
query: this.queryFilter,
187-
//sort: JSON.stringify(this.preparedSortObject),
192+
sort: sort,
188193
collection: this.collection,
189194
db: this.db,
190195
url: "/o/export/db"
@@ -251,7 +256,9 @@
251256
},
252257
preparedSortObject: function() {
253258
var ob = {};
254-
ob[this.sort] = this.isDescentSort ? -1 : 1;
259+
if (this.sort) {
260+
ob[this.sort] = this.isDescentSort ? -1 : 1;
261+
}
255262
return ob;
256263
}
257264
},

0 commit comments

Comments
 (0)