Late translate a module's dashboard-pane/dashlet labels

refs #5600
This commit is contained in:
Johannes Meyer 2015-09-16 14:29:33 +02:00
parent bbadb0b75c
commit 8b7a1ce28f
3 changed files with 37 additions and 31 deletions

View File

@ -306,13 +306,19 @@ class Module
$navigation = new Navigation(); $navigation = new Navigation();
foreach ($panes as $pane) { foreach ($panes as $pane) {
/** @var DashboardContainer $pane */ /** @var DashboardContainer $pane */
$dashlets = array();
foreach ($pane->getDashlets() as $dashletName => $dashletUrl) {
$dashlets[$this->translate($dashletName)] = $dashletUrl;
}
$navigation->addItem( $navigation->addItem(
$pane->getName(), $pane->getName(),
array_merge( array_merge(
$pane->getProperties(), $pane->getProperties(),
array( array(
'label' => $this->translate($pane->getName()),
'type' => 'dashboard-pane', 'type' => 'dashboard-pane',
'dashlets' => $pane->getDashlets() 'dashlets' => $dashlets
) )
) )
); );

View File

@ -76,7 +76,7 @@ class Dashboard extends AbstractWidget
$panes = array(); $panes = array();
foreach ($navigation as $dashboardPane) { foreach ($navigation as $dashboardPane) {
/** @var DashboardPane $dashboardPane */ /** @var DashboardPane $dashboardPane */
$pane = new Pane($dashboardPane->getName()); $pane = new Pane($dashboardPane->getLabel());
foreach ($dashboardPane->getDashlets() as $title => $url) { foreach ($dashboardPane->getDashlets() as $title => $url) {
$pane->addDashlet($title, $url); $pane->addDashlet($title, $url);
} }

View File

@ -238,122 +238,122 @@ $section->add($this->translate('Monitoring Health'), array(
/* /*
* Current Incidents * Current Incidents
*/ */
$dashboard = $this->dashboard($this->translate('Current Incidents'), array('priority' => 50)); $dashboard = $this->dashboard(N_('Current Incidents'), array('priority' => 50));
$dashboard->add( $dashboard->add(
$this->translate('Service Problems'), N_('Service Problems'),
'monitoring/list/services?service_problem=1&limit=10&sort=service_severity' 'monitoring/list/services?service_problem=1&limit=10&sort=service_severity'
); );
$dashboard->add( $dashboard->add(
$this->translate('Recently Recovered Services'), N_('Recently Recovered Services'),
'monitoring/list/services?service_state=0&limit=10&sort=service_last_state_change&dir=desc' 'monitoring/list/services?service_state=0&limit=10&sort=service_last_state_change&dir=desc'
); );
$dashboard->add( $dashboard->add(
$this->translate('Host Problems'), N_('Host Problems'),
'monitoring/list/hosts?host_problem=1&sort=host_severity' 'monitoring/list/hosts?host_problem=1&sort=host_severity'
); );
/* /*
* Overview * Overview
*/ */
$dashboard = $this->dashboard($this->translate('Overview'), array('priority' => 60)); $dashboard = $this->dashboard(N_('Overview'), array('priority' => 60));
$dashboard->add( $dashboard->add(
$this->translate('Service Grid'), N_('Service Grid'),
'monitoring/list/servicegrid?limit=15,18' 'monitoring/list/servicegrid?limit=15,18'
); );
$dashboard->add( $dashboard->add(
$this->translate('Service Groups'), N_('Service Groups'),
'/monitoring/list/servicegroups' '/monitoring/list/servicegroups'
); );
$dashboard->add( $dashboard->add(
$this->translate('Host Groups'), N_('Host Groups'),
'/monitoring/list/hostgroups' '/monitoring/list/hostgroups'
); );
/* /*
* Most Overdue * Most Overdue
*/ */
$dashboard = $this->dashboard($this->translate('Overdue'), array('priority' => 70)); $dashboard = $this->dashboard(N_('Overdue'), array('priority' => 70));
$dashboard->add( $dashboard->add(
$this->translate('Late Host Check Results'), N_('Late Host Check Results'),
'monitoring/list/hosts?host_next_update<now' 'monitoring/list/hosts?host_next_update<now'
); );
$dashboard->add( $dashboard->add(
$this->translate('Late Service Check Results'), N_('Late Service Check Results'),
'monitoring/list/services?service_next_update<now' 'monitoring/list/services?service_next_update<now'
); );
$dashboard->add( $dashboard->add(
$this->translate('Acknowledgements Active For At Least Three Days'), N_('Acknowledgements Active For At Least Three Days'),
'monitoring/list/comments?comment_type=Ack&comment_timestamp<-3 days&sort=comment_timestamp&dir=asc' 'monitoring/list/comments?comment_type=Ack&comment_timestamp<-3 days&sort=comment_timestamp&dir=asc'
); );
$dashboard->add( $dashboard->add(
$this->translate('Downtimes Active For More Than Three Days'), N_('Downtimes Active For More Than Three Days'),
'monitoring/list/downtimes?downtime_is_in_effect=1&downtime_scheduled_start<-3%20days&sort=downtime_start&dir=asc' 'monitoring/list/downtimes?downtime_is_in_effect=1&downtime_scheduled_start<-3%20days&sort=downtime_start&dir=asc'
); );
/* /*
* Muted Objects * Muted Objects
*/ */
$dashboard = $this->dashboard($this->translate('Muted'), array('priority' => 80)); $dashboard = $this->dashboard(N_('Muted'), array('priority' => 80));
$dashboard->add( $dashboard->add(
$this->translate('Disabled Service Notifications'), N_('Disabled Service Notifications'),
'monitoring/list/services?service_notifications_enabled=0&limit=10' 'monitoring/list/services?service_notifications_enabled=0&limit=10'
); );
$dashboard->add( $dashboard->add(
$this->translate('Disabled Host Notifications'), N_('Disabled Host Notifications'),
'monitoring/list/hosts?host_notifications_enabled=0&limit=10' 'monitoring/list/hosts?host_notifications_enabled=0&limit=10'
); );
$dashboard->add( $dashboard->add(
$this->translate('Disabled Service Checks'), N_('Disabled Service Checks'),
'monitoring/list/services?service_active_checks_enabled=0&limit=10' 'monitoring/list/services?service_active_checks_enabled=0&limit=10'
); );
$dashboard->add( $dashboard->add(
$this->translate('Disabled Host Checks'), N_('Disabled Host Checks'),
'monitoring/list/hosts?host_active_checks_enabled=0&limit=10' 'monitoring/list/hosts?host_active_checks_enabled=0&limit=10'
); );
$dashboard->add( $dashboard->add(
$this->translate('Acknowledged Problem Services'), N_('Acknowledged Problem Services'),
'monitoring/list/services?service_acknowledgement_type=2&service_problem=1&sort=service_state&limit=10' 'monitoring/list/services?service_acknowledgement_type=2&service_problem=1&sort=service_state&limit=10'
); );
$dashboard->add( $dashboard->add(
$this->translate('Acknowledged Problem Hosts'), N_('Acknowledged Problem Hosts'),
'monitoring/list/hosts?host_acknowledgement_type=2&host_problem=1&sort=host_severity&limit=10' 'monitoring/list/hosts?host_acknowledgement_type=2&host_problem=1&sort=host_severity&limit=10'
); );
/* /*
* Activity Stream * Activity Stream
*/ */
$dashboard = $this->dashboard($this->translate('Activity Stream'), array('priority' => 90)); $dashboard = $this->dashboard(N_('Activity Stream'), array('priority' => 90));
$dashboard->add( $dashboard->add(
$this->translate('Recent Events'), N_('Recent Events'),
'monitoring/list/eventhistory?timestamp>=-3%20days&sort=timestamp&dir=desc&limit=8' 'monitoring/list/eventhistory?timestamp>=-3%20days&sort=timestamp&dir=desc&limit=8'
); );
$dashboard->add( $dashboard->add(
$this->translate('Recent Hard State Changes'), N_('Recent Hard State Changes'),
'monitoring/list/eventhistory?timestamp>=-3%20days&type=hard_state&sort=timestamp&dir=desc&limit=8' 'monitoring/list/eventhistory?timestamp>=-3%20days&type=hard_state&sort=timestamp&dir=desc&limit=8'
); );
$dashboard->add( $dashboard->add(
$this->translate('Recent Notifications'), N_('Recent Notifications'),
'monitoring/list/eventhistory?timestamp>=-3%20days&type=notify&sort=timestamp&dir=desc&limit=8' 'monitoring/list/eventhistory?timestamp>=-3%20days&type=notify&sort=timestamp&dir=desc&limit=8'
); );
$dashboard->add( $dashboard->add(
$this->translate('Downtimes Recently Started'), N_('Downtimes Recently Started'),
'monitoring/list/eventhistory?timestamp>=-3%20days&type=dt_start&sort=timestamp&dir=desc&limit=8' 'monitoring/list/eventhistory?timestamp>=-3%20days&type=dt_start&sort=timestamp&dir=desc&limit=8'
); );
$dashboard->add( $dashboard->add(
$this->translate('Downtimes Recently Ended'), N_('Downtimes Recently Ended'),
'monitoring/list/eventhistory?timestamp>=-3%20days&type=dt_end&sort=timestamp&dir=desc&limit=8' 'monitoring/list/eventhistory?timestamp>=-3%20days&type=dt_end&sort=timestamp&dir=desc&limit=8'
); );
/* /*
* Stats * Stats
*/ */
$dashboard = $this->dashboard($this->translate('Stats'), array('priority' => 100)); $dashboard = $this->dashboard(N_('Stats'), array('priority' => 100));
$dashboard->add( $dashboard->add(
$this->translate('Check Stats'), N_('Check Stats'),
'monitoring/health/stats' 'monitoring/health/stats'
); );
$dashboard->add( $dashboard->add(
$this->translate('Process Information'), N_('Process Information'),
'monitoring/health/info' 'monitoring/health/info'
); );