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
18 scope.AppliCB = function (appliID) {
19 console.log ("Application Clicked ID=[%s]", appliID);
23 scope.AppliCB = function(appliID, action, response) {
24 // Action is done within Widget Controller only update debug UI zone
25 scope.request = action;
26 scope.errcode = response.status;
27 if (response.data) scope.response = response.data;
30 scope.GetRunnables = function() {
31 console.log ("Dashboard GetRunnables");
33 AppCall.get ("afm-main", "runnables", {/*query*/}, function(response) {
35 // update debug UI zone
36 scope.request = "/api/afm-main/runnable";
37 scope.response = response.data;
38 scope.errcode = response.status;
40 if (response.status !== 200) {
41 console.log ("Hoop GetRunnable failed");
45 // Check this is a valid response from Binder
46 if (response.data.request.jtype !== "AJB_reply" && response.data.request.api !== "runnables") {
47 Notification.error ({message: "Invalid Respond to /opa/afm-main/runnable response.data="+response.data, delay: 5000});
51 // loop on runnable application to prepare for display
53 for (var idx=0; idx < response.data.response.length; idx ++) {
54 appliIDs[idx] = response.data.response [idx].id;
55 scope.appliStore [response.data.response [idx].id] = response.data.response [idx];
57 scope.appliIDs = appliIDs; // avoid partial update to limit UI refresh
62 scope.FileUploaded = function (status) {
63 console.log ("file Uploaded");
67 scope.AutoStart = function () {
68 console.log ("AutoStart requesting Apps list");
74 console.log ("Dashboard Controller Loaded");