@@ -2,23 +2,43 @@ define(["../notjQuery"], function (notjQuery) {
22
33 "use strict" ;
44 class ActionList {
5- constructor ( ) {
6- this . on ( 'click' , '.action-list [data-action-item]:not(.page-separator), .action-list [data-action-item] a[href]' , this . onClick , this ) ;
7- this . on ( 'close-column' , '#main > #col2' , this . onColumnClose , this ) ;
8- this . on ( 'column-moved' , this . onColumnMoved , this ) ;
9-
10- this . on ( 'rendered' , '#main .container' , this . onRendered , this ) ;
11- this . on ( 'keydown' , '#body' , this . onKeyDown , this ) ;
12-
13- this . on ( 'click' , '.load-more[data-no-icinga-ajax] a' , this . onLoadMoreClick , this ) ;
14- this . on ( 'keypress' , '.load-more[data-no-icinga-ajax] a' , this . onKeyPress , this ) ;
5+ constructor ( list ) {
6+ this . list = list ;
157
168 this . lastActivatedItemUrl = null ;
179 this . lastTimeoutId = null ;
1810 this . isProcessingLoadMore = false ;
1911 this . activeRequests = { } ;
2012 }
2113
14+ bind ( ) {
15+ notjQuery ( this . list ) . on ( 'click' , '.action-list [data-action-item]:not(.page-separator), .action-list [data-action-item] a[href]' , this . onClick , this ) ;
16+ /*this.on('close-column', '#main > #col2', this.onColumnClose, this);
17+ this.on('column-moved', this.onColumnMoved, this);*/
18+
19+ notjQuery ( this . list ) . on ( 'rendered' , this . onRendered , this ) ;
20+ /* this.on('keydown', '#body', this.onKeyDown, this);
21+
22+ this.on('click', '.load-more[data-no-icinga-ajax] a', this.onLoadMoreClick, this);
23+ this.on('keypress', '.load-more[data-no-icinga-ajax] a', this.onKeyPress, this);*/
24+
25+ // this.onRendered(this.list);
26+ }
27+
28+ refresh ( list ) {
29+ if ( list === this . list ) {
30+ // If the DOM node is still the same, nothing has changed
31+ return ;
32+ }
33+
34+ this . list = list ;
35+ this . bind ( ) ;
36+ }
37+
38+ destroy ( ) {
39+ this . list = null ;
40+ }
41+
2242 /**
2343 * Parse the filter query contained in the given URL query string
2444 *
@@ -54,7 +74,7 @@ define(["../notjQuery"], function (notjQuery) {
5474 }
5575
5676 onClick ( event ) {
57- let _this = event . data . self ;
77+ let _this = this ; // event.data.self;
5878 let target = event . currentTarget ;
5979
6080 if ( target . matches ( 'a' ) && ( ! target . matches ( '.subject' ) || event . ctrlKey || event . metaKey ) ) {
@@ -66,7 +86,7 @@ define(["../notjQuery"], function (notjQuery) {
6686 event . stopPropagation ( ) ;
6787
6888 let item = target . closest ( '[data-action-item]' ) ;
69- let list = target . closest ( '.action-list' ) ;
89+ let list = _this . list ; // target.closest('.action-list');
7090 let activeItems = _this . getActiveItems ( list ) ;
7191 let toActiveItems = [ ] ,
7292 toDeactivateItems = [ ] ;
@@ -111,6 +131,7 @@ define(["../notjQuery"], function (notjQuery) {
111131 && toActiveItems . length === 0
112132 && _this . icinga . loader . getLinkTargetFor ( $ ( target ) ) . attr ( 'id' ) === 'col2'
113133 ) {
134+ //add event 'deselect-all'
114135 _this . icinga . ui . layout1col ( ) ;
115136 _this . icinga . history . pushCurrentState ( ) ;
116137 _this . enableAutoRefresh ( 'col1' ) ;
@@ -704,6 +725,7 @@ define(["../notjQuery"], function (notjQuery) {
704725 }
705726
706727 onRendered ( event , isAutoRefresh ) {
728+ console . log ( 'onRendered' ) ;
707729 let _this = event . data . self ;
708730 let container = event . target ;
709731 let isTopLevelContainer = container . matches ( '#main > :scope' ) ;
0 commit comments