Merge pull request #3857 from Icinga/fix/wrong-window-title-on-some-pages-3851

Fix wrong window title on some pages
This commit is contained in:
Johannes Meyer 2019-07-15 08:37:29 +02:00 committed by GitHub
commit 8ad3754c55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 94 additions and 6 deletions

View File

@ -13,6 +13,7 @@ class AboutController extends Controller
{
$this->view->version = Version::get();
$this->view->modules = Icinga::app()->getModuleManager()->getLoadedModules();
$this->view->title = $this->translate('About');
$this->view->tabs = $this->getTabs()->add(
'about',
array(

View File

@ -68,6 +68,7 @@ class AccountController extends Controller
$form->handleRequest();
$this->view->form = $form;
$this->view->title = $this->translate('My Account');
$this->getTabs()->activate('account');
}
}

View File

@ -12,6 +12,13 @@ use Icinga\Web\Url;
class AnnouncementsController extends Controller
{
public function init()
{
$this->view->title = $this->translate('Announcements');
parent::init();
}
/**
* List all announcements
*/

View File

@ -54,7 +54,7 @@ class AuthenticationController extends Controller
$form->handleRequest();
}
$this->view->form = $form;
$this->view->title = $this->translate('Icinga Web 2 Login');
$this->view->defaultTitle = $this->translate('Icinga Web 2 Login');
$this->view->requiresSetup = $requiresSetup;
}

View File

@ -82,6 +82,7 @@ class ConfigController extends Controller
$form->handleRequest();
$this->view->form = $form;
$this->view->title = $this->translate('General');
$this->createApplicationTabs()->activate('general');
}
@ -107,6 +108,7 @@ class ConfigController extends Controller
->order('name');
$this->setupLimitControl();
$this->setupPaginationControl($this->view->modules);
$this->view->title = $this->translate('Modules');
}
public function moduleAction()
@ -137,6 +139,7 @@ class ConfigController extends Controller
$this->view->module = $module;
$this->view->toggleForm = $toggleForm;
$this->view->title = $module->getName();
$this->view->tabs = $module->getConfigTabs()->activate('info');
$this->view->moduleGitCommitId = Version::getGitHead($module->getBaseDir());
} else {
@ -209,6 +212,7 @@ class ConfigController extends Controller
$this->view->form = $form;
$this->view->backendNames = Config::app('groups');
$this->createApplicationTabs()->activate('authentication');
$this->view->title = $this->translate('Authentication');
$this->render('userbackend/reorder');
}
@ -255,6 +259,7 @@ class ConfigController extends Controller
});
$form->handleRequest();
$this->view->title = $this->translate('Authentication');
$this->renderForm($form, $this->translate('New User Backend'));
}
@ -293,6 +298,7 @@ class ConfigController extends Controller
$this->httpNotFound(sprintf($this->translate('User backend "%s" not found'), $backendName));
}
$this->view->title = $this->translate('Authentication');
$this->renderForm($form, $this->translate('Update User Backend'));
}
@ -325,6 +331,7 @@ class ConfigController extends Controller
});
$form->handleRequest();
$this->view->title = $this->translate('Authentication');
$this->renderForm($form, $this->translate('Remove User Backend'));
}
@ -338,6 +345,7 @@ class ConfigController extends Controller
->setKeyColumn('name')
->select()
->order('name');
$this->view->title = $this->translate('Resources');
$this->createApplicationTabs()->activate('resource');
}
@ -358,6 +366,7 @@ class ConfigController extends Controller
$form->handleRequest();
$this->view->form = $form;
$this->view->title = $this->translate('Resources');
$this->render('resource/create');
}
@ -377,6 +386,7 @@ class ConfigController extends Controller
$form->handleRequest();
$this->view->form = $form;
$this->view->title = $this->translate('Resources');
$this->render('resource/modify');
}
@ -441,6 +451,7 @@ class ConfigController extends Controller
}
$this->view->form = $form;
$this->view->title = $this->translate('Resources');
$this->render('resource/remove');
}
}

View File

@ -21,6 +21,13 @@ use Icinga\Web\Widget;
class GroupController extends AuthBackendController
{
public function init()
{
$this->view->title = $this->translate('User Groups');
parent::init();
}
/**
* List all user groups of a single backend
*/

View File

@ -54,5 +54,6 @@ class ListController extends Controller
$this->setupLimitControl();
$this->setupPaginationControl($this->view->logData);
$this->view->title = $this->translate('Application Log');
}
}

View File

