Skip to content

Commit 5ee5145

Browse files
authored
Merge pull request #678 from frknbasaran/guidelines
[guidelines] missing files changed.
2 parents 0936b91 + b57b926 commit 5ee5145

File tree

7 files changed

+175
-210
lines changed

7 files changed

+175
-210
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

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
var plugin = {},
1+
var exported = {},
22
plugins = require('../../pluginManager.js');
33

44
(function() {
55
plugins.appTypes.push("desktop");
6-
}(plugin));
6+
}(exported));
77

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

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*globals countlyView,_,Handlebars,$,jQuery,countlySession,countlyDeviceDetails,countlyTotalUsers,countlyLanguage,countlyGlobal,countlyLocation,CountlyHelpers,app,countlyCommon,DesktopDashboardView */
1+
/*global $, jQuery, CountlyHelpers, countlyLocation, _, DesktopDashboardView, countlyGlobal, countlyView, Handlebars, countlySession, countlyDeviceDetails, countlyTotalUsers, countlyLanguage, countlySession, countlyCommon, app */
22
window.DesktopDashboardView = countlyView.extend({
33
selectedView: "#draw-total-sessions",
44
selectedMap: "#map-list-sessions",

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

+8-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
},
@@ -159,7 +160,7 @@ app.addPageScript("/manage/apps", function() {
159160
});
160161
});
161162

162-
app.addAppManagementSwitchCallback(function(appId, type) {
163+
app.addAppManagementSwitchCallback(function() {
163164
if (start_populating) {
164165
start_populating = false;
165166
setTimeout(function() {

plugins/star-rating/frontend/public/javascripts/countly.models.js

+16-12
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
1-
2-
/*global
3-
countlyGlobal,
4-
countlyCommon,
5-
jQuery
6-
*/
7-
8-
(function(starRatingPlugin, $) {
1+
/*global countlyCommon, countlyGlobal, jQuery, $*/
2+
(function(starRatingPlugin) {
93
var _pv = {};
104
// feedbackd datas
115
var _fd = {};
@@ -17,7 +11,7 @@
1711
* This is for platform and version info request
1812
* @namespace starRatingPlugin
1913
* @method requestPlatformVersion
20-
* @param {boolean} isRefresh - refresh or not
14+
* @param {boolean} isRefresh - is it refresh?
2115
* @return {func} ajax func to request data and store in _pv
2216
*/
2317
starRatingPlugin.requestPlatformVersion = function(isRefresh) {
@@ -41,7 +35,9 @@
4135

4236
/**
4337
* This is for fetching star rating data in a period
44-
* @param {boolean} isRefresh - refresh page or not
38+
* @namespace starRatingPlugin
39+
* @method requestRatingInPeriod
40+
* @param {boolean} isRefresh - is it refresh?
4541
* @return {func} ajax func to request data and store in _rating
4642
*/
4743
starRatingPlugin.requestRatingInPeriod = function(isRefresh) {
@@ -68,6 +64,8 @@
6864

6965
/**
7066
* This is for fetching period object from server side when selected period is 'month' in frontend
67+
* @namespace starRatingPlugin
68+
* @method requesPeriod
7169
* @return {func} ajax func to request data and store in _period
7270
*/
7371
starRatingPlugin.requesPeriod = function() {
@@ -91,6 +89,8 @@
9189

9290
/**
9391
* This is for fetching feedback comments objects from server side
92+
* @namespace starRatingPlugin
93+
* @method requestFeedbackData
9494
* @param {object} filterObj - filter querys for feedback data list
9595
* @return {func} ajax func to request data and store in _fd
9696
*/
@@ -124,8 +124,10 @@
124124

125125
/**
126126
* This is for fetching feedback comments objects from server side
127-
* @param {string} id - widget id
128-
* @param {func} callback - call back func
127+
* @namespace starRatingPlugin
128+
* @method requestSingleWidget
129+
* @param {string} id - id of widget
130+
* @param {func} callback - callback method
129131
* @return {func} ajax func to request data and store in _fd
130132
*/
131133
starRatingPlugin.requestSingleWidget = function(id, callback) {
@@ -217,6 +219,8 @@
217219

218220
/**
219221
* This is for fetching feedback comments objects from server side
222+
* @namespace starRatingPlugin
223+
* @method requestFeedbackData
220224
* @return {func} ajax func to request data and store in _fd
221225
*/
222226
starRatingPlugin.requestFeedbackWidgetsData = function() {

0 commit comments

Comments
 (0)