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 30
30
" ampersand-state" ,
31
31
" scout-server" ,
32
32
" glob" ,
33
- " electron-squirrel-startup"
33
+ " electron-squirrel-startup" ,
34
+ " ipc"
34
35
]
35
36
},
36
37
"fonts" : [
Original file line number Diff line number Diff line change @@ -10,5 +10,5 @@ div.instance-properties
10
10
span.num-collections
11
11
strong( data-hook ='num-collections' )
12
12
| 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 1
1
var View = require ( 'ampersand-view' ) ;
2
2
var app = require ( 'ampersand-app' ) ;
3
3
// var debug = require('debug')('scout:sidebar:instace-properties');
4
+ var _ = require ( 'lodash' ) ;
4
5
5
6
var InstancePropertiesView = module . exports = View . extend ( {
6
7
template : require ( './instance-properties.jade' ) ,
@@ -9,7 +10,11 @@ var InstancePropertiesView = module.exports = View.extend({
9
10
version : 'string' ,
10
11
numDatabases : 'number' ,
11
12
numCollections : 'number' ,
12
- instance : 'state'
13
+ instance : 'state' ,
14
+ is_fetching : {
15
+ type : 'boolean' ,
16
+ default : true
17
+ }
13
18
} ,
14
19
bindings : {
15
20
'instance.host.hostname' : {
@@ -27,14 +32,31 @@ var InstancePropertiesView = module.exports = View.extend({
27
32
numDatabases : {
28
33
type : 'text' ,
29
34
hook : 'num-databases'
35
+ } ,
36
+ is_fetching : {
37
+ type : 'booleanClass' ,
38
+ hook : 'refresh-icon' ,
39
+ yes : [ 'fa-refresh' , 'fa-spin' ] ,
40
+ no : 'fa-repeat'
30
41
}
31
42
} ,
43
+ events : {
44
+ 'click button[data-hook=refresh-button]' : 'onRefreshButtonClicked'
45
+ } ,
32
46
initialize : function ( ) {
33
47
this . listenTo ( app . instance , 'sync' , this . onInstanceFetched ) ;
34
48
} ,
35
49
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 ) ;
36
54
this . numDatabases = app . instance . databases . length ;
37
55
this . numCollections = app . instance . collections . length ;
56
+ } ,
57
+ onRefreshButtonClicked : function ( ) {
58
+ app . instance . fetch ( ) ;
59
+ this . is_fetching = true ;
38
60
}
39
61
} ) ;
40
62
You can’t perform that action at this time.
0 commit comments