Commit 4a7515c4 by Őry Máté

network: related field if changed by magic

parent 435f4556
...@@ -28,6 +28,17 @@ function getURLParameter(name) { ...@@ -28,6 +28,17 @@ function getURLParameter(name) {
); );
} }
function doBlink(id, count) {
if (count > 0) {
$(id).parent().delay(200).queue(function() {
$(this).delay(200).queue(function() {
$(this).removeClass("has-warning").dequeue();
doBlink(id, count-1);});
$(this).addClass("has-warning").dequeue()
});
}
}
$(function() { $(function() {
$("[title]").tooltip(); $("[title]").tooltip();
...@@ -43,10 +54,11 @@ $("#ipv4-magic").click(function() { ...@@ -43,10 +54,11 @@ $("#ipv4-magic").click(function() {
$.ajax({url: window.location, $.ajax({url: window.location,
data: {vlan: $("[name=vlan]").val()}, data: {vlan: $("[name=vlan]").val()},
success: function(data) { success: function(data) {
$("[name=ipv4]").val(data["ipv4"]); $("[name=ipv4]").val(data["ipv4"]);
if (!$("[name=ipv6]").val()) { if ($("[name=ipv6]").val() != data["ipv6"]) {
$("[name=ipv6]").val(data["ipv6"]); doBlink("[name=ipv6]", 3);
} }
$("[name=ipv6]").val(data["ipv6"]);
}}); }});
}); });
$("#ipv6-tpl-magic").click(function() { $("#ipv6-tpl-magic").click(function() {
...@@ -55,6 +67,10 @@ $("#ipv6-tpl-magic").click(function() { ...@@ -55,6 +67,10 @@ $("#ipv6-tpl-magic").click(function() {
network6: $("[name=network6]").val()}, network6: $("[name=network6]").val()},
success: function(data) { success: function(data) {
$("[name=ipv6_template]").val(data["ipv6_template"]); $("[name=ipv6_template]").val(data["ipv6_template"]);
if ($("[name=host_ipv6_prefixlen]").val() != data["host_ipv6_prefixlen"]) {
doBlink("[name=host_ipv6_prefixlen]", 3);
}
$("[name=host_ipv6_prefixlen]").val(data["host_ipv6_prefixlen"]);
}}); }});
}); });
}); });
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment