phpstan, phpcs, phpunit fixes

This commit is contained in:
Dennis Eichhorn 2023-01-27 22:12:09 +01:00
parent deec179a55
commit 1e21efa715
3 changed files with 15 additions and 7 deletions

View File

@ -36,7 +36,7 @@ export class NotificationMessage
/** @type {boolean} isSticky */
this.isSticky = isSticky;
this.primaryButton = null;
this.primaryButton = null;
this.secondaryButton = null;
};
};

View File

@ -56,7 +56,7 @@ export class Form
return this.forms[id];
};
hasChanges()
hasChanges ()
{
const length = this.forms.length;

View File

@ -5,7 +5,6 @@ import { NotificationLevel } from '../Message/Notification/NotificationLevel.j
import { NotificationMessage } from '../Message/Notification/NotificationMessage.js';
import { NotificationType } from '../Message/Notification/NotificationType.js';
/**
* UI manager for handling basic ui elements.
*
@ -117,13 +116,21 @@ export class GeneralUI
.then((response) => response.text())
.then((html) => {
if (window.omsApp.state && window.omsApp.state.hasChanges) {
let message = new NotificationMessage(NotificationLevel.WARNING, 'Unsaved changes', 'Do you want to continue?', true, true);
const message = new NotificationMessage(
NotificationLevel.WARNING,
'Unsaved changes',
'Do you want to continue?',
true,
true
);
message.primaryButton = {
text: 'Yes',
style: 'ok',
callback: function () {
document.documentElement.innerHTML = html;
window.omsApp.state.hasChanges = false;
window.omsApp.state.hasChanges = false;
this.parentNode.remove();
history.pushState({}, null, UriFactory.build(uri));
/* This is not working as it reloads the page ?!
@ -133,14 +140,15 @@ export class GeneralUI
*/
// @todo: fix memory leak which most likely exists because of continous binding without removing binds
window.omsApp.reInit();
},
}
};
message.secondaryButton = {
text: 'No',
style: 'error',
callback: function () {
this.parentNode.remove();
},
}
};
window.omsApp.notifyManager.send(message, NotificationType.APP_NOTIFICATION);