@ -127,6 +127,7 @@ class NavigationController extends Controller
$this->view->types = $this->listItemTypes();
$this->view->items = $query;
$this->view->title = $this->translate('Navigation');
$this->getTabs()
->add(
'account',
@ -187,6 +188,7 @@ class NavigationController extends Controller
$this->view->types = $this->listItemTypes();
$this->view->items = $query;
$this->view->title = $this->translate('Shared Navigation');
$this->getTabs()->add(
'navigation/shared',
array(
@ -242,6 +244,7 @@ class NavigationController extends Controller
});
$form->handleRequest();
$this->view->title = $this->translate('Navigation');
$this->renderForm($form, $this->translate('New Navigation Item'));
}
@ -297,6 +300,7 @@ class NavigationController extends Controller
$this->httpNotFound(sprintf($this->translate('Navigation item "%s" not found'), $itemName));
}
$this->view->title = $this->translate('Navigation');
$this->renderForm($form, $this->translate('Update Navigation Item'));
}
@ -340,6 +344,7 @@ class NavigationController extends Controller
});
$form->handleRequest();
$this->view->title = $this->translate('Navigation');
$this->renderForm($form, $this->translate('Remove Navigation Item'));
}
@ -428,5 +433,6 @@ class NavigationController extends Controller
}
$this->view->navigation = $navigation;
$this->view->title = $navigation->getLabel();
}
}

View File

@ -18,6 +18,13 @@ use Icinga\Web\Notification;
*/
class RoleController extends AuthBackendController
{
public function init()
{
$this->view->title = $this->translate('Roles');
parent::init();
}
/**
* List roles
*

View File

@ -20,6 +20,13 @@ use Icinga\Web\Widget;
class UserController extends AuthBackendController
{
public function init()
{
$this->view->title = $this->translate('Users');
parent::init();
}
/**
* List all users of a single backend
*/

View File

@ -58,6 +58,7 @@ class UsergroupbackendController extends Controller
});
$form->handleRequest();
$this->view->title = $this->translate('Authentication');
$this->renderForm($form, $this->translate('New User Group Backend'));
}
@ -94,6 +95,7 @@ class UsergroupbackendController extends Controller
$this->httpNotFound(sprintf($this->translate('User group backend "%s" not found'), $backendName));
}
$this->view->title = $this->translate('Authentication');
$this->renderForm($form, $this->translate('Update User Group Backend'));
}
@ -125,6 +127,7 @@ class UsergroupbackendController extends Controller
});
$form->handleRequest();
$this->view->title = $this->translate('Authentication');
$this->renderForm($form, $this->translate('Remove User Group Backend'));
}
}

View File

@ -46,7 +46,13 @@ if ($this->layout()->inlineLayout) {
</div>
<?php endif ?>
<div id="main" role="main">
<div id="col1" class="container<?= $moduleClass ?>"<?php if ($moduleName): ?> data-icinga-module="<?= $moduleName ?>" <?php endif ?> data-icinga-url="<?= $this->escape(Url::fromRequest()->without('renderLayout')->getAbsoluteUrl()); ?>"<?= $refresh; ?> style="display: block">
<div id="col1"
class="container<?= $moduleClass ?>"
<?php if ($moduleName): ?>data-icinga-module="<?= $moduleName ?>"<?php endif ?>
data-icinga-title="<?= ! empty($this->title) ? $this->escape($this->title) . ' :: ' : '' ?><?= $this->defaultTitle ?>"
data-icinga-url="<?= $this->escape(Url::fromRequest()->without('renderLayout')->getAbsoluteUrl()); ?>"
<?= $refresh; ?>
style="display: block">
<?= $this->render($inlineLayoutScript) ?>
</div>
<div id="col2" class="container">

View File

@ -27,7 +27,7 @@ $innerLayoutScript = $this->layout()->innerLayout . '.phtml';
<meta name="google" value="notranslate">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta http-equiv="cleartype" content="on">
<title><?= $this->title ? $this->escape($this->title) : $this->defaultTitle ?></title>
<title><?= $this->title ? $this->escape($this->title) . ' :: ' : '' ?><?= $this->defaultTitle ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="application-name" content="Icinga Web 2">

View File

@ -511,11 +511,11 @@ class ActionController extends Zend_Controller_Action
}
$resp->setHeader(
'X-Icinga-Title',
rawurlencode($this->view->title . ' :: ' . static::DEFAULT_TITLE),
rawurlencode($this->view->title . ' :: ' . $this->view->defaultTitle),
true
);
} else {
$resp->setHeader('X-Icinga-Title', rawurlencode(static::DEFAULT_TITLE), true);
$resp->setHeader('X-Icinga-Title', rawurlencode($this->view->defaultTitle), true);
}
$layout = $this->_helper->layout();

View File

