Skip to content

Commit 8e4f9fa

Browse files
committed
[menu] add menu items without document ready, so they are added in time for url check
1 parent 2a4b2fc commit 8e4f9fa

File tree

23 files changed

+162
-1998
lines changed

23 files changed

+162
-1998
lines changed

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

+19-22
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
countlyAlerts,
55
jQuery,
66
countlyVue,
7-
$,
87
app,
98
countlyCommon,
109
countlyEvent,
@@ -531,26 +530,24 @@
531530
app.route('/manage/alerts', 'alerts', function() {
532531
this.renderWhenReady(alertsView);
533532
});
534-
$(document).ready(function() {
535-
app.addMenu("management", {code: "alerts", permission: ALERTS_FEATURE_NAME, url: "#/manage/alerts", text: "alert.plugin-title", priority: 100});
533+
app.addMenu("management", {code: "alerts", permission: ALERTS_FEATURE_NAME, url: "#/manage/alerts", text: "alert.plugin-title", priority: 100});
536534

537-
var conUpdateConcurrentUser = countlyAuth.validateUpdate("concurrent_users");
538-
var canCreateConcurrentUser = countlyAuth.validateCreate("concurrent_users");
539-
if (countlyGlobal.plugins.indexOf("concurrent_users") > -1 && (canCreateConcurrentUser || conUpdateConcurrentUser)) {
540-
countlyVue.container.registerData("/alerts/data-type", {label: jQuery.i18n.map["concurrent-users.title"], value: 'online-users'});
541-
countlyVue.container.registerData("/alerts/data-define", {
542-
"online-users": {
543-
target: [
544-
{ value: 't', label: jQuery.i18n.map["concurrent-users.alert-type.t"]},
545-
{ value: 'o', label: jQuery.i18n.map["concurrent-users.alert-type.o"]},
546-
{ value: 'm', label: jQuery.i18n.map["concurrent-users.alert-type.m"]},
547-
],
548-
condition: [
549-
{ value: 'gt', label: jQuery.i18n.map["concurrent-users.gt"]},
550-
{ value: 'lt', label: jQuery.i18n.map["concurrent-users.lt"]},
551-
],
552-
}
553-
});
554-
}
555-
});
535+
var conUpdateConcurrentUser = countlyAuth.validateUpdate("concurrent_users");
536+
var canCreateConcurrentUser = countlyAuth.validateCreate("concurrent_users");
537+
if (countlyGlobal.plugins.indexOf("concurrent_users") > -1 && (canCreateConcurrentUser || conUpdateConcurrentUser)) {
538+
countlyVue.container.registerData("/alerts/data-type", {label: jQuery.i18n.map["concurrent-users.title"], value: 'online-users'});
539+
countlyVue.container.registerData("/alerts/data-define", {
540+
"online-users": {
541+
target: [
542+
{ value: 't', label: jQuery.i18n.map["concurrent-users.alert-type.t"]},
543+
{ value: 'o', label: jQuery.i18n.map["concurrent-users.alert-type.o"]},
544+
{ value: 'm', label: jQuery.i18n.map["concurrent-users.alert-type.m"]},
545+
],
546+
condition: [
547+
{ value: 'gt', label: jQuery.i18n.map["concurrent-users.gt"]},
548+
{ value: 'lt', label: jQuery.i18n.map["concurrent-users.lt"]},
549+
],
550+
}
551+
});
552+
}
556553
})();

plugins/compliance-hub/frontend/public/javascripts/countly.views.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*global $, CV, app, countlyVue, countlyConsentManager, countlyCommon, countlyConsentManager, CountlyHelpers, countlyGlobal, countlyAuth */
1+
/*global CV, app, countlyVue, countlyConsentManager, countlyCommon, countlyConsentManager, CountlyHelpers, countlyGlobal, countlyAuth */
22
(function() {
33
var FEATURE_NAME = "compliance_hub";
44
var UserView = countlyVue.views.create({
@@ -672,8 +672,6 @@
672672
renderedView.params = params;
673673
this.renderWhenReady(renderedView);
674674
});
675-
$(document).ready(function() {
676-
app.addSubMenu("management", {code: "compliance", permission: "compliance_hub", url: "#/manage/compliance/", text: "compliance_hub.title", priority: 60});
677-
});
675+
app.addSubMenu("management", {code: "compliance", permission: "compliance_hub", url: "#/manage/compliance/", text: "compliance_hub.title", priority: 60});
678676

679677
})();

