Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-843 8be9461ba -> a14783a9e


# IGNITE-843 Wip on cache indexed types.


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

Branch: refs/heads/ignite-843
Commit: 81b98a1cb9163cf534972dacf8852b50a4e3556b
Parents: 6c0928b
Author: AKuznetsov <akuznet...@gridgain.com>
Authored: Thu Jun 11 15:41:44 2015 +0700
Committer: AKuznetsov <akuznet...@gridgain.com>
Committed: Thu Jun 11 15:41:44 2015 +0700

----------------------------------------------------------------------
 .../nodejs/public/form-models/caches.json       |  5 +-
 .../public/javascripts/controllers/caches.js    | 58 ++++++++++++++++----
 .../nodejs/views/includes/controls.jade         | 14 ++++-
 modules/webconfig/nodejs/views/simplePopup.jade |  4 +-
 4 files changed, 65 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/81b98a1c/modules/webconfig/nodejs/public/form-models/caches.json
----------------------------------------------------------------------
diff --git a/modules/webconfig/nodejs/public/form-models/caches.json 
b/modules/webconfig/nodejs/public/form-models/caches.json
index eae2c1f..dfc028d 100644
--- a/modules/webconfig/nodejs/public/form-models/caches.json
+++ b/modules/webconfig/nodejs/public/form-models/caches.json
@@ -351,8 +351,9 @@
           ]
         },
         {
-          "label": "SQL functions",
-          "type": "text",
+          "table-label": "SQL functions",
+          "label": "SQL function",
+          "type": "table-simple",
           "model": "sqlFunctionClasses",
           "tip": [
             "Classes with user-defined functions for SQL queries."

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/81b98a1c/modules/webconfig/nodejs/public/javascripts/controllers/caches.js
----------------------------------------------------------------------
diff --git a/modules/webconfig/nodejs/public/javascripts/controllers/caches.js 
b/modules/webconfig/nodejs/public/javascripts/controllers/caches.js
index 3872249..6ba705b 100644
--- a/modules/webconfig/nodejs/public/javascripts/controllers/caches.js
+++ b/modules/webconfig/nodejs/public/javascripts/controllers/caches.js
@@ -17,15 +17,7 @@
 
 configuratorModule.controller('cachesController', ['$scope', '$modal', 
'$http', function ($scope, $modal, $http) {
         $scope.templates = [
-            {
-                value: {
-                    mode: 'PARTITIONED', atomicityMode: 'ATOMIC',
-                    indexedTypes: [{
-                        keyClass: 'org.some.KeyClass',
-                        valueClass: 'org.some.ValueClass'
-                    }, {keyClass: 'org.some.KeyClass2', valueClass: 
'org.some.ValueClass2'}]
-                }, label: 'Partitioned'
-            },
+            {value: {mode: 'PARTITIONED', atomicityMode: 'ATOMIC'}, label: 
'Partitioned'},
             {value: {mode: 'REPLICATED', atomicityMode: 'ATOMIC'}, label: 
'Replicated'},
             {value: {mode: 'LOCAL', atomicityMode: 'ATOMIC'}, label: 'Local'}
         ];
@@ -96,8 +88,14 @@ configuratorModule.controller('cachesController', ['$scope', 
'$modal', '$http',
 
             var idx = $scope.indexedTypeIdx;
 
-            if (idx < 0)
-                idxTypes.push({keyClass: k, valueClass: v});
+            if (idx < 0) {
+                var newItem = {keyClass: k, valueClass: v};
+
+                if (undefined == idxTypes)
+                    $scope.backupItem.indexedTypes = [newItem];
+                else
+                    idxTypes.push(newItem);
+            }
             else {
                 var idxType = idxTypes[idx];
 
@@ -187,5 +185,43 @@ configuratorModule.controller('cachesController', 
['$scope', '$modal', '$http',
                     console.log('Error: ' + errorMessage);
                 });
         };
+
+        $scope.createSimpleItem = function(desc, rows) {
+            $scope.simplePopup = {
+                rows: rows,
+                desc: desc
+            };
+
+            $scope.pupup = $modal({scope: $scope, template: '/simplePopup', 
show: true});
+        };
+
+        $scope.saveSimpleItem = function(row) {
+            var popup = $scope.simplePopup;
+            var rows = popup.rows;
+
+            if (popup.index)
+                angular.extend(rows[popup.index], row);
+            else if (undefined == rows)
+                popup.rows = [row];
+            else
+                popup.rows.push(row);
+
+            $scope.pupup.hide();
+        };
+
+        $scope.editSimpleItem = function(desc, rows, idx) {
+            $scope.simplePopup = {
+                desc: desc,
+                rows: rows,
+                index: idx,
+                row: angular.copy(rows[idx])
+            };
+
+            $modal({scope: $scope, template: '/simplePopup', show: true});
+        };
+
+        $scope.removeSimpleItem = function(rows, idx) {
+            rows.splice(idx, 1);
+        };
     }]
 );
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/81b98a1c/modules/webconfig/nodejs/views/includes/controls.jade
----------------------------------------------------------------------
diff --git a/modules/webconfig/nodejs/views/includes/controls.jade 
b/modules/webconfig/nodejs/views/includes/controls.jade
index 537d6c4..8f4d2f8 100644
--- a/modules/webconfig/nodejs/views/includes/controls.jade
+++ b/modules/webconfig/nodejs/views/includes/controls.jade
@@ -91,12 +91,24 @@ mixin form-row
             +tip('field.tip')
             .details-row(ng-repeat='detail in field.details[#{masterMdl}]')
                 +details-row
+        div(ng-switch-when='table-simple')
+            div
+                label {{field.table-label}}
+                +tip('field.tip')
+            button.btn.btn-primary(style='margin-left: 18px;' 
ng-click='createSimpleItem(field, #{masterMdl})') Add {{field.label}}
+            .col-sm-10.links.details-row(style='margin-bottom: 0px;' 
nh-show='#{masterMdl}[field.model].length > 0')
+                table(st-table=masterMdl)
+                    tbody
+                        tr(ng-repeat='row in #{masterMdl}')
+                            td
+                                a(ng-click='editSimpleItem(field, 
#{masterMdl}, $index)') {{$index + 1}}. {{row}}
+                                
label.fa.fa-remove(ng-click='removeSimpleItem(#{masterMdl}, $index)')
         div(ng-switch-when='indexedTypes')
             div
                 label Indexed types: {{backupItem.indexedTypes.length}}
                 +tip('field.tip')
             button.btn.btn-primary(style='margin-left: 18px; margin-top: 10px; 
margin-bottom: 10px' ng-click='editIndexedTypes(-1)') Add indexed type
-            .col-sm-10.links
+            .col-sm-10.links(nh-show='backupItem.indexedTypes.length > 0')
                 -var idxTypes = 'backupItem.indexedTypes'
                 table(st-table=idxTypes)
                     tbody

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/81b98a1c/modules/webconfig/nodejs/views/simplePopup.jade
----------------------------------------------------------------------
diff --git a/modules/webconfig/nodejs/views/simplePopup.jade 
b/modules/webconfig/nodejs/views/simplePopup.jade
index c6e8bf2..d107e53 100644
--- a/modules/webconfig/nodejs/views/simplePopup.jade
+++ b/modules/webconfig/nodejs/views/simplePopup.jade
@@ -24,8 +24,8 @@
                 .modal-body.row
                     .col-sm-10.col-sm-offset-1
                         .details-row
-                            label.col-sm-2 {{simplePopup.desc.label | 
capitalize}}:
-                            .col-sm-9
+                            label.col-sm-3 {{simplePopup.desc.label | 
capitalize}}:
+                            .col-sm-8
                                 input.form-control(type='text' 
ng-model='simplePopup.row' required)
                             
i.tip.fa.fa-question-circle(ng-if='simplePopup.desc.tip' 
bs-tooltip='simplePopup.desc.tip.join("")' type='button')
                 .modal-footer

Reply via email to