4 // WARNING: make sure than app/frontend/services/AppConfig.js match your server
6 // list all rependencies within the page + controler if needed
7 angular.module('DashboardModule', ['SubmitButton', 'TokenRefresh', 'AppliButton'])
9 .controller('DashboardController', function (AppCall, Notification) {
10 var scope = this; // I hate JavaScript
14 scope.status ="err-no";
15 scope.appliIDs =[]; // array to hold applications ID
16 scope.appliStore={}; // array to hold applications json description
19 scope.AppliCB = function(appliID, action, response) {
20 // Action is done within Widget Controller only update debug UI zone
21 scope.request = action;
22 scope.errcode = response.status;
23 if (response.data) scope.response = response.data;
26 scope.GetRunnables = function() {
27 console.log ("Dashboard GetRunnables");
29 AppCall.get ("afm-main", "runnables", {/*query*/}, function(response) {
31 // update debug UI zone
32 scope.request = "/api/afm-main/runnable";
33 scope.response = response.data;
34 scope.errcode = response.status;
36 if (response.status !== 200) {
37 console.log ("Hoop GetRunnable failed");
41 // Check this is a valid response from Binder
42 if (response.data.request.jtype !== "AJB_reply" && response.data.request.api !== "runnables") {
43 Notification.error ({message: "Invalid Respond to /opa/afm-main/runnable response.data="+response.data, delay: 5000});
47 // loop on runnable application to prepare for display
49 for (var idx=0; idx < response.data.response.length; idx ++) {
50 appliIDs[idx] = response.data.response [idx].id;
51 scope.appliStore [response.data.response [idx].id] = response.data.response [idx];
53 scope.appliIDs = appliIDs; // avoid partial update to limit UI refresh
58 scope.FileUploaded = function (response) {
59 console.log ("file Uploaded");
60 // Cannot display post results as GetRunnable will overload them aynchronously
61 scope.request = "/api/afm-main/install";
62 scope.response = response.headers;
63 scope.errcode = response.status;
65 // everything looks OK update app list
69 scope.AutoStart = function () {
70 console.log ("AutoStart requesting Apps list");
76 console.log ("Dashboard Controller Loaded");