plugins/data-manager/frontend/public/javascripts/countly.views.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*global app, countlyAuth, countlyVue, CV, $, countlyDataManager, countlyCommon, moment, countlyGlobal, CountlyHelpers */
1+
/*global app, countlyAuth, countlyVue, CV, countlyDataManager, countlyCommon, moment, countlyGlobal, CountlyHelpers */
22

33
(function() {
44

@@ -1305,8 +1305,5 @@
13051305
this.renderWhenReady(detailView);
13061306
});
13071307

1308-
$(document).ready(function() {
1309-
app.addSubMenu("management", { code: "data-manager", permission: FEATURE_NAME, url: "#/manage/data-manager/", text: "data-manager.plugin-title", priority: 20 });
1310-
});
1311-
1308+
app.addSubMenu("management", { code: "data-manager", permission: FEATURE_NAME, url: "#/manage/data-manager/", text: "data-manager.plugin-title", priority: 20 });
13121309
})();

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

+2-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, moment _*/
22

33
(function() {
44
var FEATURE_NAME = 'dbviewer';
@@ -442,8 +442,6 @@
442442
});
443443

444444

445-
$(document).ready(function() {
446-
app.addMenu("management", {code: "db", permission: FEATURE_NAME, url: "#/manage/db", text: "dbviewer.title", priority: 120});
447-
});
445+
app.addMenu("management", {code: "db", permission: FEATURE_NAME, url: "#/manage/db", text: "dbviewer.title", priority: 120});
448446

449447
})();
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
/*global $, app */
1+
/*global app */
22

33
app.addAppType("desktop", null);
44

5-
$(document).ready(function() {
6-
app.addSubMenuForType("desktop", "analytics", {code: "analytics-technology", permission: "core", url: "#/analytics/technology", text: "sidebar.analytics.technology", priority: 30});
7-
app.addSubMenuForType("desktop", "analytics", {code: "analytics-geo", permission: "core", url: "#/analytics/geo", text: "sidebar.analytics.geo", priority: 40});
8-
app.addSubMenuForType("desktop", "analytics", {code: "analytics-sessions", permission: "core", url: "#/analytics/sessions", text: "sidebar.analytics.session", priority: 20});
9-
app.addSubMenuForType("desktop", "analytics", {code: "analytics-users", permission: "core", url: "#/analytics/users", text: "sidebar.analytics.users", priority: 10});
10-
app.addSubMenuForType("desktop", "analytics", {code: "analytics-loyalty", permission: "core", url: "#/analytics/loyalty", text: "sidebar.analytics.user-loyalty", priority: 15});
11-
});
5+
app.addSubMenuForType("desktop", "analytics", {code: "analytics-technology", permission: "core", url: "#/analytics/technology", text: "sidebar.analytics.technology", priority: 30});
6+
app.addSubMenuForType("desktop", "analytics", {code: "analytics-geo", permission: "core", url: "#/analytics/geo", text: "sidebar.analytics.geo", priority: 40});
7+
app.addSubMenuForType("desktop", "analytics", {code: "analytics-sessions", permission: "core", url: "#/analytics/sessions", text: "sidebar.analytics.session", priority: 20});
8+
app.addSubMenuForType("desktop", "analytics", {code: "analytics-users", permission: "core", url: "#/analytics/users", text: "sidebar.analytics.users", priority: 10});
9+
app.addSubMenuForType("desktop", "analytics", {code: "analytics-loyalty", permission: "core", url: "#/analytics/loyalty", text: "sidebar.analytics.user-loyalty", priority: 15});

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

