Patchwork [bitbake-devel,02/18] toaster: warn new filter replaces existing filter

login
register
mail settings
Submitter Alexandru DAMIAN
Date March 24, 2014, 6:37 p.m.
Message ID <6be58123fcdb0ff20de2a88315e1e3012effd1d3.1395686148.git.alexandru.damian@intel.com>
Download mbox | patch
Permalink /patch/69085/
State New
Headers show

Comments

Alexandru DAMIAN - March 24, 2014, 6:37 p.m.
From: David Reyna <David.Reyna@windriver.com>

If the user pop-ups a filter dialog when another filter is already
active, warn the user that the new filter would replace the
previous filter.

[YOCTO #5960]

Signed-off-by: David Reyna <David.Reyna@windriver.com>
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
---
 lib/toaster/toastergui/static/css/default.css       | 1 +
 lib/toaster/toastergui/templates/filtersnippet.html | 5 +++++
 lib/toaster/toastergui/templatetags/projecttags.py  | 6 ++++++
 3 files changed, 12 insertions(+)

Patch

diff --git a/lib/toaster/toastergui/static/css/default.css b/lib/toaster/toastergui/static/css/default.css
index 53a3fee..d960f4b 100644
--- a/lib/toaster/toastergui/static/css/default.css
+++ b/lib/toaster/toastergui/static/css/default.css
@@ -105,6 +105,7 @@  select { width: auto; }
 .no-results { margin: 10px 0; }
 .task-name { margin-left: 7px; }
 .icon-hand-right {color: #ccccc; }
+.help-inline { margin: 5px; }
 
 
 
diff --git a/lib/toaster/toastergui/templates/filtersnippet.html b/lib/toaster/toastergui/templates/filtersnippet.html
index e0e1181..a72eeaa 100644
--- a/lib/toaster/toastergui/templates/filtersnippet.html
+++ b/lib/toaster/toastergui/templates/filtersnippet.html
@@ -28,6 +28,11 @@ 
         </div>
         <div class="modal-footer">
             <button type="submit" class="btn btn-primary">Apply</button>
+            {% if request.GET.filter %}
+                {% if request.GET.filter|string_remove_regex:':.*' != f.options.0.1|string_remove_regex:':.*' %}
+                <span class="help-inline pull-left">You can only apply one filter to the table. This filter will override the current filter.</span>
+                {% endif %}
+            {% endif %}
         </div>
 </form>
 
diff --git a/lib/toaster/toastergui/templatetags/projecttags.py b/lib/toaster/toastergui/templatetags/projecttags.py
index e7b23cb..39e92ce 100644
--- a/lib/toaster/toastergui/templatetags/projecttags.py
+++ b/lib/toaster/toastergui/templatetags/projecttags.py
@@ -189,6 +189,12 @@  def string_slice(strvar,slicevar):
         return strvar[int(first):int(last)]
 
 @register.filter
+def string_remove_regex(value,ex):
+    """ remove sub-string of string that matches regex
+    """
+    return re.sub(ex, '', value)
+
+@register.filter
 def filtered_installedsize(size, installed_size):
     """If package.installed_size not null and not empty return it,
        else return package.size