From 4b4975911360bab1ae3f2182c54d8b6e04bd8368 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Thu, 1 Feb 2024 10:36:43 +0100 Subject: [PATCH] UI - Show error/warning when trying to compare the same version --- changedetectionio/static/js/diff-overview.js | 7 ++++++- changedetectionio/templates/diff.html | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/changedetectionio/static/js/diff-overview.js b/changedetectionio/static/js/diff-overview.js index 8cbe7dcd..767cf6e1 100644 --- a/changedetectionio/static/js/diff-overview.js +++ b/changedetectionio/static/js/diff-overview.js @@ -90,5 +90,10 @@ $(document).ready(function () { } } - + $('#diff-form').on('submit', function (e) { + if ($('select[name=from_version]').val() === $('select[name=to_version]').val()) { + e.preventDefault(); + alert('Error - You are trying to compare the same version.'); + } + }); }); diff --git a/changedetectionio/templates/diff.html b/changedetectionio/templates/diff.html index 6cac4605..0197bfc9 100644 --- a/changedetectionio/templates/diff.html +++ b/changedetectionio/templates/diff.html @@ -13,7 +13,7 @@
-
+
{% if versions|length >= 1 %} Compare