+6-9
Original file line numberDiff line numberDiff line change
@@ -879,14 +879,11 @@
879879
this.renderWhenReady(hooksDetailView);
880880
});
881881

882-
$(document).ready(function() {
883-
app.addMenu("management", {code: "hooks", permission: FEATURE_NAME, url: "#/manage/hooks", text: "hooks.plugin-title", priority: 110});
882+
app.addMenu("management", {code: "hooks", permission: FEATURE_NAME, url: "#/manage/hooks", text: "hooks.plugin-title", priority: 110});
884883

885-
//check if configuration view exists
886-
if (app.configurationsView) {
887-
app.configurationsView.registerLabel("hooks", "hooks.plugin-title");
888-
app.configurationsView.registerLabel("hooks.batchSize", "hooks.batch-size");
889-
}
890-
891-
});
884+
//check if configuration view exists
885+
if (app.configurationsView) {
886+
app.configurationsView.registerLabel("hooks", "hooks.plugin-title");
887+
app.configurationsView.registerLabel("hooks.batchSize", "hooks.batch-size");
888+
}
892889
})();

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

+21-23
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*global $, moment, countlyVue, app, countlyLogger, countlyCommon, CV, countlyGlobal */
1+
/*global moment, countlyVue, app, countlyLogger, countlyCommon, CV, countlyGlobal */
22
(function() {
33
var isSecondFormat = (Math.round(parseFloat(this.timestamp)) + "").length === 10;
44

@@ -209,28 +209,26 @@
209209
}]
210210
});
211211

212-
$(document).ready(function() {
213-
app.logger = logger;
212+
app.logger = logger;
214213

215-
app.route('/manage/logger', 'logger', function() {
216-
var params = {};
217-
this.logger.params = params;
218-
this.renderWhenReady(this.logger);
219-
});
220-
221-
app.addSubMenu("management", { code: "logger", permission: "logger", url: "#/manage/logger", text: "logger.title", priority: 50 });
222-
if (app.configurationsView) {
223-
app.configurationsView.registerLabel("logger.state", "logger.state");
224-
app.configurationsView.registerInput("logger.state", {
225-
input: "el-select",
226-
attrs: {},
227-
list: [
228-
{ value: 'on', label: CV.i18n("logger.state-on") },
229-
{ value: 'off', label: CV.i18n("logger.state-off") },
230-
{ value: 'automatic', label: CV.i18n("logger.state-automatic") }
231-
]
232-
});
233-
app.configurationsView.registerLabel("logger.limit", "logger.limit");
234-
}
214+
app.route('/manage/logger', 'logger', function() {
215+
var params = {};
216+
this.logger.params = params;
217+
this.renderWhenReady(this.logger);
235218
});
219+
220+
app.addSubMenu("management", { code: "logger", permission: "logger", url: "#/manage/logger", text: "logger.title", priority: 50 });
221+
if (app.configurationsView) {
222+
app.configurationsView.registerLabel("logger.state", "logger.state");
223+
app.configurationsView.registerInput("logger.state", {
224+
input: "el-select",
225+
attrs: {},
226+
list: [
227+
{ value: 'on', label: CV.i18n("logger.state-on") },
228+
{ value: 'off', label: CV.i18n("logger.state-off") },
229+
{ value: 'automatic', label: CV.i18n("logger.state-automatic") }
230+
]
231+
});
232+
app.configurationsView.registerLabel("logger.limit", "logger.limit");
233+
}
236234
})();
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
/*globals $,app */
1+
/*globals app */
22

33
app.addAppType("mobile", null);
44

