Merge pull request #4763 from Icinga/drop-internet-explorer-support

Drop IE support
This commit is contained in:
Johannes Meyer 2022-06-13 16:44:48 +02:00 committed by GitHub
commit de424ddadb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 56 additions and 126 deletions

View File

@ -16,7 +16,6 @@ $innerLayoutScript = $this->layout()->innerLayout . '.phtml';
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="google" value="notranslate"> <meta name="google" value="notranslate">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta http-equiv="cleartype" content="on"> <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="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover">

View File

@ -28,7 +28,6 @@ $innerLayoutScript = $this->layout()->innerLayout . '.phtml';
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="google" value="notranslate"> <meta name="google" value="notranslate">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta http-equiv="cleartype" content="on"> <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="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover">

View File

@ -1,10 +0,0 @@
<html>
<head>
<?php if (isset($this->layout()->redirectUrl)): ?>
<meta name="redirectUrl" content="<?= $this->layout()->redirectUrl; ?>">
<?php endif ?>
</head>
<body>
<?= $this->render('inline.phtml'); ?>
</body>
</html>

View File

@ -23,10 +23,6 @@ or sub-category here:
If your desired browser and its version is showing up in green when visiting the respective link, If your desired browser and its version is showing up in green when visiting the respective link,
it's probably okay to use it for Icinga Web 2. it's probably okay to use it for Icinga Web 2.
!!! note
Support for Internet Explorer will be completely dropped with version 2.11
## Upgrade <a id="upgrade"></a> ## Upgrade <a id="upgrade"></a>
In case you are upgrading from an older version of Icinga Web 2 In case you are upgrading from an older version of Icinga Web 2

View File

@ -5,6 +5,7 @@ v2.6 to v2.8 requires to follow the instructions for v2.7 too.
## Upgrading to Icinga Web 2 2.11.x ## Upgrading to Icinga Web 2 2.11.x
* Support for Internet Explorer 11 has been removed.
* The Vagrant file and all its assets have been removed. * The Vagrant file and all its assets have been removed.
* The `IniStore` class has been removed due to the deprecation of the Preferences ini backend. * The `IniStore` class has been removed due to the deprecation of the Preferences ini backend.
* The `DbStore` class has been removed and its methods have been added to `PreferencesStore` class. * The `DbStore` class has been removed and its methods have been added to `PreferencesStore` class.

View File

