summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFulup Ar Foll <fulup@iot.bzh>2016-01-28 11:20:53 +0100
committerFulup Ar Foll <fulup@iot.bzh>2016-01-28 11:20:53 +0100
commit3d6f539592cb2171ed67b3c2b0246fd72ddfaa0d (patch)
treefaabf717115d78879e50f925e89c1b24a5c2df0e
parent712446796a33a47ea7e5fafd7950141ac8060530 (diff)
Minor Cleanup
-rw-r--r--afm-client/app/Backend/RestApis/PostMockApi.js12
-rw-r--r--afm-client/app/Frontend/pages/Dashboard/DashboardModule.js14
2 files changed, 14 insertions, 12 deletions
diff --git a/afm-client/app/Backend/RestApis/PostMockApi.js b/afm-client/app/Backend/RestApis/PostMockApi.js
index 022f774..7bc71f7 100644
--- a/afm-client/app/Backend/RestApis/PostMockApi.js
+++ b/afm-client/app/Backend/RestApis/PostMockApi.js
@@ -27,23 +27,23 @@ function NewApi(handle, prefix) {
// defined upload directory and check it's a valid one
var upload = multer({ dest: handle.config.UPLOAD_DIR});
// WARNING: single('avatar') should match with <upload-image name="avatar">
- handle.app.post(prefix +'/upload-image', upload.single('avatar'), function (req, res) {
+ handle.app.post(prefix +'/upload-image', upload.any(), function (req, res) {
- handle.trace (scope, 1, "%s/upload file=%s dest=%s/%s", prefix, req.file.originalname, req.file.destination, req.file.filename);
+ handle.trace (scope, 1, "%s/upload file=%s dest=%s/%s", prefix, req.files[0].originalname, req.files[0].destination, req.files[0].filename);
res.send({"jtype": "TEST_message", "status": "success", "info": "done"});
});
// WARNING: single('music') should match with <upload-audio name="music">
- handle.app.post(prefix +'/upload-music', upload.single('music'), function (req, res) {
+ handle.app.post(prefix +'/upload-music', upload.any(), function (req, res) {
- handle.trace (scope, 1, "%s/upload file=%s dest=%s/%s", prefix, req.file.originalname, req.file.destination, req.file.filename);
+ handle.trace (scope, 1, "%s/upload file=%s dest=%s/%s", prefix, req.files[0].originalname, req.files[0].destination, req.files[0].filename);
res.send({"jtype": "TEST_message", "status": "success", "info": "done"});
});
// WARNING: single('appli') should match with <upload-audio name="appli">
- handle.app.post(prefix +'/upload-appli', upload.single('appli'), function (req, res) {
+ handle.app.post(prefix +'/upload-appli', upload.any(), function (req, res) {
- handle.trace (scope, 1, "%s/upload file=%s dest=%s/%s", prefix, req.file.originalname, req.file.destination, req.file.filename);
+ handle.trace (scope, 1, "%s/upload file=%s dest=%s/%s", prefix, req.files[0].originalname, req.files[0].destination, req.files[0].filename);
res.send({"jtype": "TEST_message", "status": "success", "info": "done"});
});
diff --git a/afm-client/app/Frontend/pages/Dashboard/DashboardModule.js b/afm-client/app/Frontend/pages/Dashboard/DashboardModule.js
index c075372..83408a5 100644
--- a/afm-client/app/Frontend/pages/Dashboard/DashboardModule.js
+++ b/afm-client/app/Frontend/pages/Dashboard/DashboardModule.js
@@ -15,11 +15,7 @@ angular.module('DashboardModule', ['SubmitButton', 'TokenRefresh', 'AppliButton'
scope.appliIDs =[]; // array to hold applications ID
scope.appliStore={}; // array to hold applications json description
- scope.AppliCB = function (appliID) {
- console.log ("Application Clicked ID=[%s]", appliID);
-
- };
-
+
scope.AppliCB = function(appliID, action, response) {
// Action is done within Widget Controller only update debug UI zone
scope.request = action;
@@ -59,8 +55,14 @@ angular.module('DashboardModule', ['SubmitButton', 'TokenRefresh', 'AppliButton'
});
};
- scope.FileUploaded = function (status) {
+ scope.FileUploaded = function (response) {
console.log ("file Uploaded");
+ // Cannot display post results as GetRunnable will overload them
+ scope.request = "/api/afm-main/runnable";
+ scope.response = response.headers;
+ scope.errcode = response.status;
+
+ // everything looks OK update app list
scope.GetRunnables();
};