You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by an...@apache.org on 2015/10/09 10:19:14 UTC

ignite git commit: ignite-843 Added pojo for client configuration, changed title for type metadata table.

Repository: ignite
Updated Branches:
  refs/heads/ignite-843 745a55f2e -> 5480205a2


ignite-843 Added pojo for client configuration, changed title for type metadata table.


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

Branch: refs/heads/ignite-843
Commit: 5480205a2f552e29595b23ae53a98686aab8e344
Parents: 745a55f
Author: Vasiliy Sisko <vs...@gridgain.com>
Authored: Fri Oct 9 15:19:00 2015 +0700
Committer: Andrey <an...@gridgain.com>
Committed: Fri Oct 9 15:19:00 2015 +0700

----------------------------------------------------------------------
 .../main/js/controllers/metadata-controller.js  | 13 +++-
 .../main/js/controllers/summary-controller.js   | 66 ++++++++++++--------
 .../main/js/views/configuration/metadata.jade   |  2 +-
 .../main/js/views/configuration/summary.jade    | 42 +++++++------
 4 files changed, 76 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/5480205a/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 6c64c58..9f35aaa 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
@@ -17,8 +17,8 @@
 
 // Controller for Metadata screen.
 consoleModule.controller('metadataController', [
-    '$scope', '$controller', '$http', '$modal', '$common', '$timeout', '$focus', '$confirm', '$confirmBatch', '$message', '$clone', '$table', '$preview', '$loading', '$unsavedChangesGuard',
-    function ($scope, $controller, $http, $modal, $common, $timeout, $focus, $confirm, $confirmBatch, $message, $clone, $table, $preview, $loading, $unsavedChangesGuard) {
+    '$scope', '$controller', '$filter', '$http', '$modal', '$common', '$timeout', '$focus', '$confirm', '$confirmBatch', '$message', '$clone', '$table', '$preview', '$loading', '$unsavedChangesGuard',
+    function ($scope, $controller, $filter, $http, $modal, $common, $timeout, $focus, $confirm, $confirmBatch, $message, $clone, $table, $preview, $loading, $unsavedChangesGuard) {
             $unsavedChangesGuard.install($scope);
 
             // Initialize the super class and extend it.
@@ -628,6 +628,15 @@ consoleModule.controller('metadataController', [
                 }
             };
 
+            $scope.metadataTitle = function () {
+                var validFilter = $filter('metadatasValidation');
+
+                if ($scope.ui.showValid || validFilter($scope.displayedRows, false, true).length == 0)
+                    return 'Types metadata:';
+
+                return 'Type metadata without key fields:';
+            };
+
             function selectFirstItem() {
                 if ($scope.metadatas.length > 0)
                     $scope.selectItem($scope.metadatas[0]);

http://git-wip-us.apache.org/repos/asf/ignite/blob/5480205a/modules/control-center-web/src/main/js/controllers/summary-controller.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/summary-controller.js b/modules/control-center-web/src/main/js/controllers/summary-controller.js
index db49a94..b3ed15c 100644
--- a/modules/control-center-web/src/main/js/controllers/summary-controller.js
+++ b/modules/control-center-web/src/main/js/controllers/summary-controller.js
@@ -37,7 +37,8 @@ consoleModule.controller('summaryController', [
         {value: undefined, label: 'Not set'}
     ];
 
-    $scope.tabs = { activeTab: 0 };
+    $scope.tabsServer = { activeTab: 0 };
+    $scope.tabsClient = { activeTab: 0 };
 
     $scope.pojoClasses = function() {
         var classes = [];
@@ -53,6 +54,7 @@ consoleModule.controller('summaryController', [
     $scope.oss = ['debian:8', 'ubuntu:14.10'];
 
     $scope.configServer = {javaClassServer: 1, os: undefined};
+    $scope.configClient = {};
 
     $scope.backupItem = {javaClassClient: 1};
 
@@ -89,47 +91,61 @@ consoleModule.controller('summaryController', [
         $scope.javaServer = $generatorJava.cluster($scope.selectedItem, $scope.configServer.javaClassServer === 2);
     };
 
-    function selectPojoClass() {
-        _.forEach($generatorJava.metadatas, function(meta) {
-            if (meta.keyType == $scope.configServer.pojoClass)
-                $scope.pojoClass = meta.keyClass;
-            else if (meta.valueType == $scope.configServer.pojoClass)
-                $scope.pojoClass = meta.valueClass;
+    function selectPojoClass(config) {
+        $generatorJava.metadatas.forEach(function(meta) {
+            if (meta.keyType == config.pojoClass)
+                return config.pojoClassBody = meta.keyClass;
+
+            if (meta.valueType == config.pojoClass)
+                return config.pojoClassBody = meta.valueClass;
         });
     }
 
+    function pojoClsListener(config) {
+        return function () {
+            selectPojoClass(config);
+        };
+    }
+
     $scope.updatePojos = function() {
         if ($common.isDefined($scope.selectedItem)) {
-            var curCls = $scope.configServer.pojoClass;
+            var curServCls = $scope.configServer.pojoClass;
+            var curCliCls = $scope.configClient.pojoClass;
 
             $generatorJava.pojos($scope.selectedItem.caches, $scope.configServer.useConstructor, $scope.configServer.includeKeyFields);
 
-            if (!$common.isDefined(curCls) || _.findIndex($generatorJava.metadatas, function (meta) {
-                    return meta.keyType == curCls || meta.valueType == curCls;
-                }) < 0) {
-                if ($generatorJava.metadatas.length > 0) {
-                    if ($common.isDefined($generatorJava.metadatas[0].keyType))
-                        $scope.configServer.pojoClass = $generatorJava.metadatas[0].keyType;
-                    else
-                        $scope.configServer.pojoClass = $generatorJava.metadatas[0].valueType;
+            function restoreSelected(selected, config, tabs) {
+                if (!$common.isDefined(selected) || _.findIndex($generatorJava.metadatas, function (meta) {
+                        return meta.keyType == selected || meta.valueType == selected;
+                    }) < 0) {
+                    if ($generatorJava.metadatas.length > 0) {
+                        if ($common.isDefined($generatorJava.metadatas[0].keyType))
+                            config.pojoClass = $generatorJava.metadatas[0].keyType;
+                        else
+                            config.pojoClass = $generatorJava.metadatas[0].valueType;
+                    }
+                    else {
+                        config.pojoClass = undefined;
+
+                        if (tabs.activeTab == 2)
+                            tabs.activeTab = 0;
+                    }
                 }
-                else {
-                    $scope.configServer.pojoClass = undefined;
+                else
+                    config.pojoClass = selected;
 
-                    if ($scope.tabs.activeTab == 2)
-                        $scope.tabs.activeTab = 0;
-                }
+                selectPojoClass(config);
             }
-            else
-                $scope.configServer.pojoClass = curCls;
 
-            selectPojoClass();
+            restoreSelected(curServCls, $scope.configServer, $scope.tabsServer);
+            restoreSelected(curCliCls, $scope.configClient, $scope.tabsClient);
         }
     };
 
     $scope.$watch('configServer.javaClassServer', $scope.generateJavaServer, true);
 
-    $scope.$watch('configServer.pojoClass', selectPojoClass, true);
+    $scope.$watch('configServer.pojoClass', pojoClsListener($scope.configServer), true);
+    $scope.$watch('configClient.pojoClass', pojoClsListener($scope.configClient), true);
 
     $scope.$watch('configServer.useConstructor', $scope.updatePojos, true);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/5480205a/modules/control-center-web/src/main/js/views/configuration/metadata.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/views/configuration/metadata.jade b/modules/control-center-web/src/main/js/views/configuration/metadata.jade
index 7e051bf..42b4a1a 100644
--- a/modules/control-center-web/src/main/js/views/configuration/metadata.jade
+++ b/modules/control-center-web/src/main/js/views/configuration/metadata.jade
@@ -34,7 +34,7 @@ block content
                         thead
                             tr
                                 th
-                                    lable.labelHeader.labelFormField Types metadata:
+                                    lable.labelHeader.labelFormField {{metadataTitle()}}
                                     .col-sm-8.pull-right(style='padding: 0')
                                         .col-sm-6
                                             .pull-right.labelLogin.additional-filter(ng-if='(displayedRows | metadatasValidation:false:true).length > 0')

http://git-wip-us.apache.org/repos/asf/ignite/blob/5480205a/modules/control-center-web/src/main/js/views/configuration/summary.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/views/configuration/summary.jade b/modules/control-center-web/src/main/js/views/configuration/summary.jade
index 05ccc0f..b900e88 100644
--- a/modules/control-center-web/src/main/js/views/configuration/summary.jade
+++ b/modules/control-center-web/src/main/js/views/configuration/summary.jade
@@ -31,6 +31,25 @@ mixin btn-download(side)
     .panel-tip-container(style='float: right;' data-placement='bottom' bs-tooltip='"Download #{side} configuration"')
         button.btn.btn-primary.pull-right(type='submit' ng-click='$event.stopPropagation()') Download
 
+mixin pojos(side)
+    div(bs-pane title='POJO' ng-show='pojoAvailable()')
+        .details-row
+            .col-xs-2.col-sm-2.col-md-2
+                label POJO class:
+            .col-xs-10.col-sm-10.col-md-10
+                button.select-toggle.form-control(ng-model='config#{side}.pojoClass' bs-select bs-options='item for item in pojoClasses()')
+            .col-xs-2.col-sm-2.col-md-2
+                label
+            .col-xs-10.col-sm-10.col-md-10
+                input(type='checkbox' ng-model='configServer.useConstructor')
+                | Generate constructors
+            .col-xs-2.col-sm-2.col-md-2
+                label
+            .col-xs-10.col-sm-10.col-md-10
+                input(type='checkbox' ng-model='configServer.includeKeyFields')
+                | Include key fields
+        div(ui-ace='{ onLoad: aceInit, mode: "java" }' ng-model='config#{side}.pojoClassBody')
+
 block content
     .docs-header
         h1 Configurations Summary
@@ -52,7 +71,7 @@ block content
                         input(type='hidden' name='includeKeyFields' value='{{configServer.includeKeyFields}}')
                         +btn-download('server')
                     .panel-collapse(role='tabpanel' bs-collapse-target)
-                        .summary-tabs(bs-tabs data-bs-active-pane="tabs.activeTab" ng-show='selectedItem' template='summary/summary-tabs')
+                        .summary-tabs(bs-tabs data-bs-active-pane="tabsServer.activeTab" ng-show='selectedItem' template='summary/summary-tabs')
                             div(bs-pane title='XML')
                                 div(ui-ace='{ onLoad: aceInit, mode: "xml" }' ng-model='xmlServer')
                             div(bs-pane title='Java')
@@ -62,23 +81,7 @@ block content
                                     .col-xs-4.col-sm-3.col-md-3
                                         button.select-toggle.form-control(ng-model='configServer.javaClassServer' bs-select bs-options='item.value as item.label for item in javaClassItems' data-sort='false')
                                 div(ui-ace='{ onLoad: aceInit, mode: "java" }' ng-model='javaServer')
-                            div(bs-pane title='POJO' ng-show='pojoAvailable()')
-                                .details-row
-                                    .col-xs-2.col-sm-2.col-md-2
-                                        label POJO class:
-                                    .col-xs-10.col-sm-10.col-md-10
-                                        button.select-toggle.form-control(ng-model='configServer.pojoClass' bs-select bs-options='item for item in pojoClasses()')
-                                    .col-xs-2.col-sm-2.col-md-2
-                                        label
-                                    .col-xs-10.col-sm-10.col-md-10
-                                        input(type='checkbox' ng-model='configServer.useConstructor')
-                                        | Generate constructors
-                                    .col-xs-2.col-sm-2.col-md-2
-                                        label
-                                    .col-xs-10.col-sm-10.col-md-10
-                                        input(type='checkbox' ng-model='configServer.includeKeyFields')
-                                        | Include key fields
-                                div(ui-ace='{ onLoad: aceInit, mode: "java" }' ng-model='pojoClass')
+                            +pojos('Server')
                             div(bs-pane title='Dockerfile')
                                 .details-row
                                     p
@@ -108,7 +111,7 @@ block content
                         div(ng-show='selectedItem')
                             .details-row(ng-repeat='field in clientFields')
                                 +form-row-custom(['col-xs-4 col-sm-4 col-md-3'], ['col-xs-4 col-sm-4 col-md-3'], 'backupItem')
-                            .summary-tabs(bs-tabs template='summary/summary-tabs')
+                            .summary-tabs(bs-tabs data-bs-active-pane="tabsClient.activeTab" template='summary/summary-tabs')
                                 div(bs-pane title='XML')
                                     div(ui-ace='{ onLoad: aceInit, mode: "xml" }' ng-model='xmlClient')
                                 div(bs-pane title='Java')
@@ -118,3 +121,4 @@ block content
                                         .col-xs-4.col-sm-3.col-md-3
                                             button.select-toggle.form-control(ng-model='backupItem.javaClassClient' bs-select bs-options='item.value as item.label for item in javaClassItems' data-sort='false')
                                     div(ui-ace='{ onLoad: aceInit, mode: "java" }' ng-model='javaClient')
+                                +pojos('Client')