KDots: Implement popup registry + popups_garbage_collector()

At this point, just to avoid a JS error from egw_open.openPopup()
This commit is contained in:
nathan 2024-07-08 13:45:04 -06:00
parent 6d7b097072
commit 5e7220b7a8

View File

@ -102,6 +102,9 @@ export class EgwFramework extends LitElement
@property({type: Array, attribute: "application-list"}) @property({type: Array, attribute: "application-list"})
applicationList : ApplicationInfo[] = []; applicationList : ApplicationInfo[] = [];
// Keep track of open popups
private _popups : Window[] = [];
private get tabs() : SlTabGroup { return this.shadowRoot.querySelector("sl-tab-group");} private get tabs() : SlTabGroup { return this.shadowRoot.querySelector("sl-tab-group");}
connectedCallback() connectedCallback()
@ -419,6 +422,7 @@ export class EgwFramework extends LitElement
const windowID = this.egw.openPopup(_url, _width, _height, _windowName, _app, true, _status, true); const windowID = this.egw.openPopup(_url, _width, _height, _windowName, _app, true, _status, true);
windowID.framework = this; windowID.framework = this;
this._popups.push(windowID);
if(_returnID !== false) if(_returnID !== false)
{ {
@ -426,6 +430,21 @@ export class EgwFramework extends LitElement
} }
} }
/**
* Collect and close all already closed windows
* egw.open_link expects it from the framework
*/
public popups_garbage_collector()
{
for(var i = 0; i < this._popups.length; i++)
{
if(this._popups[i].closed)
{
this._popups.splice(i, 1);
}
}
}
/** /**
* Tries to obtain the application from a menuaction * Tries to obtain the application from a menuaction
* @param {string} _url * @param {string} _url