Skip to content

Commit f2b4d27

Browse files
authored
Merge pull request #5656 from Countly/views-issues
[Views] fixed loading state
2 parents d9ed773 + 0a3c184 commit f2b4d27

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

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

+6-8
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@
300300
showViewCountWarning: false,
301301
tableDynamicCols: dynamicCols,
302302
isGraphLoading: true,
303-
isTableLoading: false,
303+
isTableLoading: true,
304304
showActionMapColumn: showActionMapColumn, //for action map
305305
domains: [], //for action map
306306
persistentSettings: [],
@@ -320,7 +320,6 @@
320320
this.$store.dispatch('countlyViews/onSetSelectedViews', self.persistentSettings);
321321
this.$store.dispatch('countlyViews/fetchData').then(function() {
322322
self.calculateGraphSeries();
323-
self.isGraphLoading = false;
324323
self.showActionsMapColumn(); //for action map
325324
self.setUpDomains(); //for action map
326325
});
@@ -342,7 +341,6 @@
342341
}
343342
this.$store.dispatch('countlyViews/fetchData').then(function() {
344343
self.calculateGraphSeries();
345-
self.isGraphLoading = false;
346344
self.showActionsMapColumn();//for action map
347345
self.setUpDomains();//for action map
348346
});
@@ -426,11 +424,10 @@
426424
self.isGraphLoading = true;
427425
self.$store.dispatch('countlyViews/fetchData').then(function() {
428426
self.calculateGraphSeries();
429-
self.isGraphLoading = false;
430427
});
431428
});
432429

433-
this.refresh();
430+
this.refresh(true);
434431
},
435432
handleSelectionChange: function(selectedRows) {
436433
var self = this;
@@ -467,7 +464,6 @@
467464
self.isGraphLoading = true;
468465
self.$store.dispatch('countlyViews/fetchData').then(function() {
469466
self.calculateGraphSeries();
470-
self.isGraphLoading = false;
471467
});
472468
});
473469
return true;
@@ -486,10 +482,10 @@
486482
}
487483
this.$store.dispatch('countlyViews/fetchData').then(function() {
488484
self.calculateGraphSeries();
489-
self.isGraphLoading = false;
485+
});
486+
this.$store.dispatch("countlyViews/fetchViewsMainTable", {"segmentKey": this.$store.state.countlyViews.selectedSegment, "segmentValue": this.$store.state.countlyViews.selectedSegmentValue}).then(function() {
490487
self.isTableLoading = false;
491488
});
492-
this.$store.dispatch("countlyViews/fetchViewsMainTable", {"segmentKey": this.$store.state.countlyViews.selectedSegment, "segmentValue": this.$store.state.countlyViews.selectedSegmentValue});
493489
},
494490
calculateTotalCards: function() {
495491
var totals = this.$store.state.countlyViews.totals || {};
@@ -568,6 +564,7 @@
568564
}
569565
};
570566
}
567+
self.isGraphLoading = false;
571568
});
572569
},
573570
getExportQuery: function() {
@@ -617,6 +614,7 @@
617614
},
618615
dateChanged: function() {
619616
this.isSpecialPeriod = countlyCommon.periodObj.isSpecialPeriod;
617+
this.refresh(true);
620618
},
621619
openDrillViewDrawer: function() {
622620
let self = this;

plugins/views/frontend/public/templates/views.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ <h4 class="bu-pt-1" data-test-id="for-label">{{i18n('views.for')}}</h4>
130130
</template>
131131
</template>
132132
</cly-datatable-n>
133-
<cly-datatable-n v-else resizable border :force-loading="isTableLoading" test-id="datatable-analytics-views"
133+
<cly-datatable-n v-else resizable border v-loading="isTableLoading" :force-loading="isTableLoading" test-id="datatable-analytics-views"
134134
:default-sort="{prop: 'u', order: 'descending'}" :available-dynamic-cols="tableDynamicCols"
135135
:persist-key="tablePersistKey" :data-source="remoteTableDataSource" :export-query="getExportQuery"
136136
ref="viewsTable" @selection-change="handleSelectionChange">

0 commit comments

Comments
 (0)