mirror of
				https://github.com/hyperion-project/hyperion.ng.git
				synced 2025-03-01 10:33:28 +00:00 
			
		
		
		
	* Example JSON Form Example with General setting I have created a new Category "General" with several Settings for Hyperion. For now the Submit Button only console.log's the values. Known Bug: For some reason it seems to do not load the bootstrap correctly or maybe the Lib isn't compatible with the newest version of bootstrap. * Translationsupport for JSON Forms * Hotfix * Added Bootstrap Switches for all checkboxes All checkboxes will be converted to Switches
		
			
				
	
	
		
			77 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			77 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
<div class="container-fluid">
 | 
						|
    <div class="row">
 | 
						|
        <div class="col-lg-12">
 | 
						|
            <h1 class="page-header" lang="en" data-lang-token="main_menu_general_conf_token">General</h1>
 | 
						|
			<div class="introd">
 | 
						|
				<h4 lang="en" data-lang-token="remote_general_conf_intro">You can edit the general configuration here.</h4>
 | 
						|
			</div>
 | 
						|
			<hr>
 | 
						|
			<div class="col-lg-12">
 | 
						|
        <form id="generalConfForm"></form>
 | 
						|
      </div>
 | 
						|
		</div>
 | 
						|
	</div>
 | 
						|
</div>
 | 
						|
 | 
						|
 | 
						|
<script>
 | 
						|
 | 
						|
	$(document).ready( function() {
 | 
						|
 | 
						|
		webSocket = new WebSocket('ws://'+document.location.hostname+':19444');
 | 
						|
		var serverInfo;
 | 
						|
 | 
						|
		webSocket.onerror = function(event) {
 | 
						|
			alert(event.data);
 | 
						|
		};
 | 
						|
 | 
						|
 | 
						|
		webSocket.onopen = function(event) {
 | 
						|
			webSocket.send('{"command":"config","subcommand":"getschema"}');
 | 
						|
		};
 | 
						|
 | 
						|
		webSocket.onmessage = function(response){
 | 
						|
			logger = JSON.parse(response.data).result.properties.logger;
 | 
						|
      jsonServer = JSON.parse(response.data).result.properties.jsonServer;
 | 
						|
      protoServer = JSON.parse(response.data).result.properties.protoServer;
 | 
						|
      boblightServer = JSON.parse(response.data).result.properties.boblightServer;
 | 
						|
      udpListener = JSON.parse(response.data).result.properties.udpListener;
 | 
						|
      webConfig = JSON.parse(response.data).result.properties.webConfig;
 | 
						|
 | 
						|
 | 
						|
      $('form').jsonForm({
 | 
						|
        schema: {
 | 
						|
          logger,
 | 
						|
          jsonServer,
 | 
						|
          protoServer,
 | 
						|
          boblightServer,
 | 
						|
          udpListener,
 | 
						|
          webConfig,
 | 
						|
 | 
						|
        },
 | 
						|
        onSubmit: function (errors, values) {
 | 
						|
          if (errors) {
 | 
						|
            console.log(errors);
 | 
						|
          }
 | 
						|
          else {
 | 
						|
            console.log(values);
 | 
						|
          }
 | 
						|
        }
 | 
						|
      });
 | 
						|
 | 
						|
 | 
						|
 | 
						|
      enableFormTranslation("generalConfForm", "generalConfForm");
 | 
						|
 | 
						|
      $("[type='checkbox']").bootstrapSwitch();
 | 
						|
 | 
						|
 | 
						|
		}
 | 
						|
 | 
						|
  });
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
</script>
 |