diff --git a/application/controllers/RedundancygroupController.php b/application/controllers/RedundancygroupController.php index c65d3e723..539cf0522 100644 --- a/application/controllers/RedundancygroupController.php +++ b/application/controllers/RedundancygroupController.php @@ -37,6 +37,16 @@ class RedundancygroupController extends Controller /** @var RedundancyGroup */ protected $group; + protected const SORT_RULES = [ + 'name' => 'host.display_name, service.display_name, redundancy_group.display_name', + 'severity' => 'service.state.severity desc, service.state.last_state_change desc, ' + . 'host.state.severity desc, host.state.last_state_change desc, ' + .'redundancy_group.state.failed desc, redundancy_group.state.last_state_change desc', + 'state' => 'service.state.soft_state, host.state.soft_state, redundancy_group.state.failed', + 'last_state_change' => 'service.state.last_state_change desc, host.state.last_state_change desc, ' + . 'redundancy_group.state.last_state_change desc' + ]; + public function init(): void { // in case of quick actions, param id is not given @@ -56,7 +66,7 @@ public function init(): void $this->group = $query->first(); if ($this->group === null) { - throw new NotFoundError(t('Redundancy Group not found')); + throw new NotFoundError($this->translate('Redundancy Group not found')); } $this->setTitleTab($this->getRequest()->getActionName()); @@ -99,10 +109,10 @@ public function membersAction(): \Generator $sortControl = $this->createSortControl( $nodesQuery, [ - 'name' => t('Name'), - 'severity desc, last_state_change desc' => t('Severity'), - 'state' => t('Current State'), - 'last_state_change desc' => t('Last State Change') + self::SORT_RULES['name'] => $this->translate('Name'), + self::SORT_RULES['severity'] => $this->translate('Severity'), + self::SORT_RULES['state'] => $this->translate('Current State'), + self::SORT_RULES['last_state_change'] => $this->translate('Last State Change') ] ); $viewModeSwitcher = $this->createViewModeSwitcher($paginationControl, $limitControl); @@ -160,10 +170,10 @@ public function childrenAction() $sortControl = $this->createSortControl( $nodesQuery, [ - 'name' => t('Name'), - 'severity desc, last_state_change desc' => t('Severity'), - 'state' => t('Current State'), - 'last_state_change desc' => t('Last State Change') + self::SORT_RULES['name'] => $this->translate('Name'), + self::SORT_RULES['severity'] => $this->translate('Severity'), + self::SORT_RULES['state'] => $this->translate('Current State'), + self::SORT_RULES['last_state_change'] => $this->translate('Last State Change') ] ); $viewModeSwitcher = $this->createViewModeSwitcher($paginationControl, $limitControl); @@ -251,22 +261,22 @@ public function searchEditorAction(): void } $this->getDocument()->add($editor); - $this->setTitle(t('Adjust Filter')); + $this->setTitle($this->translate('Adjust Filter')); } protected function createTabs(): Tabs { $tabs = $this->getTabs() ->add('index', [ - 'label' => t('Redundancy Group'), + 'label' => $this->translate('Redundancy Group'), 'url' => Links::redundancyGroup($this->group) ]) ->add('members', [ - 'label' => t('Members'), + 'label' => $this->translate('Members'), 'url' => Links::redundancyGroupMembers($this->group) ]) ->add('children', [ - 'label' => t('Children'), + 'label' => $this->translate('Children'), 'url' => Links::redundancyGroupChildren($this->group) ]);