mirror of
				https://github.com/hyperion-project/hyperion.ng.git
				synced 2025-03-01 10:33:28 +00:00 
			
		
		
		
	Refactor JSON-API and cleanups
This commit is contained in:
		| @@ -73,26 +73,30 @@ $(document).ready(function () { | ||||
|   //End language selection | ||||
|  | ||||
|   $(window.hyperion).on("cmd-authorize-tokenRequest cmd-authorize-getPendingTokenRequests", function (event) { | ||||
|     var val = event.response.info; | ||||
|     if (Array.isArray(event.response.info)) { | ||||
|       if (event.response.info.length == 0) { | ||||
|         return | ||||
|       } | ||||
|       val = event.response.info[0] | ||||
|       if (val.comment == '') | ||||
|         $('#modal_dialog').modal('hide'); | ||||
|     } | ||||
|  | ||||
|     showInfoDialog("grantToken", $.i18n('conf_network_tok_grantT'), $.i18n('conf_network_tok_grantMsg') + '<br><span style="font-weight:bold">App: ' + val.comment + '</span><br><span style="font-weight:bold">Code: ' + val.id + '</span>') | ||||
|     $("#tok_grant_acc").off().on('click', function () { | ||||
|       tokenList.push(val) | ||||
|       // forward event, in case we need to rebuild the list now | ||||
|       $(window.hyperion).trigger({ type: "build-token-list" }); | ||||
|       requestHandleTokenRequest(val.id, true) | ||||
|     }); | ||||
|     $("#tok_deny_acc").off().on('click', function () { | ||||
|       requestHandleTokenRequest(val.id, false) | ||||
|     }); | ||||
|     if (event.response && event.response.info !== undefined) { | ||||
|       var val = event.response.info; | ||||
|  | ||||
|       if (Array.isArray(event.response.info)) { | ||||
|         if (event.response.info.length == 0) { | ||||
|           return | ||||
|         } | ||||
|         val = event.response.info[0] | ||||
|         if (val.comment == '') | ||||
|           $('#modal_dialog').modal('hide'); | ||||
|       } | ||||
|  | ||||
|       showInfoDialog("grantToken", $.i18n('conf_network_tok_grantT'), $.i18n('conf_network_tok_grantMsg') + '<br><span style="font-weight:bold">App: ' + val.comment + '</span><br><span style="font-weight:bold">Code: ' + val.id + '</span>') | ||||
|       $("#tok_grant_acc").off().on('click', function () { | ||||
|         tokenList.push(val) | ||||
|         // forward event, in case we need to rebuild the list now | ||||
|         $(window.hyperion).trigger({ type: "build-token-list" }); | ||||
|         requestHandleTokenRequest(val.id, true) | ||||
|       }); | ||||
|       $("#tok_deny_acc").off().on('click', function () { | ||||
|         requestHandleTokenRequest(val.id, false) | ||||
|       }); | ||||
|     } | ||||
|   }); | ||||
|  | ||||
|   $(window.hyperion).one("cmd-authorize-getTokenList", function (event) { | ||||
|   | ||||
| @@ -3,10 +3,13 @@ var createdCont = false; | ||||
| var isScroll = true; | ||||
|  | ||||
| performTranslation(); | ||||
| requestLoggingStop(); | ||||
|  | ||||
| $(document).ready(function () { | ||||
|  | ||||
|   window.addEventListener('hashchange', function(event) { | ||||
|     requestLoggingStop(); | ||||
|   }); | ||||
|  | ||||
|   requestLoggingStart(); | ||||
|  | ||||
|   $('#conf_cont').append(createOptPanel('fa-reorder', $.i18n("edt_conf_log_heading_title"), 'editor_container', 'btn_submit')); | ||||
| @@ -180,7 +183,7 @@ $(document).ready(function () { | ||||
|  | ||||
|     $(window.hyperion).on("cmd-logging-update", function (event) { | ||||
|  | ||||
|       var messages = (event.response.result.messages); | ||||
|       var messages = (event.response.data.messages); | ||||
|  | ||||
|       if (messages.length != 0) { | ||||
|         if (!createdCont) { | ||||
|   | ||||
| @@ -213,13 +213,13 @@ $(document).ready(function () { | ||||
|     for (var key in tokenList) { | ||||
|       var lastUse = (tokenList[key].last_use) ? tokenList[key].last_use : "-"; | ||||
|       var btn = '<button id="tok' + tokenList[key].id + '" type="button" class="btn btn-danger">' + $.i18n('general_btn_delete') + '</button>'; | ||||
|       $('.tktbody').append(createTableRow([tokenList[key].comment, lastUse, btn], false, true)); | ||||
|       $('.tktbody').append(createTableRow([tokenList[key].id, tokenList[key].comment, lastUse, btn], false, true)); | ||||
|       $('#tok' + tokenList[key].id).off().on('click', handleDeleteToken); | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   createTable('tkthead', 'tktbody', 'tktable'); | ||||
|   $('.tkthead').html(createTableRow([$.i18n('conf_network_tok_cidhead'), $.i18n('conf_network_tok_lastuse'), $.i18n('general_btn_delete')], true, true)); | ||||
|   $('.tkthead').html(createTableRow([$.i18n('conf_network_tok_idhead'), $.i18n('conf_network_tok_cidhead'), $.i18n('conf_network_tok_lastuse'), $.i18n('general_btn_delete')], true, true)); | ||||
|   buildTokenList(); | ||||
|  | ||||
|   function handleDeleteToken(e) { | ||||
|   | ||||
| @@ -261,7 +261,7 @@ $(document).ready(function () { | ||||
|       $("body").get(0).style.setProperty("--background-var", "none"); | ||||
|     } | ||||
|     else { | ||||
|       printLedsToCanvas(event.response.result.leds) | ||||
|       printLedsToCanvas(event.response.data.leds) | ||||
|       $("body").get(0).style.setProperty("--background-var", "url(" + ($('#leds_preview_canv')[0]).toDataURL("image/jpg") + ") no-repeat top left"); | ||||
|     } | ||||
|   }); | ||||
| @@ -275,7 +275,7 @@ $(document).ready(function () { | ||||
|       } | ||||
|     } | ||||
|     else { | ||||
|       var imageData = (event.response.result.image); | ||||
|       var imageData = (event.response.data.image); | ||||
|  | ||||
|       var image = new Image(); | ||||
|       image.onload = function () { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user