2
0

srs.en.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. var scApp = angular.module("scApp", ["ngRoute", "ngResource",
  2. "bravoUiAlert", "bravoUiPopover"
  3. ]);
  4. scApp.config(["$routeProvider", function($routeProvider){
  5. $routeProvider.otherwise({redirectTo:"/connect"})
  6. .when("/connect", {templateUrl:"views/connect_en.html", controller:"CSCConnect"})
  7. .when("/vhosts", {templateUrl:"views/vhosts_en.html", controller:"CSCVhosts"})
  8. .when("/vhosts/:id", {templateUrl:"views/vhost_en.html", controller:"CSCVhost"})
  9. .when("/streams", {templateUrl:"views/streams_en.html", controller:"CSCStreams"})
  10. .when("/streams/:id", {templateUrl:"views/stream_en.html", controller:"CSCStream"})
  11. .when("/clients", {templateUrl:"views/clients_en.html", controller:"CSCClients"})
  12. .when("/clients/:id", {templateUrl:"views/client_en.html", controller:"CSCClient"})
  13. .when("/configs", {templateUrl:"views/configs_en.html", controller:"CSCConfigs"})
  14. .when("/summaries", {templateUrl:"views/summary_en.html", controller:"CSCSummary"});
  15. }]);
  16. scApp.filter("sc_filter_time", function(){
  17. return function(v){
  18. var s = "";
  19. if (v > 3600 * 24) {
  20. s = Number(v / 3600 / 24).toFixed(0) + "d ";
  21. v = v % (3600 * 24);
  22. }
  23. s += relative_seconds_to_HHMMSS(v);
  24. return s;
  25. };
  26. });
  27. scApp.filter("sc_filter_yesno", function(){
  28. return function(v){
  29. return v? "Yes":"No";
  30. };
  31. });
  32. scApp.filter("sc_filter_enabled", function(){
  33. return function(v){
  34. return v? "Enabled":"Disabled";
  35. };
  36. });
  37. scApp.filter("sc_filter_yn", function(){
  38. return function(v){
  39. return v? "Y":"N";
  40. };
  41. });
  42. scApp.filter("sc_filter_has_stream", function(){
  43. return function(v){
  44. return v? "Y":"N";
  45. };
  46. });
  47. scApp.filter("sc_filter_ctype", function(){
  48. return function(v){
  49. return v? "Publish":"Play";
  50. };
  51. });
  52. scApp.filter("sc_filter_obj", function(){
  53. return function(v) {
  54. return v !== undefined? v : "Unknown";
  55. };
  56. });
  57. scApp.filter("sc_filter_security", function(){
  58. return function(v) {
  59. var action = v.action === "allow"? "Allow":"Denied";
  60. var method = v.method === "all"? "Any": (v.method === "publish"? "Publish":"Play");
  61. var entry = v.entry === "all"? "All" : v.entry;
  62. return action + " " + entry + " " + method;
  63. }
  64. });
  65. var scDirectiveTemplate = ''
  66. + '<td class="{{data.error| sc_filter_style_error}}">'
  67. + '{{key}}'
  68. + '</td>'
  69. + '<td colspan="{{editing? 2:0}}" title="{{data.value}}" class="{{data.error| sc_filter_style_error}}">'
  70. + '<div class="form-inline">'
  71. + '<span class="{{!data.error && data.value == undefined?\'label\':\'\'}}" ng-show="!editing">'
  72. + '<span ng-show="bool == \'true\' && data.value != undefined">{{data.value| sc_filter_enabled}}</span>'
  73. + '<span ng-show="bool != \'true\' || data.value == undefined">{{data.value| sc_filter_obj| sc_filter_less}}</span>'
  74. + '</span> '
  75. + '<input type="text" class="{{span}} inline" ng-show="editing && bool != \'true\' && !select" ng-model="data.value"> '
  76. + '<label class="checkbox" ng-show="editing && bool == \'true\'"><input type="checkbox" ng-model="data.value">Enable</label> '
  77. + '<select ng-model="data.value" ng-options="s as s for s in selects" ng-show="editing && select"></select>'
  78. + '<a href="javascript:void(0)" ng-click="load_default()" ng-show="editing && default != undefined" title="Use Default Values">Restore</a> '
  79. + '</div>'
  80. + '<div ng-show="editing">{{desc}}</div>'
  81. + '</td>'
  82. + '<td ng-show="!editing" class="{{data.error| sc_filter_style_error}}">'
  83. + '{{desc}}'
  84. + '</td>'
  85. + '<td class="span1 {{data.error| sc_filter_style_error}}">'
  86. + '<a href="javascript:void(0)" ng-click="edit()" ng-show="!editing" title="Mofity it">Update</a> '
  87. + '<a bravo-popover href="javascript:void(0)"'
  88. + 'data-content="Confirm Update?" data-title="Please Confirm" data-placement="left"'
  89. + 'bravo-popover-confirm="commit()" ng-show="editing">'
  90. + 'Submit'
  91. + '</a> '
  92. + '<a href="javascript:void(0)" ng-click="cancel()" ng-show="editing" title="Cancel">Cancel</a> '
  93. + '</td>';