update JSON.parse to $.parseJSON in dash2.monitoredit.js

build-default-monitor-config-from-definitions
Moe 2020-05-20 14:02:55 -07:00
parent 30496d88cc
commit 59becdfbff
1 changed files with 10 additions and 10 deletions

View File

@ -58,7 +58,7 @@ $.aM.drawList = function(){
$.aM.e.on('shown.bs.modal', function () { $.aM.e.on('shown.bs.modal', function () {
$.aM.drawList() $.aM.drawList()
}) })
$.aM.import=function(e){ $.aM.import = function(e){
$.get($.ccio.init('location',$user)+$user.auth_token+'/hls/'+e.values.ke+'/'+e.values.mid+'/detectorStream.m3u8',function(data){ $.get($.ccio.init('location',$user)+$user.auth_token+'/hls/'+e.values.ke+'/'+e.values.mid+'/detectorStream.m3u8',function(data){
$('#monEditBufferPreview').html(data) $('#monEditBufferPreview').html(data)
}) })
@ -67,13 +67,13 @@ $.aM.import=function(e){
$.each(e.values,function(n,v){ $.each(e.values,function(n,v){
$.aM.e.find('[name="'+n+'"]').val(v).change() $.aM.e.find('[name="'+n+'"]').val(v).change()
}) })
e.ss=JSON.parse(e.values.details); e.ss = $.parseJSON(e.values.details);
//get maps //get maps
$.aM.maps.empty() $.aM.maps.empty()
if(e.ss.input_maps&&e.ss.input_maps!==''){ if(e.ss.input_maps&&e.ss.input_maps!==''){
var input_maps var input_maps
try{ try{
input_maps = JSON.parse(e.ss.input_maps) input_maps = $.parseJSON(e.ss.input_maps)
}catch(er){ }catch(er){
input_maps = e.ss.input_maps; input_maps = e.ss.input_maps;
} }
@ -95,7 +95,7 @@ $.aM.import=function(e){
if(e.ss.stream_channels&&e.ss.stream_channels!==''){ if(e.ss.stream_channels&&e.ss.stream_channels!==''){
var stream_channels var stream_channels
try{ try{
stream_channels = JSON.parse(e.ss.stream_channels) stream_channels = $.parseJSON(e.ss.stream_channels)
}catch(er){ }catch(er){
stream_channels = e.ss.stream_channels; stream_channels = e.ss.stream_channels;
} }
@ -112,7 +112,7 @@ $.aM.import=function(e){
if(e.ss.input_map_choices&&e.ss.input_map_choices!==''){ if(e.ss.input_map_choices&&e.ss.input_map_choices!==''){
var input_map_choices var input_map_choices
try{ try{
input_map_choices = JSON.parse(e.ss.input_map_choices) input_map_choices = $.parseJSON(e.ss.input_map_choices)
}catch(er){ }catch(er){
input_map_choices = e.ss.input_map_choices; input_map_choices = e.ss.input_map_choices;
} }
@ -135,7 +135,7 @@ $.aM.import=function(e){
}); });
$.each(e.ss,function(n,v){ $.each(e.ss,function(n,v){
try{ try{
var variable=JSON.parse(v) var variable=$.parseJSON(v)
}catch(err){ }catch(err){
var variable=v var variable=v
} }
@ -296,7 +296,7 @@ $.aM.f.submit(function(ee){
}) })
// //
if($('#copy_settings').val() === '1'){ if($('#copy_settings').val() === '1'){
e.s.details = JSON.parse(e.s.details); e.s.details = $.parseJSON(e.s.details);
var copyMonitors = $.aM.monitorsForCopy.val(); var copyMonitors = $.aM.monitorsForCopy.val();
var chosenSections = []; var chosenSections = [];
var chosenMonitors = {}; var chosenMonitors = {};
@ -313,7 +313,7 @@ $.aM.f.submit(function(ee){
} }
}) })
var alterSettings = function(settingsToAlter,monitor){ var alterSettings = function(settingsToAlter,monitor){
monitor.details = JSON.parse(monitor.details); monitor.details = $.parseJSON(monitor.details);
var searchElements = [] var searchElements = []
if(settingsToAlter.indexOf('field=') > -1){ if(settingsToAlter.indexOf('field=') > -1){
var splitSettingsToAlter = settingsToAlter.split('=') var splitSettingsToAlter = settingsToAlter.split('=')
@ -544,7 +544,7 @@ $.aM.e.on('change','.detector_cascade_selection',function(){
// var e={}; // var e={};
// e.details=$.aM.e.find('[name="details"]') // e.details=$.aM.e.find('[name="details"]')
// try{ // try{
// e.detailsVal=JSON.parse(e.details.val()) // e.detailsVal=$.parseJSON(e.details.val())
// }catch(err){ // }catch(err){
// e.detailsVal={} // e.detailsVal={}
// } // }
@ -577,7 +577,7 @@ $.aM.e.find('.import_config').click(function(e){
}); });
$.confirm.click({title:'Import',class:'btn-primary'},function(){ $.confirm.click({title:'Import',class:'btn-primary'},function(){
try{ try{
e.values=JSON.parse($.confirm.e.find('textarea').val()); e.values=$.parseJSON($.confirm.e.find('textarea').val());
$.aM.import(e) $.aM.import(e)
$.aM.e.modal('show') $.aM.e.modal('show')
}catch(err){ }catch(err){