Repository: ignite Updated Branches: refs/heads/ignite-843-rc2 3f25639d1 -> e2faebd8c
IGNITE-843 WIP configure caches templates on import metadata. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e2faebd8 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e2faebd8 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e2faebd8 Branch: refs/heads/ignite-843-rc2 Commit: e2faebd8c0b961a1d2a59e276024752a83d4908f Parents: 3f25639 Author: Alexey Kuznetsov <[email protected]> Authored: Fri Jan 15 18:31:28 2016 +0700 Committer: Alexey Kuznetsov <[email protected]> Committed: Fri Jan 15 18:31:28 2016 +0700 ---------------------------------------------------------------------- .../main/js/controllers/metadata-controller.js | 70 +++++++++++++++++++- .../src/main/js/public/stylesheets/style.scss | 6 ++ .../js/views/configuration/metadata-import.jade | 27 +++++--- 3 files changed, 92 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/e2faebd8/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 fdd34cf..ec2c96f 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 @@ -54,6 +54,13 @@ consoleModule.controller('metadataController', function ($filter, $http, $timeou selectFirstItem(); } + function _dropDownItem(lbl, val) { + return { + label: lbl, + value: val + } + } + $scope.removeDemoItems = function () { $table.tableReset(); @@ -70,6 +77,12 @@ consoleModule.controller('metadataController', function ($filter, $http, $timeou $scope.caches = data.caches; $scope.metadatas = data.metadatas; + $scope.importCaches = [_dropDownItem('New cache', 'IMPORT_META_NEW_CACHE')]; + $scope.importCacheTemplates = [ + _dropDownItem('PARTITIONED', 'IMPORT_META_DFLT_PARTITIONED_CACHE'), + _dropDownItem('REPLICATED', 'IMPORT_META_DFLT_REPLICATED_CACHE') + ]; + $scope.ui.generatedCachesClusters = []; _.forEach($scope.clusters, function (cluster) { @@ -573,6 +586,9 @@ consoleModule.controller('metadataController', function ($filter, $http, $timeou $http.post('/api/v1/agent/tables', preset) .success(function (tables) { tables.forEach(function (tbl) { + tbl.cache = 'IMPORT_META_NEW_CACHE'; + tbl.template = 'PARTITIONED'; + Object.defineProperty(tbl, 'label', { get: function () { return tbl.schema + '.' + tbl.tbl; @@ -582,6 +598,9 @@ consoleModule.controller('metadataController', function ($filter, $http, $timeou tbl.use = $common.isDefined(_.find(tbl.cols, function (col) { return col.key; })); + + tbl.editCache = false; + tbl.editTemplate = false; }); $scope.importMeta.action = 'tables'; @@ -596,6 +615,40 @@ consoleModule.controller('metadataController', function ($filter, $http, $timeou }); } + $scope.curDbTable = null; + + $scope.startEditDbTableCache = function (tbl) { + if ($scope.curDbTable) { + $scope.curDbTable.editCache = false; + $scope.curDbTable.editTemplate = false; + } + + + tbl.editCache = true; + + $scope.curDbTable = tbl; + }; + + $scope.startEditDbTableTemplate = function (tbl) { + if ($scope.curDbTable) { + $scope.curDbTable.editCache = false; + $scope.curDbTable.editTemplate = false; + } + + tbl.editTemplate = true; + + $scope.curDbTable = tbl; + }; + + $scope.dbTableCache = function (tbl) { + var cache = tbl.cache; + + if (cache === 'IMPORT_META_NEW_CACHE') + return 'New cache'; + + return tbl.cache; + }; + /** * Show page with import metadata options. */ @@ -963,6 +1016,21 @@ consoleModule.controller('metadataController', function ($filter, $http, $timeou $scope.caches = data.caches; $scope.metadatas = data.metadatas; + $scope.importCaches = [_dropDownItem('New cache', 'IMPORT_META_NEW_CACHE')]; + + if (!$common.isEmptyArray($scope.caches)) { + $scope.importCaches.push(null); + + _.forEach($scope.caches, function (cache) { + $scope.importCaches.push(cache); + }); + } + + $scope.importCacheTemplates = [ + _dropDownItem('PARTITIONED', 'IMPORT_META_DFLT_PARTITIONED_CACHE'), + _dropDownItem('REPLICATED', 'IMPORT_META_DFLT_REPLICATED_CACHE') + ]; + _.forEach($scope.clusters, function (cluster) { $scope.ui.generatedCachesClusters.push(cluster.value); }); @@ -1065,7 +1133,7 @@ consoleModule.controller('metadataController', function ($filter, $http, $timeou space: $scope.spaces[0]._id, caches: cacheId && _.find($scope.caches, {value: cacheId}) ? [cacheId] : (!$common.isEmptyArray($scope.caches) ? [$scope.caches[0].value] : []), - metadata: 'Configuration' + queryMetadata: 'Configuration' }; } http://git-wip-us.apache.org/repos/asf/ignite/blob/e2faebd8/modules/control-center-web/src/main/js/public/stylesheets/style.scss ---------------------------------------------------------------------- diff --git a/modules/control-center-web/src/main/js/public/stylesheets/style.scss b/modules/control-center-web/src/main/js/public/stylesheets/style.scss index 303d104..adfb478 100644 --- a/modules/control-center-web/src/main/js/public/stylesheets/style.scss +++ b/modules/control-center-web/src/main/js/public/stylesheets/style.scss @@ -887,6 +887,12 @@ button.form-control { } } +.td-ellipsis { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + .table-modal-striped { width: 100%; http://git-wip-us.apache.org/repos/asf/ignite/blob/e2faebd8/modules/control-center-web/src/main/js/views/configuration/metadata-import.jade ---------------------------------------------------------------------- diff --git a/modules/control-center-web/src/main/js/views/configuration/metadata-import.jade b/modules/control-center-web/src/main/js/views/configuration/metadata-import.jade index 9d3e8ec..31c3a74 100644 --- a/modules/control-center-web/src/main/js/views/configuration/metadata-import.jade +++ b/modules/control-center-web/src/main/js/views/configuration/metadata-import.jade @@ -19,6 +19,14 @@ include ../includes/controls mixin chk(mdl, change, tip) input(type='checkbox' ng-model=mdl ng-change=change bs-tooltip='' data-title=tip data-placement='bottom') +mixin td-ellipses-lbl(w, lbl) + td.td-ellipsis(width='#{w}' style='min-width: #{w}; max-width: #{w}') + label #{lbl} + +mixin td-ellipses-a(w, ref) + td.td-ellipsis(width='#{w}' style='min-width: #{w}; max-width: #{w}') + a #{ref} + .modal.center(role='dialog') .modal-dialog .modal-content(dw-loading='loadingMetadataFromDb' dw-loading-options='importMeta.loadingOptions') @@ -118,7 +126,7 @@ mixin chk(mdl, change, tip) label Table name th(width='160px') label Cache - th + th(width='128px') label Template tbody tr @@ -127,16 +135,15 @@ mixin chk(mdl, change, tip) table.table-modal-striped(id='metadataTableData') tbody tr(ng-repeat='table in importMeta.displayedTables') - td(width='30px') + td(width='30px' style='min-width: 30px; max-width: 30px') input(type='checkbox' ng-model='table.use' ng-change='selectTable()') - td(width='130px') - label {{::table.schema}} - td(width='160px') - label {{::table.tbl}} - td(width='160px') - label TODO - td - label TODO + +td-ellipses-lbl('130px', '{{::table.schema}}') + +td-ellipses-lbl('160px', '{{::table.tbl}}') + td.td-ellipsis(width='160px' style='min-width: 160px; max-width: 160px') + 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-ellipses-a('128px', '{{table.template}}') .metadata-content(ng-show='importMeta.action == "options"' style='margin-bottom: 75px') form.form-horizontal(name='optionsForm' novalidate) .settings-row
