LSP - trigger deletion with the rest of config
This commit is contained in:
parent
9943509d5f
commit
1cae0a7fd3
2 changed files with 4 additions and 9 deletions
|
@ -122,9 +122,9 @@ UI.buildUI([b]);c.replaceWith(a.children())}},{type:"buttons",buttons:[{type:"ca
|
|||
[];mist.data.config.limits.push(n);a={config:{limits:mist.data.config.limits}};break;case "stream":if(typeof mist.data.streams[b[1]].limits=="undefined")mist.data.streams[b[1]].limits=[];mist.data.streams[b[1]].limits.push(n);if(mist.data.LTS){a={addstream:{}};a.addstream[b[1]]=mist.data.streams[b[1]]}else a={streams:mist.data.streams}}}mist.send(function(){UI.navto(UI.returnTab[0],UI.returnTab[1])},a)}}]}]),u=UI.buildUI(i);b.append(u);u.find(".limit_type").closest("label").after(u.find(".limit_value").closest("label"));
|
||||
u.find(".limit_type").trigger("change");break;case "Triggers":"triggers"in mist.data.config||(mist.data.config.triggers={});g=$("<tbody>");q=$("<table>").html($("<thead>").html($("<tr>").html($("<th>").text("Trigger on").attr("data-sort-type","string").addClass("sorting-asc")).append($("<th>").text("Applies to").attr("data-sort-type","string")).append($("<th>").text("Handler").attr("data-sort-type","string")).append($("<th>")))).append(g);b.append(UI.buildUI([{type:"help",help:"Triggers are the system you can use to react to events that occur inside MistServer. These allow you to block specific users, redirect streams, keep tabs on what is being pushed where, etcetera. For full documentation, please refer to the developer documentation section on the MistServer website."}])).append($("<button>").text("New trigger").click(function(){UI.navto("Edit Trigger")})).append(q);
|
||||
q.stupidtable();i=mist.data.config.triggers;for(r in i)for(w in i[r])g.append($("<tr>").attr("data-index",r+","+w).append($("<td>").text(r)).append($("<td>").text(i[r][w][2].join(", "))).append($("<td>").text(i[r][w][0])).append($("<td>").html($("<button>").text("Edit").click(function(){UI.navto("Edit Trigger",$(this).closest("tr").attr("data-index"))})).append($("<button>").text("Delete").click(function(){var a=$(this).closest("tr").attr("data-index").split(",");if(confirm("Are you sure you want to delete this "+
|
||||
a[0]+" trigger?")){mist.data.config.triggers[a[0]].splice(a[1],1);mist.data.config.triggers[a[0]].length==0&&delete mist.data.config.triggers[a[0]];mist.send(function(){UI.navto("Triggers")},{config:{triggers:mist.data.config.triggers}})}}))));break;case "Edit Trigger":"triggers"in mist.data.config||(mist.data.config.triggers={});c?(c=c.split(","),i=mist.data.config.triggers[c[0]][c[1]],n={triggeron:c[0],appliesto:i[2],url:i[0],async:i[1],"default":i[3]}):(b.html($("<h2>").text("New Trigger")),n=
|
||||
{});b.append(UI.buildUI([{label:"Trigger on",pointer:{main:n,index:"triggeron"},help:"For what event this trigger should activate.",type:"select",select:[["SYSTEM_START","SYSTEM_START: after MistServer boot"],["SYSTEM_STOP","SYSTEM_STOP: right before MistServer shutdown"],["SYSTEM_CONFIG","SYSTEM_CONFIG: after MistServer configurations have changed"],["OUTPUT_START","OUTPUT_START: right after the start command has been send to a protocol"],["OUTPUT_STOP","OUTPUT_STOP: right after the close command has been send to a protocol "],
|
||||
["STREAM_ADD","STREAM_ADD: right before new stream configured"],["STREAM_CONFIG","STREAM_CONFIG: right before a stream configuration has changed"],["STREAM_REMOVE","STREAM_REMOVE: right before a stream has been deleted"],["STREAM_SOURCE","STREAM_SOURCE: right before stream source is loaded"],["STREAM_LOAD","STREAM_LOAD: right before stream input is loaded in memory"],["STREAM_READY","STREAM_READY: when the stream input is loaded and ready for playback"],["STREAM_UNLOAD","STREAM_UNLOAD: right before the stream input is removed from memory"],
|
||||
a[0]+" trigger?")){mist.data.config.triggers[a[0]].splice(a[1],1);mist.data.config.triggers[a[0]].length==0&&delete mist.data.config.triggers[a[0]];mist.send(function(){UI.navto("Triggers")},{config:mist.data.config})}}))));break;case "Edit Trigger":"triggers"in mist.data.config||(mist.data.config.triggers={});c?(c=c.split(","),i=mist.data.config.triggers[c[0]][c[1]],n={triggeron:c[0],appliesto:i[2],url:i[0],async:i[1],"default":i[3]}):(b.html($("<h2>").text("New Trigger")),n={});b.append(UI.buildUI([{label:"Trigger on",
|
||||
pointer:{main:n,index:"triggeron"},help:"For what event this trigger should activate.",type:"select",select:[["SYSTEM_START","SYSTEM_START: after MistServer boot"],["SYSTEM_STOP","SYSTEM_STOP: right before MistServer shutdown"],["SYSTEM_CONFIG","SYSTEM_CONFIG: after MistServer configurations have changed"],["OUTPUT_START","OUTPUT_START: right after the start command has been send to a protocol"],["OUTPUT_STOP","OUTPUT_STOP: right after the close command has been send to a protocol "],["STREAM_ADD",
|
||||
"STREAM_ADD: right before new stream configured"],["STREAM_CONFIG","STREAM_CONFIG: right before a stream configuration has changed"],["STREAM_REMOVE","STREAM_REMOVE: right before a stream has been deleted"],["STREAM_SOURCE","STREAM_SOURCE: right before stream source is loaded"],["STREAM_LOAD","STREAM_LOAD: right before stream input is loaded in memory"],["STREAM_READY","STREAM_READY: when the stream input is loaded and ready for playback"],["STREAM_UNLOAD","STREAM_UNLOAD: right before the stream input is removed from memory"],
|
||||
["STREAM_TRACK_ADD","STREAM_TRACK_ADD: right before a track will be added to a stream; e.g.: additional push received"],["STREAM_TRACK_REMOVE","STREAM_TRACK_REMOVE: right before a track will be removed track from a stream; e.g.: push timeout"],["CONN_OPEN","CONN_OPEN: right after a new incoming connection has been received"],["CONN_CLOSE","CONN_CLOSE: right after a connection has been closed"],["CONN_PLAY","CONN_PLAY: right before a stream playback of a connection"]],LTSonly:!0,"function":function(){switch($(this).getval()){case "SYSTEM_START":case "SYSTEM_STOP":case "SYSTEM_CONFIG":case "OUTPUT_START":case "OUTPUT_STOP":$("[name=appliesto]").setval([]).closest(".UIelement").hide();
|
||||
break;default:$("[name=appliesto]").closest(".UIelement").show()}}},{label:"Applies to",pointer:{main:n,index:"appliesto"},help:"For triggers that can apply to specific streams, this value decides what streams they are triggered for. (none checked = always triggered)",type:"checklist",checklist:Object.keys(mist.data.streams),LTSonly:!0},$("<br>"),{label:"Handler (URL or executable)",help:"This can be either an HTTP URL or a full path to an executable.",pointer:{main:n,index:"url"},validate:["required"],
|
||||
type:"str",LTSonly:!0},{label:"Blocking",type:"checkbox",help:"If checked, pauses processing and uses the response of the handler. If the response does not start with 1, true, yes or cont, further processing is aborted. If unchecked, processing is never paused and the response is not checked.",pointer:{main:n,index:"async"},LTSonly:!0},{label:"Default response",type:"str",help:"For blocking requests, the default response in case the handler cannot be executed for any reason.",pointer:{main:n,index:"default"},
|
||||
|
|
|
@ -3488,14 +3488,9 @@ var UI = {
|
|||
delete mist.data.config.triggers[index[0]];
|
||||
}
|
||||
|
||||
var send = {
|
||||
config: {
|
||||
triggers: mist.data.config.triggers
|
||||
}
|
||||
};
|
||||
mist.send(function(d){
|
||||
UI.navto('Triggers');
|
||||
},send);
|
||||
},{config:mist.data.config});
|
||||
}
|
||||
})
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue