Add ViewModeSwitcher control - #392
Conversation
ae88160 to
f3ac3a2
Compare
693285d to
737bb92
Compare
737bb92 to
8e6f962
Compare
sukhwinder33445
left a comment
There was a problem hiding this comment.
Apart from the changes I’ve pointed out, the code looks fine to me.
90441d7 to
3d73145
Compare
|
@nilmerg please have a look. |
fa0757c to
dd841b9
Compare
nilmerg
left a comment
There was a problem hiding this comment.
I'm not really convinced that this follows what I proposed in the issue. The view mode dependent limit change is not automatically done anymore, and the dynamic correction of the current page is missing. Custom rules, so to say, are also not even considered.
And where's:
So the new implementation should allow to add new modes as well as to remove default modes.
It also misses basic accessibility support, as the id protection has no fallback. Since it is now a library part I consider this a must, as unique ID's are not a requirement of Icinga Web, only the part that it must be based on the container id. ipl-html also provides a fallback in case of the new decorator implementation for this very reason: A sane default.
So this is far from finished, I'm afraid.
26296c6 to
319eba5
Compare
319eba5 to
dda27db
Compare
nilmerg
left a comment
There was a problem hiding this comment.
Looks fine now, thank you. Though, I will first check any dependent implementation before merging it.
Migrate icingadb-web's `ViewModeSwitcher`, and modify it to use `ViewMode` instances to represent each view-mode. This allows consumers to customize available view-modes without a subclass.
Add a `Controls` trait, that provides a `createViewModeSwitcher()` factory, which emits the events `view-mode-set` and `view-mode-change` The request of the created `ViewModeSwitcher` and other controls the trait may provide in the future can all be handled with `Controls::handleRequests()`
If a child class uses `Controls::createViewModeSwitcher()` to create a `ViewModeSwitcher`, the page size of the current `ViewMode` is used as default in `createLimitControl()` and `createPaginationControl()` If a changed view mode also changed the page size, the current page is corrected so that the previously first element is always visbible on the corrected page. Both changes rely on events emmited by the `Controls` trait and will not affect child classes that don't use the trait.
If `Controls::createViewModeSwitcher()` was used to create a `ViewModeSwitcher`, the factory did not shift its view mode param, so it is explicitly shifted here so it isn't used for the created filter.
b24e05c to
98e0b90
Compare
This PR implements the Notification History list and per-notification detail view. Changes: - Added `NotificationHistory` model + renderer + detail widget, with new controllers for list/detail views. - Extended incident detail with a `Notification History` tab and scoped search suggestions. - Added supporting enums, condition description helper, styling, and PHPUnit tests. resolves #475 ### require: - Icinga/icinga-notifications#472 - Icinga/ipl-web#392


resolve #340
A
ViewModeSwitcherclass similar to the one in icingadb-web is added. It was reworked so that adding and removing view modes can be done without declaring a subclass.To allow this the
ViewModeclass is added, which contains name, icon, titles for active/inactive state and the default page size.The
Controlstrait is added with acreateViewModeSwitcher()function.It registers a listener to
ViewModeSwitcher::ON_REQUEST, which populates theViewModeSwitcherwith the view mode from the url and emitsON_VIEW_MODE_SET.If the view mode is changed, a
ViewModeSwitcher::ON_SUBMITlistener emitsON_VIEW_MODE_CHANGEwith theViewModeSwitcher, its previous view mode and a$redirectUrlthat listeners may modify.The
handleControls()function suggested in #340 is implemented, which callshandleRequest()for all controls passed totrackControl(), in case of theViewModeSwitcherthis is done by the factory method.The
CompatControllerregisters listeners on the trait's events in thecreateLimitControl()andcreatePaginationControl()factories, to adjust the default limit, page size to teh current view mode, and correct the current page when the view mode is changed.SearchControls::createSearchBar()is adjusted to shift the view mode param before building its filter, because theControlstrait does not have access to theUrlParams.