update slice prefix in slice name field when site is changed slice create page
diff --git a/planetstack/templates/admin/core/slice/change_form.html b/planetstack/templates/admin/core/slice/change_form.html
index c94b580..e97364b 100644
--- a/planetstack/templates/admin/core/slice/change_form.html
+++ b/planetstack/templates/admin/core/slice/change_form.html
@@ -8,6 +8,13 @@
{% endfor %}
];
+sites = [
+{% for s in sites %}
+ [{{ s.0 }}, {{ s.1 }}],
+{% endfor %}
+];
+
+
function update_nodes(deployment_select, node_select_id) {
deployment_id = $(deployment_select).val();
html = "<option value=''>---------</option>\n";
@@ -20,6 +27,15 @@
//console.log(html);
$("#"+node_select_id).empty().append(html);
}
+
+function update_slice_prefix(site_select, slice_name_id) {
+ site_id = $(site_select).val();
+ slice_prefix="";
+ if (site_id in sites) {
+ slice_prefix=sites[site_id]+"_";
+ }
+ $("#"+slice_name_id).val(slice_prefix);
+}
</script>
{% endblock %}