Skip to content

Commit e466c8d

Browse files
committed
[guidelines] missing files changed.
- [compare] api.js - [dbviewer] countly.views.js - [desktop] api.js - [desktop] countly.js - [populator] countly.views.js - [star-rating] countly.models.js - [star-rating] countly.views.js
1 parent cfb8a74 commit e466c8d

File tree

7 files changed

+180
-221
lines changed

7 files changed

+180
-221
lines changed

plugins/compare/api/api.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,11 @@ var exported = {},
8787
}
8888

8989
var appsToFetch = params.qstring.apps;
90-
9190
for (var appsFetchIndex = 0; appsFetchIndex < appsToFetch.length; appsFetchIndex++) {
92-
if (appsToFetch[appsFetchIndex].length != 24) {
93-
return common.returnMessage(params, 400, 'Invalid app id length in apps parameter, each app id should be 24 characters long');
91+
if (appsToFetch[appsFetchIndex].length !== 24) {
92+
return common.returnMessage(params, 400, 'Invalid app id length in apps parameter, each app id should be 24 characters long');
9493
}
9594
}
96-
9795
params.qstring.app_id = appsToFetch[0];
9896

9997
ob.validateUserForDataReadAPI(params, function() {

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

+28-32
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/*global store, countlyView, $, countlyGlobal, production, Handlebars, jQuery, app, CountlyHelpers, Backbone, DBViewerView, CountlyDrop, countlyDBviewer*/
12
window.DBViewerView = countlyView.extend({
23
initialize: function() {
34
this.dbviewer_selected_app = "all";
@@ -16,7 +17,7 @@ window.DBViewerView = countlyView.extend({
1617
}), countlyDBviewer.initialize(self.dbviewer_selected_app)).then(function() { });
1718
}
1819
},
19-
renderCommon: function(isRefresh) {
20+
renderCommon: function() {
2021
var self = this;
2122
this.templateData = {
2223
"page-title": jQuery.i18n.map["dbviewer.title"],
@@ -37,10 +38,6 @@ window.DBViewerView = countlyView.extend({
3738
}
3839

3940
var prepareSwitch = function() {
40-
// check is not exist dbviewer_selected_app in localStorage
41-
if (!store.get('dbviewer_selected_app')) {
42-
var app_name = $.i18n.map["common.all"];
43-
}
4441
// clear app-list
4542
$('#app-list').html("");
4643
// prepend "all apps" link to list
@@ -59,7 +56,7 @@ window.DBViewerView = countlyView.extend({
5956
$('#app-selector').html(store.get('dbviewer_selected_app').name);
6057
}
6158
else {
62-
$('#app-selector').html((self.dbviewer_selected_app == "all") ? $.i18n.map["common.all"] : self.dbviewer_selected_app.name);
59+
$('#app-selector').html((self.dbviewer_selected_app === "all") ? $.i18n.map["common.all"] : self.dbviewer_selected_app.name);
6360
}
6461

6562
};
@@ -72,38 +69,38 @@ window.DBViewerView = countlyView.extend({
7269
self.dbviewer_selected_app = "all";
7370
store.remove('dbviewer_selected_app');
7471
for (var key in countlyGlobal.apps) {
75-
if (countlyGlobal.apps[key]._id == $(this).data('value')) {
72+
if (countlyGlobal.apps[key]._id === $(this).data('value')) {
7673
self.dbviewer_selected_app = countlyGlobal.apps[key];
7774
store.set('dbviewer_selected_app', self.dbviewer_selected_app);
7875
}
7976
}
8077
prepareSwitch();
8178
countlyDBviewer.initialize(self.dbviewer_selected_app._id)
82-
.then(function(response) {
79+
.then(function() {
8380
var filteredData = countlyDBviewer.getData();
8481
filteredData.forEach(function(db) {
8582
$('.dbviewer-collection-list-' + db.name).css({"height": (window.innerHeight - 150) + "px"});
8683
var filteredCollectionListKeys = Object.keys(filteredData[0].collections);
8784
var filteredCollectionListValues = Object.values(filteredData[0].collections);
8885

8986
filteredCollectionListValues.sort(function(a, b) {
90-
if (a < b) {
87+
if (a < b) {
9188
return -1;
9289
}
93-
if (a > b) {
90+
if (a > b) {
9491
return 1;
9592
}
96-
return 0;
93+
return 0;
9794
});
9895

9996
filteredCollectionListKeys.sort(function(a, b) {
100-
if (a < b) {
97+
if (a < b) {
10198
return -1;
10299
}
103-
if (a > b) {
100+
if (a > b) {
104101
return 1;
105102
}
106-
return 0;
103+
return 0;
107104
});
108105

109106
$('.dbviewer-collection-list-' + db.name).html("");
@@ -153,7 +150,7 @@ window.DBViewerView = countlyView.extend({
153150
var self = this;
154151
// r we have cache query properties for this collection?
155152
// if collection properties is exist load them from localStorage
156-
if ((store.get('dbviewer_current_collection') && store.get('dbviewer_current_collection') == self.collection)) {
153+
if ((store.get('dbviewer_current_collection') && store.get('dbviewer_current_collection') === self.collection)) {
157154
// prepare projection values if it's exist on localStorage
158155
if (store.get('dbviewer_projection_values')) {
159156
self.projection = {};
@@ -208,14 +205,14 @@ window.DBViewerView = countlyView.extend({
208205
//trigger for render localizations manually
209206
app.localize();
210207
self.accordion();
211-
if (store.get('dbviewer_selected_app') == "all") {
208+
if (store.get('dbviewer_selected_app') === "all") {
212209
$('#app-selector').html($.i18n.map["common.all"]);
213210
}
214211
else {
215-
$('#app-selector').html((self.dbviewer_selected_app == "all") ? $.i18n.map["common.all"] : self.dbviewer_selected_app.name);
212+
$('#app-selector').html((self.dbviewer_selected_app === "all") ? $.i18n.map["common.all"] : self.dbviewer_selected_app.name);
216213
}
217214

218-
if (self.filter != "{}") {
215+
if (self.filter !== "{}") {
219216
$(".dbviewer-collection-filter").val(self.filter);
220217
}
221218

@@ -224,7 +221,7 @@ window.DBViewerView = countlyView.extend({
224221
by the state of current collection
225222
is that same collection before refresh? or not?
226223
*/
227-
if (!(store.get('dbviewer_current_collection') && store.get('dbviewer_current_collection') == self.collection)) {
224+
if (!(store.get('dbviewer_current_collection') && store.get('dbviewer_current_collection') === self.collection)) {
228225
self.selected_projection = {};
229226
self.sort = {};
230227
store.set('dbviewer_current_collection', self.collection);
@@ -273,7 +270,7 @@ window.DBViewerView = countlyView.extend({
273270
var options = [];
274271
// if options are exist and rendering in same collection
275272
// load options from localStorage
276-
if ((store.get('dbviewer_current_collection') && store.get('dbviewer_current_collection') == self.collection) && store.get('countly_collectionoptions')) {
273+
if ((store.get('dbviewer_current_collection') && store.get('dbviewer_current_collection') === self.collection) && store.get('countly_collectionoptions')) {
277274
options = JSON.parse(store.get('countly_collectionoptions'));
278275
}
279276
// generate new options array
@@ -305,20 +302,19 @@ window.DBViewerView = countlyView.extend({
305302
searchField: ['key'],
306303
options: options,
307304
render: {
308-
item: function(item, escape) {
305+
item: function(item) {
309306
return '<div>' +
310307
item.key +
311308
'</div>';
312309
},
313-
option: function(item, escape) {
310+
option: function(item) {
314311
var label = item.key;
315-
var caption = item.key;
316312
return '<div>' +
317313
'<span class="label">' + label + '</span>' +
318314
'</div>';
319315
}
320316
},
321-
createFilter: function(input) {
317+
createFilter: function() {
322318
return true;
323319
},
324320
create: function(input) {
@@ -351,7 +347,7 @@ window.DBViewerView = countlyView.extend({
351347
});
352348

353349
// fill inputs with projection and sort values if in the same collection
354-
if (store.get('dbviewer_current_collection') && store.get('dbviewer_current_collection') == self.collection) {
350+
if (store.get('dbviewer_current_collection') && store.get('dbviewer_current_collection') === self.collection) {
355351
if (typeof self.selected_projection !== "object" && self.selected_projection !== "") {
356352
self.selected_projection.split(",").forEach(function(tag) {
357353
$('#dbviewer-projection')[0].selectize.addOption({ "key": tag });
@@ -376,8 +372,8 @@ window.DBViewerView = countlyView.extend({
376372
jsonlint = false;
377373
}
378374
// show and hide json status indicator by conditions
379-
if (jsonlint || ($(this).val() == "" && !jsonlint)) {
380-
if (!($(this).val() == "")) {
375+
if (jsonlint || ($(this).val() === "" && !jsonlint)) {
376+
if (!($(this).val() === "")) {
381377
$(this).val(JSON.stringify(o));
382378
}
383379
$('.dbviewer-correct-json').css({ "display": 'block' });
@@ -408,7 +404,7 @@ window.DBViewerView = countlyView.extend({
408404

409405
// decide which button is active?
410406
// and set it active
411-
if (store.get('dbviewer_sort_type') != null) {
407+
if (store.get('dbviewer_sort_type') !== null) {
412408
if (store.get('dbviewer_sort_type') === -1) {
413409
$('#dbviewer-sort-descend').addClass('dbviewer-sort-active');
414410
$('#dbviewer-sort-ascend').removeClass('dbviewer-sort-active');
@@ -486,7 +482,7 @@ window.DBViewerView = countlyView.extend({
486482
store.remove('dbviewer_projection_values');
487483
}
488484
// prepare filter by input values
489-
var filter = $(".dbviewer-collection-filter").val() == "" ? JSON.stringify({}) : $(".dbviewer-collection-filter").val();
485+
var filter = $(".dbviewer-collection-filter").val() === "" ? JSON.stringify({}) : $(".dbviewer-collection-filter").val();
490486
// prepare sort by input values
491487
self.filter = filter;
492488
self.projection = projection;
@@ -538,7 +534,7 @@ window.DBViewerView = countlyView.extend({
538534
var self = this;
539535
$("#accordion").accordion({
540536
collapsible: true,
541-
active: (self.db == "countly_drill") ? 1 : 0
537+
active: (self.db === "countly_drill") ? 1 : 0
542538
});
543539
$("#accordion a").removeClass("selected");
544540
$("#accordion a[href='#" + Backbone.history.fragment + "']").addClass("selected");
@@ -569,7 +565,7 @@ app.route('/manage/db/:dbs/:collection', 'dbs', function(db, collection) {
569565
this.dbviewerView.collection = collection;
570566
this.dbviewerView.document = null;
571567
this.dbviewerView.page = null;
572-
if (store.get("countly_collection") != collection) {
568+
if (store.get("countly_collection") !== collection) {
573569
store.set("countly_collectionfilter", "{}");
574570
store.set("countly_collection", collection);
575571
this.dbviewerView.filter = "{}";
@@ -589,7 +585,7 @@ app.route('/manage/db/:dbs/:collection/page/:page', 'dbs', function(db, collecti
589585
this.dbviewerView.collection = collection;
590586
this.dbviewerView.document = null;
591587
this.dbviewerView.page = parseInt(page);
592-
if (store.get("countly_collection") != collection) {
588+
if (store.get("countly_collection") !== collection) {
593589
store.set("countly_collectionfilter", "{}");
594590
this.dbviewerView.filter = "{}";
595591
store.set("countly_collection", collection);

plugins/desktop/api/api.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
var plugin = {},
2-
common = require('../../../api/utils/common.js'),
1+
var exported = {},
32
plugins = require('../../pluginManager.js');
43

5-
(function(plugin) {
4+
(function() {
65
plugins.appTypes.push("desktop");
7-
}(plugin));
6+
}(exported));
87

9-
module.exports = plugin;
8+
module.exports = exported;

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

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/*global $, jQuery, CountlyHelpers, countlyLocation, _, DesktopDashboardView, countlyGlobal, countlyView, Handlebars, countlySession, countlyDeviceDetails, countlyTotalUsers, countlyLanguage, countlySession, countlyCommon, app */
12
window.DesktopDashboardView = countlyView.extend({
23
selectedView: "#draw-total-sessions",
34
selectedMap: "#map-list-sessions",
@@ -36,7 +37,7 @@ window.DesktopDashboardView = countlyView.extend({
3637

3738
var elID = $(this).find('.select').attr("id");
3839

39-
if (self.selectedView == "#" + elID) {
40+
if (self.selectedView === "#" + elID) {
4041
return true;
4142
}
4243

@@ -88,8 +89,7 @@ window.DesktopDashboardView = countlyView.extend({
8889
},
8990
renderCommon: function(isRefresh, isDateChange) {
9091
var sessionData = countlySession.getSessionData(),
91-
locationData = countlyLocation.getLocationData({maxCountries: 10}),
92-
sessionDP = countlySession.getSessionDPTotal();
92+
locationData = countlyLocation.getLocationData({maxCountries: 10});
9393

9494
this.locationData = locationData;
9595
sessionData["page-title"] = countlyCommon.getDateRange();
@@ -189,7 +189,7 @@ window.DesktopDashboardView = countlyView.extend({
189189

190190
var self = this;
191191
$.when(this.beforeRender()).then(function() {
192-
if (app.activeView != self) {
192+
if (app.activeView !== self) {
193193
return false;
194194
}
195195
self.renderCommon(true);
@@ -211,16 +211,16 @@ window.DesktopDashboardView = countlyView.extend({
211211
targetValue = parseFloat(newEl.find(".number .value").text()),
212212
targetPost = newEl.find(".number .value").text().replace(targetValue, '');
213213

214-
if (targetValue != currNumberVal) {
215-
if (targetValue < currNumberVal || (targetPost.length && targetPost != currNumPost)) {
214+
if (targetValue !== currNumberVal) {
215+
if (targetValue < currNumberVal || (targetPost.length && targetPost !== currNumPost)) {
216216
$(el).find(".number").replaceWith(newEl.find(".number"));
217217
}
218218
else {
219219
jQuery({someValue: currNumberVal, currEl: currNumberEl}).animate({someValue: targetValue}, {
220220
duration: 2000,
221221
easing: 'easeInOutQuint',
222222
step: function() {
223-
if ((targetValue + "").indexOf(".") == -1) {
223+
if ((targetValue + "").indexOf(".") === -1) {
224224
this.currEl.text(Math.round(this.someValue) + targetPost);
225225
}
226226
else {
@@ -241,7 +241,7 @@ window.DesktopDashboardView = countlyView.extend({
241241
$(".usparkline").peity("bar", { width: "100%", height: "30", colour: "#83C986", strokeColour: "#83C986", strokeWidth: 2 });
242242
$(".dsparkline").peity("bar", { width: "100%", height: "30", colour: "#DB6E6E", strokeColour: "#DB6E6E", strokeWidth: 2 });
243243

244-
if (newPage.find("#map-list-right").length == 0) {
244+
if (newPage.find("#map-list-right").length === 0) {
245245
$("#map-list-right").remove();
246246
}
247247

@@ -268,7 +268,7 @@ window.DesktopDashboardView = countlyView.extend({
268268
'</div>');
269269
}
270270

271-
if (self.locationData.length == 0) {
271+
if (self.locationData.length === 0) {
272272
$("#geo-chart-outer").addClass("empty");
273273
}
274274
else {

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

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/*global countlyPopulator, countlyGlobal, countlyCommon, $, moment, app, countlyView, Handlebars, jQuery, PopulatorView, CountlyHelpers, production*/
12
window.PopulatorView = countlyView.extend({
23
initialize: function() {
34
},
@@ -9,7 +10,7 @@ window.PopulatorView = countlyView.extend({
910
})).then(function() {});
1011
}
1112
},
12-
renderCommon: function(isRefresh) {
13+
renderCommon: function() {
1314
this.templateData = {
1415
"page-title": jQuery.i18n.map["populator.plugin-title"]
1516
};
@@ -40,8 +41,8 @@ window.PopulatorView = countlyView.extend({
4041
$("#start-populate").show();
4142
$(".populate-bar div").stop(true);
4243
$(".populate-bar div").width(0);
43-
CountlyHelpers.confirm(jQuery.i18n.map["populator.success"], "popStyleGreen", function(result) {
44-
if (!result) {
44+
CountlyHelpers.confirm(jQuery.i18n.map["populator.success"], "popStyleGreen", function(dialogResult) {
45+
if (!dialogResult) {
4546
return true;
4647
}
4748
window.location = "/dashboard";
@@ -57,8 +58,8 @@ window.PopulatorView = countlyView.extend({
5758
$('.close-dialog').trigger('click');
5859
if (done === true) {
5960
$("#start-populate").show();
60-
CountlyHelpers.confirm(jQuery.i18n.map["populator.success"], "popStyleGreen", function(result) {
61-
if (!result) {
61+
CountlyHelpers.confirm(jQuery.i18n.map["populator.success"], "popStyleGreen", function(stopGenerationDialogResult) {
62+
if (!stopGenerationDialogResult) {
6263
return true;
6364
}
6465
window.location = "/dashboard";
@@ -116,7 +117,7 @@ window.PopulatorView = countlyView.extend({
116117
$("#populate-to").datepicker({dateFormat: "yy-mm-dd", constrainInput: true, maxDate: now });
117118
}
118119
app.localize();
119-
if (this.state == "/autostart") {
120+
if (this.state === "/autostart") {
120121
$("#start-populate").click();
121122
}
122123
},
@@ -158,11 +159,12 @@ app.addPageScript("/manage/apps", function() {
158159
}
159160
});
160161
});
161-
162+
// eslint-disable-next-line
162163
app.addAppManagementSwitchCallback(function(appId, type) {
163164
if (start_populating) {
164165
start_populating = false;
165166
setTimeout(function() {
167+
// eslint-disable-next-line
166168
var appId = $("#view-app-id").text();
167169
app.switchApp(appId, function() {
168170
app.navigate("/manage/populate/autostart", true);

0 commit comments

Comments
 (0)