Skip to content

Commit

Permalink
Merge pull request #29 from NETWAYS/chore/remove-unused-code
Browse files Browse the repository at this point in the history
Remove some unsed code
  • Loading branch information
martialblog authored Dec 9, 2024
2 parents 9cbdebc + 58a0ba1 commit 108b469
Show file tree
Hide file tree
Showing 3 changed files with 234 additions and 282 deletions.
53 changes: 0 additions & 53 deletions library/Grafana/Helpers/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,63 +4,10 @@

class Util
{

public static function graphiteReplace(string $string = ''): string
{
$string = preg_replace('/[^a-zA-Z0-9\*\-:]/', '_', $string);

return $string;
}

public static function httpStatusCodetoString(int $code = 0): string
{
$statuscodes = [
'100' => 'Continue',
'101' => 'Switching Protocols',
'200' => 'OK',
'201' => 'Created',
'202' => 'Accepted',
'203' => 'Non-Authoritative Information',
'204' => 'No Content',
'205' => 'Reset Content',
'206' => 'Partial Content',
'300' => 'Multiple Choices',
'302' => 'Found',
'303' => 'See Other',
'304' => 'Not Modified',
'305' => 'Use Proxy',
'400' => 'Bad Request',
'401' => 'Unauthorized',
'402' => 'Payment Required',
'403' => 'Forbidden',
'404' => 'Not Found',
'405' => 'Method Not Allowed',
'406' => 'Not Acceptable',
'407' => 'Proxy Authentication Required',
'408' => 'Request Timeout',
'409' => 'Conflict',
'410' => 'Gone',
'411' => 'Length Required',
'412' => 'Precondition Failed',
'413' => 'Request Entity Too Large',
'414' => 'Request-URI Too Long',
'415' => 'Unsupported Media Type',
'416' => 'Requested Range Not Satisfiable',
'417' => 'Expectation Failed',
'500' => 'Internal Server Error',
'501' => 'Not Implemented',
'502' => 'Bad Gateway',
'503' => 'Service Unavailable',
'504' => 'Gateway Timeout',
'505' => 'HTTP Version Not Supported'
];

$code = (string)$code;

if (array_key_exists($code, $statuscodes)) {
return $statuscodes[$code];
}

return $code;
}
}
4 changes: 1 addition & 3 deletions library/Grafana/ProvidedHook/Icingadb/HostActions.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,14 @@

class HostActions extends HostActionsHook
{
protected $defaultTimerange = '1w/w';

public function getActionsForObject(Host $host): array
{
if (! Auth::getInstance()->hasPermission('grafana/showall')) {
return [];
}

$config = Config::module('grafana')->getSection('grafana');
$timerange = $config->get('timerangeAll', $this->defaultTimerange);
$timerange = $config->get('timerangeAll', '1w/w');

return [
new Link(
Expand Down
Loading

0 comments on commit 108b469

Please sign in to comment.