From cfd53eb09d82d7f8cc1aa41314d9de8ba99809d5 Mon Sep 17 00:00:00 2001 From: Lukas Fryc Date: Wed, 27 Jan 2016 11:08:20 +0100 Subject: [PATCH] activity screen - do not show blank slate when search is active AGPUSH-1500 --- .../components/app-detail/include/activity.html | 16 ++++++++-------- .../components/app-detail/include/activity.js | 17 +++++++++++++++++ .../app-detail/include/analytics.html | 2 +- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/admin-ui/app/components/app-detail/include/activity.html b/admin-ui/app/components/app-detail/include/activity.html index bdd865e030..9e944ebd48 100644 --- a/admin-ui/app/components/app-detail/include/activity.html +++ b/admin-ui/app/components/app-detail/include/activity.html @@ -1,4 +1,4 @@ -
+

Notification activity

Explore push messages that you have sent to the registered devices.

@@ -29,6 +29,11 @@

Notification activity

+ + +

No message matches the given search criteria.

+ + @@ -93,7 +98,7 @@

Notification activity

-
+
@@ -103,12 +108,7 @@

You haven't send push notifications

There are no registered device for this application.

-
+

Check out the documentation on how to get started to register a device.

diff --git a/admin-ui/app/components/app-detail/include/activity.js b/admin-ui/app/components/app-detail/include/activity.js index 6dbfa337ba..6cf28d9906 100644 --- a/admin-ui/app/components/app-detail/include/activity.js +++ b/admin-ui/app/components/app-detail/include/activity.js @@ -11,12 +11,17 @@ angular.module('upsConsole') this.currentEnd = 0; this.perPage = 10; this.searchString = ''; + this.activeSearch = ''; var refreshInterval; + /** + * Fetches new data, reflecting provided page and searchString + */ function fetchMetrics( page, searchString ) { return metricsEndpoint.fetchApplicationMetrics(self.app.pushApplicationID, searchString, page, self.perPage) .then(function( data ) { + self.activeSearch = searchString; self.metrics.forEach(function( originalMetric ) { data.pushMetrics.some(function ( newMetric ) { if (originalMetric.id === newMetric.id && originalMetric.$toggled) { @@ -43,6 +48,18 @@ angular.module('upsConsole') }); } + /** + * Determines whether search is active - either the user typed search string or the data doesn't reflect the search string yet. + * + * @return false if searchString if false and data reflects that searchString; true otherwise + */ + this.isSearchActive = function() { + return self.searchString || self.activeSearch; + }; + + /** + * Fetches new data on page change + */ this.onPageChange = function ( page ) { fetchMetrics( page, self.searchString ); }; diff --git a/admin-ui/app/components/app-detail/include/analytics.html b/admin-ui/app/components/app-detail/include/analytics.html index 6f8c0591b8..77006c2168 100644 --- a/admin-ui/app/components/app-detail/include/analytics.html +++ b/admin-ui/app/components/app-detail/include/analytics.html @@ -94,7 +94,7 @@

No Charts yet

There are no registered device for this application.

- Check out the documentation on how to get started to register a device. +

Check out the documentation on how to get started to register a device.