SimpleList No Result optional warning msg
authorLoic Baron <loic.baron@lip6.fr>
Fri, 17 Jan 2014 15:34:43 +0000 (16:34 +0100)
committerLoic Baron <loic.baron@lip6.fr>
Fri, 17 Jan 2014 15:34:43 +0000 (16:34 +0100)
plugins/lists/simplelist.py
plugins/lists/static/js/simplelist.js
portal/dashboardview.py

index c817d9b..a099078 100644 (file)
@@ -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']
 
index f3476c0..6df47cf 100644 (file)
     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;
         }
index 17e3a5c..bf42603 100644 (file)
@@ -53,6 +53,7 @@ class DashboardView (LoginRequiredAutoLogoutView):
         slicelist = SliceList(
             page  = page,
             title = "slices",
+            warning_msg = "<a href='../slice_request'>Request Slice</a>",
             query = slice_query,
         )
         testbedlist = TestbedList(