Commit graph

2707 commits

Author SHA1 Message Date
Johannes Meyer
10895f94f8 CustomvarFlat: Do not ignore source paths with a zero
Some checks failed
L10n Update / update (push) Has been cancelled
CI / PHP (push) Has been cancelled
PHP evaluates `"0"` to false…
2026-05-27 17:10:40 +02:00
Johannes Meyer
f38a03d034 QueryColumnsProvider: Fully use up limit with custom variables
Previously custom variables that didn't match any of the desired
sources were eating up the query's limit and so there is a chance
that not even a single variable was listed. This especially
occurs with the updated notifications integration, as the available
database columns are very limited in number. But even in other views
this may have been noticed by users in case they have many variables
that are similarly named but have no overlap with database columns.
(i.e. input that doesn't match any database columns but many vars)
2026-05-27 16:52:56 +02:00
Johannes Meyer
01b7431ad5
Fix tactical overview export (#1370)
Some checks failed
L10n Update / update (push) Has been cancelled
CI / PHP (push) Has been cancelled
This introduces a new model `TacticalStateSummary` that represents a
union of `HoststateSummary` and `ServicestateSummary`. The union of both
is required to have the default export functionality also yield results
for both types of states as it only evaluates the first query. Now,
CSV/JSON exports also contain service states. Both can be differentiated
either by looking at the column data types (`null` for `hosts_*` columns
means it's a service state summary) or by simply checking the `type`
column which is either `'host_state'` or `'service_state'`.

fixes #1334
2026-05-22 16:24:43 +02:00
Johannes Meyer
df1d2c076d tactical: Fetch states using a single query
This ensures that exports to CSV/JSON contain results
for both host and service states as the default export
procedure only evaluates a single query.

fixes #1334
2026-05-22 16:23:14 +02:00
Johannes Meyer
7fcac0e3b7 db: Introduce new model TacticalStateSummary 2026-05-22 16:23:14 +02:00
Johannes Meyer
bdc8561267
Add V2/Source hook for icinga-notifications-web (#1369)
Some checks are pending
L10n Update / update (push) Waiting to run
CI / PHP (push) Waiting to run
This PR adds a new `V2/Icinga2Source` hook implementation to integrate
with the `V2/SourceHook` interface from `icinga-notifications-web`.

### Supporting changes required by the hook:
- Introduce `QueryValuesProvider` — Decouples value suggestion logic
from `ObjectSuggestions` into a standalone Generator-based class. This
allows the hook's `getValueSuggestions()` to reuse the same suggestion
infrastructure without a `Suggestions` context.
- `QueryColumnsProvider`: Add `setShowRelationLabels()` setter — Exposes
the relation label display option so the hook can control it.
- `QueryColumnsProvider`: Make `collectFilterColumns()` protected — No
longer needs to be public; the override in `SearchControls` that called
it statically is removed as the optimization it provided is no longer
necessary.
- `ObjectSuggestions`: Remove label-to-path resolution for columns with
spaces to ensure consistency between the suggestions in the search bar
and suggestions provided by the `Icinga2Source`.

resolves: #1365
### Requires:
- https://github.com/Icinga/icinga-notifications-web/pull/469
- https://github.com/Icinga/icingadb-web/pull/1375
- https://github.com/Icinga/ipl-orm/pull/161
2026-05-22 16:17:16 +02:00
Sukhwinder Dhillon
4cc6a93925 QueryColumnsProvider: Introduce setter setShowRelationLabels() 2026-05-22 16:12:37 +02:00
Sukhwinder Dhillon
295d93e5ca Add support for V2/Icinga2Source hook for icinga-notifications-web
Co-authored-by: Johannes Meyer <johannes.meyer@icinga.com>
2026-05-22 16:11:54 +02:00
Sukhwinder Dhillon
2771db1696 Remove now superfluous class ObjectSuggestionsCursor
The code has been moved directly to the `QueryValuesProvider` class.

`QueryValuesProvider`: Bypassing the ORM is no longer required.
necessary and has been removed. The yield type must be an array
containing at least the keys `search` and `label` for `searchSuggestion`
to work. Previously these keys were created by wrapper classes.
2026-05-21 16:34:02 +02:00
Sukhwinder Dhillon
bb922c60f2 QueryColumnsProvider: Make method collectFilterColumns() protected
Remove the overwritten method `fetchFilterColumns` of `SearchControls`
trait as this optimization is no longer necessary. Since the method is
now only used within its own class, it can be made protected.
2026-05-21 16:34:02 +02:00
Sukhwinder Dhillon
a13647ac90 ObjectSuggestions: Remove special handeling for $column with space
Moving the code to `QueryValuesProvider` does not seem helpful, as
this covers a rare case that is not really necessary.

To ensure consistency between the suggestions in the search bar and in
`SourceHook`, this must be removed.
2026-05-21 16:34:02 +02:00
Sukhwinder Dhillon
9d1dfd92d3 Introduce QueryValuesProvider
Decouple value suggestion logic into a standalone `Generator` instance.
This allows callers to fetch column values without any `Suggestions`
context. A plain `foreach` on the provider is enough.

`ObjectSuggestions::fetchValueSuggestions` is reduced to a thin wrapper
that resolves label-to-path input before delegating to the new class.
2026-05-21 16:34:02 +02:00
Bastian Lederer
8736be428f Use UrlParams::addValues instead Url::setParams
Some checks are pending
L10n Update / update (push) Waiting to run
CI / PHP (push) Waiting to run
Previously `Url::setParams()` was used by `ServiceController::historyAction` to set `name` and `host.name`,
since the function overwrites all parameters the sort parameter was not included in the loadMoreUrl.
`UrlParams::addValues` fixes this problem sicne is keeps the existing parameters.

For consistency `HostController::historyAction` is also adjusted to match this implementation.
2026-05-21 16:02:54 +02:00
Sukhwinder Dhillon
75d4d13c73 CustomvarFlat: Fix path splitting for special chars and bracket notation
Two issues were fixed in the split regex:

1. Special characters before `.` were ignored:
The old regex only split on `.` when directly preceded by a word
character (\w), causing splits to be missed when `.` was preceded
by special characters like whitespace, / or $.
Result before: `foo /.bar.one` => `['foo /.bar', 'one']`
Result after: `foo /.bar.one` => `['foo /', 'bar', 'one']`

2. Brackets mid-word were incorrectly split:
The old regex split before any `[`, causing keys like `con[0]cat` to be
split incorrectly.
Resulti before: `con[0]cat` => `['con', '[0]cat']`
Now splits before `[` only when it's a standalone array index — meaning
`]` is followed by `.`, another `[`, or end of string.
Result after: `con[0]cat` => `['con', '[0]', 'cat']`
2026-05-21 15:52:42 +02:00
Johannes Meyer
07df145091 IcingaRedis: Do not fail while fetching last heartbeat
Some checks failed
L10n Update / update (push) Has been cancelled
CI / PHP (push) Has been cancelled
fixes #1372
2026-05-07 08:16:29 +02:00
fsalomon
b1dabef96c
Preserve state labels in plugin output (#1366)
Some checks failed
L10n Update / update (push) Has been cancelled
CI / PHP (push) Has been cancelled
- Keep bracketed state labels as text inside plugin output (state-ball
replacements)
- Hide the text visually while preserving the existing state-ball
styling
  
Nice when copy&pasting plugin output to a code agent.

---------

Co-authored-by: Fabian Salomon <4098510+fsalomon@users.noreply.github.com>
2026-04-28 14:18:37 +02:00
Johannes Meyer
b7dc502db5 css: Don't export @iplWebAssets anymore
This variable is available since Icinga Web v2.9.0
(https://github.com/Icinga/icingaweb2/pull/4381)
The `@exports` feature is not ported to ipl-web
with https://github.com/Icinga/ipl-web/pull/365.
2026-04-27 10:25:03 +02:00
Johannes Meyer
4917819eb0
Allow switching between relative and absolute timestamps (#1322)
Some checks failed
L10n Update / update (push) Has been cancelled
CI / PHP (push) Has been cancelled
2026-04-24 15:56:13 +02:00
Bastian Lederer
aa08f66a51 Add js for the TimestampToggle
`timestamp-toggle.js` listens to changes of `timestamp-toggle-control`
and clicks on `.toggleable-timestamp` elements and toggles their
`hidden` attribute.
It also updates the `timestamps` parameter in all relevant URLs.
2026-04-24 15:52:15 +02:00
Bastian Lederer
e44a808d6a Add timestamp control to history views
Use the `TimestampToggle` provided by `Controller::createTimestampControl()`
and use the new `HistoryList`
2026-04-24 15:52:15 +02:00
Bastian Lederer
4255bfe7c8 Support relative and absolute timestamp rendering
Add a `useRelativeTimestamps` flag to `EventRenderer` and `NotificationRenderer`.
For timestamps that support switching between relative and absolute time
two `time` elements are rendered, with only one visible, so the frontend can
easily switch between them.
2026-04-24 15:52:15 +02:00
Bastian Lederer
bf83c2637c Replace LoadMoreObjectList with HistoryObjectList
Rename and specialize the list for history views.
Insert a day-separator between entries of different days,
to support this when load-more is used the a URL parameter
with the date of the most recently added element is added to the `loadmoreUrl`.

The css for these new classes is added and `action-list.js` is adjusted so it
skips over the day-separator.
2026-04-24 15:40:42 +02:00
Bastian Lederer
c927e7ef74 Controller: Add timestamp preference handling
Introduce `createTimestampControl()` which returns a `TimestampToggle`.
The current mode is resolved from the URL param, the user's session
or the stored preferences and is saved on submit of the toggle.

The saving of view-modes is adjusted so it does not overwrite
the new `icingadb.timestamps` key in the preferences.
2026-04-24 15:40:42 +02:00
Bastian Lederer
d6d0d2190a Add TimestampToggle control
Add a control to allow users to switch between absolute and relatvie timestamps.
2026-04-24 15:40:42 +02:00
Johannes Meyer
ac52d749c9
Add a control to choose columns in tabular view mode (#1333)
Some checks failed
L10n Update / update (push) Has been cancelled
CI / PHP (push) Has been cancelled
Add a new form to choose the displayed columns in hosts and services
view.

resolves: #82
2026-04-17 09:11:27 +02:00
Bastian Lederer
c8a719d8ed Raise ipl minimum requirement to 0.20.0 2026-04-16 07:29:17 +02:00
Bastian Lederer
f3542683b1 Improve css and clean up code 2026-04-15 10:54:57 +02:00
Bastian Lederer
6d88691435 Use a control-button for the opener 2026-04-15 08:59:48 +02:00
Bastian Lederer
e72399eebf Adapt column-chooser-opener style 2026-04-14 16:40:47 +02:00
Bastian Lederer
fb03ded9d8 Apply Copilot suggestions
- Use strict interface for `QueryColumnsProvider::matchSuggestions`
- use ~"calc()" in less
2026-04-14 15:49:27 +02:00
Bastian Lederer
760ceb4662 QueryColumnsProvider::applyBaseFilter: change visibility to protected 2026-04-14 15:13:49 +02:00
Bastian Lederer
478a834439 QueryColumnsProvider: Adapt to changed key in SearchSuggestions 2026-04-14 15:13:49 +02:00
Bastian Lederer
37faae6b4b Add support for relations in labels of QueryColumnsProvider 2026-04-14 15:13:49 +02:00
Bastian Lederer
152ca2a0c3 USe Translation trait and improve code style 2026-04-14 15:13:49 +02:00
Bastian Lederer
77b1543488 Improve exclusion of custom vars
Use a `where` to filter out custom vars that should be excluded
2026-04-14 15:13:49 +02:00
Bastian Lederer
0e6d03f3da Adjust customVarSources and minor improvements 2026-04-14 15:13:49 +02:00
Bastian Lederer
47f4c4c562 Apply review suggestions 2026-04-14 15:13:49 +02:00
Bastian Lederer
e58b2707c1 Remove unnecessary validation of terms 2026-04-14 15:13:49 +02:00
Bastian Lederer
2359f4ab69 Move column deserialization to ColumnChooser 2026-04-14 15:13:49 +02:00
Bastian Lederer
b3c88ba2d0 Introduce QueryColumnsProvider 2026-04-14 15:13:49 +02:00
Bastian Lederer
7970cc0c20 Use new license headers 2026-04-14 15:13:49 +02:00
Bastian Lederer
fd9b7e3653 Use setTitle 2026-04-14 15:13:49 +02:00
Bastian Lederer
7f666b67a4 Add missing phpdoc 2026-04-14 15:13:49 +02:00
Bastian Lederer
7b49b302bd Controller::createColumnControl(): remove param $viewModeSwitcher 2026-04-14 15:13:49 +02:00
Bastian Lederer
71d2ad5104 Adjust usages of Controller::createColumnControl() 2026-04-14 15:13:49 +02:00
Bastian Lederer
2bbabe0059 Controller::createColumnControl(): Add phpdoc and remove $resolver param 2026-04-14 15:13:49 +02:00
Bastian Lederer
afbe91e14a Clean up unused imports 2026-04-14 15:13:49 +02:00
Bastian Lederer
fdc0f91daa Adjust usages of CreateColumnControl with GridViewModeSwitcher
Ensure `GridViewModeSwitcher::class` is passed
2026-04-14 15:13:49 +02:00
Bastian Lederer
01996ffcfe Fix the $redirectUrl in Controller::createColumnControl()
It was previously hard coded...
2026-04-14 15:13:49 +02:00
Bastian Lederer
28fd72541e ColumnChooser: catch InvalidRelationException 2026-04-14 15:13:49 +02:00