[TIC-Web] remove profile button group and add error handler of http request 53/119253/1
authorChangHyun Lee <leechwin.lee@samsung.com>
Thu, 16 Mar 2017 06:38:10 +0000 (15:38 +0900)
committerChangHyun Lee <leechwin.lee@samsung.com>
Thu, 16 Mar 2017 06:38:10 +0000 (15:38 +0900)
- remove profile button group
- add error handler of http request

Change-Id: Idbcc63c907bcd0382f95492f0f9ab7cd09157856
Signed-off-by: ChangHyun Lee <leechwin.lee@samsung.com>
config.json
controller/ticcore.js
public/src/index.html
public/src/js/main.js
public/src/js/page/package.js
public/src/js/page/settings.js

index 3db86ec..fa8638c 100644 (file)
@@ -46,7 +46,7 @@
             "JOB_READ_LOG": "/api/job/log/"
         },
         "PACKAGE": {
-            "TEST": "testtest"
+            "EXPORT": "/api/exports/"
         },
         "IMAGE": {
             "IMAGE_GET_ALL_COUNT": "/api/image/count/",
index f59f449..be926cf 100644 (file)
@@ -54,6 +54,14 @@ ticcore.getAnalysis = function getAnalysis (req, res) {
     });
 
     ticCoreReq.write(postData);
+
+    ticCoreReq.on('error', function (err) {
+        res.send({
+            result: 'false',
+            message: err.message
+        })
+    });
+
     ticCoreReq.end();
 };
 
@@ -89,6 +97,14 @@ ticcore.getExports = function getExports(req, res) {
     });
 
     ticCoreReq.write(postData);
+
+    ticCoreReq.on('error', function (err) {
+        res.send({
+            result: 'false',
+            message: err.message
+        })
+    });
+
     ticCoreReq.end();
 };
 
index 2084e2b..94f88ef 100644 (file)
             </div><!-- /.container -->
         </nav>
 
-
         <!-- Package Section -->
         <section id="tic-package-section">
             <div class="container">
                     <!-- Package Left Column -->
                     <div class="col-md-6">
                         <div class="panel panel-primary">
+                            <div class="panel-heading">
+                                <h3 class="panel-title">Package List</h3>
+                            </div>
                             <div class="panel-body">
-                                <!-- Profile Toolbar -->
-                                <div class="btn-group btn-group-justified">
-                                    <div class="btn-group">
-                                        <button type="button" class="btn btn-primary">All</button>
-                                    </div>
-                                    <div class="btn-group">
-                                        <button type="button" class="btn btn-primary">Common</button>
-                                    </div>
-                                    <div class="btn-group">
-                                        <button type="button" class="btn btn-primary">Mobile</button>
-                                    </div>
-                                    <div class="btn-group">
-                                        <button type="button" class="btn btn-primary">Wearable</button>
-                                    </div>
-                                    <div class="btn-group">
-                                        <button type="button" class="btn btn-primary">TV</button>
-                                    </div>
-                                </div>
                                 <!-- Package Tree Toolbar -->
                                 <div id="tic-package-left-col-tree-toolbar">
                                     <div class="input-group">
index e1e6561..849dd2a 100644 (file)
@@ -34,7 +34,7 @@ define([
         .catch(function (reason) {
             logger.error(reason);
             Util.showLoadingDialog(false);
-            Util.showAlertDialog('Failed to load package list.<br>Please check the tic-core.');
+            Util.showAlertDialog('Failed to load package list.<br>Please check the tic-core.<br>Error: ' + reason);
         });
 
         // Keep the state of the active item on navbar
index 6947842..6fb3cf4 100644 (file)
@@ -29,9 +29,6 @@ define([
     var groups = null;
     var groupId = 0;
 
-    // template for the URL
-    var URL_EXPORTS = '<%= url %>/api/exports';
-
     var JOB_STATUS_INPROGRESS = 'INPROGRESS';
 
     // AppConfig
@@ -93,15 +90,6 @@ define([
             Job.doCreateAnImage(msgData);
         }
 
-        function getExportsUrl() {
-            var url = _.template(URL_EXPORTS)({
-                url: location.origin
-            });
-
-            logger.info('onClickHandlerForImgCreationBtn.getExportsUrl: ' + url);
-            return url ;
-        }
-
         function getRecipeFile() {
             var msgData;
 
@@ -153,7 +141,7 @@ define([
                 return Util.POST(AppConfig.EVENT.JOB.JOB_EDIT_ONE + newJobModel.getJobId(), msgObj);
             }
 
-            return Util.POST(getExportsUrl(), msgData)
+            return Util.POST(AppConfig.EVENT.PACKAGE.EXPORT, msgData)
             .then(onSuccessGetRecipeFile)
             .catch(onErrorGetRecipeFile);
         }
index e702ea3..ad9e31b 100644 (file)
@@ -55,9 +55,13 @@ define([
 
         return Util.POST(ANALYSIS_URL, postBody)
         .then(function (result) {
-            repoStore = result.data.repos;
-            _updateRepo();
-            return result.data;
+            if (result.result === 'true') {
+                repoStore = result.data.repos;
+                _updateRepo();
+                return result.data;
+            } else {
+                return Promise.reject(result.message);
+            }
         });
     }
 
@@ -167,7 +171,7 @@ define([
             .catch(function (reason) {
                 logger.error(reason);
                 Util.showLoadingDialog(false);
-                Util.showAlertDialog('Failed to load package list.<br>Please check the tic-core.');
+                Util.showAlertDialog('Failed to load package list.<br>Please check the tic-core.<br>Error: ' + reason);
             });
         }
         $('#tic-repository-apply').on('click', _applyRepoBtnHandler);