diff --git a/packages/web/management/js/fog/fog.common.js b/packages/web/management/js/fog/fog.common.js index 268fcfeb0f..1a04a1b757 100644 --- a/packages/web/management/js/fog/fog.common.js +++ b/packages/web/management/js/fog/fog.common.js @@ -5328,6 +5328,7 @@ function reinitialize() { setupPasswordReveal(); setupUniversalSearch(); setupInfoCard(); + setupInfoCardActions(); }; /** @@ -5395,6 +5396,73 @@ function setupInfoCard() { }); } + +/** + * The info card's one-click task buttons. + * + * Straight to the create endpoint. The options form at + * ?node={node}&sub=deploy is skipped deliberately -- Deploy, Capture and + * Multi-Cast need nothing off it, and fetching it only to post it back + * unchanged is the click this exists to remove. Everything that form's POST + * is checked for -- a pending host, an assigned and enabled image, a + * protected image on a capture, one image across a multicast -- is checked + * in deployPost(), not in the form, so nothing is skipped but the rendering. + * + * scheduleType is the one field that must be sent: validateScheduleType() + * throws on an absent value rather than defaulting, so an empty body would + * come back "Invalid scheduling type". + * + * Every button confirms first. The list grid's equivalents do not, but there + * you have ticked a row to get them; here you arrive on this page just by + * clicking a host name, and one stray click would deploy over a running + * machine -- or, from a group, over all of them. The text is built server + * side (FOGPageRender::renderQuickTaskActions) because it is translated. + */ +function setupInfoCardActions() { + // Guards the window between the click and the server's answer. Per button + // rather than one flag for the card: Deploy and Capture are different + // taskings and there is no reason firing one should block the other. The + // button stays enabled underneath so nothing has to re-enable it on a + // refusal; this is only about the impatient double-click, which would + // otherwise be two identical taskings. + var running = {}; + + // Delegated and namespaced: the card is torn down and rebuilt with the + // page on every AJAX nav, so a direct binding would be lost on the first + // one and doPageLoad() would stack a new one per visit. + $(document) + .off('click.fogQuickTask') + .on('click.fogQuickTask', '.fog-quicktask', function(e) { + e.preventDefault(); + var btn = $(this), + node = btn.data('node'), + id = btn.data('id'), + type = btn.data('type'), + key = node + ':' + id + ':' + type; + if (running[key]) { + return; + } + if (!window.confirm(btn.data('confirm'))) { + return; + } + running[key] = true; + $.apiCall( + 'post', + '../management/index.php?node=' + encodeURIComponent(node) + + '&sub=deploy&id=' + encodeURIComponent(id) + + '&type=' + encodeURIComponent(type), + {scheduleType: 'instant'}, + function() { + // Both outcomes land here and both only need the lock released. + // apiCall has already drawn the toast, and there is nothing on + // this page to repaint: the card's Last Deployed is the date the + // last task FINISHED, which a task just queued has not. + running[key] = false; + } + ); + }); +} + // Select2 builds its search inputs with neither id/name nor a label, tripping // the browser's "form field should have an id or name" autofill advisory and the // "no label associated with a form field" accessibility advisory. There are two diff --git a/packages/web/management/languages/de_DE.UTF-8/LC_MESSAGES/messages.po b/packages/web/management/languages/de_DE.UTF-8/LC_MESSAGES/messages.po index 4b47e8f510..3fe5ef2ae0 100644 --- a/packages/web/management/languages/de_DE.UTF-8/LC_MESSAGES/messages.po +++ b/packages/web/management/languages/de_DE.UTF-8/LC_MESSAGES/messages.po @@ -2410,6 +2410,10 @@ msgstr "Benutzer erfolgreich erstellt" msgid "Create Users On First Login" msgstr "" +#, fuzzy, php-format +msgid "Create a %1$s task for %2$s?" +msgstr "Benutzer erfolgreich erstellt" + #, fuzzy, php-format msgid "Create a %s" msgstr "Neue %s erstellen" @@ -7869,6 +7873,10 @@ msgstr "" msgid "Queued deletion is not active and cannot be canceled" msgstr "Snapin ist geschützt und kann nicht gelöscht werden" +#, fuzzy +msgid "Quick tasks" +msgstr "Aktive Multicast-Tasks" + msgid "RESOURCES" msgstr "" @@ -10412,7 +10420,6 @@ msgstr "" msgid "The term goes in q. limit caps results PER CLASS, not overall, and this route is not paged -- there is no nextUrl to follow. Within a class, names that start with the term sort first. Both fields may also be sent as POST body fields. Also reachable as /search." msgstr "" -#, php-format msgid "The term. Because it is a path segment, a term containing / ? # or % cannot travel this way; use /unisearch?q= instead." msgstr "" @@ -11852,6 +11859,10 @@ msgstr "" msgid "ago" msgstr "vor" +#, php-format +msgid "all %1$d hosts in group \"%2$s\"" +msgstr "" + #, fuzzy msgid "all current storage nodes" msgstr "momentanen Speicherknoten löschen." @@ -12147,6 +12158,10 @@ msgstr "" msgid "host" msgstr "Host" +#, fuzzy, php-format +msgid "host \"%s\"" +msgstr "Hosts" + #, fuzzy msgid "host is" msgstr "Hosts" @@ -13809,10 +13824,6 @@ msgstr "" #~ msgid "min (all)" #~ msgstr "Aktiviert" -#, fuzzy -#~ msgid "multicast tasks!" -#~ msgstr "Aktive Multicast-Tasks" - #, fuzzy #~ msgid "no database to" #~ msgstr "Keine Datenbank zum" diff --git a/packages/web/management/languages/en_US.UTF-8/LC_MESSAGES/messages.po b/packages/web/management/languages/en_US.UTF-8/LC_MESSAGES/messages.po index 394a393447..cac44bb7ba 100644 --- a/packages/web/management/languages/en_US.UTF-8/LC_MESSAGES/messages.po +++ b/packages/web/management/languages/en_US.UTF-8/LC_MESSAGES/messages.po @@ -2413,6 +2413,10 @@ msgstr "User created" msgid "Create Users On First Login" msgstr "" +#, fuzzy, php-format +msgid "Create a %1$s task for %2$s?" +msgstr "User created" + #, fuzzy, php-format msgid "Create a %s" msgstr "Create New %s" @@ -7880,6 +7884,10 @@ msgstr "" msgid "Queued deletion is not active and cannot be canceled" msgstr "Snapin is protected and cannot be deleted" +#, fuzzy +msgid "Quick tasks" +msgstr "Active Multicast Tasks" + msgid "RESOURCES" msgstr "" @@ -10421,7 +10429,6 @@ msgstr "" msgid "The term goes in q. limit caps results PER CLASS, not overall, and this route is not paged -- there is no nextUrl to follow. Within a class, names that start with the term sort first. Both fields may also be sent as POST body fields. Also reachable as /search." msgstr "" -#, php-format msgid "The term. Because it is a path segment, a term containing / ? # or % cannot travel this way; use /unisearch?q= instead." msgstr "" @@ -11860,6 +11867,10 @@ msgstr "" msgid "ago" msgstr " ago" +#, php-format +msgid "all %1$d hosts in group \"%2$s\"" +msgstr "" + #, fuzzy msgid "all current storage nodes" msgstr "Invalid storage node" @@ -12153,6 +12164,10 @@ msgstr "" msgid "host" msgstr "host" +#, fuzzy, php-format +msgid "host \"%s\"" +msgstr "host" + #, fuzzy msgid "host is" msgstr "host" @@ -13770,10 +13785,6 @@ msgstr "" #~ msgid "min (all)" #~ msgstr "Enabled" -#, fuzzy -#~ msgid "multicast tasks!" -#~ msgstr "Active Multicast Tasks" - #, fuzzy #~ msgid "no database to" #~ msgstr "No database to work off" diff --git a/packages/web/management/languages/es_ES.UTF-8/LC_MESSAGES/messages.po b/packages/web/management/languages/es_ES.UTF-8/LC_MESSAGES/messages.po index 1caee998b9..ad38dff2f0 100644 --- a/packages/web/management/languages/es_ES.UTF-8/LC_MESSAGES/messages.po +++ b/packages/web/management/languages/es_ES.UTF-8/LC_MESSAGES/messages.po @@ -2431,6 +2431,10 @@ msgstr "creado por el usuario" msgid "Create Users On First Login" msgstr "" +#, fuzzy, php-format +msgid "Create a %1$s task for %2$s?" +msgstr "creado por el usuario" + #, fuzzy, php-format msgid "Create a %s" msgstr "Crear nuevo grupo" @@ -7998,6 +8002,10 @@ msgstr "" msgid "Queued deletion is not active and cannot be canceled" msgstr "está protegido, no se permite la eliminación" +#, fuzzy +msgid "Quick tasks" +msgstr "MulticastTask" + msgid "RESOURCES" msgstr "" @@ -10579,7 +10587,6 @@ msgstr "" msgid "The term goes in q. limit caps results PER CLASS, not overall, and this route is not paged -- there is no nextUrl to follow. Within a class, names that start with the term sort first. Both fields may also be sent as POST body fields. Also reachable as /search." msgstr "" -#, php-format msgid "The term. Because it is a path segment, a term containing / ? # or % cannot travel this way; use /unisearch?q= instead." msgstr "" @@ -12020,6 +12027,10 @@ msgstr "" msgid "ago" msgstr " hace" +#, php-format +msgid "all %1$d hosts in group \"%2$s\"" +msgstr "" + #, fuzzy msgid "all current storage nodes" msgstr "nodo de almacenamiento no válido" @@ -12314,6 +12325,10 @@ msgstr "" msgid "host" msgstr "anfitrión" +#, fuzzy, php-format +msgid "host \"%s\"" +msgstr "anfitrión" + #, fuzzy msgid "host is" msgstr "anfitrión" @@ -13915,10 +13930,6 @@ msgstr "" #~ msgid "min (all)" #~ msgstr "habilitado" -#, fuzzy -#~ msgid "multicast tasks!" -#~ msgstr "MulticastTask" - #, fuzzy #~ msgid "not found on disk" #~ msgstr "No se encontró Clase FOGPage para este nodo" diff --git a/packages/web/management/languages/eu_ES.UTF-8/LC_MESSAGES/messages.po b/packages/web/management/languages/eu_ES.UTF-8/LC_MESSAGES/messages.po index 03abe4584f..232108da8e 100644 --- a/packages/web/management/languages/eu_ES.UTF-8/LC_MESSAGES/messages.po +++ b/packages/web/management/languages/eu_ES.UTF-8/LC_MESSAGES/messages.po @@ -2410,6 +2410,10 @@ msgstr "Benutzer erfolgreich erstellt" msgid "Create Users On First Login" msgstr "" +#, fuzzy, php-format +msgid "Create a %1$s task for %2$s?" +msgstr "Benutzer erfolgreich erstellt" + #, fuzzy, php-format msgid "Create a %s" msgstr "Neue %s erstellen" @@ -7870,6 +7874,10 @@ msgstr "" msgid "Queued deletion is not active and cannot be canceled" msgstr "Snapin ist geschützt und kann nicht gelöscht werden" +#, fuzzy +msgid "Quick tasks" +msgstr "Aktive Multicast-Tasks" + msgid "RESOURCES" msgstr "" @@ -10413,7 +10421,6 @@ msgstr "" msgid "The term goes in q. limit caps results PER CLASS, not overall, and this route is not paged -- there is no nextUrl to follow. Within a class, names that start with the term sort first. Both fields may also be sent as POST body fields. Also reachable as /search." msgstr "" -#, php-format msgid "The term. Because it is a path segment, a term containing / ? # or % cannot travel this way; use /unisearch?q= instead." msgstr "" @@ -11853,6 +11860,10 @@ msgstr "" msgid "ago" msgstr "vor" +#, php-format +msgid "all %1$d hosts in group \"%2$s\"" +msgstr "" + #, fuzzy msgid "all current storage nodes" msgstr "momentanen Speicherknoten löschen." @@ -12148,6 +12159,10 @@ msgstr "" msgid "host" msgstr "Host" +#, fuzzy, php-format +msgid "host \"%s\"" +msgstr "Hosts" + #, fuzzy msgid "host is" msgstr "Hosts" @@ -13810,10 +13825,6 @@ msgstr "" #~ msgid "min (all)" #~ msgstr "Aktiviert" -#, fuzzy -#~ msgid "multicast tasks!" -#~ msgstr "Aktive Multicast-Tasks" - #, fuzzy #~ msgid "no database to" #~ msgstr "Keine Datenbank zum" diff --git a/packages/web/management/languages/fr_FR.UTF-8/LC_MESSAGES/messages.po b/packages/web/management/languages/fr_FR.UTF-8/LC_MESSAGES/messages.po index 34d4e9fc2b..537d138abd 100644 --- a/packages/web/management/languages/fr_FR.UTF-8/LC_MESSAGES/messages.po +++ b/packages/web/management/languages/fr_FR.UTF-8/LC_MESSAGES/messages.po @@ -2413,6 +2413,10 @@ msgstr "utilisateur créé" msgid "Create Users On First Login" msgstr "" +#, fuzzy, php-format +msgid "Create a %1$s task for %2$s?" +msgstr "utilisateur créé" + #, fuzzy, php-format msgid "Create a %s" msgstr "Créer un nouveau %s" @@ -7865,6 +7869,10 @@ msgstr "" msgid "Queued deletion is not active and cannot be canceled" msgstr "Snapin est protégé et ne peut être supprimé" +#, fuzzy +msgid "Quick tasks" +msgstr "Tâches Multicast actifs" + msgid "RESOURCES" msgstr "" @@ -10405,7 +10413,6 @@ msgstr "" msgid "The term goes in q. limit caps results PER CLASS, not overall, and this route is not paged -- there is no nextUrl to follow. Within a class, names that start with the term sort first. Both fields may also be sent as POST body fields. Also reachable as /search." msgstr "" -#, php-format msgid "The term. Because it is a path segment, a term containing / ? # or % cannot travel this way; use /unisearch?q= instead." msgstr "" @@ -11845,6 +11852,10 @@ msgstr "" msgid "ago" msgstr " depuis" +#, php-format +msgid "all %1$d hosts in group \"%2$s\"" +msgstr "" + #, fuzzy msgid "all current storage nodes" msgstr "nœud de stockage non valide" @@ -12138,6 +12149,10 @@ msgstr "" msgid "host" msgstr "hôte" +#, fuzzy, php-format +msgid "host \"%s\"" +msgstr "hôte" + #, fuzzy msgid "host is" msgstr "hôte" @@ -13759,10 +13774,6 @@ msgstr "" #~ msgid "min (all)" #~ msgstr "Activée" -#, fuzzy -#~ msgid "multicast tasks!" -#~ msgstr "Tâches Multicast actifs" - #, fuzzy #~ msgid "no database to" #~ msgstr "Aucune base de données de travailler hors" diff --git a/packages/web/management/languages/it_IT.UTF-8/LC_MESSAGES/messages.po b/packages/web/management/languages/it_IT.UTF-8/LC_MESSAGES/messages.po index 5f5ba1a7fd..112f91ab1d 100644 --- a/packages/web/management/languages/it_IT.UTF-8/LC_MESSAGES/messages.po +++ b/packages/web/management/languages/it_IT.UTF-8/LC_MESSAGES/messages.po @@ -2355,6 +2355,10 @@ msgstr "Creazione utente riuscita" msgid "Create Users On First Login" msgstr "" +#, fuzzy, php-format +msgid "Create a %1$s task for %2$s?" +msgstr "Creazione utente riuscita" + #, fuzzy, php-format msgid "Create a %s" msgstr "Crea nuovo %s" @@ -7662,6 +7666,10 @@ msgstr "" msgid "Queued deletion is not active and cannot be canceled" msgstr "Snapin è protetto e non può essere cancellato" +#, fuzzy +msgid "Quick tasks" +msgstr "Compiti multicast attivi" + msgid "RESOURCES" msgstr "" @@ -10128,7 +10136,6 @@ msgstr "" msgid "The term goes in q. limit caps results PER CLASS, not overall, and this route is not paged -- there is no nextUrl to follow. Within a class, names that start with the term sort first. Both fields may also be sent as POST body fields. Also reachable as /search." msgstr "" -#, php-format msgid "The term. Because it is a path segment, a term containing / ? # or % cannot travel this way; use /unisearch?q= instead." msgstr "" @@ -11528,6 +11535,10 @@ msgstr "" msgid "ago" msgstr "fa" +#, php-format +msgid "all %1$d hosts in group \"%2$s\"" +msgstr "" + msgid "all current storage nodes" msgstr "tutti i nodi di archiviazione attivi" @@ -11811,6 +11822,10 @@ msgstr "" msgid "host" msgstr "host" +#, fuzzy, php-format +msgid "host \"%s\"" +msgstr "hosts" + #, fuzzy msgid "host is" msgstr "hosts" @@ -13410,10 +13425,6 @@ msgstr "" #~ msgid "min (all)" #~ msgstr "Abilitato" -#, fuzzy -#~ msgid "multicast tasks!" -#~ msgstr "Compiti multicast attivi" - #~ msgid "no database to" #~ msgstr "Nessun database a" diff --git a/packages/web/management/languages/ja_JP.UTF-8/LC_MESSAGES/messages.po b/packages/web/management/languages/ja_JP.UTF-8/LC_MESSAGES/messages.po index 9ee1c1f9d7..ea294efbd8 100644 --- a/packages/web/management/languages/ja_JP.UTF-8/LC_MESSAGES/messages.po +++ b/packages/web/management/languages/ja_JP.UTF-8/LC_MESSAGES/messages.po @@ -2340,6 +2340,10 @@ msgstr "タスクタイプを作成" msgid "Create Users On First Login" msgstr "" +#, fuzzy, php-format +msgid "Create a %1$s task for %2$s?" +msgstr "タスク状態を作成" + #, fuzzy, php-format msgid "Create a %s" msgstr "新しい %s を作成" @@ -7642,6 +7646,10 @@ msgstr "" msgid "Queued deletion is not active and cannot be canceled" msgstr "スナップインは保護されているため削除できません" +#, fuzzy +msgid "Quick tasks" +msgstr "マルチキャストタスク" + msgid "RESOURCES" msgstr "" @@ -10085,7 +10093,6 @@ msgstr "" msgid "The term goes in q. limit caps results PER CLASS, not overall, and this route is not paged -- there is no nextUrl to follow. Within a class, names that start with the term sort first. Both fields may also be sent as POST body fields. Also reachable as /search." msgstr "" -#, php-format msgid "The term. Because it is a path segment, a term containing / ? # or % cannot travel this way; use /unisearch?q= instead." msgstr "" @@ -11484,6 +11491,10 @@ msgstr "" msgid "ago" msgstr "前" +#, php-format +msgid "all %1$d hosts in group \"%2$s\"" +msgstr "" + msgid "all current storage nodes" msgstr "現在のすべてのストレージノード" @@ -11767,6 +11778,10 @@ msgstr "ビットレート" msgid "host" msgstr "ホスト" +#, fuzzy, php-format +msgid "host \"%s\"" +msgstr "ホスト" + #, fuzzy msgid "host is" msgstr "ホスト" @@ -14918,10 +14933,6 @@ msgstr "" #~ msgid "more secure" #~ msgstr "より安全" -#, fuzzy -#~ msgid "multicast tasks!" -#~ msgstr "マルチキャストタスク" - #~ msgid "no login will appear" #~ msgstr "ログイン画面は表示されません" diff --git a/packages/web/management/languages/messages.pot b/packages/web/management/languages/messages.pot index 370ce07fc0..0f96014895 100644 --- a/packages/web/management/languages/messages.pot +++ b/packages/web/management/languages/messages.pot @@ -2083,6 +2083,10 @@ msgstr "" msgid "Create Users On First Login" msgstr "" +#, php-format +msgid "Create a %1$s task for %2$s?" +msgstr "" + #, php-format msgid "Create a %s" msgstr "" @@ -6741,6 +6745,9 @@ msgstr "" msgid "Queued deletion is not active and cannot be canceled" msgstr "" +msgid "Quick tasks" +msgstr "" + msgid "RESOURCES" msgstr "" @@ -8925,7 +8932,6 @@ msgstr "" msgid "The term goes in q. limit caps results PER CLASS, not overall, and this route is not paged -- there is no nextUrl to follow. Within a class, names that start with the term sort first. Both fields may also be sent as POST body fields. Also reachable as /search." msgstr "" -#, php-format msgid "The term. Because it is a path segment, a term containing / ? # or % cannot travel this way; use /unisearch?q= instead." msgstr "" @@ -10204,6 +10210,10 @@ msgstr "" msgid "ago" msgstr "" +#, php-format +msgid "all %1$d hosts in group \"%2$s\"" +msgstr "" + msgid "all current storage nodes" msgstr "" @@ -10460,6 +10470,10 @@ msgstr "" msgid "host" msgstr "" +#, php-format +msgid "host \"%s\"" +msgstr "" + msgid "host is" msgstr "" diff --git a/packages/web/management/languages/pt_BR.UTF-8/LC_MESSAGES/messages.po b/packages/web/management/languages/pt_BR.UTF-8/LC_MESSAGES/messages.po index 6f8a33f5b2..498df9cbd2 100644 --- a/packages/web/management/languages/pt_BR.UTF-8/LC_MESSAGES/messages.po +++ b/packages/web/management/languages/pt_BR.UTF-8/LC_MESSAGES/messages.po @@ -2413,6 +2413,10 @@ msgstr "usuário criado" msgid "Create Users On First Login" msgstr "" +#, fuzzy, php-format +msgid "Create a %1$s task for %2$s?" +msgstr "usuário criado" + #, fuzzy, php-format msgid "Create a %s" msgstr "Criar novo %s" @@ -7867,6 +7871,10 @@ msgstr "" msgid "Queued deletion is not active and cannot be canceled" msgstr "Snapin está protegido e não pode ser excluído" +#, fuzzy +msgid "Quick tasks" +msgstr "Tarefas Multicast ativos" + msgid "RESOURCES" msgstr "" @@ -10408,7 +10416,6 @@ msgstr "" msgid "The term goes in q. limit caps results PER CLASS, not overall, and this route is not paged -- there is no nextUrl to follow. Within a class, names that start with the term sort first. Both fields may also be sent as POST body fields. Also reachable as /search." msgstr "" -#, php-format msgid "The term. Because it is a path segment, a term containing / ? # or % cannot travel this way; use /unisearch?q= instead." msgstr "" @@ -11848,6 +11855,10 @@ msgstr "" msgid "ago" msgstr " atrás" +#, php-format +msgid "all %1$d hosts in group \"%2$s\"" +msgstr "" + #, fuzzy msgid "all current storage nodes" msgstr "nó de armazenamento inválido" @@ -12141,6 +12152,10 @@ msgstr "" msgid "host" msgstr "anfitrião" +#, fuzzy, php-format +msgid "host \"%s\"" +msgstr "anfitrião" + #, fuzzy msgid "host is" msgstr "anfitrião" @@ -13762,10 +13777,6 @@ msgstr "" #~ msgid "min (all)" #~ msgstr "ativado" -#, fuzzy -#~ msgid "multicast tasks!" -#~ msgstr "Tarefas Multicast ativos" - #, fuzzy #~ msgid "no database to" #~ msgstr "Nenhum banco de dados para trabalhar fora" diff --git a/packages/web/management/languages/zh_CN.UTF-8/LC_MESSAGES/messages.po b/packages/web/management/languages/zh_CN.UTF-8/LC_MESSAGES/messages.po index ee144b805d..4e7b96548f 100644 --- a/packages/web/management/languages/zh_CN.UTF-8/LC_MESSAGES/messages.po +++ b/packages/web/management/languages/zh_CN.UTF-8/LC_MESSAGES/messages.po @@ -2413,6 +2413,10 @@ msgstr "用户创建" msgid "Create Users On First Login" msgstr "" +#, fuzzy, php-format +msgid "Create a %1$s task for %2$s?" +msgstr "用户创建" + #, fuzzy, php-format msgid "Create a %s" msgstr "新建%s" @@ -7867,6 +7871,10 @@ msgstr "" msgid "Queued deletion is not active and cannot be canceled" msgstr "管理单元被保护,不能被删除" +#, fuzzy +msgid "Quick tasks" +msgstr "活动组播任务" + msgid "RESOURCES" msgstr "" @@ -10408,7 +10416,6 @@ msgstr "" msgid "The term goes in q. limit caps results PER CLASS, not overall, and this route is not paged -- there is no nextUrl to follow. Within a class, names that start with the term sort first. Both fields may also be sent as POST body fields. Also reachable as /search." msgstr "" -#, php-format msgid "The term. Because it is a path segment, a term containing / ? # or % cannot travel this way; use /unisearch?q= instead." msgstr "" @@ -11848,6 +11855,10 @@ msgstr "" msgid "ago" msgstr "前" +#, php-format +msgid "all %1$d hosts in group \"%2$s\"" +msgstr "" + #, fuzzy msgid "all current storage nodes" msgstr "无效的存储节点" @@ -12141,6 +12152,10 @@ msgstr "" msgid "host" msgstr "主办" +#, fuzzy, php-format +msgid "host \"%s\"" +msgstr "主办" + #, fuzzy msgid "host is" msgstr "主办" @@ -13762,10 +13777,6 @@ msgstr "" #~ msgid "min (all)" #~ msgstr "启用" -#, fuzzy -#~ msgid "multicast tasks!" -#~ msgstr "活动组播任务" - #, fuzzy #~ msgid "no database to" #~ msgstr "没有数据库工作关闭" diff --git a/packages/web/src/Base/FOGPage.php b/packages/web/src/Base/FOGPage.php index 16afb38253..c7d3635072 100644 --- a/packages/web/src/Base/FOGPage.php +++ b/packages/web/src/Base/FOGPage.php @@ -99,6 +99,18 @@ abstract class FOGPage extends FOGBase * @var array */ public $noteSources = []; + /** + * Pre-rendered action buttons for the info card, or ''. + * + * Sits to the right of the notes in the same card. Built by a page's + * edit() -- renderQuickTaskActions() is the only builder today -- and + * echoed by renderInfoCard(). A string rather than a spec array because + * the only thing the renderer does with it is echo it, and the pages + * that set it are already building markup with makeButton(). + * + * @var string + */ + public $noteActions = ''; /** * Table header data * diff --git a/packages/web/src/Base/FOGPageRender.php b/packages/web/src/Base/FOGPageRender.php index bde8ae1056..01b5f320da 100644 --- a/packages/web/src/Base/FOGPageRender.php +++ b/packages/web/src/Base/FOGPageRender.php @@ -546,23 +546,128 @@ protected static function noteSourceAttrs($source) return $attrs; } + /** + * The info card's one-click task buttons. + * + * The host and group LIST grids have carried these since + * HostManagement::_quickTaskItems(): the two or three task types that + * take no options, fired straight at the create endpoint instead of + * fetching an options form only to post it back untouched. This is the + * same affordance on the edit pages, so an admin already looking at a + * host or a group does not have to go back to the grid, find the row + * again and tick it to do the obvious thing to it. + * + * Deploy and Capture for a host, Deploy and Multi-Cast for a group -- + * the same pairing _quickTaskItems() documents, and for the same + * reason: those are the types that need no options, which is the whole + * reason they can be one click. + * + * btn-secondary, and neither of them primary. Nothing here is the card's + * commit action -- the General tab's Update is -- so these are two + * shortcuts in a header strip, not a decision cluster in a form footer, + * and the weight a red button would carry is carried by the + * confirmation instead. It is also what the list grid's own quick + * buttons are, since DataTables draws its button bar that way. + * + * Filled, NOT btn-outline-secondary, and that is a contrast decision + * rather than a taste one. Outline keeps #6c757d as the TEXT color, and + * against the dark card (#212529) that is 3.29:1 -- under the 4.5:1 AA + * floor for body-sized text. Filled puts white on #6c757d instead and + * holds 4.69:1 in both themes. Measured against the shipped + * adminlte4.min.css + fog-default-ui.min.css, not assumed. + * + * @param string $node Page node, e.g. 'host' or 'group'. Also decides + * the permission: ?node=X&sub=deploy resolves to + * X.task via Authorization::_subToAction(), so + * the gate here and the gate the POST hits are + * the same string by construction. + * @param int $id The entity being edited. + * @param array $typeIds TaskType ids, in the order they should appear. + * @param string $target Already-translated description of what the task + * lands on, e.g. 'host "foo"'. Interpolated into + * the confirmation. Built by the caller because + * only the caller knows whether it is one machine + * or a group of them. + * + * @return string The button group markup, or '' if none may be shown. + */ + public static function renderQuickTaskActions( + $node, + $id, + array $typeIds, + $target + ) { + // Same refusal _quickTaskItems() makes: a user without the + // permission would be shown buttons whose POST can only be denied. + if (!Authorization::can($node . '.task')) { + return ''; + } + + $buttons = ''; + foreach ($typeIds as $typeId) { + $TaskType = new TaskType($typeId); + // A server whose taskTypes row was deleted simply loses that + // button, the same way the accordion and the grid lose theirs. + if (!$TaskType->isValid()) { + continue; + } + $name = (string)$TaskType->get('name'); + // Built here, not in the script. gettext runs server side, so a + // sentence assembled in JS would never reach the .pot -- the + // same reason noteSourceAttrs() builds its on/off labels here. + $confirm = sprintf( + _('Create a %1$s task for %2$s?'), + $name, + $target + ); + $buttons .= self::makeButton( + 'quicktask-' . \Initiator::e($node) . '-' . (int)$TaskType->get('id'), + ' ' . \Initiator::e($name), + 'btn btn-secondary fog-quicktask', + 'type="button"' + . ' data-node="' . \Initiator::e($node) . '"' + . ' data-id="' . (int)$id . '"' + . ' data-type="' . (int)$TaskType->get('id') . '"' + . ' data-confirm="' . \Initiator::e($confirm) . '"' + ); + } + if ('' === $buttons) { + return ''; + } + + return '