You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ak...@apache.org on 2016/01/25 18:12:01 UTC

ignite git commit: IGNITE-843 WIP rework domain model import + minor fixes on IGFS and summary.

Repository: ignite
Updated Branches:
  refs/heads/ignite-843-rc2 ac8625b48 -> ffb7edcfd


IGNITE-843 WIP rework domain model import + minor fixes on IGFS and summary.


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

Branch: refs/heads/ignite-843-rc2
Commit: ffb7edcfda91cefe16fdb68e9f11f1219da79081
Parents: ac8625b
Author: AKuznetsov <ak...@gridgain.com>
Authored: Tue Jan 26 00:11:58 2016 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Tue Jan 26 00:11:58 2016 +0700

----------------------------------------------------------------------
 .../configuration/summary/summary.controller.js |   1 +
 .../main/js/controllers/domains-controller.js   | 136 +++++++++++--------
 .../js/views/configuration/domains-import.jade  |  17 ++-
 .../src/main/js/views/configuration/igfs.jade   |   8 +-
 4 files changed, 93 insertions(+), 69 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/ffb7edcf/modules/control-center-web/src/main/js/app/modules/states/configuration/summary/summary.controller.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/app/modules/states/configuration/summary/summary.controller.js b/modules/control-center-web/src/main/js/app/modules/states/configuration/summary/summary.controller.js
