User Tools

Site Tools


userspace:json-rpc_angularjs

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
userspace:json-rpc_angularjs [2015/05/01 14:11]
justcoding
userspace:json-rpc_angularjs [2021/08/23 08:37] (current)
Line 1: Line 1:
 +====== Angular JSON-RPC ======
 Yet another method of reading the JSON-RPC interface. Yet another method of reading the JSON-RPC interface.
  
 The example below reads the result of the latest softwareAudit and displays it as a table. Information about installed sw products are merged in. The example below reads the result of the latest softwareAudit and displays it as a table. Information about installed sw products are merged in.
  
-All needed files (.html, .js, .css) should be hosted below /usr/share/opsiconfd/static/AngularExample folder thus avoiding cross scripting complaints of modern browsers.+All needed files (.html, .js, .css) should be hosted below /usr/share/opsiconfd/static/AngularExample folder. This way no other Webserver is involved and cross scripting complaints by the browser are avoided.
  
 The location would then read https://opsi:4447/AngularExample. The location would then read https://opsi:4447/AngularExample.
Line 11: Line 12:
  
 ====== Minor Obstacles ====== ====== Minor Obstacles ======
-configed will currently answer /rpc? requests with Encoding "deflate", but will anounce it as "gzip". This issue is known and a patch is [[https://forum.opsi.org/viewtopic.php?f=6&t=7449|mentioned in the forums]].+opsiconfd will currently answer /rpc? requests with Encoding "deflate", but will anounce it as "gzip". This currently prevents any browser from even reading the opsiconfd answer. The responsible Worker.py needs a small change to answer requests from a browser //and// Winst.exe (and other legacy opsi clients) as well. The issue is known and a patch is [[https://forum.opsi.org/viewtopic.php?f=6&t=7449|mentioned in the forums]].
  
 Most requests require a logon, some even special rights. The script user should be member of a new group //opsireader// and the **acl.conf** file should be prepended with appropriate lines: Most requests require a logon, some even special rights. The script user should be member of a new group //opsireader// and the **acl.conf** file should be prepended with appropriate lines:
Line 21: Line 22:
 </file> </file>
  
 +====== Calling Parameter ======
 +When called as /AngularExample/?{"dns":"clientID.domain.local"}
 +the SoftwareAudit of the given clientId is displayed. OPSI client names may be entered in an input field at any time and are queried asynchronously.
 +
 +The strange format of the query string as json has its reason: it is needed for the AndroidApp named [[https://play.google.com/store/apps/details?id=eu.dirtyharry.opsiadmin|OPSI Admin]]. The App can read barcodes/QRcodes formatted this way in order to open the details of the identified client. Nice feature when the barcode sticks on the client. 
 +
 +What if the barcode appears right on the client's screen? Try this Java app: [[https://github.com/GallusMax/opsi/tree/master/opsi-barcode|Opsi-Barcode]]
 ====== The Code ====== ====== The Code ======
 <code> <code>
Line 30: Line 38:
  </code>  </code>
  
-===== index.html =====+======= index.html =======
 Where all other is loaded from.. Where all other is loaded from..
 <code html> <code html>
Line 88: Line 96:
 </code> </code>
  
-==== swinv.js ====+======= swinv.js =======
 The AngularJS mimic.. The AngularJS mimic..
 <code JavaScript> <code JavaScript>
Line 106: Line 114:
  this.auditParams.params.push([]);  this.auditParams.params.push([]);
  this.auditParams.params.push({"clientId":"defaultclient.domain.local"});  this.auditParams.params.push({"clientId":"defaultclient.domain.local"});
- 
- opsiURL=baseurl+"?"+$filter('json')(this.auditParams); 
  
  me=this;  me=this;
Line 278: Line 284:
 </code> </code>
  
-===== swinv.css =====+======= swinv.css =======
  
 some tweaking of the appearance - anything goes.. some tweaking of the appearance - anything goes..
userspace/json-rpc_angularjs.1430489487.txt.gz ยท Last modified: 2021/08/23 08:37 (external edit)