5-
$(document).ready(function() {
6-
app.addSubMenuForType("mobile", "analytics", {code: "analytics-technology", permission: "core", url: "#/analytics/technology", text: "sidebar.analytics.technology", priority: 30});
7-
app.addSubMenuForType("mobile", "analytics", {code: "analytics-geo", permission: "core", url: "#/analytics/geo", text: "sidebar.analytics.geo", priority: 40});
8-
app.addSubMenuForType("mobile", "analytics", {code: "analytics-sessions", permission: "core", url: "#/analytics/sessions", text: "sidebar.analytics.session", priority: 20});
9-
app.addSubMenuForType("mobile", "analytics", {code: "analytics-users", permission: "core", url: "#/analytics/users", text: "sidebar.analytics.users", priority: 10});
10-
app.addSubMenuForType("mobile", "analytics", {code: "analytics-loyalty", permission: "core", url: "#/analytics/loyalty", text: "sidebar.analytics.user-loyalty", priority: 15});
11-
});
5+
app.addSubMenuForType("mobile", "analytics", {code: "analytics-technology", permission: "core", url: "#/analytics/technology", text: "sidebar.analytics.technology", priority: 30});
6+
app.addSubMenuForType("mobile", "analytics", {code: "analytics-geo", permission: "core", url: "#/analytics/geo", text: "sidebar.analytics.geo", priority: 40});
7+
app.addSubMenuForType("mobile", "analytics", {code: "analytics-sessions", permission: "core", url: "#/analytics/sessions", text: "sidebar.analytics.session", priority: 20});
8+
app.addSubMenuForType("mobile", "analytics", {code: "analytics-users", permission: "core", url: "#/analytics/users", text: "sidebar.analytics.users", priority: 10});
9+
app.addSubMenuForType("mobile", "analytics", {code: "analytics-loyalty", permission: "core", url: "#/analytics/loyalty", text: "sidebar.analytics.user-loyalty", priority: 15});

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

+15-17
Original file line numberDiff line numberDiff line change
@@ -1101,24 +1101,22 @@
11011101
this.renderWhenReady(getAccountView());
11021102
});
11031103

1104-
$(document).ready(function() {
1105-
if (countlyAuth.validateGlobalAdmin()) {
1106-
if (countlyGlobal.COUNTLY_CONTAINER !== 'frontend') {
1107-
app.addMenu("management", {code: "plugins", url: "#/manage/plugins", text: "plugins.title", icon: '<div class="logo-icon fa fa-puzzle-piece"></div>', priority: 80});
1108-
}
1104+
if (countlyAuth.validateGlobalAdmin()) {
1105+
if (countlyGlobal.COUNTLY_CONTAINER !== 'frontend') {
1106+
app.addMenu("management", {code: "plugins", url: "#/manage/plugins", text: "plugins.title", icon: '<div class="logo-icon fa fa-puzzle-piece"></div>', priority: 80});
11091107
}
1110-
if (countlyAuth.validateGlobalAdmin()) {
1111-
app.addMenu("management", {code: "configurations", url: "#/manage/configurations", text: "plugins.configs", icon: '<div class="logo-icon ion-android-options"></div>', priority: 10});
1108+
}
1109+
if (countlyAuth.validateGlobalAdmin()) {
1110+
app.addMenu("management", {code: "configurations", url: "#/manage/configurations", text: "plugins.configs", icon: '<div class="logo-icon ion-android-options"></div>', priority: 10});
11121111

1113-
var isCurrentHostnameIP = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(window.location.hostname);
1114-
var isGlobalDomainHasValue = countlyGlobal.domain === "" || typeof countlyGlobal.domain === "undefined" ? false : true;
1115-
if (!isCurrentHostnameIP && !isGlobalDomainHasValue) {
1116-
countlyPlugins.updateConfigs({"api": {"domain": window.location.protocol + "//" + window.location.hostname}}, function(err) {
1117-
if (err) {
1118-
// throw err
1119-
}
1120-
});
1121-
}
1112+
var isCurrentHostnameIP = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(window.location.hostname);
1113+
var isGlobalDomainHasValue = countlyGlobal.domain === "" || typeof countlyGlobal.domain === "undefined" ? false : true;
1114+
if (!isCurrentHostnameIP && !isGlobalDomainHasValue) {
1115+
countlyPlugins.updateConfigs({"api": {"domain": window.location.protocol + "//" + window.location.hostname}}, function(err) {
1116+
if (err) {
1117+
// throw err
1118+
}
1119+
});
11221120
}
1123-
});
1121+
}
11241122
})();

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

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* global app, countlyAuth, countlyVue, countlyPopulator, CountlyHelpers, CV, countlyCommon, $, countlyGlobal */
1+
/* global app, countlyAuth, countlyVue, countlyPopulator, CountlyHelpers, CV, countlyCommon, countlyGlobal */
22
(function() {
33
var FEATURE_NAME = 'populator';
44

@@ -288,9 +288,7 @@
288288
}
289289
});
290290