@ -56,22 +56,18 @@ if (in_array($path, $special)) {
switch ($path) { switch ($path) {
case 'css/icinga.css': case 'css/icinga.css':
$forIe11 = (bool) preg_match('/Trident\/7.0;.*rv:11/', $_SERVER['HTTP_USER_AGENT']); Stylesheet::send();
Stylesheet::send(false, $forIe11);
exit; exit;
case 'css/icinga.min.css': case 'css/icinga.min.css':
$forIe11 = (bool) preg_match('/Trident\/7.0;.*rv:11/', $_SERVER['HTTP_USER_AGENT']); Stylesheet::send(true);
Stylesheet::send(true, $forIe11);
exit; exit;
case 'js/icinga.dev.js': case 'js/icinga.dev.js':
$forIe11 = (bool) preg_match('/Trident\/7.0;.*rv:11/', $_SERVER['HTTP_USER_AGENT']); JavaScript::send();
JavaScript::send(false, $forIe11);
exit; exit;
case 'js/icinga.min.js': case 'js/icinga.min.js':
$forIe11 = (bool) preg_match('/Trident\/7.0;.*rv:11/', $_SERVER['HTTP_USER_AGENT']); JavaScript::sendMinified();
JavaScript::sendMinified($forIe11);
break; break;
default: default:

View File

@ -10,14 +10,8 @@ require_once 'lessphp/lessc.inc.php';
class LessParser extends lessc class LessParser extends lessc
{ {
/** public function __construct()
* @param bool $disableModes Disable replacing compiled Less colors with CSS var() function calls and don't inject
* light mode calls
*/
public function __construct($disableModes = false)
{ {
if (! $disableModes) { $this->setOption('plugins', [new Visitor()]);
$this->setOption('plugins', [new Visitor()]);
}
} }
} }

View File

@ -1168,9 +1168,6 @@ class Form extends Zend_Form
|| $this->getUidDisabled() || $this->getUidDisabled()
|| $this->wasSent($formData) || $this->wasSent($formData)
) { ) {
if (($frameUpload = (bool) $request->getUrl()->shift('_frameUpload', false))) {
$this->getView()->layout()->setLayout('wrapped');
}
$this->populate($formData); // Necessary to get isSubmitted() to work $this->populate($formData); // Necessary to get isSubmitted() to work
if (! $this->getSubmitLabel() || $this->isSubmitted()) { if (! $this->getSubmitLabel() || $this->isSubmitted()) {
if ($this->isValid($formData) if ($this->isValid($formData)
@ -1192,10 +1189,8 @@ class Form extends Zend_Form
$this->getResponse()->json() $this->getResponse()->json()
->setSuccessData($message !== null ? array('message' => $message) : null) ->setSuccessData($message !== null ? array('message' => $message) : null)
->sendResponse(); ->sendResponse();
} elseif (! $frameUpload) {
$this->getResponse()->redirectAndExit($this->getRedirectUrl());
} else { } else {
$this->getView()->layout()->redirectUrl = $this->getRedirectUrl()->getAbsoluteUrl(); $this->getResponse()->redirectAndExit($this->getRedirectUrl());
} }
// TODO: Still bad. An api target must not behave as one if it's not an api request // TODO: Still bad. An api target must not behave as one if it's not an api request
} elseif ($this->getIsApiTarget() || $this->getRequest()->isApiRequest()) { } elseif ($this->getIsApiTarget() || $this->getRequest()->isApiRequest()) {

View File

@ -53,9 +53,9 @@ class JavaScript
'js/define.js' 'js/define.js'
]; ];
public static function sendMinified($forIe11 = false) public static function sendMinified()
{ {
self::send(true, $forIe11); self::send(true);
} }
/** /**
@ -65,7 +65,7 @@ class JavaScript
* *
* @param bool $minified Whether to compress the client side script code * @param bool $minified Whether to compress the client side script code
*/ */
public static function send($minified = false, $forIe11 = false) public static function send($minified = false)
{ {
header('Content-Type: application/javascript'); header('Content-Type: application/javascript');
$basedir = Icinga::app()->getBootstrapDirectory(); $basedir = Icinga::app()->getBootstrapDirectory();
@ -91,11 +91,9 @@ class JavaScript
$files[] = $filePath; $files[] = $filePath;
} }
if (! $forIe11) { // Prepare library file list
// Prepare library file list foreach (Icinga::app()->getLibraries() as $library) {
foreach (Icinga::app()->getLibraries() as $library) { $files = array_merge($files, $library->getJsAssets());
$files = array_merge($files, $library->getJsAssets());
}
} }
// Prepare core file list // Prepare core file list
@ -151,28 +149,26 @@ class JavaScript
$baseJs .= file_get_contents($file) . "\n\n\n"; $baseJs .= file_get_contents($file) . "\n\n\n";
} }
if (! $forIe11) { // Library files need to be namespaced first before they can be included
// Library files need to be namespaced first before they can be included foreach (Icinga::app()->getLibraries() as $library) {
foreach (Icinga::app()->getLibraries() as $library) { foreach ($library->getJsAssets() as $file) {
foreach ($library->getJsAssets() as $file) { $alreadyMinified = false;
$alreadyMinified = false; if ($minified && file_exists(($minFile = substr($file, 0, -3) . '.min.js'))) {
if ($minified && file_exists(($minFile = substr($file, 0, -3) . '.min.js'))) { $alreadyMinified = true;
$alreadyMinified = true; $file = $minFile;
$file = $minFile; }
}
$content = self::optimizeDefine( $content = self::optimizeDefine(
file_get_contents($file), file_get_contents($file),
$file, $file,
$library->getJsAssetPath(), $library->getJsAssetPath(),
$library->getName() $library->getName()
); );
if ($alreadyMinified) { if ($alreadyMinified) {
$out .= ';' . ltrim(trim($content), ';') . "\n"; $out .= ';' . ltrim(trim($content), ';') . "\n";
} else { } else {
$js .= $content . "\n\n\n"; $js .= $content . "\n\n\n";
}
} }
} }
} }

View File

@ -58,13 +58,10 @@ class LessCompiler
/** /**
* Create a new LESS compiler * Create a new LESS compiler
*
* @param bool $disableModes Disable replacing compiled Less colors with CSS var() function calls and don't inject
* light mode calls
*/ */
public function __construct($disableModes = false) public function __construct()
{ {
$this->lessc = new LessParser($disableModes); $this->lessc = new LessParser();
// Discourage usage of import because we're caching based on an explicit list of LESS files to compile // Discourage usage of import because we're caching based on an explicit list of LESS files to compile
$this->lessc->importDisabled = true; $this->lessc->importDisabled = true;
} }

View File

