File tree Expand file tree Collapse file tree 3 files changed +27
-4
lines changed
Expand file tree Collapse file tree 3 files changed +27
-4
lines changed Original file line number Diff line number Diff line change 3030 " ampersand-state" ,
3131 " scout-server" ,
3232 " glob" ,
33- " electron-squirrel-startup"
33+ " electron-squirrel-startup" ,
34+ " ipc"
3435 ]
3536 },
3637 "fonts" : [
Original file line number Diff line number Diff line change @@ -10,5 +10,5 @@ div.instance-properties
1010 span.num-collections
1111 strong( data-hook ='num-collections' )
1212 | Collections
13- button.refresh-collections
14- i.fa.fa-repeat
13+ button.refresh-collections ( data-hook = 'refresh-button' )
14+ i.fa ( data-hook = 'refresh-icon' )
Original file line number Diff line number Diff line change 11var View = require ( 'ampersand-view' ) ;
22var app = require ( 'ampersand-app' ) ;
33// var debug = require('debug')('scout:sidebar:instace-properties');
4+ var _ = require ( 'lodash' ) ;
45
56var InstancePropertiesView = module . exports = View . extend ( {
67 template : require ( './instance-properties.jade' ) ,
@@ -9,7 +10,11 @@ var InstancePropertiesView = module.exports = View.extend({
910 version : 'string' ,
1011 numDatabases : 'number' ,
1112 numCollections : 'number' ,
12- instance : 'state'
13+ instance : 'state' ,
14+ is_fetching : {
15+ type : 'boolean' ,
16+ default : true
17+ }
1318 } ,
1419 bindings : {
1520 'instance.host.hostname' : {
@@ -27,14 +32,31 @@ var InstancePropertiesView = module.exports = View.extend({
2732 numDatabases : {
2833 type : 'text' ,
2934 hook : 'num-databases'
35+ } ,
36+ is_fetching : {
37+ type : 'booleanClass' ,
38+ hook : 'refresh-icon' ,
39+ yes : [ 'fa-refresh' , 'fa-spin' ] ,
40+ no : 'fa-repeat'
3041 }
3142 } ,
43+ events : {
44+ 'click button[data-hook=refresh-button]' : 'onRefreshButtonClicked'
45+ } ,
3246 initialize : function ( ) {
3347 this . listenTo ( app . instance , 'sync' , this . onInstanceFetched ) ;
3448 } ,
3549 onInstanceFetched : function ( ) {
50+ // delay switching the spinner back to static for 500ms, otherwise the reload is not noticable
51+ _ . delay ( function ( ) {
52+ this . is_fetching = false ;
53+ } . bind ( this ) , 500 ) ;
3654 this . numDatabases = app . instance . databases . length ;
3755 this . numCollections = app . instance . collections . length ;
56+ } ,
57+ onRefreshButtonClicked : function ( ) {
58+ app . instance . fetch ( ) ;
59+ this . is_fetching = true ;
3860 }
3961} ) ;
4062
You can’t perform that action at this time.
0 commit comments