Skip to content

Commit 5330802

Browse files
authored
Merge branch 'flex' into release.24.12
2 parents 5864276 + b9c6d1c commit 5330802

File tree

4 files changed

+52
-16
lines changed

4 files changed

+52
-16
lines changed

frontend/express/app.js

+34-4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,22 @@
66
// Set process name
77
process.title = "countly: dashboard node " + process.argv[1];
88

9+
var fs = require('fs');
10+
var path = require('path');
11+
var IS_FLEX = false;
12+
13+
if (fs.existsSync(path.resolve('/opt/deployment_env.json'))) {
14+
var deploymentConf = fs.readFileSync('/opt/deployment_env.json', 'utf8');
15+
try {
16+
if (JSON.parse(deploymentConf).DEPLOYMENT_ID) {
17+
IS_FLEX = true;
18+
}
19+
}
20+
catch (e) {
21+
IS_FLEX = false;
22+
}
23+
}
24+
925
var versionInfo = require('./version.info'),
1026
pack = require('../../package.json'),
1127
COUNTLY_VERSION = versionInfo.version,
@@ -27,8 +43,6 @@ var versionInfo = require('./version.info'),
2743
}
2844
}),
2945
crypto = require('crypto'),
30-
fs = require('fs'),
31-
path = require('path'),
3246
jimp = require('jimp'),
3347
flash = require('connect-flash'),
3448
cookieParser = require('cookie-parser'),
@@ -66,7 +80,13 @@ var COUNTLY_NAMED_TYPE = "Countly Lite v" + COUNTLY_VERSION;
6680
var COUNTLY_TYPE_CE = true;
6781
var COUNTLY_TRIAL = (versionInfo.trial) ? true : false;
6882
var COUNTLY_TRACK_TYPE = "OSS";
69-
if (versionInfo.footer) {
83+
84+
if (IS_FLEX) {
85+
COUNTLY_NAMED_TYPE = "Countly v" + COUNTLY_VERSION;
86+
COUNTLY_TYPE_CE = false;
87+
COUNTLY_TRACK_TYPE = "Flex";
88+
}
89+
else if (versionInfo.footer) {
7090
COUNTLY_NAMED_TYPE = versionInfo.footer;
7191
COUNTLY_TYPE_CE = false;
7292
if (COUNTLY_NAMED_TYPE === "Countly Cloud") {
@@ -907,8 +927,9 @@ Promise.all([plugins.dbConnection(countlyConfig), plugins.dbConnection("countly_
907927
countly_tracking = plugins.isPluginEnabled('tracker') ? true : plugins.getConfig('frontend').countly_tracking,
908928
countly_domain = plugins.getConfig('api').domain,
909929
licenseNotification, licenseError;
930+
var isLocked = false;
910931
configs.export_limit = plugins.getConfig("api").export_limit;
911-
app.loadThemeFiles(configs.theme, function(theme) {
932+
app.loadThemeFiles(configs.theme, async function(theme) {
912933
if (configs._user.theme) {
913934
res.cookie("theme", configs.theme);
914935
}
@@ -922,6 +943,13 @@ Promise.all([plugins.dbConnection(countlyConfig), plugins.dbConnection("countly_
922943
if (member.upgrade) {
923944
countlyDb.collection('members').update({"_id": member._id}, {$unset: {upgrade: ""}}, function() {});
924945
}
946+
if (IS_FLEX) {
947+
let locked = await countlyDb.collection('mycountly').findOne({_id: 'lockServer'});
948+
if (locked?.isLocked === true) {
949+
isLocked = true;
950+
}
951+
952+
}
925953

926954
if (req.session.licenseError) {
927955
licenseError = req.session.licenseError;
@@ -989,6 +1017,8 @@ Promise.all([plugins.dbConnection(countlyConfig), plugins.dbConnection("countly_
9891017
helpCenterLink: COUNTLY_HELPCENTER_LINK,
9901018
featureRequestLink: COUNTLY_FEATUREREQUEST_LINK,
9911019
},
1020+
mycountly: IS_FLEX,
1021+
isLocked: isLocked,
9921022
};
9931023

9941024

frontend/express/public/core/onboarding/javascripts/countly.views.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
types: Object.keys(app.appTypes),
3838
appTemplates: appTemplates,
3939
populatorProgress: 0,
40-
populatorMaxTime: 60,
40+
populatorMaxTime: 30,
4141
isPopulatorFinished: false,
4242
isCountlyEE: countlyGlobal.plugins.includes('drill'),
4343
selectedAppTemplate: null,

plugins/pluginManager.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ var pluginManager = function pluginManager() {
155155
}
156156
db.collection('plugins').updateOne({'_id': 'plugins'}, {'$set': fordb}, function(err1) {
157157
if (err1) {
158-
log.e(err1);
158+
console.error(err1);
159159
}
160160
else {
161161
self.dispatch("/systemlogs", {params: params, action: "change_plugins", data: {before: before, update: params.qstring.plugin}});
@@ -826,6 +826,10 @@ var pluginManager = function pluginManager() {
826826
return used;
827827
};
828828

829+
this.returnEventsCopy = function() {
830+
return JSON.parse(JSON.stringify(events));
831+
};
832+
829833
/**
830834
* Dispatch specific event on api side and wait until all event handlers have processed the event (legacy)
831835
* @param {string} event - event to dispatch

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

+12-10
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@
145145

146146
countlyPlugins.toggle(plugins, function(res) {
147147
if (res.result === "started") {
148-
//self.showPluginProcessMessage(jQuery.i18n.map["plugins.processing"], jQuery.i18n.map["plugins.will-restart"], jQuery.i18n.map["plugins.please-wait"], 5000, true, 'warning', false);
149-
//self.checkProcess();
148+
//self.showPluginProcessMessage(jQuery.i18n.map["plugins.processing"], jQuery.i18n.map["plugins.will-restart"], jQuery.i18n.map["plugins.please-wait"], 5000, true, 'warning', false);
149+
//self.checkProcess();
150150
self.showPluginProcessMessage(jQuery.i18n.map["plugins.success"], jQuery.i18n.map["plugins.applying"], jQuery.i18n.map["plugins.finish"], 3000, false, 'green', true);
151151
}
152152
else {
@@ -327,7 +327,7 @@
327327
self.removeNonGlobalConfigs(self.configsData);
328328
}
329329
catch (error) {
330-
// eslint-disable-next-line no-console
330+
// eslint-disable-next-line no-console
331331
console.error(error);
332332
self.configsData = {};
333333
}
@@ -463,7 +463,7 @@
463463
this.configsData[config][key] = value;
464464
//when user disables country data tracking while city data tracking is enabled
465465
if (key === "country_data" && value === false && this.configsData[config].city_data === true) {
466-
//disable city data tracking
466+
//disable city data tracking
467467
this.configsData[config].city_data = false;
468468
//if city data tracking was originally enabled, note the change
469469
index = this.diff.indexOf("city_data");
@@ -479,7 +479,7 @@
479479
}
480480
//when user enables city data tracking while country data tracking is disabled
481481
if (key === "city_data" && value === true && this.configsData[config].country_data === false) {
482-
//enable country data tracking
482+
//enable country data tracking
483483
this.configsData[config].country_data = true;
484484
//if country data tracking was originally disabled, note the change
485485
index = this.diff.indexOf("country_data");
@@ -540,7 +540,7 @@
540540
var plugs = countlyGlobal.apps[countlyCommon.ACTIVE_APP_ID].plugins;
541541
//check if value can be overwritten on user level
542542
if (configsData[ns]._user && configsData[ns]._user[id]) {
543-
//check if value is overwritten on user level
543+
//check if value is overwritten on user level
544544
var sets = countlyGlobal.member.settings;
545545
if (sets && sets[ns] && typeof sets[ns][id] !== "undefined") {
546546
return {label: jQuery.i18n.map["configs.overwritten.user"], href: "#/account-settings"};
@@ -642,7 +642,7 @@
642642
let label = self.getLabelName(item, config) || "";
643643
let helper = self.getHelperLabel(item, config) || "";
644644
return label.toLowerCase().includes(self.searchQuery)
645-
|| helper.toLowerCase().includes(self.searchQuery);
645+
|| helper.toLowerCase().includes(self.searchQuery);
646646
});
647647
if (list.length > 0) {
648648
let tmp = group;
@@ -678,7 +678,7 @@
678678
},
679679
clearSearch: function() {
680680
this.searchQuery = "";
681-
//this.searchResultStructure = {};
681+
//this.searchResultStructure = {};
682682
}
683683
}
684684
});
@@ -1322,7 +1322,9 @@
13221322
});
13231323

13241324
if (countlyAuth.validateGlobalAdmin()) {
1325-
app.addMenu("management", {code: "plugins", pluginName: "plugins", url: "#/manage/plugins", text: "plugins.title", icon: '<div class="logo-icon fa fa-puzzle-piece"></div>', priority: 80});
1325+
if (!countlyGlobal.mycountly && countlyGlobal.plugins.indexOf('my-countly') === -1) {
1326+
app.addMenu("management", {code: "plugins", pluginName: "plugins", url: "#/manage/plugins", text: "plugins.title", icon: '<div class="logo-icon fa fa-puzzle-piece"></div>', priority: 80});
1327+
}
13261328
}
13271329
if (countlyAuth.validateGlobalAdmin()) {
13281330
app.addMenu("management", {code: "configurations", pluginName: "plugins", url: "#/manage/configurations", text: "plugins.configs", icon: '<div class="logo-icon ion-android-options"></div>', priority: 30});
@@ -1332,7 +1334,7 @@
13321334
if (!isCurrentHostnameIP && !isGlobalDomainHasValue) {
13331335
countlyPlugins.updateConfigs({"api": {"domain": window.location.protocol + "//" + window.location.hostname}}, function(err) {
13341336
if (err) {
1335-
// throw err
1337+
// throw err
13361338
}
13371339
});
13381340
}

0 commit comments

Comments
 (0)