diff --git a/client/imports/helper.js b/client/imports/helper.js
index 298f71d4876f6a83e568096127f007708cacaee9..38fc8197785a073f7cd6add809b1a949193cdb20 100644
--- a/client/imports/helper.js
+++ b/client/imports/helper.js
@@ -84,12 +84,14 @@ let Helper = function () {
this.strSessionServerStatus = "serverStatus";
this.strSessionDBStats = "dbStats";
this.strSessionUsedTabIDs = "usedTabIDs";
+ this.strSessionUsedTabIDsAggregate = "usedTabIDsAggregate";
this.strSessionSelectedDump = "selectedDump";
this.strSessionSelectedFile = "selectedFile";
this.strSessionSelectedStoredFunction = "selectedStoredFunction";
this.strSessionDistinctFields = "distinctFields";
this.strSessionSelectedQueryHistory = "selectedQueryHistory";
this.strSessionSelectedShellHistory = "selectedShellHistory";
+ this.strSessionSelectedAggregateHistory = "selectedAggregateHistory";
this.strSessionSelectorValue = "selectorValue";
this.strSessionSelectionUserManagement = "userManagementValue";
this.strSessionUsermanagementInfo = "userManagementInfo";
diff --git a/client/imports/views/pages/aggregate_pipeline/aggregate_histories/aggregate_histories.html b/client/imports/views/pages/aggregate_pipeline/aggregate_histories/aggregate_histories.html
new file mode 100644
index 0000000000000000000000000000000000000000..dcdde9b1169f67259282b1fb52c1abe7e9044455
--- /dev/null
+++ b/client/imports/views/pages/aggregate_pipeline/aggregate_histories/aggregate_histories.html
@@ -0,0 +1,44 @@
+
+
+
+
\ No newline at end of file
diff --git a/client/imports/views/pages/aggregate_pipeline/aggregate_histories/aggregate_histories.js b/client/imports/views/pages/aggregate_pipeline/aggregate_histories/aggregate_histories.js
new file mode 100644
index 0000000000000000000000000000000000000000..6e3aa7b9cad4e0165c74a290f4e9d36d1f93e692
--- /dev/null
+++ b/client/imports/views/pages/aggregate_pipeline/aggregate_histories/aggregate_histories.js
@@ -0,0 +1,84 @@
+import {Template} from "meteor/templating";
+import {Session} from "meteor/session";
+import {FlowRouter} from "meteor/kadira:flow-router";
+import {renderQuery} from "../aggregate_pipeline";
+import Helper from "/client/imports/helper";
+import Enums from "/lib/imports/enums";
+import "./aggregate_histories.html";
+
+const Ladda = require('ladda');
+
+/**
+ * Created by RSercan on 24.2.2016.
+ */
+/*global moment*/
+Template.aggregateHistories.onRendered(function () {
+ if (Session.get(Helper.strSessionCollectionNames) == undefined) {
+ FlowRouter.go('/databaseStats');
+ return;
+ }
+
+ const selector = $('#tblAggregateHistories');
+ selector.find('tbody').on('click', 'tr', function () {
+ const table = selector.DataTable();
+ Helper.doTableRowSelectable(table, $(this));
+
+ if (table.row(this).data()) {
+ Session.set(Helper.strSessionSelectedAggregateHistory, table.row(this).data());
+ $('#btnUseHistoricalPipeline').prop('disabled', false);
+ }
+ });
+});
+
+Template.aggregateHistories.events({
+ 'click #btnUseHistoricalPipeline' (e) {
+ e.preventDefault();
+ const history = Session.get(Helper.strSessionSelectedAggregateHistory);
+ if (history) renderQuery({queryInfo: history.collection, queryParams: history.pipeline});
+ }
+});
+
+export const initAggregateHistories = function () {
+ Ladda.create(document.querySelector('#btnUseHistoricalPipeline')).start();
+
+ const tbl = $('#tblAggregateHistories');
+
+ // destroy jquery datatable to prevent reinitialization (https://datatables.net/manual/tech-notes/3)
+ if ($.fn.dataTable.isDataTable('#tblAggregateHistories')) {
+ tbl.DataTable().destroy();
+ }
+
+ const history = JSON.parse(localStorage.getItem(Enums.LOCAL_STORAGE_KEYS.AGGREGATE_COMMAND_HISTORY) || "[]");
+ tbl.DataTable({
+ responsive: true,
+ lengthMenu: [5, 10, 20],
+ data: history,
+ autoWidth: false,
+ columns: [
+ {
+ data: "collection",
+ width: "20%"
+ },
+ {
+ data: "pipeline",
+ width: "60%",
+ render: function (cellData) {
+ let str = "";
+ for (let stage of cellData) {
+ str += Object.keys(stage)[0] + "
";
+ }
+ return str;
+ }
+ },
+ {
+ data: "date",
+ width: "20%",
+ render: function (cellData) {
+ return moment(cellData).format('YYYY-MM-DD HH:mm:ss');
+ }
+ }
+ ]
+ });
+
+ Ladda.stopAll();
+};
\ No newline at end of file
diff --git a/client/imports/views/pages/aggregate_pipeline/aggregate_pipeline.html b/client/imports/views/pages/aggregate_pipeline/aggregate_pipeline.html
index 861550ee17f3c750147394048a82327ad8b7a961..34c0ec639689bc331ef632c77a0a1daa46f641c1 100644
--- a/client/imports/views/pages/aggregate_pipeline/aggregate_pipeline.html
+++ b/client/imports/views/pages/aggregate_pipeline/aggregate_pipeline.html
@@ -9,6 +9,11 @@
Drag stages between list to re-order
+
-
+
-
@@ -80,6 +85,6 @@
- {{> aggregateResultModal}}
+ {{> aggregateHistories}}
{{/if}}
\ No newline at end of file
diff --git a/client/imports/views/pages/aggregate_pipeline/aggregate_pipeline.js b/client/imports/views/pages/aggregate_pipeline/aggregate_pipeline.js
index b9216a2ebe3c624244735ce26880c4f101ef01f4..73812a73f982511acd9651717dd43da3c301a173 100644
--- a/client/imports/views/pages/aggregate_pipeline/aggregate_pipeline.js
+++ b/client/imports/views/pages/aggregate_pipeline/aggregate_pipeline.js
@@ -2,6 +2,14 @@ import {Template} from "meteor/templating";
import {Meteor} from "meteor/meteor";
import {Session} from "meteor/session";
import {FlowRouter} from "meteor/kadira:flow-router";
+import {initAggregateHistories} from "./aggregate_histories/aggregate_histories";
+import Enums from "/lib/imports/enums";
+import {
+ clarifyTabID,
+ getResultTabContent,
+ setAllTabsInactive,
+ setResultToEditors
+} from "/client/imports/views/pages/browse_collection/browse_collection";
import Helper from "/client/imports/helper";
import "./aggregate_pipeline.html";
@@ -13,12 +21,67 @@ const Ladda = require('ladda');
*/
let stageNumbers = 0;
+export const renderQuery = function (query) {
+ if (!query || !query.queryInfo || !query.queryParams) return;
+
+ $("#stages").empty();
+ stageNumbers = 0;
+ $("#cmbCollections").val(query.queryInfo).trigger('chosen:updated');
+ for (let stage of query.queryParams) {
+ addStageElement(Object.keys(stage)[0], stage[Object.keys(stage)[0]]);
+ }
+};
+
+const setAggregateResult = function (result, selectedCollection, pipeline) {
+ const jsonEditor = $('#divActiveJsonEditor');
+
+ if (jsonEditor.css('display') == 'none') {
+ // there's only one tab, set results
+ jsonEditor.show('slow');
+ setResultToEditors(1, result, pipeline, selectedCollection);
+ }
+ else {
+ const resultTabs = $('#resultTabs');
+
+ // open a new tab
+ const tabID = clarifyTabID(Helper.strSessionUsedTabIDsAggregate);
+ const tabContent = getResultTabContent(tabID, 'Jsoneditor');
+ const tabTitle = selectedCollection + ' - ' + pipeline.length + ' stages';
+ setAllTabsInactive();
+
+ // set tab href
+ resultTabs.append(
+ $('- ' + tabTitle +
+ '
'));
+
+ // set tab content
+ $('#resultTabContents').append(tabContent);
+
+ // show last tab
+ const lastTab = resultTabs.find('a:last');
+ lastTab.tab('show');
+
+ setResultToEditors(tabID, result, pipeline, selectedCollection);
+ }
+
+ addPipelineToHistory(selectedCollection, pipeline);
+};
+
+const addPipelineToHistory = function (collection, pipeline) {
+ let oldOnes = localStorage.getItem(Enums.LOCAL_STORAGE_KEYS.AGGREGATE_COMMAND_HISTORY) || "[]";
+ if (oldOnes) oldOnes = JSON.parse(oldOnes);
+ if (oldOnes.length >= 20) oldOnes.splice(0, oldOnes.length - 19);
+
+ oldOnes.push({pipeline: pipeline, collection: collection, date: new Date()});
+ localStorage.setItem(Enums.LOCAL_STORAGE_KEYS.AGGREGATE_COMMAND_HISTORY, JSON.stringify(oldOnes));
+};
+
const init = function () {
- const resultTabs = $('#aggregateResultTabs');
+ const resultTabs = $('#resultTabs');
resultTabs.on('show.bs.tab', function (e) {
const query = $($(e.target).attr('href')).data('query');
if (query) {
- //renderQuery(query);
+ renderQuery(query);
}
});
@@ -27,12 +90,95 @@ const init = function () {
$(this).parents('li').remove();
$($(this).parents('a').attr('href')).remove();
});
+
+ $('#aggregateHistoriesModal').on('shown.bs.modal', function () {
+ initAggregateHistories();
+ });
+
+ $.contextMenu({
+ selector: "#resultTabs li",
+ items: {
+ close_others: {
+ name: "Close Others", icon: "fa-times-circle", callback: function () {
+ let tabId = $(this).children('a').attr('href');
+ let resultTabsLi = $('#resultTabs').find('li');
+ resultTabsLi.each(function (idx, li) {
+ let select = $(li);
+ if (select.children('a').attr('href') !== tabId) {
+ $(select.children('a').attr('href')).remove();
+ select.remove();
+ }
+ });
+ }
+ },
+ close_all: {
+ name: "Close All Tabs", icon: "fa-times", callback: function () {
+ let resultTabs = $('#resultTabs').find('li');
+ resultTabs.each(function (idx, li) {
+ let select = $(li);
+ $(select.children('a').attr('href')).remove();
+ select.remove();
+ });
+ }
+ }
+ }
+ });
};
const initCodeMirrorStage = function () {
Helper.initializeCodeMirror($('#wrapper' + stageNumbers), 'txtObjectStage' + stageNumbers, false, 50);
};
+const addStageElement = function (query, val) {
+ const cmb = $("#cmbStageQueries");
+ query = query || cmb.chosen().val();
+ if (query) {
+ query = (query.indexOf('$') !== -1 ? query : '$' + query);
+ let liElement = '- ' + query + ' Remove
';
+
+ let stringInput = '';
+ let numberInput = '';
+ let initCodeMirror, isNumber;
+ switch (query) {
+ case '$limit':
+ liElement += numberInput;
+ isNumber = true;
+ break;
+ case '$skip':
+ liElement += numberInput;
+ isNumber = true;
+ break;
+ case '$out':
+ liElement += stringInput;
+ break;
+ case '$sortByCount':
+ liElement += stringInput;
+ break;
+ case '$count':
+ liElement += stringInput;
+ break;
+ default:
+ initCodeMirror = true;
+ liElement += '';
+ break;
+ }
+
+ liElement += '
';
+ $('#stages').append(liElement);
+ if (initCodeMirror) initCodeMirrorStage();
+
+ cmb.val('').trigger('chosen:updated');
+
+ if (val) {
+ if (initCodeMirror) Helper.setCodeMirrorValue($('#wrapper' + stageNumbers), JSON.stringify(val).replace(/^"(.*)"$/, '$1'), $('#txtObjectStage' + stageNumbers));
+ else if (isNumber) $('#inputNumberStage' + stageNumbers).val(val);
+ else $('#txtStringStage' + stageNumbers).val(val.replace(/^"(.*)"$/, '$1'));
+ }
+
+ stageNumbers++;
+ }
+};
+
const createPipeline = function (stageListElements) {
const pipeline = [];
stageListElements.each(function () {
@@ -61,7 +207,6 @@ const createPipeline = function (stageListElements) {
else {
throw queryName;
}
-
pipeline.push(stage);
});
@@ -92,6 +237,10 @@ Template.aggregatePipeline.onRendered(function () {
});
Template.aggregatePipeline.events({
+ 'click #btnAggregateHistory'(){
+ $('#aggregateHistoriesModal').modal('show');
+ },
+
'click #btnExecuteAggregatePipeline' (e) {
e.preventDefault();
@@ -125,8 +274,7 @@ Template.aggregatePipeline.events({
Helper.showMeteorFuncError(err, result, "Couldn't execute ");
}
else {
-
-
+ setAggregateResult(result.result, selectedCollection, pipeline);
//setResult(result.result);
//$('#aggregateResultModal').modal('show');
}
@@ -138,47 +286,7 @@ Template.aggregatePipeline.events({
},
'change #cmbStageQueries'() {
- const cmb = $("#cmbStageQueries");
- let query = cmb.chosen().val();
- if (query) {
- query = '$' + query;
- let liElement = '- ' + query + ' Remove
';
-
- let stringInput = '';
- let numberInput = '';
- let initCodeMirror;
- switch (query) {
- case '$limit':
- liElement += numberInput;
- break;
- case '$skip':
- liElement += numberInput;
- break;
- case '$out':
- liElement += stringInput;
- break;
- case '$sortByCount':
- liElement += stringInput;
- break;
- case '$count':
- liElement += stringInput;
- break;
- default:
- initCodeMirror = true;
- liElement += '';
- break;
- }
-
- liElement += '
';
- $('#stages').append(liElement);
-
- if (initCodeMirror) {
- initCodeMirrorStage();
- }
-
- cmb.val('').trigger('chosen:updated');
- stageNumbers++;
- }
+ addStageElement();
},
'click #remove-stage-element' (e) {
diff --git a/client/imports/views/pages/aggregate_pipeline/aggregate_result_modal/aggregate_result_modal.html b/client/imports/views/pages/aggregate_pipeline/aggregate_result_modal/aggregate_result_modal.html
deleted file mode 100644
index 2e68a62a5fbdcb9690c70fa2d2241aec06aa6073..0000000000000000000000000000000000000000
--- a/client/imports/views/pages/aggregate_pipeline/aggregate_result_modal/aggregate_result_modal.html
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/client/imports/views/pages/aggregate_pipeline/aggregate_result_modal/aggregate_result_modal.js b/client/imports/views/pages/aggregate_pipeline/aggregate_result_modal/aggregate_result_modal.js
deleted file mode 100644
index 5e11e81885ea93b4922d128078ccb4f7dac626c7..0000000000000000000000000000000000000000
--- a/client/imports/views/pages/aggregate_pipeline/aggregate_result_modal/aggregate_result_modal.js
+++ /dev/null
@@ -1,21 +0,0 @@
-import {Template} from 'meteor/templating';
-
-import './aggregate_result_modal.html';
-
-const JSONEditor = require('jsoneditor');
-/**
- * Created by RSercan on 19.5.2016.
- */
-Template.aggregateResultModal.onRendered(function () {
- const jsonEditor = new JSONEditor(document.getElementById('divJsonEditor'), {
- mode: 'tree',
- modes: ['code', 'form', 'text', 'tree', 'view'],
- search: true
- });
-
- $('#divJsonEditorWrapper').data('jsoneditor', jsonEditor);
-});
-
-export const setResult = function (value) {
- $('#divJsonEditorWrapper').data('jsoneditor').set(value);
-};
\ No newline at end of file
diff --git a/client/imports/views/pages/browse_collection/browse_collection.js b/client/imports/views/pages/browse_collection/browse_collection.js
index a8efad7b5903ab66d6abcf91af6642241d667eac..ca07b0837e3612c28bfed3096315264e7be63e17 100644
--- a/client/imports/views/pages/browse_collection/browse_collection.js
+++ b/client/imports/views/pages/browse_collection/browse_collection.js
@@ -39,12 +39,175 @@ import "/client/imports/views/query_templates/collection/update_one/update_one";
import "/client/imports/views/query_templates/collection/group/group";
import "../../query_templates/collection/find/query_wizard/query_wizard";
import "./browse_collection.html";
-
const JSONEditor = require('jsoneditor');
+
const toastr = require('toastr');
const Ladda = require('ladda');
require('jquery-contextmenu');
+export const initExecuteQuery = function () {
+ // loading button
+ Ladda.create(document.querySelector('#btnExecuteQuery')).start();
+};
+
+export const setQueryResult = function (result, queryInfo, queryParams, saveHistory) {
+ const jsonEditor = $('#divActiveJsonEditor');
+ const aceEditor = $('#divActiveAceEditor');
+ const settings = Settings.findOne();
+
+ if (jsonEditor.css('display') == 'none' && aceEditor.css('display') == 'none') {
+ // there's only one tab, set results
+ if (settings.defaultResultView == 'Jsoneditor') {
+ jsonEditor.show('slow');
+ }
+ else {
+ aceEditor.show('slow');
+ }
+ setResultToEditors(1, result, queryParams, queryInfo);
+ }
+ else {
+ // close all if setting for single tab is enabled
+ const resultTabs = $('#resultTabs');
+ if (settings.singleTabResultSets) {
+ resultTabs.find('li').each(function (idx, li) {
+ let select = $(li);
+ $(select.children('a').attr('href')).remove();
+ select.remove();
+ });
+
+ $('#divBrowseCollectionFooter').hide();
+ $('#divBrowseCollectionFindFooter').hide();
+ }
+
+ // open a new tab
+ const tabID = clarifyTabID();
+ const tabContent = getResultTabContent(tabID, settings.defaultResultView);
+ const tabTitle = queryInfo + " - " + Session.get(Helper.strSessionSelectedCollection);
+ setAllTabsInactive();
+
+ // set tab href
+ resultTabs.append(
+ $('- ' + tabTitle +
+ '
'));
+
+ // set tab content
+ $('#resultTabContents').append(tabContent);
+
+ // show last tab
+ const lastTab = resultTabs.find('a:last');
+ lastTab.tab('show');
+
+ setResultToEditors(tabID, result, queryParams, queryInfo);
+ }
+
+ if (saveHistory) saveQueryHistory(queryInfo, queryParams);
+
+};
+
+export const clarifyTabID = function (sessionKey = Helper.strSessionUsedTabIDs) {
+ let result = 1;
+ let tabIDArray = Session.get(sessionKey);
+ if (tabIDArray == undefined || tabIDArray.length == 0) {
+ tabIDArray = [result];
+ Session.set(sessionKey, tabIDArray);
+ return result;
+ }
+
+ result = tabIDArray[tabIDArray.length - 1] + 1;
+
+ tabIDArray.push(result);
+ Session.set(sessionKey, tabIDArray);
+ return result;
+};
+
+export const setAllTabsInactive = function () {
+ $('#resultTabContents').each(function () {
+ const otherTab = $(this);
+ otherTab.removeClass('active');
+ if (otherTab.find('#divActiveJsonEditor').length != 0) {
+ // set all tabs different IDs to prevent setting result to existing editor.
+ const uniqueID = new Date().getTime();
+ otherTab.find('#divActiveJsonEditor').attr('id', 'divActiveJsonEditor-' + uniqueID);
+ otherTab.find('#activeJsonEditor').attr('id', 'activeJsonEditor-' + uniqueID);
+ otherTab.find('#divActiveAceEditor').attr('id', 'divActiveAceEditor-' + uniqueID);
+ otherTab.find('#activeAceEditor').attr('id', 'activeAceEditor-' + uniqueID);
+ }
+ });
+};
+
+export const setResultToEditors = function (tabID, result, queryParams, queryInfo) {
+ // set json editor
+ getEditor(tabID).set(result);
+
+ // set ace
+ AceEditor.instance('activeAceEditor', {
+ mode: 'javascript',
+ theme: 'dawn'
+ }, function (editor) {
+ editor.$blockScrolling = Infinity;
+ editor.setOptions({
+ fontSize: '12pt',
+ showPrintMargin: false
+ });
+ editor.setValue(JSON.stringify(result, null, '\t'), -1);
+ });
+
+ const activeTab = $('#tab-' + tabID);
+
+ // cache query data
+ activeTab.data('query', {
+ queryInfo: queryInfo,
+ queryParams: queryParams
+ });
+
+ // cache find data for save button
+ if (queryInfo === 'find') {
+ activeTab.data('findData', result);
+ }
+};
+
+export const getResultTabContent = function (tabID, defaultView) {
+ const jsonEditorHtml = '';
+
+ const aceEditorHtml = '';
+
+ const whichIsDisplayed = getWhichResultViewShowing();
+ let result;
+
+ if (whichIsDisplayed === 'none') {
+ let defaultIsAce = (defaultView !== 'Jsoneditor');
+ if (!defaultIsAce) {
+ result = jsonEditorHtml;
+ } else {
+ result = aceEditorHtml;
+ }
+ }
+ else {
+ if (whichIsDisplayed === 'jsonEditor') {
+ result = jsonEditorHtml;
+ }
+ else {
+ result = aceEditorHtml;
+ }
+ }
+
+ return result;
+};
+
const init = function () {
let cmb = $('#cmbQueries');
cmb.append($(""));
@@ -148,6 +311,7 @@ const init = function () {
clearQueryIfAdmin();
};
+
const clearQueryIfAdmin = function () {
$.each(Enums.ADMIN_QUERY_TYPES, function (key, value) {
if (value === Session.get(Helper.strSessionSelectedQuery)) {
@@ -157,65 +321,6 @@ const clearQueryIfAdmin = function () {
});
};
-export const initExecuteQuery = function () {
- // loading button
- Ladda.create(document.querySelector('#btnExecuteQuery')).start();
-};
-
-export const setQueryResult = function (result, queryInfo, queryParams, saveHistory) {
- const jsonEditor = $('#divActiveJsonEditor');
- const aceEditor = $('#divActiveAceEditor');
- const settings = Settings.findOne();
-
- if (jsonEditor.css('display') == 'none' && aceEditor.css('display') == 'none') {
- // there's only one tab, set results
- if (settings.defaultResultView == 'Jsoneditor') {
- jsonEditor.show('slow');
- }
- else {
- aceEditor.show('slow');
- }
- setResultToEditors(1, result, queryParams, queryInfo);
- }
- else {
- // close all if setting for single tab is enabled
- const resultTabs = $('#resultTabs');
- if (settings.singleTabResultSets) {
- resultTabs.find('li').each(function (idx, li) {
- let select = $(li);
- $(select.children('a').attr('href')).remove();
- select.remove();
- });
-
- $('#divBrowseCollectionFooter').hide();
- $('#divBrowseCollectionFindFooter').hide();
- }
-
- // open a new tab
- const tabID = clarifyTabID();
- const tabContent = getResultTabContent(tabID, settings.defaultResultView, queryInfo);
- const tabTitle = queryInfo + " - " + Session.get(Helper.strSessionSelectedCollection);
- setAllTabsInactive();
-
- // set tab href
- resultTabs.append(
- $('- ' + tabTitle +
- '
'));
-
- // set tab content
- $('#resultTabContents').append(tabContent);
-
- // show last tab
- const lastTab = resultTabs.find('a:last');
- lastTab.tab('show');
-
- setResultToEditors(tabID, result, queryParams, queryInfo);
- }
-
- if (saveHistory) saveQueryHistory(queryInfo, queryParams);
-
-};
-
const getWhichResultViewShowing = function () {
const jsonViews = $('div[id^="divActiveJsonEditor"]');
const aceViews = $('div[id^="divActiveAceEditor"]');
@@ -250,111 +355,6 @@ const saveQueryHistory = function (queryInfo, queryParams) {
});
};
-
-const setResultToEditors = function (tabID, result, queryParams, queryInfo) {
- // set json editor
- getEditor(tabID).set(result);
-
- // set ace
- AceEditor.instance('activeAceEditor', {
- mode: 'javascript',
- theme: 'dawn'
- }, function (editor) {
- editor.$blockScrolling = Infinity;
- editor.setOptions({
- fontSize: '12pt',
- showPrintMargin: false
- });
- editor.setValue(JSON.stringify(result, null, '\t'), -1);
- });
-
- const activeTab = $('#tab-' + tabID);
-
- // cache query data
- activeTab.data('query', {
- queryInfo: queryInfo,
- queryParams: queryParams
- });
-
- // cache find data for save button
- if (queryInfo === 'find') {
- activeTab.data('findData', result);
- }
-};
-
-const clarifyTabID = function () {
- let result = 1;
- let tabIDArray = Session.get(Helper.strSessionUsedTabIDs);
- if (tabIDArray == undefined || tabIDArray.length == 0) {
- tabIDArray = [result];
- Session.set(Helper.strSessionUsedTabIDs, tabIDArray);
- return result;
- }
-
- result = tabIDArray[tabIDArray.length - 1] + 1;
-
- tabIDArray.push(result);
- Session.set(Helper.strSessionUsedTabIDs, tabIDArray);
- return result;
-};
-
-const setAllTabsInactive = function () {
- $('#resultTabContents').each(function () {
- const otherTab = $(this);
- otherTab.removeClass('active');
- if (otherTab.find('#divActiveJsonEditor').length != 0) {
- // set all tabs different IDs to prevent setting result to existing editor.
- const uniqueID = new Date().getTime();
- otherTab.find('#divActiveJsonEditor').attr('id', 'divActiveJsonEditor-' + uniqueID);
- otherTab.find('#activeJsonEditor').attr('id', 'activeJsonEditor-' + uniqueID);
- otherTab.find('#divActiveAceEditor').attr('id', 'divActiveAceEditor-' + uniqueID);
- otherTab.find('#activeAceEditor').attr('id', 'activeAceEditor-' + uniqueID);
- }
- });
-};
-
-const getResultTabContent = function (tabID, defaultView) {
- const jsonEditorHtml = '';
-
- const aceEditorHtml = '';
-
- const whichIsDisplayed = getWhichResultViewShowing();
- let result;
-
- if (whichIsDisplayed === 'none') {
- let defaultIsAce = (defaultView !== 'Jsoneditor');
- if (!defaultIsAce) {
- result = jsonEditorHtml;
- } else {
- result = aceEditorHtml;
- }
- }
- else {
- if (whichIsDisplayed === 'jsonEditor') {
- result = jsonEditorHtml;
- }
- else {
- result = aceEditorHtml;
- }
- }
-
- return result;
-};
-
const getEditor = function (tabID) {
const tabView = $('#tab-' + tabID);
if (!tabView.data('jsoneditor')) {
diff --git a/client/stylesheets/main.css b/client/stylesheets/main.css
index aa099799e53b3e95f637451cc13ac86b8bb6bac6..1d3915c6f6ee959220e9b2ceeb3ca63038cd9754 100644
--- a/client/stylesheets/main.css
+++ b/client/stylesheets/main.css
@@ -20,7 +20,7 @@ tr.selected {
top: 0;
}
-#btnManageRoles, #btnEditUser, #btnManageUsers, #btnExecuteAggregatePipeline, #btnExportQueryResult, #btnClearShell, #btnRefreshStoredFunctions, #btnShowShellHistories {
+#btnManageRoles, #btnEditUser, #btnManageUsers, #btnExecuteAggregatePipeline, #btnExportQueryResult, #btnClearShell, #btnRefreshStoredFunctions, #btnShowShellHistories, #btnAggregateHistory {
margin-bottom: 0 !important;
}
diff --git a/lib/imports/enums.js b/lib/imports/enums.js
index c1ed08fc8115ba3886b40de0dd77258fe40222ab..59f8b68fd4f425e29fa6a6d4a0f8fafcf59ad718 100644
--- a/lib/imports/enums.js
+++ b/lib/imports/enums.js
@@ -5,6 +5,7 @@ let Enums = function () {
this.LOCAL_STORAGE_KEYS = {
MONGO_BINARY_INFO: 'mongoclient-mongo-binary-warn',
SHELL_COMMAND_HISTORY: 'mongoclient-shell-history',
+ AGGREGATE_COMMAND_HISTORY: 'mongoclient-aggregate-history',
MONGOCLIENT_SKIN: 'mongoclient-skin'
};