Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide Icinga to ipl/web behaviors #5238

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion library/Icinga/Web/JavaScript.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ public static function optimizeDefine($js, $filePath, $basePath, $packageName)
try {
$dependencies = $match[2] ? Json::decode($match[2]) : [];
foreach ($dependencies as &$dependencyName) {
if ($dependencyName === 'exports') {
if ($dependencyName === 'exports' || $dependencyName === 'Icinga') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just check whether the name already begins with icinga/legacy-app/.

// exports is a special keyword and doesn't need optimization
continue;
}
Expand Down
2 changes: 2 additions & 0 deletions public/js/icinga.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@
return false;
}

define('Icinga', [], () => Icinga);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I struggle to find a suitable location when to define Icinga. This is too early. At the end, it's too late. Right before the behavior initialization, it's somewhat arbitrary...

So, looking at this from another angle, I'd propose to solve this differently:

The linked PR in ipl-web only requires this because it needs Icinga.EventListener. So why don't we define just this class? In eventlistener.js, at the end of the factory: define("icinga/legacy-app/EventListener", [], () => EventListener)

Why icinga/legacy-app/? icinga/ is the global namespace. legacy-app/ is the library name. The reason for legacy- is that I don't want to use up just app/ at this time.


this.timezone = new Icinga.Timezone();
this.utils = new Icinga.Utils(this);
this.logger = new Icinga.Logger(this);
Expand Down
Loading