mirror of
https://github.com/Icinga/icingaweb2-module-businessprocess.git
synced 2025-12-26 09:19:35 -05:00
js: Suspend Web 2's autorefresh while dragging items
If a refresh happens while dragging the drop wont trigger any events and the change is not applied.
This commit is contained in:
parent
21980a394f
commit
0a5ada9bf1
1 changed files with 15 additions and 0 deletions
|
|
@ -33,6 +33,9 @@
|
|||
this.module.on('click', '.dashboard-tile', this.dashboardTileClick);
|
||||
this.module.on('end', 'div.tiles.sortable', this.tileDropped);
|
||||
|
||||
this.module.on('choose', '.sortable', this.suspendAutoRefresh);
|
||||
this.module.on('unchoose', '.sortable', this.resumeAutoRefresh);
|
||||
|
||||
this.module.icinga.logger.debug('BP module initialized');
|
||||
},
|
||||
|
||||
|
|
@ -87,6 +90,18 @@
|
|||
$(event.currentTarget).find('> .bp-link > a').first().trigger('click');
|
||||
},
|
||||
|
||||
suspendAutoRefresh: function(event) {
|
||||
// TODO: If there is a better approach some time, let me know
|
||||
$(event.originalEvent.from).closest('.container').data('lastUpdate', (new Date()).getTime() + 3600 * 1000);
|
||||
event.stopPropagation();
|
||||
},
|
||||
|
||||
resumeAutoRefresh: function(event) {
|
||||
var $container = $(event.originalEvent.from).closest('.container');
|
||||
$container.data('lastUpdate', (new Date()).getTime() - ($container.data('icingaRefresh') || 10) * 1000);
|
||||
event.stopPropagation();
|
||||
},
|
||||
|
||||
tileDropped: function(event) {
|
||||
var evt = event.originalEvent;
|
||||
if (evt.oldIndex !== evt.newIndex) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue