提交 7ec329b1 编写于 作者: R rsercano

#480 refactored iCheck

上级 b290ab54
......@@ -46,17 +46,12 @@ kadira:flow-router@2.12.1
launch-screen@1.1.1
less@2.8.0
livedata@1.0.18
lmieulet:meteor-coverage@1.1.4
logging@1.1.20
mdg:validation-error@0.5.1
meteor@1.9.2
meteor-base@1.4.0
meteorhacks:async@1.0.0
meteorhacks:picker@1.0.3
meteorspark:util@0.2.0
meteortesting:browser-tests@1.0.0
meteortesting:mocha@1.1.2
meteortesting:mocha-core@1.0.1
minifier-css@1.4.1
minifier-js@2.4.0
minimongo@1.4.5
......
import { Notification } from '/client/imports/modules/';
import { Notification } from '/client/imports/modules';
import Helper from '/client/imports/helpers/helper';
const ErrorHandler = function () {
......
import { Querying, SessionManager } from '/client/imports/modules/';
import { Querying, SessionManager } from '/client/imports/modules';
import { ReactivityProvider } from '/client/imports/facades';
import { AceEditor } from 'meteor/arch:ace-editor';
import $ from 'jquery';
......@@ -28,12 +28,6 @@ require('/node_modules/codemirror/addon/hint/show-hint.js');
const UIComponents = function () {};
UIComponents.prototype = {
initICheck(selector) {
selector.iCheck({
checkboxClass: 'icheckbox_square-green',
});
},
initializeOptionsCombobox(cmb, enums, sessionKey) {
$.each(Helper.sortObjectByKey(enums), (key, value) => {
cmb.append($('<option></option>')
......@@ -53,8 +47,7 @@ UIComponents.prototype = {
});
},
initializeCollectionsCombobox() {
const cmb = $('#cmbCollections');
initializeCollectionsCombobox(cmb) {
cmb.append($("<optgroup id='optGroupCollections' label='Collections'></optgroup>"));
const cmbOptGroupCollection = cmb.find('#optGroupCollections');
......@@ -64,6 +57,7 @@ UIComponents.prototype = {
.attr('value', value.name)
.text(value.name));
});
cmb.chosen({
create_option: true,
allow_single_deselect: true,
......@@ -72,9 +66,8 @@ UIComponents.prototype = {
});
cmb.on('change', (evt, params) => {
if (!params) return;
const selectedCollection = params.selected;
if (selectedCollection) Querying.getDistinctKeysForAutoComplete(selectedCollection);
if (!params || !params.selected) return;
Querying.getDistinctKeysForAutoComplete(params.selected);
});
},
......@@ -378,6 +371,28 @@ UIComponents.prototype = {
}
return '';
}
},
Checkbox: {
states: ['check', 'uncheck', 'enable', 'disable'],
init(selector, withState) {
selector.iCheck({
checkboxClass: 'icheckbox_square-green',
});
if (withState && this.states.indexOf(withState) !== -1) {
selector.iCheck(withState);
}
},
getState(selector) {
return selector.iCheck('update')[0].checked;
},
toggleState(selector, state) {
if (this.states.indexOf(state) === -1) return;
selector.iCheck(state);
}
}
};
......
......@@ -29,8 +29,8 @@ CollectionAdd.prototype = {
},
getFlagValue() {
const twoSizesIndexes = $('#divTwoSizesIndexes').iCheck('update')[0].checked;
const noPadding = $('#divNoPadding').iCheck('update')[0].checked;
const twoSizesIndexes = UIComponents.Checkbox.getState($('#inputTwoSizesIndexes'));
const noPadding = UIComponents.Checkbox.getState($('#inputNoPadding'));
if (!twoSizesIndexes && !noPadding) return 0;
if (twoSizesIndexes && !noPadding) return 1;
if (!twoSizesIndexes && noPadding) return 2;
......@@ -88,7 +88,7 @@ CollectionAdd.prototype = {
}
}
if ($('#cmbCollectionOrView').val() === 'view') {
options.viewOn = $('#cmbCollectionsAddCollection').val();
options.viewOn = $('#cmbCollectionsViewOn').val();
if (!options.viewOn) {
Notification.warning('select_collection');
return;
......@@ -144,21 +144,7 @@ CollectionAdd.prototype = {
cmbOptions.prop('disabled', true);
cmbOptions.find('option').prop('selected', false).trigger('chosen:updated');
SessionManager.set(SessionManager.strSessionSelectedAddCollectionOptions, []);
const cmb = $('#cmbCollectionsAddCollection');
cmb.empty();
cmb.append($('<option></option>'));
$.each(SessionManager.get(SessionManager.strSessionCollectionNames), (index, value) => {
cmb.append($('<option></option>')
.attr('value', value.name)
.text(value.name));
});
cmb.chosen({
create_option: true,
allow_single_deselect: true,
persistent_create_option: true,
skip_no_results: true,
}).trigger('chosen:updated');
UIComponents.initializeCollectionsCombobox($('#cmbCollectionsViewOn'));
UIComponents.Editor.initializeCodeMirror({ divSelector: $('#divViewPipeline'), txtAreaId: 'txtViewPipeline' });
},
......@@ -199,20 +185,20 @@ CollectionAdd.prototype = {
setTimeout(() => {
const twoSizesIndexes = $('#inputTwoSizesIndexes');
const noPadding = $('#inputNoPadding');
let twoSizesState = 'uncheck';
let noPaddingState = 'uncheck';
if (col.options.flags === 0) {
twoSizesIndexes.iCheck('uncheck');
noPadding.iCheck('uncheck');
} else if (col.options.flags === 1) {
twoSizesIndexes.iCheck('check');
noPadding.iCheck('uncheck');
if (col.options.flags === 1) {
twoSizesState = 'check';
} else if (col.options.flags === 2) {
twoSizesIndexes.iCheck('uncheck');
noPadding.iCheck('check');
noPaddingState = 'check';
} else if (col.options.flags === 3) {
twoSizesIndexes.iCheck('check');
noPadding.iCheck('check');
twoSizesState = 'check';
noPaddingState = 'check';
}
UIComponents.Checkbox.toggleState(twoSizesIndexes, twoSizesState);
UIComponents.Checkbox.toggleState(noPadding, noPaddingState);
}, 100);
}
if (col.options.indexOptionDefaults) {
......@@ -237,7 +223,7 @@ CollectionAdd.prototype = {
this.prepareFormAsView();
modalTitle.text(Helper.translate({ key: 'view_info' }));
cmbCollectionOrView.val('view').trigger('chosen:updated');
$('#cmbCollectionsAddCollection').val(col.options.viewOn).trigger('chosen:updated');
$('#cmbCollectionsViewOn').val(col.options.viewOn).trigger('chosen:updated');
if (col.options.pipeline) {
UIComponents.Editor.setCodeMirrorValue($('#divViewPipeline'), JSON.stringify(col.options.pipeline), $('#txtViewPipeline'));
}
......@@ -268,8 +254,8 @@ CollectionAdd.prototype = {
$('#inputCollectionViewName').val('');
$('#inputCappedCollectionMaxDocs').val('');
$('#inputCappedCollectionSize').val('');
$('#inputCapped, #inputNoPadding, #inputTwoSizesIndexes').iCheck('uncheck');
$('#cmbCollectionOrView, #cmbCollectionsAddCollection, #cmbAddCollectionViewOptions, #cmbValidationActionAddCollection, #cmbValidationLevelAddCollection')
UIComponents.Checkbox.toggleState($('#inputNoPadding, #inputTwoSizesIndexes'), 'uncheck');
$('#cmbCollectionOrView, #cmbCollectionsViewOn, #cmbAddCollectionViewOptions, #cmbValidationActionAddCollection, #cmbValidationLevelAddCollection')
.find('option').prop('selected', false).trigger('chosen:updated');
$('#collectionAddModalTitle').text(Helper.translate({ key: 'create_collection_view' }));
$('#spanColName').text(ReactivityProvider.findOne(ReactivityProvider.types.Connections, { _id: SessionManager.get(SessionManager.strSessionConnection)._id }).connectionName);
......
import { Notification, ErrorHandler } from '/client/imports/modules';
import { Notification, ErrorHandler, UIComponents } from '/client/imports/modules';
import { Communicator } from '/client/imports/facades';
import { Connection } from '../index';
......@@ -9,7 +9,7 @@ CollectionRename.prototype = {
resetForm() {
$('#spanCollectionNameRename').html($('#renameCollectionModal').data('collection'));
$('#inputRenameName').val('');
$('#divDropTarget').iCheck('uncheck');
UIComponents.Checkbox.toggleState($('#inputDropTarget'), 'uncheck');
},
rename() {
......@@ -17,7 +17,7 @@ CollectionRename.prototype = {
const newName = $('#inputRenameName').val();
const selectedCollection = $('#renameCollectionModal').data('collection');
const options = { dropTarget: $('#divDropTarget').iCheck('update')[0].checked };
const options = { dropTarget: UIComponents.Checkbox.getState($('#inputDropTarget')) };
if (!newName) {
Notification.warning('name-required');
......
......@@ -9,7 +9,7 @@ ViewPipelineUpdater.prototype = {
initialize() {
Notification.start('#btnSaveViewPipeline');
UIComponents.initializeCollectionsCombobox();
UIComponents.initializeCollectionsCombobox($('#cmbCollectionsUpdateViewPipeline'));
const viewName = $('#updateViewPipelineModal').data('viewName');
const connection = ReactivityProvider.findOne(ReactivityProvider.types.Connections, { _id: SessionManager.get(SessionManager.strSessionConnection)._id });
......@@ -56,7 +56,7 @@ ViewPipelineUpdater.prototype = {
const modal = $('#updateViewPipelineModal');
const pipeline = $('#jsonEditorOfViewPipeline').data('jsoneditor').get();
const viewName = modal.data('viewName');
const viewOn = $('#cmbCollections').val();
const viewOn = $('#cmbCollectionsUpdateViewPipeline').val();
const command = { collMod: viewName, pipeline };
if (viewOn) {
command.viewOn = viewOn;
......
......@@ -13,7 +13,7 @@ const Connection = function () {
const setDivToggle = function (divUseSelector, divSelector, inputSelector) {
divUseSelector.on('ifToggled', () => {
if (inputSelector.iCheck('update')[0].checked) divSelector.show();
if (UIComponents.Checkbox.getState(inputSelector)) divSelector.show();
else divSelector.hide();
});
};
......@@ -311,7 +311,7 @@ Connection.prototype = {
if (obj.certificateKeyFileName) $('#inputCertificateKey').siblings('.bootstrap-filestyle').children('input').val(obj.certificateKeyFileName);
$('#inputPassPhrase').val(obj.passPhrase);
$('#inputDisableHostnameVerification').iCheck(!obj.disableHostnameVerification ? 'uncheck' : 'check');
UIComponents.Checkbox.toggleState($('#inputDisableHostnameVerification'), !obj.disableHostnameVerification ? 'uncheck' : 'check');
},
fillFormBasicAuth(obj) {
......@@ -386,7 +386,7 @@ Connection.prototype = {
if (connection.authenticationType === 'mongodb_x509') sslTab.removeAttr('data-toggle');
else sslTab.attr('data-toggle', 'tab');
if (connection.ssl) $('#inputUseSSL').iCheck(connection.ssl.enabled ? 'check' : 'uncheck');
if (connection.ssl) UIComponents.Checkbox.toggleState($('#inputUseSSL'), connection.ssl.enabled ? 'check' : 'uncheck');
if (connection.options) this.fillFormOptionsExceptConnectWithNoPrimary(connection);
},
......@@ -406,16 +406,16 @@ Connection.prototype = {
this.fillFormAuthentication(connection);
if (connection.ssl) {
$('#inputUseSSL').iCheck(connection.ssl.enabled ? 'check' : 'uncheck');
UIComponents.Checkbox.toggleState($('#inputUseSSL'), connection.ssl.enabled ? 'check' : 'uncheck');
this.fillFormSsl(connection.ssl);
}
if (connection.ssh) {
$('#inputUseSSH').iCheck(connection.ssh.enabled ? 'check' : 'uncheck');
UIComponents.Checkbox.toggleState($('#inputUseSSH'), connection.ssh.enabled ? 'check' : 'uncheck');
this.fillFormSsh(connection);
}
if (connection.options) {
this.fillFormOptionsExceptConnectWithNoPrimary(connection);
$('#inputConnectWithNoPrimary').iCheck(!connection.options.connectWithNoPrimary ? 'uncheck' : 'check');
UIComponents.Checkbox.toggleState($('#inputConnectWithNoPrimary'), !connection.options.connectWithNoPrimary ? 'uncheck' : 'check');
}
if (connection.url) this.disableFormsForUri();
},
......@@ -450,12 +450,12 @@ Connection.prototype = {
connection.url = $('#inputUrl').val();
connection.authenticationType = $('#cmbAuthenticationType').val();
connection.databaseName = $('#inputDatabaseName').val();
if (connection.authenticationType !== 'mongodb_x509' && $('#inputUseSSL').iCheck('update')[0].checked) {
if (connection.authenticationType !== 'mongodb_x509' && UIComponents.Checkbox.getState($('#inputUseSSL'))) {
connection.ssl = this.getSSLProps();
}
this.fillHostFields(connection);
this.fillCorrectAuthenticationType(connection);
if ($('#inputUseSSH').iCheck('update')[0].checked) this.fillSsh(connection);
if (UIComponents.Checkbox.getState($('#inputUseSSH'))) this.fillSsh(connection);
this.fillOptions(connection);
if (connection.mongodb_x509) {
......@@ -498,7 +498,7 @@ Connection.prototype = {
const destinationPort = $('#inputSshDestinationPort').val();
connection.ssh = {
enabled: $('#inputUseSSH').iCheck('update')[0].checked,
enabled: UIComponents.Checkbox.getState($('#inputUseSSH')),
host: $('#inputSshHostname').val(),
port: port ? parseInt(port, 10) : '',
localPort: localPort ? parseInt(localPort, 10) : '',
......@@ -517,7 +517,7 @@ Connection.prototype = {
connectionTimeout: connectionTimeot ? parseInt(connectionTimeot, 10) : '',
socketTimeout: socketTimeout ? parseInt(socketTimeout, 10) : '',
readPreference: $('#cmbReadPreference').val(),
connectWithNoPrimary: $('#inputConnectWithNoPrimary').iCheck('update')[0].checked,
connectWithNoPrimary: UIComponents.Checkbox.getState($('#inputConnectWithNoPrimary')),
replicaSetName: $('#inputReplicaSetName').val(),
};
},
......@@ -535,12 +535,12 @@ Connection.prototype = {
getSSLProps() {
return {
enabled: $('#inputUseSSL').iCheck('update')[0].checked,
enabled: UIComponents.Checkbox.getState($('#inputUseSSL')),
rootCAFileName: $('#inputRootCA').siblings('.bootstrap-filestyle').children('input').val(),
certificateFileName: $('#inputCertificate').siblings('.bootstrap-filestyle').children('input').val(),
passPhrase: $('#inputPassPhrase').val(),
certificateKeyFileName: $('#inputCertificateKey').siblings('.bootstrap-filestyle').children('input').val(),
disableHostnameVerification: $('#inputDisableHostnameVerification').iCheck('update')[0].checked,
disableHostnameVerification: UIComponents.Checkbox.getState($('#inputDisableHostnameVerification'))
};
},
......@@ -573,7 +573,7 @@ Connection.prototype = {
$('.nav-tabs a[href="#tab-1-connection"]').tab('show');
$(':file').filestyle('clear');
$('#addEditModalSmall').html('');
$('#inputConnectWithNoPrimary, #inputDisableHostnameVerification, #inputUseSSL, #inputUseSSH').iCheck('uncheck');
UIComponents.Checkbox.toggleState($('#inputConnectWithNoPrimary, #inputDisableHostnameVerification, #inputUseSSL, #inputUseSSH'), 'uncheck');
$('#spanUseSSL').hide();
$('.divHostField:visible').remove();
this.selectedAuthType.set('');
......@@ -606,9 +606,8 @@ Connection.prototype = {
$('#cmbAuthenticationType, #cmbSshAuthType, #cmbReadPreference').chosen({
allow_single_deselect: true,
});
$('#divConnectWithNoPrimary, #divUseSSL, #divUseSSH').iCheck({
checkboxClass: 'icheckbox_square-green',
});
UIComponents.Checkbox.init($('#inputConnectWithNoPrimary, #inputUseSSH, #inputUseSSL'));
setDivToggle($('#divUseSSH'), $('#divSshTemplate'), $('#inputUseSSH'));
setDivToggle($('#divUseSSL'), $('#divSslTemplate'), $('#inputUseSSL'));
......@@ -621,7 +620,7 @@ Connection.prototype = {
+ '#inputUser, #inputPassword, #inputAuthenticationDB, #inputLdapUsername, #inputLdapPassword, #inputKerberosUsername, #inputKerberosPassword, #inputKerberosServiceName, #inputX509Username')
.prop('disabled', true).trigger('chosen:updated').parent('div')
.attr('data-original-title', 'Clear URL to activate here');
$('#inputUseSSL').iCheck('disable');
UIComponents.Checkbox.toggleState($('#inputUseSSL'), 'disable');
$('#spanUseSSL').show();
$('[data-toggle="tooltip"]').tooltip({ trigger: 'hover' });
......@@ -635,16 +634,14 @@ Connection.prototype = {
+ '#inputUser, #inputPassword, #inputAuthenticationDB, #inputLdapUsername, #inputLdapPassword, #inputKerberosUsername, #inputKerberosPassword, #inputKerberosServiceName, #inputX509Username')
.prop('disabled', false).trigger('chosen:updated').parent('div')
.attr('data-original-title', '');
$('#inputUseSSL').iCheck('enable');
UIComponents.Checkbox.toggleState($('#inputUseSSL'), 'enable');
$('#spanUseSSL').hide();
this.selectedAuthType.set($('#cmbAuthenticationType').val());
},
initializeSSLTemplate() {
$('.filestyle').filestyle({});
$('#inputDisableHostnameVerification').iCheck({
checkboxClass: 'icheckbox_square-green',
});
UIComponents.Checkbox.init($('#inputDisableHostnameVerification'));
const promptUsernamePasswordModal = $('#promptUsernamePasswordModal');
promptUsernamePasswordModal.on('shown.bs.modal', () => {
......
......@@ -2,6 +2,7 @@ import { Communicator, ReactivityProvider } from '/client/imports/facades';
import { UIComponents, ExtendedJSON, ErrorHandler, Notification } from '/client/imports/modules';
import Helper from '/client/imports/helpers/helper';
import moment from 'moment';
import $ from 'jquery';
const IndexManagement = function () {
......@@ -66,9 +67,9 @@ IndexManagement.prototype = {
$('#inputBucketSize').val(index.bucketSize);
$('#inputTTL').val(index.expireAfterSeconds);
$('#inputTextLanguageOverride').val(index.language_override);
$('#inputUnique').iCheck(index.unique ? 'check' : 'uncheck');
$('#inputBackground').iCheck(index.background ? 'check' : 'uncheck');
$('#inputSparse').iCheck(index.sparse ? 'check' : 'uncheck');
UIComponents.Checkbox.toggleState($('#inputUnique'), index.unique ? 'check' : 'uncheck');
UIComponents.Checkbox.toggleState($('#inputBackground'), index.background ? 'check' : 'uncheck');
UIComponents.Checkbox.toggleState($('#inputSparse'), index.sparse ? 'check' : 'uncheck');
$('#cmbTextIndexVersion').val(index.textIndexVersion).trigger('chosen:updated');
$('#cmbTextIndexDefaultLanguage').val(index.default_language).trigger('chosen:updated');
},
......@@ -78,19 +79,9 @@ IndexManagement.prototype = {
UIComponents.Editor.setCodeMirrorValue($('#divCollationAddIndex'), '', $('#txtCollationAddIndex'));
UIComponents.Editor.setCodeMirrorValue($('#divPartial'), '', $('#txtPartial'));
$('.divField:visible').remove();
$('.divFieldWeight:visible').remove();
$('#inputName').val('');
$('#input2DBit').val('');
$('#input2DMax').val('');
$('#input2DMin').val('');
$('#input2DSphereVersion').val('');
$('#inputBucketSize').val('');
$('#inputTTL').val('');
$('#inputTextLanguageOverride').val('');
$('#inputUnique').iCheck('uncheck');
$('#inputBackground').iCheck('uncheck');
$('#inputSparse').iCheck('uncheck');
$('.divField:visible, .divFieldWeight:visible').remove();
$('#inputName, #input2DBit, #input2DMax, #input2DMin, #input2DSphereVersion, #inputBucketSize, #inputTTL, #inputTextLanguageOverride').val('');
UIComponents.Checkbox.toggleState($('#inputUnique, #inputBackground, #inputSparse'), 'uncheck');
$('#addIndexModalTitle').html(Helper.translate({ key: 'add_index' }));
$('#btnSaveIndex').prop('disabled', false);
$('#cmbTextIndexVersion, #cmbTextIndexDefaultLanguage').find('option').prop('selected', false).trigger('chosen:updated');
......@@ -194,10 +185,10 @@ IndexManagement.prototype = {
},
setOtherOptionsForIndex(index, ttl, partialFilterExpression, indexName, collation) {
if ($('#divUnique').iCheck('update')[0].checked) index.unique = true;
if ($('#divBackground').iCheck('update')[0].checked) index.background = true;
if (UIComponents.Checkbox.getState($('#inputUnique'))) index.unique = true;
if (UIComponents.Checkbox.getState($('#inputBackground'))) index.background = true;
if (ttl) index.expireAfterSeconds = ttl;
if ($('#divSparse').iCheck('update')[0].checked) index.sparse = true;
if (UIComponents.Checkbox.getState($('#inputSparse'))) index.sparse = true;
if (partialFilterExpression) index.partialFilterExpression = partialFilterExpression;
if (collation) index.collation = collation;
if (indexName) index.name = indexName;
......@@ -254,7 +245,7 @@ IndexManagement.prototype = {
saveIndex() {
Notification.start('#btnSaveIndex');
const selectedCollection = $('#cmbCollections').val();
const selectedCollection = $('#cmbCollectionsIndexManagement').val();
const command = { createIndexes: selectedCollection, indexes: [] };
const index = this.extractIndexOptions();
......@@ -277,7 +268,7 @@ IndexManagement.prototype = {
},
initIndexes() {
const selectedCollection = $('#cmbCollections').val();
const selectedCollection = $('#cmbCollectionsIndexManagement').val();
if (!selectedCollection) {
return;
}
......@@ -453,7 +444,7 @@ IndexManagement.prototype = {
},
remove(indexName) {
const selectedCollection = $('#cmbCollections').val();
const selectedCollection = $('#cmbCollectionsIndexManagement').val();
if (indexName && selectedCollection) {
Notification.modal({
......
......@@ -14,7 +14,7 @@ Aggregate.prototype = {
$('#stages').empty();
this.stageNumbers = 0;
$('#cmbCollections').val(query.queryInfo).trigger('chosen:updated');
$('#cmbCollectionsAggregate').val(query.queryInfo).trigger('chosen:updated');
query.queryParams.forEach((stage) => { this.addStageElement(Object.keys(stage)[0], stage[Object.keys(stage)[0]]); });
},
......@@ -24,7 +24,7 @@ Aggregate.prototype = {
if (jsonEditor.css('display') === 'none') {
// there's only one tab, set results
jsonEditor.show('slow');
UIComponents.setResultToEditors(1, result, pipeline, selectedCollection);
QueryRender.setResultToEditors(1, result, pipeline, selectedCollection);
} else {
const resultTabs = $('#resultTabs');
......@@ -145,7 +145,7 @@ Aggregate.prototype = {
},
execute() {
const selectedCollection = $('#cmbCollections').chosen().val();
const selectedCollection = $('#cmbCollectionsAggregate').chosen().val();
const stages = $('#stages').find('li');
if (!selectedCollection) {
Notification.warning('select_collection');
......
......@@ -16,7 +16,7 @@ const fillDivInputs = function (relatedJqueryDiv, key, result, relatedJqueryInpu
if (val.ERROR) result.ERROR = Helper.translate({ key: `syntax-error-${key}`, options: { error: val.ERROR } });
else result[key] = val;
} else result[key] = val;
} else if (relatedJqueryDiv.find('input:checkbox').length !== 0) result[key] = relatedJqueryInput.iCheck('update')[0].checked;
} else if (relatedJqueryDiv.find('input:checkbox').length !== 0) result[key] = UIComponents.Checkbox.getState(relatedJqueryInput);
};
const fillInputs = function (relatedJqueryInput, result, key) {
......
......@@ -87,7 +87,7 @@ const renderParams = function (queryParams) {
str = str.substring(1, str.length - 1);
UIComponents.Editor.setCodeMirrorValue(relatedJqueryDiv, str);
} else UIComponents.Editor.setCodeMirrorValue(relatedJqueryDiv, JSON.stringify(queryParams[param], null, 1));
} else if (relatedJqueryDiv.find('input:checkbox').length !== 0) relatedJqueryDiv.iCheck(queryParams[param] ? 'check' : 'uncheck');
} else if (relatedJqueryDiv.find('input:checkbox').length !== 0) UIComponents.Checkbox.toggleState(relatedJqueryDiv, queryParams[param] ? 'check' : 'uncheck');
} else if (relatedJqueryInput.length !== 0) relatedJqueryInput.val(queryParams[param]);
}, 100);
});
......@@ -213,7 +213,7 @@ const getFindFinalObject = function (queryStr, cmbOptionsId) {
const args = { selector, cursorOptions };
const queryParams = { selector, cursorOptions };
if (queryStr === 'find') {
const executeExplain = $('#inputExplain').iCheck('update')[0].checked;
const executeExplain = UIComponents.Checkbox.getState($('#inputExplain'));
args.executeExplain = executeExplain;
queryParams.executeExplain = executeExplain;
}
......@@ -310,7 +310,7 @@ Querying.prototype = {
if (!checkStringInput(password, 'password')) return;
if (!checkErrorField(options)) return;
const runOnAdminDB = $('#aRunOnAdminDB').iCheck('update')[0].checked;
const runOnAdminDB = UIComponents.Checkbox.getState($('#inputRunOnAdminDB'));
proceedQueryExecution({
methodName: 'addUser',
args: { username, password, runOnAdminDB, options }
......@@ -329,7 +329,7 @@ Querying.prototype = {
if (!checkErrorField(command, 'command')) return;
const runOnAdminDB = $('#aRunOnAdminDB').iCheck('update')[0].checked;
const runOnAdminDB = UIComponents.Checkbox.getState($('#inputRunOnAdminDB'));
proceedQueryExecution({
methodName: 'command',
......@@ -354,7 +354,7 @@ Querying.prototype = {
if (!checkStringInput(username, 'username')) return;
const runOnAdminDB = $('#aRunOnAdminDB').iCheck('update')[0].checked;
const runOnAdminDB = UIComponents.Checkbox.getState($('#inputRunOnAdminDB'));
proceedQueryExecution({
methodName: 'removeUser',
args: { username, runOnAdminDB }
......@@ -643,7 +643,7 @@ Querying.prototype = {
const initial = getFromHistoryOrEditor(historyParams, $('#divInitial'), 'initial');
const reduce = getFromHistoryOrEditorString(historyParams, $('#divReduce'), 'reduce');
const finalize = getFromHistoryOrEditorString(historyParams, $('#divFinalize'), 'finalize');
const command = $('#inputCommand').iCheck('update')[0].checked;
const command = UIComponents.Checkbox.getState($('#inputCommand'));
if (!keys.startsWith('function')) {
keys = ExtendedJSON.convertAndCheckJSON(keys);
......@@ -671,7 +671,7 @@ Querying.prototype = {
IndexInformation: {
execute(historyParams) {
const fullVal = historyParams ? historyParams.fullInformation : $('#divFullInformation').iCheck('update')[0].checked;
const fullVal = historyParams ? historyParams.fullInformation : UIComponents.Checkbox.getState($('#inputFullInformation'));
proceedQueryExecution({
methodName: 'indexInformation',
......
......@@ -17,7 +17,7 @@ QueryRender.prototype = {
executeQuery() {
const queryTemplate = SessionManager.get(SessionManager.strSessionSelectedQuery);
// Since user can call here by CTRL-ENTER combination, it's a must to check URL.
if (FlowRouter.current().route.path === '/browseCollection') {
if (FlowRouter.current().route.path === '/browseCollection' || FlowRouter.current().route.path === '/adminQueries') {
if (queryTemplate) Template[queryTemplate].executeQuery();
else Notification.warning('select-query');
}
......
......@@ -92,7 +92,7 @@ SchemaAnalyzer.prototype = {