55namespace Icinga \Module \Notifications \Controllers ;
66
77use Icinga \Module \Notifications \Common \Database ;
8+ use Icinga \Module \Notifications \Common \Links ;
89use Icinga \Module \Notifications \Forms \ChannelForm ;
910use Icinga \Module \Notifications \Model \Channel ;
11+ use Icinga \Module \Notifications \View \ChannelRenderer ;
1012use Icinga \Module \Notifications \Web \Control \SearchBar \ObjectSuggestions ;
11- use Icinga \Module \Notifications \Widget \ItemList \ChannelList ;
13+ use Icinga \Module \Notifications \Widget \ItemList \ObjectList ;
1214use Icinga \Web \Notification ;
1315use Icinga \Web \Widget \Tab ;
1416use Icinga \Web \Widget \Tabs ;
15- use ipl \Html \ValidHtml ;
1617use ipl \Sql \Connection ;
1718use ipl \Stdlib \Filter ;
18- use ipl \Web \Common \BaseItemList ;
1919use ipl \Web \Compat \CompatController ;
2020use ipl \Web \Compat \SearchControls ;
2121use ipl \Web \Control \LimitControl ;
2222use ipl \Web \Control \SortControl ;
2323use ipl \Web \Filter \QueryString ;
24- use ipl \Web \Url ;
24+ use ipl \Web \Layout \ MinimalItemLayout ;
2525use ipl \Web \Widget \ButtonLink ;
2626
2727class ChannelsController extends CompatController
@@ -85,15 +85,15 @@ public function indexAction()
8585 $ this ->addControl ($ limitControl );
8686 $ this ->addControl ($ searchBar );
8787 $ this ->addContent (
88- (new ButtonLink (
89- t ('Add Channel ' ),
90- Url::fromPath ('notifications/channels/add ' ),
91- 'plus '
92- ))->setBaseTarget ('_next ' )
93- ->addAttributes (['class ' => 'add-new-component ' ])
88+ (new ButtonLink (t ('Add Channel ' ), Links::channelAdd (), 'plus ' ))
89+ ->setBaseTarget ('_next ' )
90+ ->addAttributes (['class ' => 'add-new-component ' ])
9491 );
9592
96- $ this ->addContent (new ChannelList ($ channels ));
93+ $ this ->addContent (
94+ (new ObjectList ($ channels , new ChannelRenderer ()))
95+ ->setItemLayoutClass (MinimalItemLayout::class)
96+ );
9797
9898 if (! $ searchBar ->hasBeenSubmitted () && $ searchBar ->hasBeenSent ()) {
9999 $ this ->sendMultipartUpdate ();
@@ -112,29 +112,13 @@ public function addAction()
112112 $ form ->getValue ('name ' )
113113 )
114114 );
115- $ this ->redirectNow (Url:: fromPath ( ' notifications/ channels' ));
115+ $ this ->redirectNow (Links:: channels ( ));
116116 })
117117 ->handleRequest ($ this ->getServerRequest ());
118118
119119 $ this ->addContent ($ form );
120120 }
121121
122- /**
123- * Add attribute 'class' => 'full-width' if the content is an instance of BaseItemList
124- *
125- * @param ValidHtml $content
126- *
127- * @return ChannelsController
128- */
129- protected function addContent (ValidHtml $ content )
130- {
131- if ($ content instanceof BaseItemList) {
132- $ this ->content ->getAttributes ()->add ('class ' , 'full-width ' );
133- }
134-
135- return parent ::addContent ($ content );
136- }
137-
138122 public function completeAction (): void
139123 {
140124 $ suggestions = new ObjectSuggestions ();
0 commit comments