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 persistence UI.
Date Mon, 29 Jun 2015 16:11:28 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-843 b9fb6fcdf -> 5af10b04e


IGNITE-843: WIP on persistence UI.


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

Branch: refs/heads/ignite-843
Commit: 5af10b04ef9f9718a76f73d84ad736096d39aa24
Parents: b9fb6fc
Author: AKuznetsov <akuznetsov@gridgain.com>
Authored: Mon Jun 29 23:11:18 2015 +0700
Committer: AKuznetsov <akuznetsov@gridgain.com>
Committed: Mon Jun 29 23:11:18 2015 +0700

----------------------------------------------------------------------
 .../javascripts/controllers/persistences.js     | 37 +++++++++++-
 modules/webconfig/nodejs/views/persistence.jade | 59 ++++++++++----------
 2 files changed, 66 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5af10b04/modules/webconfig/nodejs/public/javascripts/controllers/persistences.js
----------------------------------------------------------------------
diff --git a/modules/webconfig/nodejs/public/javascripts/controllers/persistences.js b/modules/webconfig/nodejs/public/javascripts/controllers/persistences.js
index 278d9a1..398f7da 100644
--- a/modules/webconfig/nodejs/public/javascripts/controllers/persistences.js
+++ b/modules/webconfig/nodejs/public/javascripts/controllers/persistences.js
@@ -17,6 +17,7 @@
 
 configuratorModule.controller('persistenceController', ['$scope', '$alert', '$http', 'commonFunctions',
function ($scope, $alert, $http, commonFunctions) {
         $scope.joinTip = commonFunctions.joinTip;
+        $scope.getModel = commonFunctions.getModel;
 
         $scope.databases = [
             {value: 'oracle', label: 'Oracle database'},
@@ -121,6 +122,10 @@ configuratorModule.controller('persistenceController', ['$scope', '$alert',
'$ht
         $scope.data = {
             curTableIdx: -1,
             curFieldIdx: -1,
+            curKeyClass: '',
+            curValueClass: '',
+            curJavaName: '',
+            curJavaType: '',
             tables: [
                 {schemaName: 'Schema1', use: true},
                 {schemaName: 'Schema1', use: true, tableName: 'Table1', keyClass: 'KeyClass1',
valueClass: 'ValueClass1',
@@ -141,10 +146,38 @@ configuratorModule.controller('persistenceController', ['$scope', '$alert',
'$ht
                     fields: [
                         {use: true, key: true, ak: true, dbName: 'name7', dbType: 'dbType7',
javaName: 'javaName7', javaType: 'javaType7'},
                         {use: true, key: false, ak: false, dbName: 'name8', dbType: 'dbType8',
javaName: 'javaName8', javaType: 'javaType8'},
-                        {use: false, key: false, ak: false, dbName: 'name9', dbType: 'dbType9',
javaName: 'javaName9', javaType: 'javaType9'}
+                        {use: false, key: false, ak: false, dbName: 'name9', dbType: 'dbType9',
javaName: 'javaName9', javaType: 'javaType9'},
+                        {use: false, key: false, ak: false, dbName: 'name10', dbType: 'dbType10',
javaName: 'javaName10', javaType: 'javaType10'},
+                        {use: false, key: false, ak: false, dbName: 'name11', dbType: 'dbType11',
javaName: 'javaName11', javaType: 'javaType11'},
+                        {use: false, key: false, ak: false, dbName: 'name12', dbType: 'dbType12',
javaName: 'javaName12', javaType: 'javaType12'}
                     ]}]
         };
 
-        $scope.curTableIdx = -1;
+        $scope.selectTable = function (idx) {
+            var data = $scope.data;
+
+            data.curTableIdx = idx;
+            data.curFieldIdx = -1;
+
+            if (idx >= 0) {
+                var tbl = data.tables[idx];
+
+                data.curKeyClass = tbl.keyClass;
+                data.curValueClass = tbl.valueClass;
+            }
+        };
+
+        $scope.selectField = function (idx) {
+            var data = $scope.data;
+
+            data.curFieldIdx = idx;
+
+            if (idx >= 0) {
+                var fld = data.tables[data.curTableIdx].fields[idx];
+
+                data.curJavaName = fld.javaName;
+                data.curJavaType = fld.javaType;
+            }
+        };
     }]
 );

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5af10b04/modules/webconfig/nodejs/views/persistence.jade
----------------------------------------------------------------------
diff --git a/modules/webconfig/nodejs/views/persistence.jade b/modules/webconfig/nodejs/views/persistence.jade
index a9996f8..c7073a5 100644
--- a/modules/webconfig/nodejs/views/persistence.jade
+++ b/modules/webconfig/nodejs/views/persistence.jade
@@ -21,6 +21,9 @@ append scripts
 
 include includes/controls
 
+mixin dbcheck(chk, clk)
+    input(type='checkbox' ng-checked=chk ng-click=clk)
+
 block content
     .docs-header
         h1 Persistence
@@ -49,22 +52,22 @@ block content
             table.table-bordered.table-condensed.col-sm-12(st-table='data.tables')
                 thead
                     tr
-                        th Schema/Table
+                        th.col-sm-3 Schema/Table
                         th Key class
                         th Value class
                 tbody
                     tr(ng-repeat='row in data.tables')
                         td
-                            input(type='checkbox' ng-if='!row.tableName' ng-checked='row.use'
ng-click='data.curTableIdx = -1')
-                            a(ng-if='!row.tableName' style='margin-left: 5px' ng-click='data.curTableIdx
= -1') {{row.schemaName}}
-                            input(type='checkbox' ng-if='row.tableName' style='margin-left:
10px' ng-checked = 'row.use' ng-click='data.curTableIdx = $index')
-                            a(ng-if='row.tableName' style='margin-left: 5px' ng-click='data.curTableIdx
= $index') {{row.tableName}}
+                            input(type='checkbox' ng-if='!row.tableName' ng-checked='row.use'
ng-click='selectTable(-1)')
+                            a(ng-if='!row.tableName' style='margin-left: 5px' ng-click='selectTable(-1)')
{{row.schemaName}}
+                            input(type='checkbox' ng-if='row.tableName' style='margin-left:
10px' ng-checked = 'row.use' ng-click='selectTable($index)')
+                            a(ng-if='row.tableName' style='margin-left: 5px' ng-click='selectTable($index)')
{{row.tableName}}
                         td
-                            a(ng-show='data.curTableIdx != $index' ng-click='data.curTableIdx
= $index; curKeyClass = data.tables[$index].keyClass') {{row.keyClass}}
-                            input(type='text' ng-show='data.curTableIdx == $index' ng-model='curKeyClass'
placeholder='Key class full name')
+                            a(ng-show='data.curTableIdx != $index' ng-click='selectTable($index)')
{{row.keyClass}}
+                            input(type='text' ng-show='data.curTableIdx == $index' ng-model='data.curKeyClass'
placeholder='Key class full name')
                         td
-                            a(ng-show='data.curTableIdx != $index' ng-click='data.curTableIdx
= $index; curValueClass = data.tables[$index].valueClass') {{row.valueClass}}
-                            input(type='text' ng-show='data.curTableIdx == $index' ng-model='curValueClass'
placeholder='Value class full name')
+                            a(ng-show='data.curTableIdx != $index' ng-click='selectTable($index)')
{{row.valueClass}}
+                            input(type='text' ng-show='data.curTableIdx == $index' ng-model='data.curValueClass'
placeholder='Value class full name')
         .links(ng-hide='data.curTableIdx < 0')
             table.table-bordered.table-condensed.col-sm-12(st-table='data.tables[data.curTableIdx].fields')
                 thead
@@ -78,24 +81,24 @@ block content
                         th.col-sm-2 Java Type
                 tbody
                     tr(ng-repeat='row in data.tables[data.curTableIdx].fields')
-                        td.col-sm-1
-                            input(type='checkbox' ng-checked='row.use')
-                        td.col-sm-1
-                            input(type='checkbox' ng-checked='row.key')
-                        td.col-sm-1
-                            input(type='checkbox' ng-checked='row.ak')
-                        td.col-sm-2
-                            a(ng-click='data.curFieldIdx = $index') {{row.dbName}}
-                        td.col-sm-2
-                            a {{row.dbType}}
-                        td.col-sm-2
-                            a(ng-show='data.curFieldIdx != $index' ng-click='data.curFieldIdx
= $index; curJavaName = data.tables[data.curTableIdx].fields[$index].javaName') {{row.javaName}}
-                            input(type='text' ng-show='data.curFieldIdx == $index' ng-model='curJavaName'
placeholder='Field Java name')
-                        td.col-sm-2
-                            a(ng-show='data.curFieldIdx != $index' ng-click='data.curFieldIdx
= $index; curJavaType = data.tables[data.curTableIdx].fields[$index].javaType') {{row.javaType}}
-                            input(type='text' ng-show='data.curFieldIdx == $index' ng-model='curJavaType'
placeholder='Field Java type')
-            button.btn.btn-primary(ng-disabled='inputForm.$invalid' ng-click='saveItem()')
Save
-            button.btn.btn-primary.btn-second(ng-show='backupItem._id' ng-click='removeItem()')
Remove
-            button.btn.btn-primary.btn-second(ng-click='reloadMetadata()') Reload
+                        td
+                            +dbcheck('row.use', 'selectField($index)')
+                        td
+                            +dbcheck('row.key', 'selectField($index)')
+                        td
+                            +dbcheck('row.ak', 'selectField($index)')
+                        td
+                            a(ng-click='selectField($index)') {{row.dbName}}
+                        td
+                            a(ng-click='selectField($index)') {{row.dbType}}
+                        td
+                            a(ng-show='data.curFieldIdx != $index' ng-click='selectField($index)')
{{row.javaName}}
+                            input(type='text' ng-show='data.curFieldIdx == $index' ng-model='data.curJavaName'
placeholder='Field Java name')
+                        td
+                            a(ng-show='data.curFieldIdx != $index' ng-click='selectField($index)')
{{row.javaType}}
+                            input(type='text' ng-show='data.curFieldIdx == $index' ng-model='data.curJavaType'
placeholder='Field Java type')
+        button.btn.btn-primary(ng-disabled='inputForm.$invalid' ng-click='saveItem()') Save
+        button.btn.btn-primary.btn-second(ng-show='backupItem._id' ng-click='removeItem()')
Remove
+        button.btn.btn-primary.btn-second(ng-click='reloadMetadata()') Reload
 
 


Mime
View raw message