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

userspace:json-rpc_angularjs [2015/05/01 14:00]
justcoding
userspace:json-rpc_angularjs [2021/08/23 08:37]
Line 1: Line 1:
-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. 
- 
-All needed files (.html, .js, .css) should be hosted below /usr/share/opsiconfd/static/AngularExample folder thus avoiding cross scripting complaints of modern browsers. 
- 
-The location would then read https://opsi:4447/AngularExample. 
- 
-====== 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]]. 
- 
-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: 
-<file> 
-getProducts_.* : sys_group(opsireader); sys_group(opsiadmin); opsi_depotserver; self; opsi_client 
-productOnClient_get.* : sys_group(opsireader); sys_group(opsiadmin); opsi_depotserver;self; opsi_client 
-auditSoftwareOnClient_get.* : sys_group(opsireader); sys_group(opsiadmin); opsi_depotserver; self; opsi_client 
-product_get.* : sys_group(opsireader); sys_group(opsiadmin); opsi_depotserver; self; opsi_client 
-</file> 
- 
-====== The Code ====== 
-<code> 
-/usr/share/opsiconfd/static/AngularExample 
-  โ”œ index.html 
-  โ”œ swinv.js 
-  โ”” swinv.css 
-  </code> 
-index.html 
-<code> 
-<!DOCTYPE html> 
-<html ng-app="opsi-swinv"> 
-<head> 
-    <link rel="stylesheet" type="text/css" href="swinv.css" > 
-    <script type="text/javascript" src="angular.js"></script> <!-- chenge to angular-min for production --> 
-    <!-- script type="text/javascript" src="angular-resource.js"></script --> 
-    <script type="text/javascript" src="swinv.js"></script> 
-    <script type="text/javascript" src="swpattern.js"></script> 
-</head> 
- 
-<body ng-controller="swinvController as sw"> 
- 
-<div class="swlist"> 
- 
-<input id="inputId" ng-model="sw.clientId"></input> 
-<button ng-click="sw.refresh(sw.clientId)">refresh list</button> 
- 
- 
-<table border > 
-  <tr><th>Name</th><th>Version</th><th>Lizenz</th><th>Installationsgrund</th></tr> 
- 
-<tr ng-repeat="swp in sw.products" ng-show="sw.nonMS(swp.name)"> 
-<td>{{swp.name}} </td> 
-<td> {{swp.version}}</td> 
-<td>{{sw.reason(swp.name)}}</td> 
-<td class={{sw.csswarn(swp.name)}}><span ng-show="!sw.isOpsi(swp.name)">{{sw.reason(swp.name)}} </span>{{sw.opsiProdId(swp.name)}}</td> 
-</tr> 
-</table> 
- 
-<br/><label><input type="checkbox" ng-model="sw.showopsiinstalled" />installed OPSI products on this client <span>({{sw.clientId}})</span></label> 
-<div ng-show="sw.showopsiinstalled"> 
-<table border> 
-  <tr><th>OpsiProduct</th></tr> 
-  <tr ng-repeat="inst in sw.installed"> 
-    <td>{{inst}}</td> 
-  </tr> 
-</table> 
-</div> 
- 
-<br/><label><input type="checkbox" ng-model="sw.showallprods" />available products</label> 
-<table ng-show="sw.showallprods" border width="100%"> 
-  <tr><th>productInfo</th><th>productId</th><th>...............................................</th></tr> 
-  <tr ng-repeat="prod in sw.productinfos"> 
-     
-    <td>{{prod.productId}}</td> 
-    <td>{{prod.name}}</td> 
-    <td></td> 
-  </tr> 
-</table> 
- 
-</div> 
-</body> 
-</html> 
-</code> 
userspace/json-rpc_angularjs.txt ยท Last modified: 2021/08/23 08:37 (external edit)