Skip to content

Commit 96c82e7

Browse files
committed
Use view mode constants
1 parent bff9e62 commit 96c82e7

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

application/controllers/ConfigmapsController.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Icinga\Module\Kubernetes\Model\ConfigMap;
1010
use Icinga\Module\Kubernetes\Web\ConfigMapList;
1111
use Icinga\Module\Kubernetes\Web\ListController;
12+
use Icinga\Module\Kubernetes\Web\ViewModeSwitcher;
1213
use ipl\Orm\Query;
1314

1415
class ConfigmapsController extends ListController
@@ -44,6 +45,6 @@ protected function getPermission(): string
4445

4546
protected function getIgnoredViewModes(): array
4647
{
47-
return ['common', 'detailed'];
48+
return [ViewModeSwitcher::VIEW_MODE_COMMON, ViewModeSwitcher::VIEW_MODE_DETAILED];
4849
}
4950
}

application/controllers/EventsController.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Icinga\Module\Kubernetes\Model\Event;
1010
use Icinga\Module\Kubernetes\Web\EventList;
1111
use Icinga\Module\Kubernetes\Web\ListController;
12+
use Icinga\Module\Kubernetes\Web\ViewModeSwitcher;
1213
use ipl\Orm\Query;
1314
use ipl\Stdlib\Filter;
1415

@@ -54,6 +55,6 @@ protected function getPermission(): string
5455

5556
protected function getIgnoredViewModes(): array
5657
{
57-
return ['detailed'];
58+
return [ViewModeSwitcher::VIEW_MODE_DETAILED];
5859
}
5960
}

application/controllers/SecretsController.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Icinga\Module\Kubernetes\Model\Secret;
1010
use Icinga\Module\Kubernetes\Web\ListController;
1111
use Icinga\Module\Kubernetes\Web\SecretList;
12+
use Icinga\Module\Kubernetes\Web\ViewModeSwitcher;
1213
use ipl\Orm\Query;
1314

1415
class SecretsController extends ListController
@@ -44,6 +45,6 @@ protected function getPermission(): string
4445

4546
protected function getIgnoredViewModes(): array
4647
{
47-
return ['detailed'];
48+
return [ViewModeSwitcher::VIEW_MODE_DETAILED];
4849
}
4950
}

library/Kubernetes/Web/ViewModeSwitcher.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,17 @@ class ViewModeSwitcher extends Form
3131
public const VIEW_MODE_DETAILED = 'detailed';
3232

3333
/** @var string Default view mode */
34-
public const DEFAULT_VIEW_MODE = 'common';
34+
public const DEFAULT_VIEW_MODE = self::VIEW_MODE_COMMON;
3535

3636
/** @var string Default view mode param */
3737
public const DEFAULT_VIEW_MODE_PARAM = 'view';
3838

3939
/** @var array View mode-icon pairs */
4040
public static $viewModes = [
41-
'minimal' => 'minimal',
42-
'common' => 'default',
43-
'detailed' => 'detailed',
44-
'tabular' => 'tabular'
41+
self::VIEW_MODE_MINIMAL => 'minimal',
42+
self::VIEW_MODE_COMMON => 'default',
43+
self::VIEW_MODE_DETAILED => 'detailed',
44+
'tabular' => 'tabular'
4545
];
4646

4747
/** @var string */

0 commit comments

Comments
 (0)