Skip to content

Commit 0a00f9e

Browse files
author
Cihad Tekin
committed
[push] skippable audience estimation
1 parent c48f69b commit 0a00f9e

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

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

+7-3
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
isFetchEventsLoading: false,
9898
isFetchLocationsLoading: false,
9999
isLoading: false,
100+
isEstimationLoading: false,
100101
localizationOptions: [],
101102
userPropertiesOptions: [],
102103
cohortOptions: [],
@@ -476,7 +477,7 @@
476477
return;
477478
}
478479
if (this.shouldEstimate(nextStep, currentStep)) {
479-
return this.estimate();
480+
this.estimate(); // estimate in the background
480481
}
481482
if (this.shouldValidateContentBeforeExit(nextStep, currentStep)) {
482483
return this.$refs.content.validate();
@@ -521,6 +522,9 @@
521522
setIsLoading: function(value) {
522523
this.isLoading = value;
523524
},
525+
setEstimationLoading: function(value) {
526+
this.isEstimationLoading = value;
527+
},
524528
getQueryFilter: function() {
525529
if (!this.queryFilter) {
526530
return {};
@@ -534,7 +538,7 @@
534538
resolve(false);
535539
return;
536540
}
537-
self.setIsLoading(true);
541+
self.setEstimationLoading(true);
538542
var options = {};
539543
options.isLocationSet = self.isLocationSet;
540544
options.from = self.from;
@@ -570,7 +574,7 @@
570574
CountlyHelpers.notify({ message: error.message, type: "error"});
571575
resolve(false);
572576
}).finally(function() {
573-
self.setIsLoading(false);
577+
self.setEstimationLoading(false);
574578
});
575579
});
576580
},

plugins/push/frontend/public/templates/push-notification-drawer.html

+16-4
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,10 @@
769769
<cly-tooltip-icon :tooltip="i18n('push-notification.compose-message-tooltip')" icon="ion ion-help-circled"> </cly-tooltip-icon>
770770
</div>
771771
<div>
772-
<el-checkbox :value="multipleLocalizations" @change="onMultipleLocalizationChange">
772+
<div class="cly-vue-push-notification-drawer__checkbox-text" v-if="isEstimationLoading">
773+
<i class="fa fa-spin fa-spinner" style="font-size: 16px;margin-right: 6px;"></i> {{i18n('push-notification.allow-to-set-different-content')}}
774+
</div>
775+
<el-checkbox :value="multipleLocalizations" @change="onMultipleLocalizationChange" v-else>
773776
<div class="cly-vue-push-notification-drawer__checkbox-text">{{i18n('push-notification.allow-to-set-different-content')}}</div>
774777
</el-checkbox>
775778
</div>
@@ -1195,7 +1198,10 @@
11951198
{{previewCohorts(pushNotificationUnderEdit.cohorts).join(', ')}}
11961199
</template>
11971200
</review-section-row>
1198-
<review-section-row v-if="shouldDisplayNumberOfUsers" :label="i18n('push-notification.current-number-of-users')" :value="currentNumberOfUsers"></review-section-row>
1201+
<review-section-row v-if="shouldDisplayNumberOfUsers" :label="i18n('push-notification.current-number-of-users')">
1202+
<template v-if="isEstimationLoading"><i class="fa fa-spin fa-spinner"></i></template>
1203+
<template v-else>{{currentNumberOfUsers}}</template>
1204+
</review-section-row>
11991205
<review-section-row v-if="pushNotificationUnderEdit[TypeEnum.ONE_TIME].targeting === TargetingEnum.SEGMENTED" :label="i18n('push-notification.geolocations')" :value="previewLocations.join(', ')"></review-section-row>
12001206
<review-section-row
12011207
v-if="type === TypeEnum.ONE_TIME"
@@ -1212,7 +1218,10 @@
12121218
{{previewCohorts(pushNotificationUnderEdit.cohorts).join(', ')}}
12131219
</template>
12141220
</review-section-row>
1215-
<review-section-row v-if="shouldDisplayNumberOfUsers" :label="i18n('push-notification.current-number-of-users')" :value="currentNumberOfUsers"></review-section-row>
1221+
<review-section-row v-if="shouldDisplayNumberOfUsers" :label="i18n('push-notification.current-number-of-users')">
1222+
<template v-if="isEstimationLoading"><i class="fa fa-spin fa-spinner"></i></template>
1223+
<template v-else>{{currentNumberOfUsers}}</template>
1224+
</review-section-row>
12161225
<review-section-row v-if="pushNotificationUnderEdit[TypeEnum.RECURRING].targeting === TargetingEnum.SEGMENTED" :label="i18n('push-notification.geolocations')" :value="previewLocations.join(', ')"></review-section-row>
12171226
<review-section-row
12181227
v-if="type === TypeEnum.RECURRING"
@@ -1229,7 +1238,10 @@
12291238
{{previewCohorts(pushNotificationUnderEdit.cohorts).join(', ')}}
12301239
</template>
12311240
</review-section-row>
1232-
<review-section-row v-if="shouldDisplayNumberOfUsers" :label="i18n('push-notification.current-number-of-users')" :value="currentNumberOfUsers"></review-section-row>
1241+
<review-section-row v-if="shouldDisplayNumberOfUsers" :label="i18n('push-notification.current-number-of-users')">
1242+
<template v-if="isEstimationLoading"><i class="fa fa-spin fa-spinner"></i></template>
1243+
<template v-else>{{currentNumberOfUsers}}</template>
1244+
</review-section-row>
12331245
<review-section-row v-if="pushNotificationUnderEdit[TypeEnum.MULTIPLE].targeting === TargetingEnum.SEGMENTED" :label="i18n('push-notification.geolocations')" :value="previewLocations.join(', ')"></review-section-row>
12341246
<review-section-row
12351247
v-if="type === TypeEnum.MULTIPLE"

0 commit comments

Comments
 (0)