Jonas Kress (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/294033

Change subject: Editor status bar cleanup
......................................................................

Editor status bar cleanup

Less prominent and clutter
Date update icon indicator (green|yellow|red)

Change-Id: I2b0853b1e4807496b9c852e9d21e9d58eb3f40c8
---
M index.html
M style.css
M wikibase/queryService/api/Sparql.js
M wikibase/queryService/ui/App.js
4 files changed, 50 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikidata/query/gui 
refs/changes/33/294033/1

diff --git a/index.html b/index.html
index 1948c8e..2fa92e7 100644
--- a/index.html
+++ b/index.html
@@ -93,8 +93,8 @@
                        <div id="query-box">
                                <form id="query-form">
                                        <textarea class="queryEditor" 
name="query" placeholder="(Input a SPARQL query or choose a query 
example)"></textarea>
-                                       <div class="alert alert-success 
alert-dismissible" role="alert">
-                                               Press <i>[CTRL-SPACE]</i> to 
activate auto completion. Data last updated: <span 
id="dbUpdated">[connecting]</span>
+                                       <div class="status navbar 
navbar-default">
+                                               Press <i 
class="list-group-item-success">[CTRL-SPACE]</i> to activate auto completion. 
Data update status: <span class="dataUpdated"><span 
class="list-group-item-success"><span class="glyphicon glyphicon-refresh" 
aria-hidden="true"></span></span></span>
                                        </div>
                                        <nav class="navbar navbar-default">
                                                <div class="nav navbar-form 
navbar-left">
diff --git a/style.css b/style.css
index c153be1..fd0b3ee 100644
--- a/style.css
+++ b/style.css
@@ -87,9 +87,15 @@
        position: relative;
 }
 
-#query-box .alert {
+#query-box .status {
        padding: 3px;
        font-size: 13px;
+       min-height: 25px;
+       color: #777;
+       margin-bottom: 5px;
+}
+.dataUpdated > span:nth-child(1) {
+       padding: 5px;
 }
 
 #query-box .nav {
@@ -120,6 +126,7 @@
     line-height: 20px;
 }
 
+
 /**
        Bootstrap Styles
 **/
@@ -129,12 +136,6 @@
 
 .navbar-right {
        margin-right: 0;
-}
-
-
-
-.label {
-       font-size: 100%;
 }
 
 .actionMessage {
diff --git a/wikibase/queryService/api/Sparql.js 
b/wikibase/queryService/api/Sparql.js
index 6c21090..a88ee10 100644
--- a/wikibase/queryService/api/Sparql.js
+++ b/wikibase/queryService/api/Sparql.js
@@ -96,8 +96,10 @@
                                                                        day: 
'numeric',
                                                                        year: 
'numeric'
                                                                } );
+                                                       var differenceInSeconds 
= Math
+                                                                       .round( 
( new Date() - updateDate ) / 1000 );
 
-                                               deferred.resolve( dateText );
+                                               deferred.resolve( dateText, 
differenceInSeconds );
                                        } ).fail( function() {
                                deferred.reject();
                        } );
diff --git a/wikibase/queryService/ui/App.js b/wikibase/queryService/ui/App.js
index 74fb231..a3c0bf8 100644
--- a/wikibase/queryService/ui/App.js
+++ b/wikibase/queryService/ui/App.js
@@ -294,10 +294,43 @@
         * @private
         */
        SELF.prototype._initDataUpdated = function() {
-               this._sparqlApi.queryDataUpdatedTime().done( function( time ) {
-                       $( '#dbUpdated' ).text( time );
-               } ).fail( function() {
-                       $( '#dbUpdated' ).text( '[unable to connect]' );
+               var self = this;
+
+               var updateColor = function() {
+                       self._sparqlApi.queryDataUpdatedTime().done( function( 
time, difference ) {
+                               var label = $( '.dataUpdated > span' );
+                               label.removeClass();
+
+                               if ( difference <= 60 * 2 ) {
+                                       label.addClass( 
'list-group-item-success' );
+                               } else if ( difference <= 60 * 15 ) {
+                                       label.addClass( 
'list-group-item-warning' );
+                               } else {
+                                       label.addClass( 
'list-group-item-danger' );
+                               }
+
+                       } );
+               };
+               updateColor();
+               window.setInterval( updateColor, 10 * 60 * 1000 );
+
+               $( '.dataUpdated' ).hover( function() {
+                       updateColor();
+
+                       var e = $( this );
+                       self._sparqlApi.queryDataUpdatedTime().done( function( 
time, difference ) {
+                               e.popover( {
+                                       html: true,
+                                       content: 'Data last updated: ' + 
difference + ' seconds ago.<br/>' + time
+                               } ).popover( 'show' );
+                       } ).fail( function() {
+                               e.popover( {
+                                       content: '[unable to connect]'
+                               } ).popover( 'show' );
+                       } );
+               }, function() {
+                       var e = $( this );
+                       e.popover( 'destroy' );
                } );
        };
 

-- 
To view, visit https://gerrit.wikimedia.org/r/294033
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2b0853b1e4807496b9c852e9d21e9d58eb3f40c8
Gerrit-PatchSet: 1
Gerrit-Project: wikidata/query/gui
Gerrit-Branch: master
Gerrit-Owner: Jonas Kress (WMDE) <jonas.kr...@wikimedia.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to