ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akuznet...@apache.org
Subject incubator-ignite git commit: IGNITE-843 WIP on tables.
Date Thu, 13 Aug 2015 01:31:35 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-843 a9fd2676a -> 2316b22b6


IGNITE-843 WIP on tables.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/2316b22b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/2316b22b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/2316b22b

Branch: refs/heads/ignite-843
Commit: 2316b22b653941541826723ae91ae712a98d4d51
Parents: a9fd267
Author: AKuznetsov <akuznetsov@gridgain.com>
Authored: Thu Aug 13 08:31:31 2015 +0700
Committer: AKuznetsov <akuznetsov@gridgain.com>
Committed: Thu Aug 13 08:31:31 2015 +0700

----------------------------------------------------------------------
 .../src/main/js/controllers/common-module.js    |  4 +-
 .../main/js/controllers/metadata-controller.js  | 46 +++++++++-----------
 2 files changed, 22 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2316b22b/modules/control-center-web/src/main/js/controllers/common-module.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/common-module.js b/modules/control-center-web/src/main/js/controllers/common-module.js
index f7abf0c..b18240e 100644
--- a/modules/control-center-web/src/main/js/controllers/common-module.js
+++ b/modules/control-center-web/src/main/js/controllers/common-module.js
@@ -675,9 +675,9 @@ controlCenterModule.service('$table', [
             }
             else if (ui == 'table-db-fields') {
                 field.newDatabaseName = null;
-                field.newDatabaseType = null;
+                field.newDatabaseType = 'INTEGER';
                 field.newJavaName = null;
-                field.newJavaType = null;
+                field.newJavaType = 'Integer';
 
                 _tableFocus('DatabaseName' + field.focusId, -1);
             }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2316b22b/modules/control-center-web/src/main/js/controllers/metadata-controller.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/metadata-controller.js b/modules/control-center-web/src/main/js/controllers/metadata-controller.js
index 7becb73..99fcc49 100644
--- a/modules/control-center-web/src/main/js/controllers/metadata-controller.js
+++ b/modules/control-center-web/src/main/js/controllers/metadata-controller.js
@@ -482,15 +482,17 @@ controlCenterModule.controller('metadataController', [
                 return true;
             };
 
-            $scope.tableDbFieldSaveVisible = function (field, index) {
-                var isNew = index < 0;
+            function tableDbFieldValue(field, index) {
+                return index < 0
+                    ? {databaseName: field.newDatabaseName, databaseType: field.newDatabaseType,
javaName: field.newJavaName, javaType: field.newJavaType}
+                    : {databaseName: field.curDatabaseName, databaseType: field.curDatabaseType,
javaName: field.curJavaName, javaType: field.curJavaType}
+            }
 
-                var databaseName = isNew ? field.newDatabaseName : field.curDatabaseName;
-                var databaseType = isNew ? field.newDatabaseType : field.curDatabaseType;
-                var javaName = isNew ? field.newJavaName : field.curJavaName;
-                var javaType = isNew ? field.newJavaType : field.curJavaType;
+            $scope.tableDbFieldSaveVisible = function (field, index) {
+                var dbFieldValue = tableDbFieldValue(field, index);
 
-                return !$common.isEmptyString(databaseName) && $common.isDefined(databaseType)
&& !$common.isEmptyString(javaName) && $common.isDefined(javaType);
+                return !$common.isEmptyString(dbFieldValue.databaseName) && $common.isDefined(dbFieldValue.databaseType)
&&
+                    !$common.isEmptyString(dbFieldValue.javaName) && $common.isDefined(dbFieldValue.javaType);
             };
 
             var dbFields = {
@@ -502,23 +504,18 @@ controlCenterModule.controller('metadataController', [
                 var dbField = dbFields[field.model];
 
                 if (dbField) {
+                    var dbFieldValue = tableDbFieldValue(field, index);
+
                     var backupItem = $scope.backupItem;
 
                     var model = backupItem[field.model];
 
-                    var newItem = {
-                        databaseName: newDatabaseName,
-                        databaseType: newDatabaseType,
-                        javaName: newJavaName,
-                        javaType: newJavaType
-                    };
-
-                    if (!$common.isValidJavaIdentifier(dbField.msg + ' java name', newJavaName))
+                    if (!$common.isValidJavaIdentifier(dbField.msg + ' java name', dbFieldValue.javaName))
                         return focusInvalidField(index, 'JavaName' + dbField.id);
 
                     if ($common.isDefined(model)) {
                         var idx = _.findIndex(model, function (dbMeta) {
-                            return dbMeta.databaseName == newDatabaseName
+                            return dbMeta.databaseName == dbFieldValue.databaseName;
                         });
 
                         // Found duplicate.
@@ -529,7 +526,7 @@ controlCenterModule.controller('metadataController', [
                         }
 
                         idx = _.findIndex(model, function (dbMeta) {
-                            return dbMeta.javaName == newJavaName
+                            return dbMeta.javaName == dbFieldValue.javaName;
                         });
 
                         // Found duplicate.
@@ -540,22 +537,19 @@ controlCenterModule.controller('metadataController', [
                         }
 
                         if (index < 0) {
-                            if (model)
-                                model.push(newItem);
-                            else
-                                backupItem[field.model] = [newItem];
+                                model.push(dbFieldValue);
                         }
                         else {
                             var item = model[index];
 
-                            item.databaseName = newDatabaseName;
-                            item.databaseType = newDatabaseType;
-                            item.javaName = newJavaName;
-                            item.javaType = newJavaType;
+                            item.databaseName = dbFieldValue.databaseName;
+                            item.databaseType = dbFieldValue.databaseType;
+                            item.javaName = dbFieldValue.javaName;
+                            item.javaType = dbFieldValue.javaType;
                         }
                     }
                     else
-                        backupItem[field.model] = [newItem];
+                        backupItem[field.model] = [dbFieldValue];
 
                     $table.tableReset();
                 }


Mime
View raw message