Gestion du module 'machineDefault/init' pour envoyer les données du système d'une machine
This commit is contained in:
parent
1383249def
commit
8cbe6cf03b
|
@ -239,7 +239,7 @@
|
|||
|
||||
"init": {
|
||||
"description": "Données d'initialisation d'une machine.",
|
||||
"permissions": ["warehouse"],
|
||||
"permissions": [],
|
||||
"parameters": {},
|
||||
"output": {
|
||||
"data": { "description": "Données d'initialisation.", "type": "array<mixed>" }
|
||||
|
|
|
@ -61,12 +61,12 @@
|
|||
],
|
||||
|
||||
"action": [
|
||||
"getById",
|
||||
"removePermission",
|
||||
|
||||
"getAll",
|
||||
"getById",
|
||||
"getByIdTarget"
|
||||
"getById"
|
||||
],
|
||||
|
||||
"state": [
|
||||
"getAll"
|
||||
],
|
||||
|
||||
"permission": [
|
||||
|
|
|
@ -365,9 +365,35 @@
|
|||
|
||||
|
||||
|
||||
/* ENVOI DES DONNEES D'INITIALISATION DU SYSTEME DES MACHINES
|
||||
*
|
||||
* @return data<Array> Données d'initialisation du système
|
||||
*
|
||||
*/
|
||||
public static function init($params){
|
||||
extract($params);
|
||||
|
||||
/* [1] On récupére la liste des actions
|
||||
=========================================================*/
|
||||
$actionsReq = new Repo('action/getAll');
|
||||
$actions = ($actionsReq->error==0) ? $actionsReq->answer() : [];
|
||||
|
||||
/* [2] On récupère la liste des états
|
||||
=========================================================*/
|
||||
$statesReq = new Repo('state/getAll');
|
||||
$states = ($statesReq->error==0) ? $statesReq->answer() : [];
|
||||
|
||||
|
||||
/* [3] Retorne les données
|
||||
=========================================================*/
|
||||
return [
|
||||
'actions' => $actions,
|
||||
'states' => $states
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace manager\repo;
|
||||
use \manager\Database;
|
||||
use \manager\Repo;
|
||||
use \manager\ManagerError;
|
||||
use \manager\repo\cluster as clusterRepo;
|
||||
|
||||
class state extends parentRepo{
|
||||
|
||||
protected static function table_name(){ static $table_name = 'state'; return $table_name; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
|
@ -165,6 +165,8 @@
|
|||
|
||||
<div id='machine-box'>
|
||||
<div id='led'></div>
|
||||
<div id='r1'></div>
|
||||
<div id='r2'></div>
|
||||
</div>
|
||||
|
||||
|
||||
|
@ -191,6 +193,8 @@
|
|||
locked: false
|
||||
};
|
||||
|
||||
var SYSTEM = {};
|
||||
|
||||
/* (2) Elements du DOM */
|
||||
var mBox = document.getElementById('machine-box');
|
||||
var led = document.getElementById('led');
|
||||
|
@ -207,7 +211,13 @@
|
|||
/* (4) Récupération des données de fonctionnement */
|
||||
var api = new APIClass('/api/');
|
||||
|
||||
|
||||
api.send({path: 'machineDefault/init'}, function(response){
|
||||
console.log(response);
|
||||
SYSTEM = {
|
||||
action: response.actions,
|
||||
state: response.states
|
||||
};
|
||||
});
|
||||
|
||||
/* [1] Fonctions
|
||||
=========================================================*/
|
||||
|
|
Loading…
Reference in New Issue