Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions packages/web/management/js/fog/fog.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -5328,6 +5328,7 @@ function reinitialize() {
setupPasswordReveal();
setupUniversalSearch();
setupInfoCard();
setupInfoCardActions();
};

/**
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 ""

Expand Down Expand Up @@ -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 ""

Expand Down Expand Up @@ -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."
Expand Down Expand Up @@ -12147,6 +12158,10 @@ msgstr ""
msgid "host"
msgstr "Host"

#, fuzzy, php-format
msgid "host \"%s\""
msgstr "Hosts"

#, fuzzy
msgid "host is"
msgstr "Hosts"
Expand Down Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 ""

Expand Down Expand Up @@ -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 ""

Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -12153,6 +12164,10 @@ msgstr ""
msgid "host"
msgstr "host"

#, fuzzy, php-format
msgid "host \"%s\""
msgstr "host"

#, fuzzy
msgid "host is"
msgstr "host"
Expand Down Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 ""

Expand Down Expand Up @@ -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 ""

Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 ""

Expand Down Expand Up @@ -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 ""

Expand Down Expand Up @@ -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."
Expand Down Expand Up @@ -12148,6 +12159,10 @@ msgstr ""
msgid "host"
msgstr "Host"

#, fuzzy, php-format
msgid "host \"%s\""
msgstr "Hosts"

#, fuzzy
msgid "host is"
msgstr "Hosts"
Expand Down Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 ""

Expand Down Expand Up @@ -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 ""

Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
Loading
Loading