@ -106,15 +106,12 @@ class StyleSheet
/** /**
* Create the StyleSheet * Create the StyleSheet
*
* @param bool $disableModes Disable replacing compiled Less colors with CSS var() function calls and don't inject
* light mode calls
*/ */
public function __construct($disableModes = false) public function __construct()
{ {
$app = Icinga::app(); $app = Icinga::app();
$this->app = $app; $this->app = $app;
$this->lessCompiler = new LessCompiler($disableModes); $this->lessCompiler = new LessCompiler();
$this->pubPath = $app->getBaseDir('public'); $this->pubPath = $app->getBaseDir('public');
$this->collect(); $this->collect();
} }
@ -224,13 +221,11 @@ class StyleSheet
* *
* Does not cache the stylesheet if the HTTP header Cache-Control or Pragma is set to no-cache. * Does not cache the stylesheet if the HTTP header Cache-Control or Pragma is set to no-cache.
* *
* @param bool $minified Whether to compress the stylesheet * @param bool $minified Whether to compress the stylesheet
* @param bool $disableModes Disable replacing compiled Less colors with CSS var() function calls and don't inject
* light mode calls
*/ */
public static function send($minified = false, $disableModes = false) public static function send($minified = false)
{ {
$styleSheet = new self($disableModes); $styleSheet = new self();
$request = $styleSheet->app->getRequest(); $request = $styleSheet->app->getRequest();
$response = $styleSheet->app->getResponse(); $response = $styleSheet->app->getResponse();

View File

@ -14,8 +14,6 @@ body {
height: 100%; height: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
// Prevent nav-level-2 flyovers from being covered by #main
z-index: 0;
} }
#content-wrapper { #content-wrapper {
@ -58,10 +56,6 @@ body {
} }
} }
#fileupload-frame-target {
display: none;
}
#responsive-debug { #responsive-debug {
font-size: 0.9em; font-size: 0.9em;
font-family: Courier new, monospace; font-family: Courier new, monospace;

View File

@ -340,13 +340,13 @@ a:hover > .icon-cancel {
} }
> i.collapse-icon { > i.collapse-icon {
display: inline; display: unset;
} }
} }
.collapsible.collapsed + .collapsible-control button { .collapsible.collapsed + .collapsible-control button {
> i.expand-icon { > i.expand-icon {
display: inline; display: unset;
} }
> i.collapse-icon { > i.collapse-icon {

View File

@ -31,10 +31,6 @@
text-decoration: none; text-decoration: none;
} }
} }
.nav-level-2 {
z-index: 1;
}
} }
#layout:not(.sidebar-collapsed) #menu .nav-item > a:first-of-type { #layout:not(.sidebar-collapsed) #menu .nav-item > a:first-of-type {

View File

