Skip to content

Commit 3609fbb

Browse files
authored
Merge pull request #2676 from LumbardhAgaj/fix/active-app-error-on-create
Fix/active app error on create app
2 parents 824c7d3 + a5e2bcf commit 3609fbb

File tree

7 files changed

+78
-165
lines changed

7 files changed

+78
-165
lines changed

Gruntfile.js

+1
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ module.exports = function(grunt) {
176176
'frontend/express/public/core/events/javascripts/countly.details.views.js',
177177
'frontend/express/public/core/user-management/javascripts/countly.overview.models.js',
178178
'frontend/express/public/core/user-management/javascripts/countly.overview.views.js',
179+
'frontend/express/public/core/app-management/javascripts/countly.models.js',
179180
'frontend/express/public/core/app-management/javascripts/countly.views.js',
180181
'frontend/express/public/core/logs/javascripts/countly.views.js',
181182
'frontend/express/public/core/token-manager/javascripts/countly.views.js',
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*global countlyVue */
2+
(function(countlyAppManagement) {
3+
countlyAppManagement.getVuexModule = function() {
4+
var getInitialState = function() {
5+
return {
6+
selectedAppId: null,
7+
isDiscarded: false,
8+
};
9+
};
10+
11+
var actions = {
12+
setSelectedAppId: function(context, payload) {
13+
context.commit('setSelectedAppId', payload);
14+
}
15+
};
16+
17+
var mutations = {
18+
setSelectedAppId: function(state, value) {
19+
state.selectedAppId = value;
20+
}
21+
};
22+
return countlyVue.vuex.Module("countlyAppManagement", {
23+
state: getInitialState,
24+
actions: actions,
25+
mutations: mutations,
26+
});
27+
};
28+
}(window.countlyAppManagement = window.countlyAppManagement || {}));

frontend/express/public/core/app-management/javascripts/countly.views.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*global countlyAuth, ELEMENT, app, countlyGlobal, CV, countlyVue, countlyCommon, CountlyHelpers, jQuery, $, Backbone, moment, sdks, countlyPlugins, countlySession, countlyLocation, countlyCity, countlyDevice, countlyCarrier, countlyDeviceDetails, countlyAppVersion, countlyEvent, _ ,*/
1+
/*global countlyAuth, ELEMENT, app, countlyGlobal, CV, countlyVue, countlyCommon, CountlyHelpers, jQuery, $, Backbone, moment, sdks, countlyPlugins, countlySession, countlyLocation, countlyCity, countlyDevice, countlyCarrier, countlyDeviceDetails, countlyAppVersion, countlyEvent, _ , countlyAppManagement*/
22
(function() {
33
var ManageAppsView = countlyVue.views.create({
44
mixins: [ELEMENT.utils.Emitter],
@@ -11,7 +11,7 @@
1111
set: function(value) {
1212
this.newApp = false;
1313
this.selectedApp = value;
14-
this.broadcast('AppSettingsContainerObservable', 'selectedApp', value);
14+
this.$store.dispatch('countlyAppManagement/setSelectedAppId', value);
1515
this.uploadData.app_image_id = countlyGlobal.apps[this.selectedApp]._id + "";
1616
this.app_icon["background-image"] = 'url("appimages/' + this.selectedApp + '.png")';
1717
this.unpatch();
@@ -528,7 +528,7 @@
528528

529529
//find next app
530530
var nextAapp = (self.appList[index2]) ? self.appList[index2].value : self.appList[0].value;
531-
self.$store.dispatch("countlyCommon/setActiveApp", nextAapp);
531+
self.$store.dispatch("countlyCommon/updateActiveApp", nextAapp);
532532
self.selectedApp = nextAapp;
533533
self.uploadData.app_image_id = countlyGlobal.apps[self.selectedApp]._id + "";
534534
self.app_icon["background-image"] = 'url("appimages/' + self.selectedApp + '.png")';
@@ -726,14 +726,14 @@
726726
},
727727
mounted: function() {
728728
var appId = this.$route.params.app_id || countlyCommon.ACTIVE_APP_ID;
729-
this.broadcast('AppSettingsContainerObservable', 'selectedApp', appId);
729+
this.$store.dispatch('countlyAppManagement/setSelectedAppId', appId);
730730
}
731731
});
732732

733733
var getMainView = function() {
734734
return new countlyVue.views.BackboneWrapper({
735735
component: ManageAppsView,
736-
vuex: []
736+
vuex: [{clyModel: countlyAppManagement}]
737737
});
738738
};
739739

frontend/express/views/dashboard.html

+1
Original file line numberDiff line numberDiff line change
@@ -1861,6 +1861,7 @@ <h4><a href="#/analytics/events/key/{{encodeURIComponent this.name}}">{{this.nam
18611861
<script language="javascript" type="text/javascript" src="<%- cdn %>core/user-analytics-overview/javascripts/countly.views.js?<%= countlyVersion %>"></script>
18621862
<script language="javascript" type="text/javascript" src="<%- cdn %>core/geo-countries/javascripts/countly.views.js?<%= countlyVersion %>"></script>
18631863
<script language="javascript" type="text/javascript" src="<%- cdn %>core/geo-countries/javascripts/countly.widgets.geo.js?<%= countlyVersion %>"></script>
1864+
<script language="javascript" type="text/javascript" src="<%- cdn %>core/app-management/javascripts/countly.models.js?<%= countlyVersion %>"></script>
18641865
<script language="javascript" type="text/javascript" src="<%- cdn %>core/app-management/javascripts/countly.views.js?<%= countlyVersion %>"></script>
18651866
<script language="javascript" type="text/javascript" src="<%- cdn %>core/user-management/javascripts/countly.models.js?<%= countlyVersion %>"></script>
18661867
<script language="javascript" type="text/javascript" src="<%- cdn %>core/user-management/javascripts/countly.views.js?<%= countlyVersion %>"></script>

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

+11-9
Original file line numberDiff line numberDiff line change
@@ -1740,7 +1740,6 @@
17401740
viewModel: JSON.parse(JSON.stringify(initialAppLevelConfig)),
17411741
modelUnderEdit: Object.assign({}, { rate: "", period: ""}),
17421742
uploadedIOSKeyFilename: '',
1743-
selectedAppId: this.$route.params.app_id || countlyCommon.ACTIVE_APP_ID,
17441743
isHuaweiConfigTouched: false,
17451744
isIOSConfigTouched: false,
17461745
AddTestUserDefinitionTypeEnum: countlyPushNotification.service.AddTestUserDefinitionTypeEnum,
@@ -1769,6 +1768,16 @@
17691768
},
17701769
selectedTestUsersRows: function() {
17711770
return this.testUsersRows[this.selectedTestUsersListOption];
1771+
},
1772+
selectedAppId: function() {
1773+
return this.$store.state.countlyAppManagement.selectedAppId;
1774+
}
1775+
},
1776+
watch: {
1777+
selectedAppId: function() {
1778+
this.iosAuthConfigType = countlyPushNotification.service.IOSAuthConfigTypeEnum.P8;
1779+
this.resetConfig();
1780+
this.reconcilate();
17721781
}
17731782
},
17741783
methods: {
@@ -1877,12 +1886,6 @@
18771886
this.resetConfig();
18781887
this.reconcilate();
18791888
},
1880-
onSelectApp: function(appId) {
1881-
this.selectedAppId = appId;
1882-
this.iosAuthConfigType = countlyPushNotification.service.IOSAuthConfigTypeEnum.P8;
1883-
this.resetConfig();
1884-
this.reconcilate();
1885-
},
18861889
isKeyEmpty: function(platform) {
18871890
if (platform === this.PlatformEnum.ANDROID) {
18881891
return !this.viewModel[platform].firebaseKey;
@@ -2149,10 +2152,9 @@
21492152
mounted: function() {
21502153
this.addKeyFileReaderLoadListener(this.onKeyFileReady);
21512154
this.addDiscardEventListener(this.onDiscard);
2152-
this.addSelectedAppEventListener(this.onSelectApp);
21532155
this.reconcilate();
21542156
},
2155-
destroyed: function() {
2157+
beforeDestroy: function() {
21562158
this.removeKeyFileReaderLoadListener(this.onKeyFileReady);
21572159
}
21582160
});

plugins/push/package-lock.json

+29-148
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/push/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
"notifications"
2121
],
2222
"dependencies": {
23-
"jsonwebtoken": "^8.0.1",
24-
"node-forge": "^1.2.1",
25-
"xxhash-addon": "^1.4.0"
23+
"jsonwebtoken": "8.0.1",
24+
"node-forge": "1.2.1",
25+
"xxhash-addon": "1.4.0"
2626
},
2727
"private": true
2828
}

0 commit comments

Comments
 (0)