Scott Baker | 510fdbb | 2014-08-05 17:19:24 -0700 | [diff] [blame] | 1 | {% extends 'admin/change_form.html' %} |
| 2 | {% block extrahead %} |
| 3 | {{ block.super }} |
| 4 | <script> |
| 5 | deployment_nodes = [ |
| 6 | {% for dn in deployment_nodes %} |
| 7 | [{{ dn.0 }}, {{ dn.1 }} , "{{ dn.2 }}"], |
| 8 | {% endfor %} |
| 9 | ]; |
Scott Baker | 34b502f | 2014-08-05 18:33:31 -0700 | [diff] [blame] | 10 | |
Tony Mack | 7283fdf | 2014-09-02 00:37:36 -0400 | [diff] [blame^] | 11 | sites = [ |
| 12 | {% for s in sites %} |
| 13 | [{{ s.0 }}, {{ s.1 }}], |
| 14 | {% endfor %} |
| 15 | ]; |
| 16 | |
| 17 | |
Scott Baker | 34b502f | 2014-08-05 18:33:31 -0700 | [diff] [blame] | 18 | function update_nodes(deployment_select, node_select_id) { |
| 19 | deployment_id = $(deployment_select).val(); |
| 20 | html = "<option value=''>---------</option>\n"; |
| 21 | for (i in deployment_nodes) { |
| 22 | dn = deployment_nodes[i]; |
| 23 | if (dn[0] == deployment_id) { |
| 24 | html = html + '<option value="' + dn[1] + '">' + dn[2] + '</option>\n' |
| 25 | } |
| 26 | } |
| 27 | //console.log(html); |
| 28 | $("#"+node_select_id).empty().append(html); |
| 29 | } |
Tony Mack | 7283fdf | 2014-09-02 00:37:36 -0400 | [diff] [blame^] | 30 | |
| 31 | function update_slice_prefix(site_select, slice_name_id) { |
| 32 | site_id = $(site_select).val(); |
| 33 | slice_prefix=""; |
| 34 | if (site_id in sites) { |
| 35 | slice_prefix=sites[site_id]+"_"; |
| 36 | } |
| 37 | $("#"+slice_name_id).val(slice_prefix); |
| 38 | } |
Scott Baker | 510fdbb | 2014-08-05 17:19:24 -0700 | [diff] [blame] | 39 | </script> |
Scott Baker | 34b502f | 2014-08-05 18:33:31 -0700 | [diff] [blame] | 40 | |
Scott Baker | 510fdbb | 2014-08-05 17:19:24 -0700 | [diff] [blame] | 41 | {% endblock %} |
| 42 | |