@@ -38,6 +38,21 @@ module.exports = Mn.View.extend({
3838 console . error ( err ) ;
3939 } ,
4040
41+ showEmpty : function ( ) {
42+ let manage = App . Cache . User . canManage ( 'redirection_hosts' ) ;
43+
44+ this . showChildView ( 'list_region' , new EmptyView ( {
45+ title : App . i18n ( 'redirection-hosts' , 'empty' ) ,
46+ subtitle : App . i18n ( 'all-hosts' , 'empty-subtitle' , { manage : manage } ) ,
47+ link : manage ? App . i18n ( 'redirection-hosts' , 'add' ) : null ,
48+ btn_color : 'yellow' ,
49+ permission : 'redirection_hosts' ,
50+ action : function ( ) {
51+ App . Controller . showNginxRedirectionForm ( ) ;
52+ }
53+ } ) ) ;
54+ } ,
55+
4156 regions : {
4257 list_region : '@ui.list_region'
4358 } ,
@@ -78,18 +93,7 @@ module.exports = Mn.View.extend({
7893 if ( response && response . length ) {
7994 view . showData ( response ) ;
8095 } else {
81- let manage = App . Cache . User . canManage ( 'redirection_hosts' ) ;
82-
83- view . showChildView ( 'list_region' , new EmptyView ( {
84- title : App . i18n ( 'redirection-hosts' , 'empty' ) ,
85- subtitle : App . i18n ( 'all-hosts' , 'empty-subtitle' , { manage : manage } ) ,
86- link : manage ? App . i18n ( 'redirection-hosts' , 'add' ) : null ,
87- btn_color : 'yellow' ,
88- permission : 'redirection_hosts' ,
89- action : function ( ) {
90- App . Controller . showNginxRedirectionForm ( ) ;
91- }
92- } ) ) ;
96+ view . showEmpty ( ) ;
9397 }
9498 }
9599 } )
0 commit comments