add icon to show admin/customer custom-notes in overview

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2022-09-01 15:44:38 +02:00
parent 754b56aba0
commit a7454b00b4
5 changed files with 31 additions and 0 deletions

View File

@@ -34,4 +34,9 @@ class Customer
return $attributes['fields']['loginfail_count'] >= Settings::Get('login.maxloginattempts') return $attributes['fields']['loginfail_count'] >= Settings::Get('login.maxloginattempts')
&& $attributes['fields']['lastlogin_fail'] > (time() - Settings::Get('login.deactivatetime')); && $attributes['fields']['lastlogin_fail'] > (time() - Settings::Get('login.deactivatetime'));
} }
public static function hasNote(array $attributes)
{
return !empty($attributes['fields']['custom_notes']);
}
} }

View File

@@ -75,6 +75,17 @@ class Text
return wordwrap($attributes['data'], 100, '<br>', true); return wordwrap($attributes['data'], 100, '<br>', true);
} }
public static function customerNoteDetailModal(array $attributes): array
{
$note = $attributes['fields']['custom_notes'] ?? '';
return [
'entry' => $attributes['fields']['id'],
'id' => 'cnModal' . $attributes['fields']['id'],
'title' => lng('usersettings.custom_notes.title') . ': ' . ($attributes['fields']['loginname'] ?? $attributes['fields']['adminname']),
'body' => nl2br($note)
];
}
public static function apikeyDetailModal(array $attributes): array public static function apikeyDetailModal(array $attributes): array
{ {
$linker = UI::getLinker(); $linker = UI::getLinker();

View File

@@ -24,6 +24,7 @@
*/ */
use Froxlor\UI\Callbacks\Admin; use Froxlor\UI\Callbacks\Admin;
use Froxlor\UI\Callbacks\Customer;
use Froxlor\UI\Callbacks\Impersonate; use Froxlor\UI\Callbacks\Impersonate;
use Froxlor\UI\Callbacks\ProgressBar; use Froxlor\UI\Callbacks\ProgressBar;
use Froxlor\UI\Callbacks\Style; use Froxlor\UI\Callbacks\Style;
@@ -112,6 +113,12 @@ return [
'deactivated', 'deactivated',
]), ]),
'actions' => [ 'actions' => [
'show' => [
'icon' => 'fa fa-eye',
'title' => lng('usersettings.custom_notes.title'),
'modal' => [Text::class, 'customerNoteDetailModal'],
'visible' => [Customer::class, 'hasNote']
],
'edit' => [ 'edit' => [
'icon' => 'fa fa-edit', 'icon' => 'fa fa-edit',
'title' => lng('panel.edit'), 'title' => lng('panel.edit'),

View File

@@ -153,6 +153,12 @@ return [
'c.traffic', 'c.traffic',
]), ]),
'actions' => [ 'actions' => [
'show' => [
'icon' => 'fa fa-eye',
'title' => lng('usersettings.custom_notes.title'),
'modal' => [Text::class, 'customerNoteDetailModal'],
'visible' => [Customer::class, 'hasNote']
],
'unlock' => [ 'unlock' => [
'icon' => 'fa fa-unlock', 'icon' => 'fa fa-unlock',
'title' => lng('panel.unlock'), 'title' => lng('panel.unlock'),

View File

@@ -483,6 +483,8 @@ return [
'no_api_keys' => 'Keine API Keys gefunden', 'no_api_keys' => 'Keine API Keys gefunden',
'key_add' => 'API Key hinzufügen', 'key_add' => 'API Key hinzufügen',
'apikey_removed' => 'Der API Key mit der ID #%s wurde erfolgreich gelöscht.', 'apikey_removed' => 'Der API Key mit der ID #%s wurde erfolgreich gelöscht.',
'apikey_added' => 'Der neue API Key wurde erfolgreich angelegt.',
'clicktoview' => 'API Key Details anzeigen',
'allowed_from' => 'Erlaube Zugriff von', 'allowed_from' => 'Erlaube Zugriff von',
'allowed_from_help' => 'Komma getrennte Liste von IPs oder Netzen.<br>Standard ist leer (von überall erlaubt).', 'allowed_from_help' => 'Komma getrennte Liste von IPs oder Netzen.<br>Standard ist leer (von überall erlaubt).',
'valid_until' => 'Gültig bis', 'valid_until' => 'Gültig bis',