diff options
author | Simon Rettberg | 2019-10-17 15:55:05 +0200 |
---|---|---|
committer | Simon Rettberg | 2019-10-17 15:55:05 +0200 |
commit | 0064f98651c627387115e84e7632f9eceff5d4c3 (patch) | |
tree | bf06e04bc6bde06f322631945be7b7d5ec5108db /modules-available/serversetup-bwlp-ipxe | |
parent | [serversetup-bwlp-ipxe/minilinux] Further improvements (diff) | |
download | slx-admin-0064f98651c627387115e84e7632f9eceff5d4c3.tar.gz slx-admin-0064f98651c627387115e84e7632f9eceff5d4c3.tar.xz slx-admin-0064f98651c627387115e84e7632f9eceff5d4c3.zip |
[serversetup-bwlp-ipxe] UI/UX tweaks
* Decluttered bootentry View in menu editor
* Show details for hook bootentry in menu editor
* Buttons for "save and reload" in menu/bootentry editor
Diffstat (limited to 'modules-available/serversetup-bwlp-ipxe')
6 files changed, 237 insertions, 206 deletions
diff --git a/modules-available/serversetup-bwlp-ipxe/lang/de/module.json b/modules-available/serversetup-bwlp-ipxe/lang/de/module.json index a5038cf8..f95573a2 100644 --- a/modules-available/serversetup-bwlp-ipxe/lang/de/module.json +++ b/modules-available/serversetup-bwlp-ipxe/lang/de/module.json @@ -11,7 +11,7 @@ "dl-x86_64": "64\u2009Bit", "module_name": "iPXE \/ Boot Menu", "page_title": "PXE- und Boot-Einstellungen", - "submenu_address": "Server-Adresse", + "submenu_address": "Server-Adresse festlegen", "submenu_bootentry": "Men\u00fceintr\u00e4ge verwalten", "submenu_download": "Downloads", "submenu_import": "Importieren", diff --git a/modules-available/serversetup-bwlp-ipxe/lang/de/template-tags.json b/modules-available/serversetup-bwlp-ipxe/lang/de/template-tags.json index f7a62091..aeffb3c2 100644 --- a/modules-available/serversetup-bwlp-ipxe/lang/de/template-tags.json +++ b/modules-available/serversetup-bwlp-ipxe/lang/de/template-tags.json @@ -40,6 +40,7 @@ "lang_generationFailed": "Erzeugen des Bootmen\u00fcs fehlgeschlagen. Der Netzwerkboot von bwLehrpool wird wahrscheinlich nicht funktionieren. Wenn Sie den Fehler nicht selbst beheben k\u00f6nnen, melden Sie bitte die Logausgabe an das bwLehrpool-Projekt.", "lang_hex": "Hex", "lang_hookExtraOptionHeading": "Weitere Angaben", + "lang_hookOfModule": "Eintrag von", "lang_hotkey": "Hotkey", "lang_idFormatHint": "(Max. 16 Zeichen, nur a-z 0-9 - _)", "lang_imageToLoad": "Zu ladendes Image (z.B. Kernel)", @@ -61,6 +62,7 @@ "lang_menuTimeout": "Timeout", "lang_menuTitle": "Men\u00fc", "lang_moduleHeading": "iPXE \/ Boot Menu", + "lang_moduleSpecificId": "Modulspezifische ID", "lang_newBootEntryHead": "Neuer Men\u00fceintrag", "lang_newMenu": "Neues Men\u00fc", "lang_none": "(keine)", @@ -72,6 +74,7 @@ "lang_recompileHint": "iPXE-Binaries jetzt neu kompilieren. Normalerweise wird dieser Vorgang bei \u00c4nderungen automatisch ausgef\u00fchrt. Sollten Bootprobleme auftreten, k\u00f6nnen Sie hier den Vorgang manuell ansto\u00dfen.", "lang_refCount": "Referenzen", "lang_referencingMenus": "Verkn\u00fcpfte Men\u00fcs", + "lang_saveAndReload": "Speichern und neu laden", "lang_scriptContent": "Skript", "lang_seconds": "Sekunden", "lang_set": "Setzen", diff --git a/modules-available/serversetup-bwlp-ipxe/page.inc.php b/modules-available/serversetup-bwlp-ipxe/page.inc.php index 81f15922..cc5fdbe5 100644 --- a/modules-available/serversetup-bwlp-ipxe/page.inc.php +++ b/modules-available/serversetup-bwlp-ipxe/page.inc.php @@ -422,8 +422,29 @@ class Page_ServerSetup extends Page Database::queryAll("SELECT Concat('menu:', menuid) AS entryid, title FROM serversetup_menu ORDER BY title ASC") ); foreach ($menu['entrylist'] as &$bootentry) { - if (!isset($bootentry['data']) || !isset($bootentry['module']) || $bootentry['module']{0} !== '.') + if (!isset($bootentry['data']) || !isset($bootentry['module'])) continue; + if ($bootentry['module']{0} !== '.') { + // Hook from other module + $bootentry['moduleName'] = Dictionary::translateFileModule($bootentry['module'], 'module', 'module_name'); + if (!$bootentry['moduleName']) { + $bootentry['moduleName'] = $bootentry['module']; + } + $bootentry['ishook'] = true; + $data = json_decode($bootentry['data'], true); + unset($bootentry['data']); + $bootentry['id'] = $data['id']; + $bootentry['otherFields'] = []; + foreach ($data as $k => $v) { + if ($k === 'id') + continue; + $bootentry['otherFields'][] = [ + 'key' => Dictionary::translateFileModule($bootentry['module'], 'module', 'ipxe-' . $k, true), + 'value' => is_bool($v) ? Util::boolToString($v) : $v, + ]; + } + continue; + } $entry = BootEntry::fromJson($bootentry['module'], $bootentry['data']); if ($entry === null) { error_log('WARNING: Ignoring NULL menu entry: ' . $bootentry['data']); @@ -753,6 +774,9 @@ class Page_ServerSetup extends Page } Message::addSuccess('menu-saved'); + if (Request::post('next') === 'reload') { + Util::redirect('?do=serversetup&show=editmenu&id=' . $menu['menuid']); + } } private function updateLocalAddress() @@ -857,6 +881,9 @@ class Page_ServerSetup extends Page WHERE entryid = :oldid', $params); Message::addSuccess('boot-entry-updated', $newId); } + if (Request::post('next') === 'reload') { + Util::redirect('?do=serversetup&show=editbootentry&id=' . $newId); + } Util::redirect('?do=serversetup&show=bootentry'); } diff --git a/modules-available/serversetup-bwlp-ipxe/templates/ipaddress.html b/modules-available/serversetup-bwlp-ipxe/templates/ipaddress.html index ea19c417..74affb9f 100644 --- a/modules-available/serversetup-bwlp-ipxe/templates/ipaddress.html +++ b/modules-available/serversetup-bwlp-ipxe/templates/ipaddress.html @@ -29,10 +29,12 @@ </tr> {{/ips}} </table> - <p> - {{lang_recompileHint}} - </p> </form> + </div> + <div class="panel-body"> + <p> + {{lang_recompileHint}} + </p> <form method="post" action="?do=ServerSetup"> <input type="hidden" name="token" value="{{token}}"> <button class="btn btn-default" name="action" value="compile" {{disabled}}> diff --git a/modules-available/serversetup-bwlp-ipxe/templates/ipxe-new-boot-entry.html b/modules-available/serversetup-bwlp-ipxe/templates/ipxe-new-boot-entry.html index 5b7e3134..fc78d0ed 100644 --- a/modules-available/serversetup-bwlp-ipxe/templates/ipxe-new-boot-entry.html +++ b/modules-available/serversetup-bwlp-ipxe/templates/ipxe-new-boot-entry.html @@ -205,6 +205,10 @@ </ul> <div class="buttonbar text-right"> + <button type="submit" class="btn btn-primary" name="next" value="reload" {{disabled}}> + <span class="glyphicon glyphicon-floppy-disk"></span> + {{lang_saveAndReload}} + </button> <button type="submit" class="btn btn-primary" {{disabled}}> <span class="glyphicon glyphicon-floppy-disk"></span> {{lang_save}} diff --git a/modules-available/serversetup-bwlp-ipxe/templates/menu-edit.html b/modules-available/serversetup-bwlp-ipxe/templates/menu-edit.html index d2fa12be..efff704f 100644 --- a/modules-available/serversetup-bwlp-ipxe/templates/menu-edit.html +++ b/modules-available/serversetup-bwlp-ipxe/templates/menu-edit.html @@ -3,225 +3,220 @@ <input type="text" name="prevent_autofill" id="prevent_autofill" value="" style="position:absolute;top:-2000px" tabindex="-1"> <input type="password" name="password_fake" id="password_fake" value="" style="position:absolute;top:-2000px" tabindex="-1"> -<div class="panel panel-default"> - <div class="panel-heading"> - {{title}} - {{^title}} - {{lang_newMenu}} - {{/title}} - </div> - <div class="panel-body list-group"> - <form method="post" action="?do=serversetup"> - <input type="hidden" name="token" value="{{token}}"> - <input type="hidden" name="action" value="savemenu"> - <input type="hidden" name="menuid" value="{{menuid}}"> +<form method="post" action="?do=serversetup"> + <input type="hidden" name="token" value="{{token}}"> + <input type="hidden" name="action" value="savemenu"> + <input type="hidden" name="menuid" value="{{menuid}}"> + <div class="panel panel-default"> + <div class="panel-heading"> + {{title}} + {{^title}} + {{lang_newMenu}} + {{/title}} + </div> + <div class="panel-body list-group"> - <div class="row list-group-item"> - <div class="col-sm-3"> - <label for="panel-title">{{lang_menuTitle}}</label> - </div> - <div class="col-sm-9"> - <input class="form-control" name="title" id="panel-title" type="text" value="{{title}}" {{readonly}}> - </div> - </div> - <div class="row list-group-item"> - <div class="col-sm-3"> - <label for="panel-timeout">{{lang_menuTimeout}}</label> + <div class="row list-group-item"> + <div class="col-sm-3"> + <label for="panel-title">{{lang_menuTitle}}</label> + </div> + <div class="col-sm-9"> + <input class="form-control" name="title" id="panel-title" type="text" value="{{title}}" {{readonly}}> + </div> </div> - <div class="col-sm-9"> - <div class="input-group"> - <input class="form-control" name="timeout" id="panel-timeout" type="number" min="0" max="9999" - value="{{timeout}}" {{readonly}}> - <span class="input-group-addon">{{lang_seconds}}</span> + <div class="row list-group-item"> + <div class="col-sm-3"> + <label for="panel-timeout">{{lang_menuTimeout}}</label> + </div> + <div class="col-sm-9"> + <div class="input-group"> + <input class="form-control" name="timeout" id="panel-timeout" type="number" min="0" max="9999" + value="{{timeout}}" {{readonly}}> + <span class="input-group-addon">{{lang_seconds}}</span> + </div> </div> </div> - </div> - <div> - <table class="table"> - <thead> - <tr> - <th class="slx-smallcol"></th> - <th class="slx-smallcol"></th> - <th class="slx-smallcol">{{lang_entryId}}</th> - <th>{{lang_title}}</th> - <th width="11%">{{lang_hotkey}}</th> - <th width="15%">{{lang_password}}</th> - <th class="slx-smallcol"><span class="glyphicon glyphicon-eye-close"></span></th> - <th class="slx-smallcol"></th> - </tr> - </thead> - <tbody id="table-body" style="overflow: auto;"> - {{#entries}} - <tr class="{{highlight}}"> - <input type="hidden" class="sort-val" name="entry[{{menuentryid}}][sortval]" value="{{sortval}}"> - <input type="hidden" name="entry[{{menuentryid}}][hidden]" value="0"> - <td class="drag-handler" style="cursor: pointer;text-align: center; vertical-align: middle;"> - <span class="glyphicon glyphicon-th-list"></span> - </td> + <div> + <table class="table"> + <thead> + <tr> + <th class="slx-smallcol"></th> + <th class="slx-smallcol"></th> + <th class="slx-smallcol">{{lang_entryId}}</th> + <th>{{lang_title}}</th> + <th width="11%">{{lang_hotkey}}</th> + <th width="15%">{{lang_password}}</th> + <th class="slx-smallcol"><span class="glyphicon glyphicon-eye-close"></span></th> + <th class="slx-smallcol"></th> + </tr> + </thead> + <tbody id="table-body" style="overflow: auto;"> + {{#entries}} + <tr class="{{highlight}}"> + <input type="hidden" class="sort-val" name="entry[{{menuentryid}}][sortval]" value="{{sortval}}"> + <input type="hidden" name="entry[{{menuentryid}}][hidden]" value="0"> + <td class="drag-handler" style="cursor: pointer;text-align: center; vertical-align: middle;"> + <span class="glyphicon glyphicon-th-list"></span> + </td> - <td class="slx-smallcol" style="text-align: center; vertical-align: middle;"> - <div class="radio radio-inline no-spacer" style="margin: 0;{{^entryid}}display: none;{{/entryid}}"> - <input type="radio" name="defaultentry" value="{{menuentryid}}" - {{#isdefault}}checked{{/isdefault}} {{perms.ipxe.menu.edit.disabled}} {{disabled}}> - <label></label> - </div> - </td> + <td class="slx-smallcol" style="text-align: center; vertical-align: middle;"> + <div class="radio radio-inline no-spacer" style="margin: 0;{{^entryid}}display: none;{{/entryid}}"> + <input type="radio" name="defaultentry" value="{{menuentryid}}" + {{#isdefault}}checked{{/isdefault}} {{perms.ipxe.menu.edit.disabled}} {{disabled}}> + <label></label> + </div> + </td> - <td class="text-nowrap"> - <input class="entry-id" type="hidden" name="entry[{{menuentryid}}][entryid]" value="{{entryid}}"> - <button type="button" class="btn btn-default" style="width:100%;text-align:left" {{disabled}} data-toggle="modal" data-target="#entry-chooser-modal"> - {{#entryid}} - {{entryid}} - {{/entryid}} - {{^entryid}} - {{lang_spacer}} - {{/entryid}} - </button> - </td> - <td> - <input class="form-control title" name="entry[{{menuentryid}}][title]" value="{{title}}" - maxlength="100" {{readonly}}> - </td> + <td class="text-nowrap"> + <input class="entry-id" type="hidden" name="entry[{{menuentryid}}][entryid]" value="{{entryid}}"> + <button type="button" class="btn btn-default" style="width:100%;text-align:left" {{disabled}} data-toggle="modal" data-target="#entry-chooser-modal"> + {{#entryid}} + {{entryid}} + {{/entryid}} + {{^entryid}} + {{lang_spacer}} + {{/entryid}} + </button> + </td> + <td> + <input class="form-control title" name="entry[{{menuentryid}}][title]" value="{{title}}" + maxlength="100" {{readonly}}> + </td> - <td> - <select class="form-control key-list no-spacer" {{^entryid}}style="display: none;"{{/entryid}} name="entry[{{menuentryid}}][hotkey]" {{readonly}} data-default="{{hotkey}}"> - </select> - </td> + <td> + <select class="form-control key-list no-spacer" {{^entryid}}style="display: none;"{{/entryid}} name="entry[{{menuentryid}}][hotkey]" {{readonly}} data-default="{{hotkey}}"> + </select> + </td> - <td> - <input class="form-control no-spacer" {{^entryid}}style="display: none;"{{/entryid}} name="entry[{{menuentryid}}][plainpass]" type="{{password_type}}" - value="{{plainpass}}" {{readonly}}> - </td> - <td class="slx-smallcol" style="text-align: center; vertical-align: middle;"> - <div class="checkbox checkbox-inline no-spacer" style="text-align: left;margin: 0;{{^entryid}}display: none;{{/entryid}}"> - <input name="entry[{{menuentryid}}][hidden]" value="1" type="checkbox" {{#hidden}}checked{{/hidden}}> - <label></label> - </div> - </td> - <td class="slx-smallcol" style="text-align: center; vertical-align: middle;"> - <button type="button" class="btn btn-default remove-button"><span class="glyphicon glyphicon-remove"></span></button> - </td> - </tr> - {{/entries}} - </tbody> - </table> - </div> - <div class="text-right" style="margin-bottom: 20px"> - <button id="add-btn" type="button" class="btn btn-success" {{disabled}}> - <span class="glyphicon glyphicon-plus-sign"></span> - {{lang_add}} - </button> - </div> - <div class="text-right"> - <a href="?do=serversetup&show=menu" type="button" class="btn btn-default">{{lang_cancel}}</a> - <button id="save-button" type="submit" class="btn btn-primary" {{disabled}}> - <span class="glyphicon glyphicon-floppy-disk"></span> - {{lang_save}} - </button> - </div> - </form> + <td> + <input class="form-control no-spacer" {{^entryid}}style="display: none;"{{/entryid}} name="entry[{{menuentryid}}][plainpass]" type="{{password_type}}" + value="{{plainpass}}" {{readonly}}> + </td> + <td class="slx-smallcol" style="text-align: center; vertical-align: middle;"> + <div class="checkbox checkbox-inline no-spacer" style="text-align: left;margin: 0;{{^entryid}}display: none;{{/entryid}}"> + <input name="entry[{{menuentryid}}][hidden]" value="1" type="checkbox" {{#hidden}}checked{{/hidden}}> + <label></label> + </div> + </td> + <td class="slx-smallcol" style="text-align: center; vertical-align: middle;"> + <button type="button" class="btn btn-default remove-button"><span class="glyphicon glyphicon-remove"></span></button> + </td> + </tr> + {{/entries}} + </tbody> + </table> + </div> + <div class="text-right" style="margin-bottom: 20px"> + <button id="add-btn" type="button" class="btn btn-success" {{disabled}}> + <span class="glyphicon glyphicon-plus-sign"></span> + {{lang_add}} + </button> + </div> + </div> + </div> - <div class="modal fade" id="entry-chooser-modal" tabindex="-1" role="dialog"> - <div class="modal-dialog" role="document"> - <div class="modal-content"> - <div class="modal-header"> - <h5 class="modal-title">{{lang_entryChooserTitle}}</h5> - </div> - <div class="modal-body"> - <div class="form-group"> - <select id="entry-list" class="form-control"> - <option value="">{{lang_spacer}}</option> - {{#entrylist}} - <option value="{{entryid}}">{{entryid}} // {{title}}</option> - {{/entrylist}} - </select> - </div> + <div class="buttonbar text-right"> + <button type="submit" class="btn btn-primary" name="next" value="reload" {{disabled}}> + <span class="glyphicon glyphicon-floppy-disk"></span> + {{lang_saveAndReload}} + </button> + <button type="submit" class="btn btn-primary" {{disabled}}> + <span class="glyphicon glyphicon-floppy-disk"></span> + {{lang_save}} + </button> + </div> +</form> + +<div class="modal fade" id="entry-chooser-modal" tabindex="-1" role="dialog"> + <div class="modal-dialog modal-lg" role="document"> + <div class="modal-content"> + <div class="modal-header"> + <h5 class="modal-title">{{lang_entryChooserTitle}}</h5> + </div> + <div class="modal-body"> + <div class="form-group"> + <select id="entry-list" class="form-control"> + <option value="">{{lang_spacer}}</option> {{#entrylist}} - <div id="entrydata-{{entryid}}" class="entrydata"> - <div class="form-group"> - <label for="{{entryid}}-name">{{lang_entryTitle}}</label> - <pre id="{{entryid}}-name">{{title}}</pre> - </div> - {{#data}} - {{#script}} - <div class="form-group"> - <label for="{{entryid}}-script">{{lang_scriptContent}}</label> - <pre id="{{entryid}}-script">{{.}}</pre> - </div> - {{/script}} - {{^script}} - {{#arch}} - <div class="form-group"> - <label for="{{entryid}}-script">{{lang_archSelector}}</label> - <pre id="{{entryid}}-arch">{{.}}</pre> - </div> - {{/arch}} - {{#archAgnostic}} - <div class="form-group"> - <label for="{{entryid}}-executable">{{lang_imageToLoad}}</label> - <pre id="{{entryid}}-executable">{{executable}}</pre> - </div> - <div class="form-group"> - <label for="{{entryid}}-initRd">{{lang_initRd}}</label> - <pre id="{{entryid}}-initRd">{{initRd}}</pre> - </div> - <div class="form-group"> - <label for="{{entryid}}-commandLine">{{lang_commandLine}}</label> - <pre id="{{entryid}}-commandLine" >{{commandLine}}</pre> - </div> - {{/archAgnostic}} - {{#PCBIOS}} - <div class="panel panel-default"> - <div class="panel-heading">PCBIOS</div> - <div class="panel-body"> - <div class="form-group"> - <label for="{{entryid}}-executable">{{lang_imageToLoad}}</label> - <pre id="{{entryid}}-executable">{{executable}}</pre> - </div> - <div class="form-group"> - <label for="{{entryid}}-initRd">{{lang_initRd}}</label> - <pre id="{{entryid}}-initRd">{{initRd}}</pre> - </div> - <div class="form-group"> - <label for="{{entryid}}-commandLine">{{lang_commandLine}}</label> - <pre id="{{entryid}}-commandLine" >{{commandLine}}</pre> - </div> - </div> - </div> - {{/PCBIOS}} - {{#EFI}} - <div class="panel panel-default"> - <div class="panel-heading">EFI</div> - <div class="panel-body"> - <div class="form-group"> - <label for="{{entryid}}-executable">{{lang_imageToLoad}}</label> - <pre id="{{entryid}}-executable">{{executable}}</pre> - </div> - <div class="form-group"> - <label for="{{entryid}}-initRd">{{lang_initRd}}</label> - <pre id="{{entryid}}-initRd">{{initRd}}</pre> - </div> - <div class="form-group"> - <label for="{{entryid}}-commandLine">{{lang_commandLine}}</label> - <pre id="{{entryid}}-commandLine" >{{commandLine}}</pre> - </div> - </div> - </div> - {{/EFI}} - {{/script}} - {{/data}} - </div> + <option value="{{entryid}}">{{entryid}} // {{title}}</option> {{/entrylist}} + </select> + </div> + {{#entrylist}} + <div id="entrydata-{{entryid}}" class="entrydata"> + <div> + {{lang_entryTitle}}: <b>{{title}}</b> </div> - <div class="modal-footer"> - <button type="button" class="btn btn-default" data-dismiss="modal">{{lang_cancel}}</button> - <button type="button" class="btn btn-primary" id="choose-entry">{{lang_ok}}</button> + {{#data}} + {{#script}} + <hr> + <div> + <label>{{lang_scriptContent}}</label> + <pre>{{.}}</pre> </div> + {{/script}} + {{#arch}} + <div> + {{lang_archSelector}}: <b>{{.}}</b> + </div> + {{/arch}} + {{#archAgnostic}} + <hr> + <label>{{lang_imageToLoad}}</label> + <pre>{{executable}}</pre> + <label>{{lang_initRd}}</label> + <pre>{{initRd}}</pre> + <label>{{lang_commandLine}}</label> + <pre>{{commandLine}}</pre> + {{/archAgnostic}} + {{#PCBIOS}} + <hr> + <h4>PCBIOS</h4> + <label>{{lang_imageToLoad}}</label> + <pre>{{executable}}</pre> + <label>{{lang_initRd}}</label> + <pre>{{initRd}}</pre> + <label>{{lang_commandLine}}</label> + <pre>{{commandLine}}</pre> + {{/PCBIOS}} + {{#EFI}} + <hr> + <h4>EFI</h4> + <label for="{{entryid}}-executable">{{lang_imageToLoad}}</label> + <pre id="{{entryid}}-executable">{{executable}}</pre> + <label for="{{entryid}}-initRd">{{lang_initRd}}</label> + <pre id="{{entryid}}-initRd">{{initRd}}</pre> + <label for="{{entryid}}-commandLine">{{lang_commandLine}}</label> + <pre id="{{entryid}}-commandLine" >{{commandLine}}</pre> + {{/EFI}} + {{/data}} + {{#ishook}} + {{lang_hookOfModule}}: <b>{{moduleName}}</b> + <hr> + <table class="slx-table"> + <tr> + <td class="slx-bold">{{lang_moduleSpecificId}}:</td> + <td class="monospace slx-bold">{{id}}</td> + </tr> + {{#otherFields}} + <tr> + <td>{{key}}:</td> + <td class="monospace">{{value}}</td> + </tr> + {{/otherFields}} + </table> + {{/ishook}} </div> + {{/entrylist}} + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-default" data-dismiss="modal">{{lang_cancel}}</button> + <button type="button" class="btn btn-primary" id="choose-entry">{{lang_ok}}</button> </div> </div> </div> </div> + <div class="hidden"> <select id="key-list-template"> <option value="">{{lang_none}}</option> |