Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
sukhwinder33445 committed Jun 26, 2024
1 parent 5442de2 commit 91b77ee
Showing 1 changed file with 34 additions and 12 deletions.
46 changes: 34 additions & 12 deletions asset/js/widget/ActionList.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,43 @@ define(["../notjQuery"], function (notjQuery) {

"use strict";
class ActionList {
constructor() {
this.on('click', '.action-list [data-action-item]:not(.page-separator), .action-list [data-action-item] a[href]', this.onClick, this);
this.on('close-column', '#main > #col2', this.onColumnClose, this);
this.on('column-moved', this.onColumnMoved, this);

this.on('rendered', '#main .container', this.onRendered, this);
this.on('keydown', '#body', this.onKeyDown, this);

this.on('click', '.load-more[data-no-icinga-ajax] a', this.onLoadMoreClick, this);
this.on('keypress', '.load-more[data-no-icinga-ajax] a', this.onKeyPress, this);
constructor(list) {
this.list = list;

this.lastActivatedItemUrl = null;
this.lastTimeoutId = null;
this.isProcessingLoadMore = false;
this.activeRequests = {};
}

bind() {
notjQuery(this.list).on('click', '.action-list [data-action-item]:not(.page-separator), .action-list [data-action-item] a[href]', this.onClick, this);
/*this.on('close-column', '#main > #col2', this.onColumnClose, this);
this.on('column-moved', this.onColumnMoved, this);*/

notjQuery(this.list).on('rendered', this.onRendered, this);
/* this.on('keydown', '#body', this.onKeyDown, this);
this.on('click', '.load-more[data-no-icinga-ajax] a', this.onLoadMoreClick, this);
this.on('keypress', '.load-more[data-no-icinga-ajax] a', this.onKeyPress, this);*/

// this.onRendered(this.list);
}

refresh(list) {
if (list === this.list) {
// If the DOM node is still the same, nothing has changed
return;
}

this.list = list;
this.bind();
}

destroy() {
this.list = null;
}

/**
* Parse the filter query contained in the given URL query string
*
Expand Down Expand Up @@ -54,7 +74,7 @@ define(["../notjQuery"], function (notjQuery) {
}

onClick(event) {
let _this = event.data.self;
let _this = this;//event.data.self;
let target = event.currentTarget;

if (target.matches('a') && (! target.matches('.subject') || event.ctrlKey || event.metaKey)) {
Expand All @@ -66,7 +86,7 @@ define(["../notjQuery"], function (notjQuery) {
event.stopPropagation();

let item = target.closest('[data-action-item]');
let list = target.closest('.action-list');
let list = _this.list;//target.closest('.action-list');
let activeItems = _this.getActiveItems(list);
let toActiveItems = [],
toDeactivateItems = [];
Expand Down Expand Up @@ -111,6 +131,7 @@ define(["../notjQuery"], function (notjQuery) {
&& toActiveItems.length === 0
&& _this.icinga.loader.getLinkTargetFor($(target)).attr('id') === 'col2'
) {
//add event 'deselect-all'
_this.icinga.ui.layout1col();
_this.icinga.history.pushCurrentState();
_this.enableAutoRefresh('col1');
Expand Down Expand Up @@ -704,6 +725,7 @@ define(["../notjQuery"], function (notjQuery) {
}

onRendered(event, isAutoRefresh) {
console.log('onRendered');
let _this = event.data.self;
let container = event.target;
let isTopLevelContainer = container.matches('#main > :scope');
Expand Down

0 comments on commit 91b77ee

Please sign in to comment.