[TIC-UI] fix the output image path 07/106807/2
authorChangHyun Lee <leechwin.lee@samsung.com>
Fri, 23 Dec 2016 06:43:09 +0000 (15:43 +0900)
committerChangHyun Lee <leechwin.lee@samsung.com>
Fri, 23 Dec 2016 06:51:00 +0000 (15:51 +0900)
- fix the child_process.exe argument

Change-Id: I4d4496bf4643f3ea5534d797684de1c337f37a0a
Signed-off-by: ChangHyun Lee <leechwin.lee@samsung.com>
public/src/js/page/image.js
server/fs/mic.js

index 45fa98a..9c82dca 100644 (file)
@@ -8,29 +8,29 @@ define([
     'use strict';
 
     // connected socket object
-    var client,
+    var client;
 
-        // the list of checked pakages
-        checkedPackagesList,
+    // the list of checked pakages
+    var checkedPackagesList;
 
-        // template for the URL
-        URL_EXPORTS = '<%= protocol %>//<%= hostname %>:<%= port %>/exports',
-
-        // the path for ks
-        PATH_TIC_KS = '/tmp/tic/ks/',
-
-        // the path for images
-        PATH_TIC_IMAGES = '/tmp/tic/images/';
+    // template for the URL
+    var URL_EXPORTS = '<%= protocol %>//<%= hostname %>:<%= port %>/exports';
 
+    // the path for ks
+    var PATH_TIC_KS = '/tmp/tic/ks/';
 
+    // the path for images
+    var PATH_TIC_IMAGES = '/tmp/tic/images/';
 
     function updateList(socket) {
+        if (!_.isEmpty(socket)) {
+            client = socket;
+        }
+
         var msgData = {
             path: PATH_TIC_IMAGES
         };
 
-        client = socket;
-
         client.emit('ws/fs/image/list/from', msgData);
 
         client.on('ws/fs/image/list/to', function (data) {
@@ -38,6 +38,7 @@ define([
 
             list = data.list;
             tableDomElem = $('#tic-image-list');
+            tableDomElem.empty();
 
             list.forEach(function (file) {
                 var liElem, aElem, spanElem, fileName, hrefPath;
@@ -156,7 +157,7 @@ define([
                 $('#tic-image-new-container').hide();
 
                 // upate the list of images
-                updateList();
+                updateList(null);
             });
         }
 
index b95e0fa..d24684a 100644 (file)
@@ -10,8 +10,8 @@ var util = require('util');
 
 var Mic = {};
 
-Mic.subprocess = function (processname, arg, cb) {
-    var p = exec(processname, arg);
+Mic.subprocess = function (processname, cb) {
+    var p = exec(processname);
     p.on('exit', cb.exit);
     p.stdout.on('data', cb.stdout || function (out) {
         process.stdout.write(out);
@@ -23,32 +23,27 @@ Mic.subprocess = function (processname, arg, cb) {
 
 Mic.create = function (paramObj, client) {
     console.log('Mic.create called');
-    var micProcess, micProcessArgs, mic, child, stdoutPath, exitPath;
 
-    stdoutPath = 'ws/fs/image/add/to';
-    exitPath = 'ws/fs/image/add/finished';
-
-    micProcess = 'sudo mic cr loop ' + paramObj.pathKsFile;
-    micProcessArgs = [];
-    micProcessArgs.push(util.format('-A %s', 'x86_64'));
-    micProcessArgs.push(util.format('-o %s', paramObj.pathOutput));
+    var stdoutPath = 'ws/fs/image/add/to';
+    var exitPath = 'ws/fs/image/add/finished';
+    var micProcess = 'sudo mic cr loop ' + paramObj.pathKsFile + util.format(' -A %s', 'x86_64') + util.format(' -o %s', paramObj.pathOutput);
 
     function sendMsg(path, msg) {
         client.emit(path, msg);
     }
 
-    Mic.subprocess(micProcess, micProcessArgs, {
+    Mic.subprocess(micProcess, {
         stdout: function (out) {
-            console.log('stdout' + out);
-            sendMsg(stdoutPath, 'stdout: ' + out);
+            console.log(out);
+            sendMsg(stdoutPath, out);
         },
         stderr: function (out) {
-            console.log('stderr' + out);
-            sendMsg(stdoutPath, 'stderr: ' + out);
+            console.error(out);
+            sendMsg(stdoutPath, out);
         },
         exit: function (out) {
-            console.log('exit: ' + out);
-            sendMsg(exitPath, 'exit: ' + out);
+            console.log(out);
+            sendMsg(exitPath, out);
         }
     });
 };