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:04] justcoding [index.html] |
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 | + | ======= |
The AngularJS mimic.. | The AngularJS mimic.. | ||
- | < | + | < |
(function(){ | (function(){ | ||
var app = angular.module(' | var app = angular.module(' | ||
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 272: | Line 282: | ||
})(); | })(); | ||
+ | </ | ||
+ | |||
+ | ======= swinv.css ======= | ||
+ | |||
+ | some tweaking of the appearance - anything goes.. | ||
+ | <code css> | ||
+ | body { | ||
+ | font-family: | ||
+ | } | ||
+ | |||
+ | table{ | ||
+ | width: 100%; | ||
+ | border-collapse: | ||
+ | } | ||
+ | |||
+ | td, th { | ||
+ | font-size: 1em; | ||
+ | border: 1px solid #aa0093; | ||
+ | padding: 3px 7px 2px 7px; | ||
+ | } | ||
+ | |||
+ | th { | ||
+ | font-size: 1.1em; | ||
+ | text-align: left; | ||
+ | padding-top: | ||
+ | padding-bottom: | ||
+ | background-color: | ||
+ | color: #ffffff; | ||
+ | } | ||
+ | |||
+ | label{ | ||
+ | background-color: | ||
+ | color: #ffffff; | ||
+ | } | ||
+ | |||
+ | |||
+ | td.warn { | ||
+ | /* enhance unlicensed products*/ | ||
+ | color: #000000; | ||
+ | background-color: | ||
+ | } | ||
+ | |||
+ | .ng-binding{ | ||
+ | // background-color: | ||
+ | font-family: | ||
+ | } | ||
</ | </ |