mirror of
https://github.com/librenms/librenms.git
synced 2024-09-21 10:28:13 +00:00
Fix validation page (#13929)
* Validation web page fixes * Validation web page fixes * update baseline
This commit is contained in:
parent
6410775bd5
commit
9c126572a2
@ -136,19 +136,6 @@ class Html
|
||||
return $graph_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find all links in some text and turn them into html links.
|
||||
*
|
||||
* @param string|null $text
|
||||
* @return string
|
||||
*/
|
||||
public static function linkify(?string $text): string
|
||||
{
|
||||
$regex = "#(http|https|ftp|ftps)://[a-z0-9\-.]*[a-z0-9\-]+(/\S*)?#i";
|
||||
|
||||
return preg_replace($regex, '<a href="$0">$0</a>', $text);
|
||||
}
|
||||
|
||||
public static function percentageBar($width, $height, $percent, $left_text = '', $right_text = '', $warn = null, $shadow = null, $colors = null)
|
||||
{
|
||||
$percent = min($percent, 100);
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
namespace LibreNMS;
|
||||
|
||||
use LibreNMS\Util\Html;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class ValidationResult
|
||||
{
|
||||
@ -223,9 +223,9 @@ class ValidationResult
|
||||
|
||||
return [
|
||||
'status' => $resultStatus,
|
||||
'statusText' => $this->getStatusText($resultStatus),
|
||||
'statusText' => substr($this->getStatusText($resultStatus), 2, -2), // remove console colors
|
||||
'message' => $this->getMessage(),
|
||||
'fix' => is_array($resultFix) ? $resultFix : ($resultList ? [Html::linkify($resultFix)] : []),
|
||||
'fix' => Arr::wrap($resultFix),
|
||||
'listDescription' => $this->getListDescription(),
|
||||
'list' => is_array($resultList) ? array_values($resultList) : [],
|
||||
];
|
||||
|
@ -11235,11 +11235,6 @@ parameters:
|
||||
count: 1
|
||||
path: tests/FunctionsTest.php
|
||||
|
||||
-
|
||||
message: "#^Method LibreNMS\\\\Tests\\\\FunctionsTest\\:\\:testLinkify\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: tests/FunctionsTest.php
|
||||
|
||||
-
|
||||
message: "#^Method LibreNMS\\\\Tests\\\\FunctionsTest\\:\\:testMacCleanToReadable\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
|
@ -32,18 +32,14 @@
|
||||
<div x-bind:id="'body-' + group.group" class="panel-collapse collapse" x-bind:class="{'in': group.status !== 2}">
|
||||
<div class="panel-body">
|
||||
<template x-for="result in group.results">
|
||||
<div class="panel" x-bind:class="{'panel-success': group.status === 2, 'panel-warning': group.status === 1, 'panel-danger': group.status === 0}">
|
||||
<div class="panel" x-bind:class="{'panel-success': result.status === 2, 'panel-warning': result.status === 1, 'panel-danger': result.status === 0}">
|
||||
<div class="panel-heading"
|
||||
x-bind:class="{'bg-success': result.status === 2, 'bg-warning': result.status === 1, 'bg-danger': result.status === 0}"
|
||||
x-text="result.statusText + ': ' + result.message"
|
||||
></div>
|
||||
<div class="panel-body" x-show="result.fix.length || result.list.length">
|
||||
<div x-show="result.fix.length">
|
||||
{{ __('validation.results.fix') }}: <code>
|
||||
<template x-for="fixText in result.fix">
|
||||
<span x-text="fixText"></span>
|
||||
</template>
|
||||
</code>
|
||||
{{ __('validation.results.fix') }}: <pre x-text='result.fix.join("\r\n")'>
|
||||
</pre>
|
||||
</div>
|
||||
<div x-show="result.list.length" class="tw-mt-5">
|
||||
<ul class='list-group' style='margin-bottom: -1px'>
|
||||
|
@ -26,7 +26,6 @@
|
||||
namespace LibreNMS\Tests;
|
||||
|
||||
use LibreNMS\Device\YamlDiscovery;
|
||||
use LibreNMS\Util\Html;
|
||||
use LibreNMS\Util\Rewrite;
|
||||
|
||||
class FunctionsTest extends TestCase
|
||||
@ -55,23 +54,6 @@ class FunctionsTest extends TestCase
|
||||
$this->assertFalse(isHexString('a5fe53'));
|
||||
}
|
||||
|
||||
public function testLinkify()
|
||||
{
|
||||
$input = 'foo@demo.net bar.ba@test.co.uk
|
||||
www.demo.com http://foo.co.uk/
|
||||
sdfsd ftp://192.168.1.1/help/me/now.php
|
||||
http://regexr.com/foo.html?q=bar
|
||||
https://mediatemple.net.';
|
||||
|
||||
$expected = 'foo@demo.net bar.ba@test.co.uk
|
||||
www.demo.com <a href="http://foo.co.uk/">http://foo.co.uk/</a>
|
||||
sdfsd <a href="ftp://192.168.1.1/help/me/now.php">ftp://192.168.1.1/help/me/now.php</a>
|
||||
<a href="http://regexr.com/foo.html?q=bar">http://regexr.com/foo.html?q=bar</a>
|
||||
<a href="https://mediatemple.net">https://mediatemple.net</a>.';
|
||||
|
||||
$this->assertSame($expected, Html::linkify($input));
|
||||
}
|
||||
|
||||
public function testDynamicDiscoveryGetValue()
|
||||
{
|
||||
$pre_cache = [
|
||||
|
Loading…
Reference in New Issue
Block a user