From df37189ffd08ea92ba19d6ecbfd9f14bf46c0550 Mon Sep 17 00:00:00 2001 From: Loic Baron Date: Fri, 17 Jan 2014 16:34:43 +0100 Subject: [PATCH] SimpleList No Result optional warning msg --- plugins/lists/simplelist.py | 2 +- plugins/lists/static/js/simplelist.js | 16 +++++++++++----- portal/dashboardview.py | 1 + 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/plugins/lists/simplelist.py b/plugins/lists/simplelist.py index c817d9bf..a0990786 100644 --- a/plugins/lists/simplelist.py +++ b/plugins/lists/simplelist.py @@ -37,5 +37,5 @@ class SimpleList (Plugin) : reqs['js_files'].append ("js/with-datatables.js") return reqs - def json_settings_list (self): return ['plugin_uuid','query_uuid','key','classname'] + def json_settings_list (self): return ['plugin_uuid','query_uuid','key','classname','warning_msg'] diff --git a/plugins/lists/static/js/simplelist.js b/plugins/lists/static/js/simplelist.js index f3476c07..6df47cfc 100644 --- a/plugins/lists/static/js/simplelist.js +++ b/plugins/lists/static/js/simplelist.js @@ -12,10 +12,16 @@ var SimpleList = Plugin.extend ({ init: function (options, element) { - this.classname=options.classname; + this.classname = options.classname; this._super (options, element); - this.buffered_records=[]; - this.listen_query(options.query_uuid); + this.buffered_records = []; + this.listen_query(options.query_uuid); + /* Optional parameter warning_msg */ + if(options.warning_msg != "unknown-setting-warning_msg"){ + this.warning_msg = options.warning_msg; + }else{ + this.warning_msg = "No Result"; + } }, on_query_in_progress: function() { @@ -56,9 +62,9 @@ object_key = this.options.key.split('.'); if (rows.length == 0 || rows[0][object_key[0]].length == 0) { if (use_datatables){ - this._datatables_set_message ($table, $tbody, unfold.warning("No result")); + this._datatables_set_message ($table, $tbody, unfold.warning(self.warning_msg)); }else{ - this._regular_set_message ($table, $tbody, unfold.warning("No result")); + this._regular_set_message ($table, $tbody, unfold.warning(self.warning_msg)); } return; } diff --git a/portal/dashboardview.py b/portal/dashboardview.py index 17e3a5ce..bf42603a 100644 --- a/portal/dashboardview.py +++ b/portal/dashboardview.py @@ -53,6 +53,7 @@ class DashboardView (LoginRequiredAutoLogoutView): slicelist = SliceList( page = page, title = "slices", + warning_msg = "Request Slice", query = slice_query, ) testbedlist = TestbedList( -- 2.43.0