291-
$(document).ready(function() {
292-
app.addSubMenu("management", {code: "populate", permission: FEATURE_NAME, url: "#/manage/populate", text: "populator.plugin-title", priority: 30, classes: "populator-menu"});
293-
});
291+
app.addSubMenu("management", {code: "populate", permission: FEATURE_NAME, url: "#/manage/populate", text: "populator.plugin-title", priority: 30, classes: "populator-menu"});
294292
countlyVue.container.registerMixin("/manage/export/export-features", {
295293
beforeCreate: function() {
296294
var self = this;

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

+10-12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable no-console */
2-
/* global countlyVue,app,CV,countlyPushNotification,countlyPushNotificationComponent,CountlyHelpers,countlyCommon,$,countlyGlobal,countlyAuth,Promise*/
2+
/* global countlyVue,app,CV,countlyPushNotification,countlyPushNotificationComponent,CountlyHelpers,countlyCommon,countlyGlobal,countlyAuth,Promise*/
33

44
(function() {
55

@@ -2835,16 +2835,14 @@
28352835

28362836

28372837
//countly.view global management settings
2838-
$(document).ready(function() {
2839-
app.addMenuForType("mobile", "reach", {code: "push", permission: featureName, url: "#/messaging", text: "push-notification.title", icon: '<div class="logo ion-chatbox-working"></div>', priority: 10});
2840-
addWidgetToCustomDashboard();
2838+
app.addMenuForType("mobile", "reach", {code: "push", permission: featureName, url: "#/messaging", text: "push-notification.title", icon: '<div class="logo ion-chatbox-working"></div>', priority: 10});
2839+
addWidgetToCustomDashboard();
28412840

2842-
if (app.configurationsView) {
2843-
app.configurationsView.registerLabel("push", "push-notification.title");
2844-
app.configurationsView.registerLabel("push.proxyhost", "push-notification.proxy-host");
2845-
app.configurationsView.registerLabel("push.proxypass", "push-notification.proxy-password");
2846-
app.configurationsView.registerLabel("push.proxyport", "push-notification.proxy-port");
2847-
app.configurationsView.registerLabel("push.proxyuser", "push-notification.proxy-user");
2848-
}
2849-
});
2841+
if (app.configurationsView) {
2842+
app.configurationsView.registerLabel("push", "push-notification.title");
2843+
app.configurationsView.registerLabel("push.proxyhost", "push-notification.proxy-host");
2844+
app.configurationsView.registerLabel("push.proxypass", "push-notification.proxy-password");
2845+
app.configurationsView.registerLabel("push.proxyport", "push-notification.proxy-port");
2846+
app.configurationsView.registerLabel("push.proxyuser", "push-notification.proxy-user");
2847+
}
28502848
}());
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
/*global app, $ */
2-
$(document).ready(function() {
3-
//check if configuration view exists
4-
if (app.configurationsView) {
5-
app.configurationsView.registerLabel("recaptcha", "recaptcha.title");
6-
}
7-
});
1+
/*global app*/
2+
//check if configuration view exists
3+
if (app.configurationsView) {
4+
app.configurationsView.registerLabel("recaptcha", "recaptcha.title");
5+
}

0 commit comments

Comments
 (0)