Commit 952d0696 by kevalbhatt

ATLAS-3382 : UI: Entity & Classification count are not getting updated after…

ATLAS-3382 : UI: Entity & Classification count are not getting updated after clicking on refresh button
parent a310bc29
......@@ -210,16 +210,16 @@ require(['App',
this.enumDefCollection.url = UrlLinks.enumDefApiUrl();
this.enumDefCollection.modelAttrName = "enumDefs";
this.classificationDefCollection = new VTagList();
this.entityCountCollection = new VTagList();
this.entityCountCollection.url = UrlLinks.entityCountApi();
this.entityCountCollection.modelAttrName = "data";
this.metricCollection = new VTagList();
this.metricCollection.url = UrlLinks.metricsApiUrl();
this.metricCollection.modelAttrName = "data";
App.appRouter = new Router({
entityDefCollection: this.entityDefCollection,
typeHeaders: this.typeHeaders,
enumDefCollection: this.enumDefCollection,
classificationDefCollection: this.classificationDefCollection,
entityCountCollection: this.entityCountCollection
metricCollection: this.metricCollection
});
var startApp = function() {
......@@ -301,7 +301,7 @@ require(['App',
}
});
this.entityCountCollection.fetch({
this.metricCollection.fetch({
skipDefaultError: true,
complete: function() {
--that.asyncFetchCounter;
......
......@@ -42,7 +42,7 @@ define([
'*actions': 'defaultAction'
},
initialize: function(options) {
_.extend(this, _.pick(options, 'entityDefCollection', 'typeHeaders', 'enumDefCollection', 'classificationDefCollection', 'entityCountCollection'));
_.extend(this, _.pick(options, 'entityDefCollection', 'typeHeaders', 'enumDefCollection', 'classificationDefCollection', 'metricCollection'));
this.showRegions();
this.bindCommonEvents();
this.listenTo(this, 'route', this.postRouteExecute, this);
......@@ -58,7 +58,7 @@ define([
'enumDefCollection': this.enumDefCollection,
'classificationDefCollection': this.classificationDefCollection,
'glossaryCollection': this.glossaryCollection,
'entityCountCollection': this.entityCountCollection
'metricCollection': this.metricCollection
}
this.sharedObj = {
searchTableColumns: {},
......@@ -77,7 +77,8 @@ define([
require([
'views/site/Statistics',
], function(Statistics) {
new Statistics();
new Statistics(_.extend({}, that.preFetchedCollectionLists,
that.sharedObj));
});
});
$('body').on('click', 'li.aboutAtlas', function() {
......
......@@ -40,7 +40,7 @@ define(['require', 'utils/Enums', 'utils/Utils', 'underscore'], function(require
enumDefApiUrl: function(name) {
return this.getDefApiUrl('enum', name);
},
entityCountApi: function(){
metricsApiUrl: function(){
return this.baseUrl + '/admin/metrics'
},
getDefApiUrl: function(type, name) {
......
......@@ -89,9 +89,9 @@ define(['require',
* @constructs
*/
initialize: function(options) {
_.extend(this, _.pick(options, 'value', 'typeHeaders', 'searchVent', 'entityDefCollection', 'enumDefCollection', 'classificationDefCollection', 'searchTableColumns', 'searchTableFilters', 'entityCountCollection'));
_.extend(this, _.pick(options, 'value', 'typeHeaders', 'searchVent', 'entityDefCollection', 'enumDefCollection', 'classificationDefCollection', 'searchTableColumns', 'searchTableFilters', 'metricCollection'));
this.type = "basic";
this.entityCountObj = _.first(this.entityCountCollection.toJSON());
this.entityCountObj = _.first(this.metricCollection.toJSON());
this.filterTypeSelected = [];
var param = Utils.getUrlState.getQueryParams();
this.query = {
......@@ -358,16 +358,35 @@ define(['require',
includeDE: null
}), param);
},
fetchCollection: function(value) {
this.typeHeaders.fetch({ reset: true });
},
onRefreshButton: function() {
this.fetchCollection();
//to check url query param contain type or not
var checkURLValue = Utils.getUrlState.getQueryParams(this.url);
if (this.searchVent && (_.has(checkURLValue, "tag") || _.has(checkURLValue, "type") || _.has(checkURLValue, "query"))) {
this.searchVent.trigger('search:refresh');
var that = this,
apiCount = 2,
updateSearchList = function() {
if (apiCount === 0) {
that.initializeValues();
var checkURLValue = Utils.getUrlState.getQueryParams(that.url);
if (that.searchVent && (_.has(checkURLValue, "tag") || _.has(checkURLValue, "type") || _.has(checkURLValue, "query"))) {
that.searchVent.trigger('search:refresh');
}
}
};
this.metricCollection.fetch({
skipDefaultError: true,
complete: function() {
--apiCount;
that.entityCountObj = _.first(that.metricCollection.toJSON());
updateSearchList();
}
});
this.typeHeaders.fetch({
skipDefaultError: true,
silent: true,
complete: function() {
--apiCount;
updateSearchList();
}
});
},
advancedInfo: function(e) {
require([
......
......@@ -85,11 +85,9 @@ define(['require',
},
bindEvents: function() {},
fetchMetricData: function(options) {
var that = this,
entityCountCollection = new VTagList();
entityCountCollection.url = UrlLinks.entityCountApi();
entityCountCollection.modelAttrName = "data";
entityCountCollection.fetch({
var that = this;
this.metricCollection.fetch({
skipDefaultError: true,
success: function(data) {
var data = _.first(data.toJSON());
that.renderStats({ valueObject: data.general.stats, dataObject: data.general });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment