[TIC-Web] fix the bug for import dialog 74/123274/2
authorChangHyun Lee <leechwin.lee@samsung.com>
Wed, 5 Apr 2017 06:08:45 +0000 (15:08 +0900)
committerChangHyun Lee <leechwin.lee@samsung.com>
Wed, 5 Apr 2017 06:15:46 +0000 (15:15 +0900)
- change the color of url
- fix the status of ok button

Change-Id: I2d1018adb19f92ee06245c5301d53e0b9c8955be
Signed-off-by: ChangHyun Lee <leechwin.lee@samsung.com>
public/src/css/style.css
public/src/js/page/import.js

index 1eadbfa..b1c73fb 100644 (file)
@@ -421,7 +421,7 @@ tr.extended_job_table_row:hover td {
     display: block;
     padding: 5px;
     border: 1px solid #CCC;
-    color: #08c;
+    color: #333;
     background: #eee;
     max-width: 100%;
 }
index e1e68be..af9c63d 100644 (file)
@@ -55,21 +55,19 @@ define([
 
                 _getRecipe()
                 .then(function (recipes) {
-                    resolve(recipes);
                     $('#tic-import-dialog').modal('hide');
+                    resolve(recipes);
                 })
                 .catch(function (err) {
                     _.remove(recipeStore, function (item) {
                         return item === recipeItem;
                     });
-                    $('#tic-import-recipe-confirm-ok').prop('disabled', false);
+                    $('#tic-import-recipe-confirm-ok').prop('disabled', true);
 
                     $inputDom.parent().removeClass('has-success').addClass('has-error');
                     var helpDomContent = '<ul class="list-unstyled"><li>' + err + '</li></ul>';
                     var helpDomId = '#'+ radioId + '-help';
                     $(helpDomId).append(helpDomContent);
-
-                    resolve();
                 })
             });
         });
@@ -83,6 +81,8 @@ define([
                 if (value.checked === false ) {
                     if (dom.type === 'url' || dom.type === 'text') {
                         $(dom).val('').change();
+                        var idDomQuery = '#' + value.id + '-help';
+                        $(idDomQuery).empty();
                     }
                 }
             });
@@ -104,15 +104,20 @@ define([
                 unique: function($el) {
                     var input = $el.val().trim();
                     if (_.isEmpty(input)) {
+                        $('#tic-import-recipe-confirm-ok').prop('disabled', true);
+                        return;
+                    }
+                    if (!Util.validateURL(input)) {
+                        $('#tic-import-recipe-confirm-ok').prop('disabled', true);
                         return;
                     }
                     var duplicatedUrl = _.filter(recipeStore, ['url', input]);
-                    if (Util.validateURL(input) && !_.isEmpty(duplicatedUrl)) {
+                    if ( !_.isEmpty(duplicatedUrl)) {
                         $('#tic-import-recipe-confirm-ok').prop('disabled', true);
                         return 'URL is already in use.';
-                    } else {
-                        $('#tic-import-recipe-confirm-ok').prop('disabled', false);
                     }
+                    $('#tic-import-recipe-confirm-ok').prop('disabled', false);
+                    return;
                 }
             }
         });