index fc816c9..44da468 100644
--- a/modules/control-center-web/src/main/js/app/modules/states/configuration/summary/summary.controller.js
+++ b/modules/control-center-web/src/main/js/app/modules/states/configuration/summary/summary.controller.js
@@ -40,6 +40,7 @@ export default [
         $scope.panelExpanded = $common.panelExpanded;
         $scope.tableVisibleRow = $table.tableVisibleRow;
         $scope.widthIsSufficient = $common.widthIsSufficient;
+        $scope.dialects = {};
 
         $scope.projectStructureOptions = {
             nodeChildren: 'children',

http://git-wip-us.apache.org/repos/asf/ignite/blob/ffb7edcf/modules/control-center-web/src/main/js/controllers/domains-controller.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/domains-controller.js b/modules/control-center-web/src/main/js/controllers/domains-controller.js
index ff19b5b..a1f0e3d 100644
--- a/modules/control-center-web/src/main/js/controllers/domains-controller.js
+++ b/modules/control-center-web/src/main/js/controllers/domains-controller.js
@@ -469,7 +469,7 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
 
                                 if ($scope.importDomain.demo) {
                                     $scope.ui.packageNamePrev = $scope.ui.packageName;
-                                    $scope.ui.packageName = 'org.apache.ignite.console.demo.model';
+                                    $scope.ui.packageName = 'model';
                                 }
                                 else if ($scope.ui.packageNamePrev) {
                                     $scope.ui.packageName = $scope.ui.packageNamePrev;
@@ -597,37 +597,53 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
             }
         };
 
-        $scope.importCommonActions = [
-            {label: 'Create new cache by template', value: 1},
-            {label: 'Associate with existing cache', value: 2}
-        ];
-
-        // TODO $scope.$watch();
+        $scope.importCommonActions = [];
+        $scope.importCommonCachesOrTemplates = [];
 
-        var zzz = [];
+        $scope.importCurrentActions = [];
+        $scope.importCurrentTemplates = [];
+        $scope.importCurrentCaches = [];
 
-        $scope.importCommonCachesOrTemplates = function () {
-            zzz.length = 0;
+        function _fillCommonCachesOrTemplates() {
+            $scope.importCommonCachesOrTemplates.length = 0;
 
             if ($scope.ui.importCommonAction == IMPORT_DM_NEW_CACHE) {
-                zzz.push(DFLT_PARTITIONED_CACHE);
-                zzz.push(DFLT_REPLICATED_CACHE);
+                $scope.importCommonCachesOrTemplates.push(DFLT_PARTITIONED_CACHE);
+                $scope.importCommonCachesOrTemplates.push(DFLT_REPLICATED_CACHE);
             }
 
             if (!$common.isEmptyArray($scope.caches)) {
-                if (zzz.length > 0)
-                    zzz.push(null);
+                if ($scope.importCommonCachesOrTemplates.length > 0)
+                    $scope.importCommonCachesOrTemplates.push(null);
 
                 _.forEach($scope.caches, function (cache) {
-                    zzz.push(cache);
+                    $scope.importCommonCachesOrTemplates.push(cache);
                 });
 
-                $timeout(function() {
-                    $scope.ui.importCommonCacheOrTemplate = zzz.length > 0 ? zzz[0].value : null;
+                $scope.ui.importCommonCacheOrTemplate = $scope.importCommonCachesOrTemplates.length > 0 ? $scope.importCommonCachesOrTemplates[0].value : null;
+            }
+        }
+
+        $scope.$watch('ui.importCommonAction', function () {
+            _fillCommonCachesOrTemplates();
+        });
+
+        $scope.tableActionView = function(tbl) {
+            if (tbl.action === IMPORT_DM_NEW_CACHE) {
+                var template = _.find($scope.importCurrentTemplates, function (t) {
+                    return t && tbl.template === t.value;
                 });
+
+                return 'Create ' + tbl.generatedCacheName + ' (' + template.label + ')';
             }
+            else {
+                var cache = _.find($scope.importCurrentCaches, function (c) {
+                    return tbl.cache === c.value;
+                });
 
-            return zzz;
+
+                return cache ? ('Associate with ' + cache.label) : 'No caches to associate with';
+            }
         };
 
         /**
@@ -649,14 +665,43 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
 
             $http.post('/api/v1/agent/tables', preset)
                 .success(function (tables) {
+                    var hasCaches = !$common.isEmptyArray($scope.caches);
+
+                    $scope.importCommonActions.length = 0;
+                    $scope.importCommonActions.push({label: 'Create new cache by template', value: IMPORT_DM_NEW_CACHE});
+                    if (hasCaches)
+                        $scope.importCommonActions.push({label: 'Associate with existing cache', value: IMPORT_DM_ASSOCIATE_CACHE});
+
+                    $scope.importCurrentActions.length = 0;
+                    $scope.importCurrentActions.push({label: 'Create', value: IMPORT_DM_NEW_CACHE});
+                    if (hasCaches)
+                        $scope.importCurrentActions.push({label: 'Associate', value: IMPORT_DM_ASSOCIATE_CACHE});
+
+                    $scope.importCurrentTemplates.length = 0;
+                    $scope.importCurrentCaches.length = 0;
+
+                    $scope.importCurrentTemplates.push(DFLT_PARTITIONED_CACHE);
+                    $scope.importCurrentTemplates.push(DFLT_REPLICATED_CACHE);
+
+                    if (hasCaches) {
+                        $scope.importCurrentTemplates.push(null);
+
+                        _.forEach($scope.caches, function (cache) {
+                            $scope.importCurrentTemplates.push(cache);
+                            $scope.importCurrentCaches.push(cache);
+                        });
+                    }
+
+                    var dfltCache = $scope.importCurrentCaches.length > 0 ? $scope.importCurrentCaches[0] : null;
 
                     _.forEach(tables, function (tbl, idx) {
                         tbl.id = idx;
-                        tbl.cache = IMPORT_DM_NEW_CACHE.value;
+                        tbl.action = IMPORT_DM_NEW_CACHE;
+                        tbl.generatedCacheName = toJavaClassName(tbl.tbl) + 'Cache';
+                        tbl.сache = dfltCache ? dfltCache.value : null;
                         tbl.template = DFLT_PARTITIONED_CACHE.value;
                         tbl.label = tbl.schema + '.' + tbl.tbl;
-                        tbl.editCache = false;
-                        tbl.editTemplate = false;
+                        tbl.edit = false;
                         tbl.use = $common.isDefined(_.find(tbl.cols, function (col) {
                             return col.key;
                         }));
@@ -665,6 +710,8 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
                     $scope.importDomain.action = 'tables';
                     $scope.importDomain.tables = tables;
                     $scope.importDomain.info = INFO_SELECT_TABLES;
+
+                    _fillCommonCachesOrTemplates();
                 })
                 .error(function (errMsg) {
                     $common.showError(errMsg);
@@ -676,49 +723,26 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
 
         $scope.applyDefaults = function () {
             _.forEach($scope.importDomain.displayedTables, function (table) {
-                table.editCache = false;
-                table.editTemplate = false;
-                table.cache = $scope.ui.dfltTableCache;
-                table.template = $scope.ui.dfltTableTemplate;
+                table.edit = false;
+                table.action = $scope.ui.importCommonAction;
+
+                if (table.action === IMPORT_DM_NEW_CACHE)
+                    table.template = $scope.ui.importCommonCacheOrTemplate;
+                else
+                    table.cache = $scope.ui.importCommonCacheOrTemplate;
             });
         };
 
         $scope.curDbTable = null;
 
         $scope.startEditDbTableCache = function (tbl) {
-            if ($scope.curDbTable) {
-                $scope.curDbTable.editCache = false;
-                $scope.curDbTable.editTemplate = false;
-            }
+            if ($scope.curDbTable)
+                $scope.curDbTable.edit = false;
 
-            tbl.editCache = true;
+            tbl.edit = true;
             $scope.curDbTable = tbl;
         };
 
-        $scope.startEditDbTableTemplate = function (tbl) {
-            if ($scope.curDbTable) {
-                $scope.curDbTable.editCache = false;
-                $scope.curDbTable.editTemplate = false;
-            }
-
-            $timeout(function () {
-                tbl.editTemplate = true;
-                $scope.curDbTable = tbl;
-            });
-        };
-
-        $scope.dbTableCache = function (tbl) {
-            return 'TODO'; //  _.find($scope.importCaches, {value: tbl.cache}).label;
-        };
-
-        $scope.dbTableTemplate = function (tbl) {
-            return 'TODO';
-            //if (tbl.cache === IMPORT_DM_NEW_CACHE.value)
-            //    return _.find($scope.importCacheTemplates, {value: tbl.template}).label;
-            //
-            //return '';
-        };
-
         /**
          * Show page with import domain models options.
          */
@@ -930,8 +954,8 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
                         newDomain.keyType = newDomain.keyFields[0].jdbcType.javaType;
 
                     // Prepare caches for generation.
-                    if (table.cache === IMPORT_DM_NEW_CACHE.value) {
-                        var template = _.find($scope.importCacheTemplates, {value: table.template});
+                    if (table.action === IMPORT_DM_NEW_CACHE) {
+                        var template = _.find($scope.importCurrentTemplates, {value: table.template});
 
                         newDomain.newCache = angular.copy(template ? template.cache : DFLT_PARTITIONED_CACHE.cache);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ffb7edcf/modules/control-center-web/src/main/js/views/configuration/domains-import.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/views/configuration/domains-import.jade b/modules/control-center-web/src/main/js/views/configuration/domains-import.jade
index a67c96d..4a03f88 100644
--- a/modules/control-center-web/src/main/js/views/configuration/domains-import.jade
+++ b/modules/control-center-web/src/main/js/views/configuration/domains-import.jade
@@ -140,24 +140,23 @@ mixin td-ellipses-lbl(w, lbl)
                                                     input(type='checkbox' ng-model='table.use' ng-change='selectTable()')
                                                 +td-ellipses-lbl('130px', '{{::table.schema}}')
                                                 +td-ellipses-lbl('160px', '{{::table.tbl}}')
-                                                td(width='160px' style='min-width: 160px; max-width: 160px')
+                                                td(colspan='2' width='288px' style='min-width: 160px; max-width: 160px')
                                                     div.td-ellipsis
-                                                        a(ng-if='!table.editCache' ng-click='startEditDbTableCache(table)') {{dbTableCache(table)}}
-                                                        button.select-toggle.form-control(ng-if='table.editCache' bs-select ng-model='table.cache' data-container='false' bs-options='item.value as item.label for item in importCaches')
-                                                td(width='128px' style='min-width: 128px; max-width: 128px')
-                                                    div.td-ellipsis
-                                                        a(ng-if='!table.editTemplate' ng-click='startEditDbTableTemplate(table)') {{dbTableTemplate(table)}}
-                                                        button.select-toggle.form-control(ng-if='table.editTemplate' bs-select ng-model='table.template' style='max-width: 110px' data-container='false' bs-options='item.value as item.label for item in importCacheTemplates')
+                                                        a(ng-if='!table.edit' ng-click='startEditDbTableCache(table)') {{tableActionView(table)}}
+                                                        div(style='display: flex' ng-if='table.edit')
+                                                            button.select-toggle.form-control(style='width: 35%; margin-right: 5px' bs-select ng-model='table.action' data-container='false' bs-options='item.value as item.label for item in importCurrentActions')
+                                                            button.select-toggle.form-control(ng-if='table.action==1' style='width: 65%; margin-right: 0' bs-select ng-model='table.template' data-container='false' bs-options='item.value as item.label for item in importCurrentTemplates')
+                                                            button.select-toggle.form-control(ng-if='table.action==2' style='width: 65%; margin-right: 0' bs-select ng-model='table.cache' data-container='false' bs-options='item.value as item.label for item in importCurrentCaches')
                                                 td
                 .settings-row
-                    label Defaults for tables
+                    label Defaults to be applied for filtered tables
                     i.tipLabel.fa.fa-question-circle(bs-tooltip='' data-title='Select and apply options for caches generation')
                 .settings-row
                     .col-sm-11
                         .col-sm-6(style='padding-right: 5px')
                             button.select-toggle.form-control(bs-select ng-model='ui.importCommonAction' data-container='false' bs-options='item.value as item.label for item in importCommonActions')
                         .col-sm-6(style='padding-left: 5px; padding-right: 5px')
-                            button.select-toggle.form-control(bs-select ng-model='ui.importCommonCacheOrTemplate' data-container='false' bs-options='item.value as item.label for item in importCommonCachesOrTemplates()')
+                            button.select-toggle.form-control(bs-select ng-model='ui.importCommonCacheOrTemplate' data-container='false' bs-options='item.value as item.label for item in importCommonCachesOrTemplates')
                     .col-sm-1(style='padding-left: 5px')
                         button.btn.btn-primary(ng-click='applyDefaults()') Apply
             .import-domain-model-wizard-page(ng-show='importDomain.action == "options"' style='margin-bottom: 176px')

http://git-wip-us.apache.org/repos/asf/ignite/blob/ffb7edcf/modules/control-center-web/src/main/js/views/configuration/igfs.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/views/configuration/igfs.jade b/modules/control-center-web/src/main/js/views/configuration/igfs.jade
index 13c14dc..7dcd6be 100644
--- a/modules/control-center-web/src/main/js/views/configuration/igfs.jade
+++ b/modules/control-center-web/src/main/js/views/configuration/igfs.jade
@@ -19,10 +19,10 @@ include ../includes/controls
 .docs-header
     h1 Create and Configure IGFS
 .docs-body(ng-controller='igfsController')
-    ignite-information(data-title='Configure IGFS only if you going to use In-memory File System')
-        p Ignite File System (IGFS) is an in-memory file system allowing work with files and directories over existing cache infrastructure.
-        p IGFS can either work as purely in-memory file system, or delegate to another file system (e.g. various Hadoop file system implementations) acting as a caching layer (see #[a(href='https://apacheignite.readme.io/docs/secondary-file-system' target='_blank') secondary file system]  for more detail).
-        p In addition IGFS provides API to execute map-reduce tasks over file system data.
+    ignite-information(data-title='Configure IGFS only if you are going to use In-memory File System')
+        p Ignite File System (IGFS) is an in-memory file system allowing work with files and directories over existing cache infrastructure
+        p IGFS can either work as purely in-memory file system, or delegate to another file system (e.g. various Hadoop file system implementations) acting as a caching layer (see #[a(href='https://apacheignite.readme.io/docs/secondary-file-system' target='_blank') secondary file system]  for more detail)
+        p In addition IGFS provides API to execute map-reduce tasks over file system data
     //-- ignite-callout
         ignite-callout-cel(data-title='On This Screen')
             li Configure IGFS file systems