This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
userspace:json-rpc_angularjs [2015/05/01 14:09] 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 / | + | All needed files (.html, .js, .css) should be hosted below / |
| The location would then read https:// | The location would then read https:// | ||
| + | |||
| + | ====== Prerequisites ====== | ||
| + | Of course its helpful to load the angular-min.js (or angular.js for development) from an appropriate location. The example uses a local copy. | ||
| ====== Minor Obstacles ====== | ====== Minor Obstacles ====== | ||
| - | configed | + | opsiconfd |
| Most requests require a logon, some even special rights. The script user should be member of a new group // | Most requests require a logon, some even special rights. The script user should be member of a new group // | ||
| Line 18: | Line 22: | ||
| </ | </ | ||
| + | ====== Calling Parameter ====== | ||
| + | When called as / | ||
| + | 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:// | ||
| + | |||
| + | What if the barcode appears right on the client' | ||
| ====== The Code ====== | ====== The Code ====== | ||
| < | < | ||
| / | / | ||
| ├ index.html | ├ index.html | ||
| + | ├ angular.js | ||
| ├ swinv.js | ├ swinv.js | ||
| └ swinv.css | └ swinv.css | ||
| </ | </ | ||
| - | ===== index.html ===== | + | ======= index.html |
| Where all other is loaded from.. | Where all other is loaded from.. | ||
| <code html> | <code html> | ||
| Line 84: | Line 96: | ||
| </ | </ | ||
| - | ==== swinv.js ==== | + | ======= swinv.js |
| The AngularJS mimic.. | The AngularJS mimic.. | ||
| <code JavaScript> | <code JavaScript> | ||
| Line 102: | Line 114: | ||
| this.auditParams.params.push([]); | this.auditParams.params.push([]); | ||
| this.auditParams.params.push({" | this.auditParams.params.push({" | ||
| - | |||
| - | opsiURL=baseurl+"?" | ||
| me=this; | me=this; | ||
| Line 274: | Line 284: | ||
| </ | </ | ||
| - | ===== swinv.css ===== | + | ======= swinv.css |
| some tweaking of the appearance - anything goes.. | some tweaking of the appearance - anything goes.. | ||