]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
webui: added service stream details dialog (fixes #2006)
authorAdam Sutton <dev@adamsutton.me.uk>
Tue, 22 Apr 2014 23:41:27 +0000 (00:41 +0100)
committerAdam Sutton <dev@adamsutton.me.uk>
Tue, 22 Apr 2014 23:42:30 +0000 (00:42 +0100)
src/webui/static/app/idnode.js
src/webui/static/app/mpegts.js

index 5373b81b366b3d8fca6ce99832c89ab0474ad3e8..c172ff18da0dde1c5d04a66e92bf933de5a226d3 100644 (file)
@@ -650,6 +650,7 @@ tvheadend.idnode_grid = function(panel, conf)
     var filters = [];
     var fields  = [];
     var buttons = [];
+    var plugins = conf.plugins || [];
     var saveBtn = null;
     var undoBtn = null;
     var addBtn  = null;
@@ -958,6 +959,7 @@ tvheadend.idnode_grid = function(panel, conf)
       items       : [ '-', 'Auto-refresh', auto,
                       '->', '-', 'Per page', count ]
     });
+    plugins.push(filter);
     var grid   = new Ext.grid.EditorGridPanel({
       stateful      : true,
       stateId       : conf.url,
@@ -966,9 +968,7 @@ tvheadend.idnode_grid = function(panel, conf)
       store         : store,
       cm            : model,
       selModel      : select,
-      plugins       : [
-        filter
-      ],
+      plugins       : plugins,
       viewConfig    : {
         forceFit : true
       },
index 1e5f007cd8b258d9b7625cacc021c2bd975aba71..8e8b7107cbba99398d4e16ea51d95926223847b8 100644 (file)
@@ -95,6 +95,65 @@ tvheadend.muxes = function(panel)
   });
 }
 
+tvheadend.show_service_streams = function ( data ) {
+  var i, j;
+       var html = '';
+
+  html += '<table style="font-size:8pt;font-family:mono;padding:2px"';
+       html += '<tr>';
+       html += '<th style="width:50px;font-weight:bold">Index</th>';
+       html += '<th style="width:120px;font-weight:bold">PID</th>';
+       html += '<th style="width:100px;font-weight:bold">Type</th>';
+       html += '<th style="width:75px;font-weight:bold">Language</th>';
+  html += '<th style="width:*;font-weight:bold">Details</th>';
+       html += '</tr>';
+
+  function hexstr ( d ) {
+    return ('0000' + d.toString(16)).slice(-4);
+  }
+    
+  function fixstr ( d ) {
+    var r = d.toString();
+    var l = r.length;
+    var i;
+    for (i = l; i < 5; i++) {
+      r = '&nbsp;' + r;
+    }
+    return r;
+  }
+
+       for (i = 0; i < data.streams.length; i++) {
+               var s = data.streams[i];
+    var d = '&nbsp;';
+    var p = '0x' + hexstr(s.pid) + '&nbsp;/&nbsp;' + fixstr(s.pid);
+
+               html += '<tr>';
+               html += '<td>' + (s.index > 0 ? s.index : '&nbsp;') + '</td>';
+               html += '<td>' + p + '</td>';
+               html += '<td>' + s.type + '</td>';
+               html += '<td>' + (s.language || '&nbsp;') + '</td>'
+    if (s.type == 'CA') {
+      d = 'CAIDS: ';
+      for (j = 0; j < s.caids.length; j++) {
+        d += s.caids[j].caid + ', ';
+      }
+    }
+               html += '<td>' + d + '</td>';
+               html += '</tr>';
+       }
+
+       var win = new Ext.Window({
+               title : 'Service details for ' + data.name,
+               layout : 'fit',
+               width : 600,
+               height : 300,
+               plain : true,
+               bodyStyle : 'padding: 5px',
+               html : html
+       });
+       win.show();
+}
+
 tvheadend.services = function(panel)
 {
   var mapButton = new Ext.Toolbar.Button({
@@ -111,6 +170,26 @@ tvheadend.services = function(panel)
     else
       mapButton.setText('Map All')
   }
+  var actions = new Ext.ux.grid.RowActions({
+    header    : '',
+    width     : 10,
+    actions   : [ {
+      iconCls : 'info',
+      qtip    : 'Detailed stream info',
+      cb      : function ( grid, rec, act, row, col ) {
+        Ext.Ajax.request({
+          url    : 'api/service/streams',
+          params : {
+            uuid : rec.id
+          },
+          success : function (r, o) {
+            var d = Ext.util.JSON.decode(r.responseText);
+            tvheadend.show_service_streams(d);
+          }
+        });
+      }
+    } ]
+  });
   tvheadend.idnode_grid(panel, {
     url      : 'api/mpegts/service',
     comet    : 'service',
@@ -129,8 +208,10 @@ tvheadend.services = function(panel)
         renderer : function(v, o, r) {
           return "<a href='stream/service/" + r.id + "'>Play</a>";
         }
-      }
+      },
+      actions
     ],
+    plugins   : [ actions ],
     sort     : {
       field  : 'svcname',
       direction : 'ASC'