@ -66,6 +66,7 @@ class CommentController extends Controller
public function showAction()
{
$this->view->comment = $this->comment;
$this->view->title = $this->translate('Comments');
if ($this->hasPermission('monitoring/command/comment/delete')) {
$listUrl = Url::fromPath('monitoring/list/comments')

View File

@ -56,6 +56,7 @@ class CommentsController extends Controller
$this->comments = $query;
$this->view->title = $this->translate('Comments');
$this->getTabs()->add(
'comments',
array(

View File

@ -27,6 +27,8 @@ class ConfigController extends Controller
public function init()
{
$this->assertPermission('config/modules');
$this->view->title = $this->translate('Backends');
$this->view->defaultTitle = 'monitoring :: ' . $this->view->defaultTitle;
parent::init();
}
@ -290,6 +292,7 @@ class ConfigController extends Controller
$form->handleRequest();
$this->view->form = $form;
$this->view->title = $this->translate('Security');
$this->view->tabs = $this->Module()->getConfigTabs()->activate('security');
}
}

View File

@ -86,6 +86,7 @@ class DowntimeController extends Controller
$this->view->stateName = $isService ? Service::getStateText($this->downtime->service_state)
: Host::getStateText($this->downtime->host_state);
$this->view->title = $this->translate('Downtimes');
if ($this->hasPermission('monitoring/command/downtime/delete')) {
$form = new DeleteDowntimeCommandForm();
$form

View File

@ -63,6 +63,7 @@ class DowntimesController extends Controller
$this->downtimes = $query;
$this->view->title = $this->translate('Downtimes');
$this->getTabs()->add(
'downtimes',
array(

View File

@ -70,6 +70,7 @@ class EventController extends Controller
$this->getDetails($type, $event)
);
$this->view->title = $this->translate('Event Overview');
$this->getTabs()
->add('event', array(
'title' => $label,

View File

@ -113,6 +113,7 @@ class HealthController extends Controller
*/
public function statsAction()
{
$this->view->title = $this->translate('Stats');
$this->getTabs()->activate('stats');
$servicestats = $this->backend->select()->from('servicestatussummary', array(

View File

@ -35,6 +35,8 @@ class HostController extends MonitoredObjectController
$this->object = $host;
$this->createTabs();
$this->getTabs()->activate('host');
$this->view->title = $host->host_display_name;
$this->view->defaultTitle = $this->translate('Hosts') . ' :: ' . $this->view->defaultTitle;
}
/**

View File

@ -68,6 +68,7 @@ class HostsController extends Controller
)
)->extend(new DashboardAction())->extend(new MenuAction())->activate('show');
$this->view->listAllLink = Url::fromRequest()->setPath('monitoring/list/hosts');
$this->view->title = $this->translate('Hosts');
}
protected function handleCommandForm(ObjectsCommandForm $form)

View File

@ -40,6 +40,12 @@ class ServiceController extends MonitoredObjectController
$this->object = $service;
$this->createTabs();
$this->getTabs()->activate('service');
$this->view->title = $service->service_display_name;
$this->view->defaultTitle = join(' :: ', [
$service->host_display_name,
$this->translate('Services'),
$this->view->defaultTitle
]);
}
/**

View File

@ -74,6 +74,7 @@ class ServicesController extends Controller
'url' => Url::fromRequest()
)
)->extend(new DashboardAction())->extend(new MenuAction())->activate('show');
$this->view->title = $this->translate('Services');
}
protected function handleCommandForm(ObjectsCommandForm $form)

View File

@ -19,6 +19,13 @@ class ShowController extends Controller
*/
protected $backend;
public function init()
{
$this->view->defaultTitle = $this->translate('Contacts') . ' :: ' . $this->view->defaultTitle;
parent::init();
}
public function contactAction()
{
$contactName = $this->params->getRequired('contact_name');
@ -71,6 +78,7 @@ class ShowController extends Controller
$this->view->notifications = $notifications;
$this->setupLimitControl();
$this->setupPaginationControl($this->view->notifications);
$this->view->title = $contact->contact_name;
}
$this->view->contact = $contact;

View File

@ -15,6 +15,7 @@ class TacticalController extends Controller
{
$this->setAutorefreshInterval(15);
$this->view->title = $this->translate('Tactical Overview');
$this->getTabs()->add(
'tactical_overview',
array(

View File

@ -67,6 +67,7 @@ class IndexController extends Controller
}
$this->view->wizard = $wizard;
$this->view->title = $this->translate('Setup') . ' :: ' . $this->view->defaultTitle;
}
/**

View File

@ -543,7 +543,9 @@
}
var title = req.getResponseHeader('X-Icinga-Title');
if (title && ! req.autorefresh && req.$target.closest('.dashboard').length === 0) {
if (title && target === 'layout') {
this.icinga.ui.setTitle(decodeURIComponent(title));
} else if (title && ! req.autorefresh && req.$target.closest('.dashboard').length === 0) {
req.$target.data('icingaTitle', decodeURIComponent(title));
}