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:14:04 UTC
[09/11] ignite git commit: IGNITE-843 WIP rework domain model import.
IGNITE-843 WIP rework domain model import.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/40e44de7
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/40e44de7
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/40e44de7
Branch: refs/heads/ignite-843-rc3
Commit: 40e44de717345ab37e350b284e5525b966be2a8d
Parents: da6b16e
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Mon Jan 25 17:05:15 2016 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Mon Jan 25 17:05:15 2016 +0700
----------------------------------------------------------------------
.../main/js/controllers/domains-controller.js | 139 ++++++++++---------
.../js/views/configuration/domains-import.jade | 38 ++---
2 files changed, 87 insertions(+), 90 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/40e44de7/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 201e71a..ff19b5b 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
@@ -25,11 +25,14 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
$scope.ui = $common.formUI();
+ var IMPORT_DM_NEW_CACHE = 1;
+ var IMPORT_DM_ASSOCIATE_CACHE = 2;
+
+ $scope.ui.importCommonAction = IMPORT_DM_NEW_CACHE;
$scope.ui.packageName = $commonUtils.toJavaPackageName($scope.$root.user.email.replace('@', '.')
.split('.').reverse().join('.') + '.model');
$scope.ui.builtinKeys = true;
$scope.ui.usePrimitives = true;
- $scope.ui.generateCaches = true;
$scope.ui.generatedCachesClusters = [];
$scope.removeDemoDropdown = [{
@@ -594,18 +597,38 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
}
};
- var IMPORT_DM_NEW_CACHE = {
- label: 'New cache',
- value: -1
- };
+ $scope.importCommonActions = [
+ {label: 'Create new cache by template', value: 1},
+ {label: 'Associate with existing cache', value: 2}
+ ];
- var IMPORT_DM_DO_NOT_GENERATE = {
- label: 'Do not generate',
- value: -2
- };
+ // TODO $scope.$watch();
+
+ var zzz = [];
+
+ $scope.importCommonCachesOrTemplates = function () {
+ zzz.length = 0;
+
+ if ($scope.ui.importCommonAction == IMPORT_DM_NEW_CACHE) {
+ zzz.push(DFLT_PARTITIONED_CACHE);
+ zzz.push(DFLT_REPLICATED_CACHE);
+ }
- $scope.ui.dfltTableCache = IMPORT_DM_NEW_CACHE.value;
- $scope.ui.dfltTableTemplate = DFLT_PARTITIONED_CACHE.value;
+ if (!$common.isEmptyArray($scope.caches)) {
+ if (zzz.length > 0)
+ zzz.push(null);
+
+ _.forEach($scope.caches, function (cache) {
+ zzz.push(cache);
+ });
+
+ $timeout(function() {
+ $scope.ui.importCommonCacheOrTemplate = zzz.length > 0 ? zzz[0].value : null;
+ });
+ }
+
+ return zzz;
+ };
/**
* Load list of database tables.
@@ -626,19 +649,6 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
$http.post('/api/v1/agent/tables', preset)
.success(function (tables) {
- $scope.importCaches = [IMPORT_DM_NEW_CACHE, IMPORT_DM_DO_NOT_GENERATE];
-
- $scope.importCacheTemplates = [DFLT_PARTITIONED_CACHE, DFLT_REPLICATED_CACHE];
-
- if (!$common.isEmptyArray($scope.caches)) {
- $scope.importCaches.push(null);
- $scope.importCacheTemplates.push(null);
-
- _.forEach($scope.caches, function (cache) {
- $scope.importCaches.push(cache);
- $scope.importCacheTemplates.push(cache);
- });
- }
_.forEach(tables, function (tbl, idx) {
tbl.id = idx;
@@ -664,10 +674,6 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
});
}
- $scope.dfltTableTemplateVisible = function () {
- return $scope.ui.dfltTableCache === IMPORT_DM_NEW_CACHE.value;
- };
-
$scope.applyDefaults = function () {
_.forEach($scope.importDomain.displayedTables, function (table) {
table.editCache = false;
@@ -702,14 +708,15 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
};
$scope.dbTableCache = function (tbl) {
- return _.find($scope.importCaches, {value: tbl.cache}).label;
+ return 'TODO'; // _.find($scope.importCaches, {value: tbl.cache}).label;
};
$scope.dbTableTemplate = function (tbl) {
- if (tbl.cache === IMPORT_DM_NEW_CACHE.value)
- return _.find($scope.importCacheTemplates, {value: tbl.template}).label;
-
- return '';
+ return 'TODO';
+ //if (tbl.cache === IMPORT_DM_NEW_CACHE.value)
+ // return _.find($scope.importCacheTemplates, {value: tbl.template}).label;
+ //
+ //return '';
};
/**
@@ -923,46 +930,44 @@ consoleModule.controller('domainsController', function ($filter, $http, $timeout
newDomain.keyType = newDomain.keyFields[0].jdbcType.javaType;
// Prepare caches for generation.
- if ($scope.ui.generateCaches && table.cache !== IMPORT_DM_DO_NOT_GENERATE.value) {
- if (table.cache === IMPORT_DM_NEW_CACHE.value) {
- var template = _.find($scope.importCacheTemplates, {value: table.template});
-
- newDomain.newCache = angular.copy(template ? template.cache : DFLT_PARTITIONED_CACHE.cache);
-
- delete newDomain.newCache._id;
- newDomain.newCache.name = typeName + 'Cache';
- newDomain.newCache.clusters = $scope.ui.generatedCachesClusters;
- newDomain.newCache.demo = $scope.importDomain.demo;
-
- // POJO store factory is not defined in template.
- if (!newDomain.newCache.cacheStoreFactory ||
- newDomain.newCache.cacheStoreFactory.kind !== 'CacheJdbcPojoStoreFactory') {
- var dialect = $scope.importDomain.demo ? 'H2' : $scope.selectedPreset.db;
-
- newDomain.newCache.cacheStoreFactory = {
- kind: 'CacheJdbcPojoStoreFactory',
- CacheJdbcPojoStoreFactory: {
- dataSourceBean: 'ds' + dialect,
- dialect: dialect
- }
- };
- }
+ if (table.cache === IMPORT_DM_NEW_CACHE.value) {
+ var template = _.find($scope.importCacheTemplates, {value: table.template});
+
+ newDomain.newCache = angular.copy(template ? template.cache : DFLT_PARTITIONED_CACHE.cache);
+
+ delete newDomain.newCache._id;
+ newDomain.newCache.name = typeName + 'Cache';
+ newDomain.newCache.clusters = $scope.ui.generatedCachesClusters;
+ newDomain.newCache.demo = $scope.importDomain.demo;
+
+ // POJO store factory is not defined in template.
+ if (!newDomain.newCache.cacheStoreFactory ||
+ newDomain.newCache.cacheStoreFactory.kind !== 'CacheJdbcPojoStoreFactory') {
+ var dialect = $scope.importDomain.demo ? 'H2' : $scope.selectedPreset.db;
+
+ newDomain.newCache.cacheStoreFactory = {
+ kind: 'CacheJdbcPojoStoreFactory',
+ CacheJdbcPojoStoreFactory: {
+ dataSourceBean: 'ds' + dialect,
+ dialect: dialect
+ }
+ };
}
- else if (table.cache !== IMPORT_DM_DO_NOT_GENERATE._id) {
- var cacheId = table.cache;
+ }
+ else {
+ var cacheId = table.cache;
- newDomain.caches = [cacheId];
+ newDomain.caches = [cacheId];
- if (!_.contains(checkedCaches, cacheId)) {
- var cache = _.find($scope.caches, {value: cacheId}).cache;
+ if (!_.contains(checkedCaches, cacheId)) {
+ var cache = _.find($scope.caches, {value: cacheId}).cache;
- var change = $common.autoCacheStoreConfiguration(cache, [newDomain]);
+ var change = $common.autoCacheStoreConfiguration(cache, [newDomain]);
- if (change)
- newDomain.cacheStoreChanges = [{cacheId: cacheId, change: change}];
+ if (change)
+ newDomain.cacheStoreChanges = [{cacheId: cacheId, change: change}];
- checkedCaches.push(cacheId)
- }
+ checkedCaches.push(cacheId)
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/40e44de7/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 fb99045..a67c96d 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
@@ -126,10 +126,8 @@ mixin td-ellipses-lbl(w, lbl)
label Schema
th(width='160px')
label Table name
- th(width='160px')
- label(ng-show='ui.generateCaches') Cache
- th(width='128px')
- label(ng-show='ui.generateCaches') Template
+ th(colspan=2 width='288px')
+ label Cache
th
tbody
tr
@@ -143,31 +141,25 @@ mixin td-ellipses-lbl(w, lbl)
+td-ellipses-lbl('130px', '{{::table.schema}}')
+td-ellipses-lbl('160px', '{{::table.tbl}}')
td(width='160px' style='min-width: 160px; max-width: 160px')
- div.td-ellipsis(ng-show='ui.generateCaches')
+ 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(ng-show='ui.generateCaches')
+ 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')
td
.settings-row
- .checkbox
- label
- input(id='importGenerateCaches' type='checkbox' ng-model='ui.generateCaches')
- | Generate caches
- i.tipLabel.fa.fa-question-circle(bs-tooltip='' data-title='Separate cache will be generated for each loaded table')
- div
- .col-xs-5.col-sm-5.col-md-5
- label(style='float: left; line-height: 28px; margin-right: 10px') Cache:
- .input-tip
- button.select-toggle.form-control(bs-select ng-model='ui.dfltTableCache' ng-disabled='!ui.generateCaches' data-container='false' bs-options='item.value as item.label for item in importCaches')
- .col-xs-5.col-sm-5.col-md-5(ng-show='dfltTableTemplateVisible()')
- label(style='float: left; line-height: 28px; margin: 0 10px') Template:
- .input-tip
- button.select-toggle.form-control(bs-select ng-model='ui.dfltTableTemplate' ng-disabled='!ui.generateCaches' data-container='false' bs-options='item.value as item.label for item in importCacheTemplates')
- .col-xs-2.col-sm-2.col-md-2
- button.btn.btn-primary(style="margin: 0 0 0 5px" ng-disabled='!ui.generateCaches' ng-click='applyDefaults()') Apply
+ label Defaults for 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()')
+ .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')
form.form-horizontal(name='optionsForm' novalidate)
.settings-row
@@ -195,7 +187,7 @@ mixin td-ellipses-lbl(w, lbl)
.col-xs-9.col-sm-10.col-md-10
i.tipField.fa.fa-question-circle(bs-tooltip='' data-title='Choose clusters that will be associated with generated caches')
.input-tip
- button.select-toggle.form-control(id='generatedCachesClusters' bs-select ng-model='ui.generatedCachesClusters' ng-disabled='!ui.generateCaches' ng-class='{placeholder: !(ui.generatedCachesClusters && ui.generatedCachesClusters.length > 0)}' data-container='false' data-multiple='1' placeholder='Choose clusters for generated caches' bs-options='item.value as item.label for item in clusters')
+ button.select-toggle.form-control(id='generatedCachesClusters' bs-select ng-model='ui.generatedCachesClusters' ng-class='{placeholder: !(ui.generatedCachesClusters && ui.generatedCachesClusters.length > 0)}' data-container='false' data-multiple='1' placeholder='Choose clusters for generated caches' bs-options='item.value as item.label for item in clusters')
.modal-footer
label(ng-hide='importDomain.action == "drivers" || (importDomain.action == "connect" && importDomain.demo)').labelField {{importDomain.info}}
a.btn.btn-primary(ng-hide='importDomain.action == "drivers" || importDomain.action == "connect"' ng-click='importDomainPrev()' bs-tooltip='' data-title='{{prevTooltipText()}}' data-placement='bottom') Prev