@ -86,12 +86,6 @@
to { opacity: 1; } to { opacity: 1; }
} }
/* IE */
@-ms-keyframes fadein {
from { opacity: 0; }
to { opacity: 1; }
}
/* Opera < 12.1 */ /* Opera < 12.1 */
@-o-keyframes fadein { @-o-keyframes fadein {
from { opacity: 0; } from { opacity: 0; }

View File

@ -1,11 +1,5 @@
/*! Icinga Web 2 | (c) 2014 Icinga Development Team | GPLv2+ */ /*! Icinga Web 2 | (c) 2014 Icinga Development Team | GPLv2+ */
/* IE11 Polyfills */
if (window.NodeList && !NodeList.prototype.forEach) {
NodeList.prototype.forEach = Array.prototype.forEach;
}
/* jQuery Plugins */ /* jQuery Plugins */
(function ($) { (function ($) {

View File

@ -448,7 +448,6 @@
// the highest precedence before hrefs defined in the tr itself and regular links // the highest precedence before hrefs defined in the tr itself and regular links
var $a = $('a[href].rowaction', el).first(); var $a = $('a[href].rowaction', el).first();
if ($a.length) { if ($a.length) {
// TODO: Find out whether we leak memory on IE with this:
$(el).attr('href', $a.attr('href')); $(el).attr('href', $a.attr('href'));
return; return;
} }
@ -461,11 +460,6 @@
} }
}); });
// IE will not ignore user-select unless we cancel selectstart
$('table.action.multiselect tr, table.table-row-selectable.multiselect tr', container).each(function(idx, el) {
$(el).on('selectstart', false);
});
// draw all active selections that have disappeared on reload // draw all active selections that have disappeared on reload
_this.tables().each(function(i, el) { _this.tables().each(function(i, el) {
new Selection(el, _this.icinga).refresh(); new Selection(el, _this.icinga).refresh();

View File

@ -67,7 +67,7 @@
var toCollapse = []; var toCollapse = [];
$.each(document.querySelectorAll('.collapsible'), function (_, collapsible) { $.each(document.querySelectorAll('.collapsible'), function (_, collapsible) {
if ($(collapsible).is('.can-collapse')) { if (collapsible.matches('.can-collapse')) {
if (! _this.canCollapse(collapsible)) { if (! _this.canCollapse(collapsible)) {
var toggleSelector = collapsible.dataset.toggleElement; var toggleSelector = collapsible.dataset.toggleElement;
if (! toggleSelector) { if (! toggleSelector) {
@ -98,7 +98,7 @@
Collapsible.prototype.onExpand = function(collapsiblePath) { Collapsible.prototype.onExpand = function(collapsiblePath) {
var collapsible = $(collapsiblePath)[0]; var collapsible = $(collapsiblePath)[0];
if (collapsible && $(collapsible).is('.can-collapse')) { if (collapsible && collapsible.matches('.can-collapse')) {
this.expand(collapsible); this.expand(collapsible);
} }
}; };
@ -134,7 +134,7 @@
_this.icinga.logger.error( _this.icinga.logger.error(
'[Collapsible] Collapsible control has no associated .collapsible: ', $target[0]); '[Collapsible] Collapsible control has no associated .collapsible: ', $target[0]);
} else if (typeof collapsible.dataset.noPersistence !== 'undefined') { } else if (typeof collapsible.dataset.noPersistence !== 'undefined') {
if ($(collapsible).is('.collapsed')) { if (collapsible.matches('.collapsed')) {
_this.expand(collapsible); _this.expand(collapsible);
} else { } else {
_this.collapse(collapsible, _this.calculateCollapsedHeight(collapsible)); _this.collapse(collapsible, _this.calculateCollapsedHeight(collapsible));
@ -200,9 +200,9 @@
return ''; return '';
} }
if (collapsible.tagName === 'TABLE') { if (collapsible.matches('table')) {
return '> tbody > tr'; return '> tbody > tr';
} else if (collapsible.tagName === 'UL' || collapsible.tagName === 'OL') { } else if (collapsible.matches('ul, ol')) {
return '> li:not(.collapsible-control)'; return '> li:not(.collapsible-control)';
} }

View File

@ -24,7 +24,7 @@
* @param icinga * @param icinga
* @constructor * @constructor
*/ */
var InputEnrichment = function (icinga) { let InputEnrichment = function (icinga) {
Icinga.EventListener.call(this, icinga); Icinga.EventListener.call(this, icinga);
this.on('beforerender', '#main > .container, #modal-content', this.onBeforeRender, this); this.on('beforerender', '#main > .container, #modal-content', this.onBeforeRender, this);
@ -76,8 +76,8 @@
let inputs = event.target.querySelectorAll('[data-enrichment-type]'); let inputs = event.target.querySelectorAll('[data-enrichment-type]');
// Remember current instances // Remember current instances
inputs.forEach(function (input) { inputs.forEach((input) => {
var enrichment = _this._enrichments.get(input); let enrichment = _this._enrichments.get(input);
if (enrichment) { if (enrichment) {
_this._cachedEnrichments[_this.icinga.utils.getDomPath(input).join(' > ')] = enrichment; _this._cachedEnrichments[_this.icinga.utils.getDomPath(input).join(' > ')] = enrichment;
} }
@ -95,9 +95,9 @@
if (autorefresh) { if (autorefresh) {
// Apply remembered instances // Apply remembered instances
for (var inputPath in _this._cachedEnrichments) { for (let inputPath in _this._cachedEnrichments) {
var enrichment = _this._cachedEnrichments[inputPath]; let enrichment = _this._cachedEnrichments[inputPath];
var input = container.querySelector(inputPath); let input = container.querySelector(inputPath);
if (input !== null) { if (input !== null) {
enrichment.refresh(input); enrichment.refresh(input);
_this._enrichments.set(input, enrichment); _this._enrichments.set(input, enrichment);
@ -110,9 +110,9 @@
} }
// Create new instances // Create new instances
var inputs = container.querySelectorAll('[data-enrichment-type]'); let inputs = container.querySelectorAll('[data-enrichment-type]');
inputs.forEach(function (input) { inputs.forEach((input) => {
var enrichment = _this._enrichments.get(input); let enrichment = _this._enrichments.get(input);
if (! enrichment) { if (! enrichment) {
switch (input.dataset.enrichmentType) { switch (input.dataset.enrichmentType) {
case 'search-bar': case 'search-bar':

View File

@ -44,7 +44,7 @@
*/ */
window.addEventListener('storage', function(event) { window.addEventListener('storage', function(event) {
var url = icinga.utils.parseUrl(event.url); var url = icinga.utils.parseUrl(event.url);
if (! url.path.substring(0, icinga.config.baseUrl.length) === icinga.config.baseUrl) { if (! url.path.startsWith(icinga.config.baseUrl)) {
// A localStorage is shared between all paths on the same origin. // A localStorage is shared between all paths on the same origin.
// So we need to make sure it's us who made a change. // So we need to make sure it's us who made a change.
return; return;