diff options
Diffstat (limited to 'modules-available/runmode/templates')
-rw-r--r-- | modules-available/runmode/templates/machine-selector.html | 31 | ||||
-rw-r--r-- | modules-available/runmode/templates/module-machine-list.html | 4 |
2 files changed, 23 insertions, 12 deletions
diff --git a/modules-available/runmode/templates/machine-selector.html b/modules-available/runmode/templates/machine-selector.html index 7f37f5a2..8b608f7e 100644 --- a/modules-available/runmode/templates/machine-selector.html +++ b/modules-available/runmode/templates/machine-selector.html @@ -1,12 +1,7 @@ <h1>{{lang_assignRunmodeToMachine}}</h1> <h2>{{moduleName}} // {{modeName}}</h2> -<p>{{lang_assignMachineIntroText}}</p> -<div class="hidden"> - {{#machines}} - <div id="qex-{{machineuuid}}">{{hostname}}</div> - {{/machines}} -</div> +<p>{{lang_assignMachineIntroText}}</p> <h4>{{lang_addNewMachines}}</h4> <form method="post" action="?do=runmode"> @@ -15,13 +10,18 @@ <input type="hidden" name="module" value="{{module}}" id="i-module"> <input type="hidden" name="modeid" value="{{modeid}}" id="i-modeid"> <input type="hidden" name="redirect" value="{{redirect}}"> - <select id="machine-sel" name="machines[]" multiple> + <select id="machine-sel" name="machines[]" multiple {{disabled}}> </select> <div class="buttonbar"> - <button type="submit" class="btn btn-primary">{{lang_save}}</button> + <button type="submit" class="btn btn-primary" {{disabled}}>{{lang_save}}</button> </div> </form> +{{#add-only}} + <h4>{{lang_existingClients}}</h4> + <div id="existing-list"></div> +{{/add-only}} + <script type="application/javascript"><!-- const MODULE = document.getElementById('i-module').value; @@ -58,7 +58,7 @@ function loadMachines(query, callback) { } } $.ajax({ - url: '?do=runmode&action=getmachines&query=' + encodeURIComponent(query), + url: '?do=runmode&action=getmachines&module={{module}}&query=' + encodeURIComponent(query), type: 'GET', dataType: 'json', error: function () { @@ -120,6 +120,17 @@ document.addEventListener('DOMContentLoaded', function () { })(); }); var old = {{{machines}}} || []; + var list = $('#existing-list'); + if (list.length !== 0) { + old.forEach(function (x) { list.append(renderMachineOption(x, function(str) { + return (str + '') + .replace(/&/g, '&') + .replace(/</g, '<') + .replace(/>/g, '>') + .replace(/"/g, '"'); + }))}); + old = []; + } var $box = $('#machine-sel').selectize({ options: old, items: old.map(function(x) { return x.machineuuid; }), @@ -132,7 +143,7 @@ document.addEventListener('DOMContentLoaded', function () { load: loadMachines, maxItems: null, sortField: 'hostname', - sortDirection: 'asc', + sortDirection: 'asc' }); }); diff --git a/modules-available/runmode/templates/module-machine-list.html b/modules-available/runmode/templates/module-machine-list.html index 283fb393..89424922 100644 --- a/modules-available/runmode/templates/module-machine-list.html +++ b/modules-available/runmode/templates/module-machine-list.html @@ -36,12 +36,12 @@ </td> <td class="text-center"> {{#canedit}} - <button type="submit" class="btn btn-danger btn-sm" name="machineuuid" value="{{machineuuid}}"> + <button type="submit" class="btn btn-danger btn-sm" name="machineuuid" value="{{machineuuid}}" {{disabled}}> <span class="glyphicon glyphicon-trash"></span> </button> {{/canedit}} {{#deleteUrl}} - <a class="btn btn-default btn-sm" href="?do={{module}}&{{deleteUrl}}{{modeid}}"> + <a class="btn btn-default btn-sm {{disabled}}" href="?do={{module}}&{{deleteUrl}}{{modeid}}"> <span class="glyphicon glyphicon-edit"></span> </a> {{/deleteUrl}} |