Repository: ignite Updated Branches: refs/heads/ignite-843 5e559928b -> 7aae0ee85
IGNITE-843 WIP preview. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7aae0ee8 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7aae0ee8 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7aae0ee8 Branch: refs/heads/ignite-843 Commit: 7aae0ee85ab081a509dacc5ab8dc24b349136db1 Parents: 5e55992 Author: AKuznetsov <[email protected]> Authored: Mon Aug 24 23:03:11 2015 +0700 Committer: AKuznetsov <[email protected]> Committed: Mon Aug 24 23:03:11 2015 +0700 ---------------------------------------------------------------------- .../main/js/controllers/caches-controller.js | 8 +- .../main/js/controllers/clusters-controller.js | 27 +- .../src/main/js/controllers/common-module.js | 727 +++++++++++++++---- .../main/js/controllers/metadata-controller.js | 8 +- .../main/js/controllers/models/clusters.json | 12 + .../control-center-web/src/main/js/package.json | 8 +- .../src/main/js/views/includes/controls.jade | 6 +- 7 files changed, 606 insertions(+), 190 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/7aae0ee8/modules/control-center-web/src/main/js/controllers/caches-controller.js ---------------------------------------------------------------------- diff --git a/modules/control-center-web/src/main/js/controllers/caches-controller.js b/modules/control-center-web/src/main/js/controllers/caches-controller.js index 978e263..f7e67d6 100644 --- a/modules/control-center-web/src/main/js/controllers/caches-controller.js +++ b/modules/control-center-web/src/main/js/controllers/caches-controller.js @@ -16,11 +16,12 @@ */ controlCenterModule.controller('cachesController', [ - '$scope', '$http', '$common', '$focus', '$confirm', '$copy', '$table', - function ($scope, $http, $common, $focus, $confirm, $copy, $table) { + '$scope', '$http', '$common', '$focus', '$confirm', '$copy', '$table', '$preview', + function ($scope, $http, $common, $focus, $confirm, $copy, $table, $preview) { $scope.joinTip = $common.joinTip; $scope.getModel = $common.getModel; $scope.javaBuildInClasses = $common.javaBuildInClasses; + $scope.compactJavaName = $common.compactJavaName; $scope.tableReset = $table.tableReset; $scope.tableNewItem = $table.tableNewItem; @@ -38,9 +39,10 @@ controlCenterModule.controller('cachesController', [ $scope.tablePairSave = $table.tablePairSave; $scope.tablePairSaveVisible = $table.tablePairSaveVisible; - $scope.compactJavaName = $common.compactJavaName; + $scope.previewInit = $preview.previewInit; $scope.hidePopover = $common.hidePopover; + var showPopoverMessage = $common.showPopoverMessage; $scope.atomicities = $common.mkOptions(['ATOMIC', 'TRANSACTIONAL']); http://git-wip-us.apache.org/repos/asf/ignite/blob/7aae0ee8/modules/control-center-web/src/main/js/controllers/clusters-controller.js ---------------------------------------------------------------------- diff --git a/modules/control-center-web/src/main/js/controllers/clusters-controller.js b/modules/control-center-web/src/main/js/controllers/clusters-controller.js index 292ec40..ac6b347 100644 --- a/modules/control-center-web/src/main/js/controllers/clusters-controller.js +++ b/modules/control-center-web/src/main/js/controllers/clusters-controller.js @@ -15,8 +15,8 @@ * limitations under the License. */ -controlCenterModule.controller('clustersController', ['$scope', '$http', '$common', '$focus', '$confirm', '$copy', '$table', - function ($scope, $http, $common, $focus, $confirm, $copy, $table) { +controlCenterModule.controller('clustersController', ['$scope', '$http', '$common', '$focus', '$confirm', '$copy', '$table', '$preview', '$code', + function ($scope, $http, $common, $focus, $confirm, $copy, $table, $preview, $code) { $scope.joinTip = $common.joinTip; $scope.getModel = $common.getModel; @@ -33,6 +33,8 @@ controlCenterModule.controller('clustersController', ['$scope', '$http', '$commo $scope.tableSimpleDown = $table.tableSimpleDown; $scope.tableSimpleDownVisible = $table.tableSimpleDownVisible; + $scope.previewInit = $preview.previewInit; + $scope.hidePopover = $common.hidePopover; var showPopoverMessage = $common.showPopoverMessage; @@ -66,20 +68,7 @@ controlCenterModule.controller('clustersController', ['$scope', '$http', '$commo } } - $scope.aceInit = function (editor) { - editor.setReadOnly(true); - editor.setOption("highlightActiveLine", false); - - var renderer = editor.renderer; - - renderer.setHighlightGutterLine(false); - renderer.setShowPrintMargin(false); - renderer.setOption('fontSize', '14px'); - - editor.setTheme('ace/theme/chrome'); - }; - - $scope.preview = '<bean class="org.apache.ignite.configuration.IgniteConfiguration"></bean>'; + $scope.preview = {}; $scope.cacheModes = $common.mkOptions(['LOCAL', 'REPLICATED', 'PARTITIONED']); @@ -193,8 +182,12 @@ controlCenterModule.controller('clustersController', ['$scope', '$http', '$commo $scope.selectItem($scope.clusters[0]); $scope.$watch('backupItem', function (val) { - if (val) + if (val) { sessionStorage.clusterBackupItem = angular.toJson(val); + + $scope.preview.general = $code.xmlClusterGeneral(val).join(''); + $scope.preview.atomics = $code.xmlClusterAtomics(val).join(''); + } }, true); }) .error(function (errMsg) { http://git-wip-us.apache.org/repos/asf/ignite/blob/7aae0ee8/modules/control-center-web/src/main/js/controllers/common-module.js ---------------------------------------------------------------------- diff --git a/modules/control-center-web/src/main/js/controllers/common-module.js b/modules/control-center-web/src/main/js/controllers/common-module.js index f268743..85bdc3e 100644 --- a/modules/control-center-web/src/main/js/controllers/common-module.js +++ b/modules/control-center-web/src/main/js/controllers/common-module.js @@ -526,7 +526,17 @@ controlCenterModule.service('$common', [ }); }, isDefined: isDefined, - isEmptyArray: isEmptyArray, + hasProperty: function (obj, props) { + for (var propName in props) { + if (props.hasOwnProperty(propName)) { + if (obj[propName]) + return true; + } + } + + return false; + }, + isEmptyArray: isEmptyArray, isEmptyString: isEmptyString, errorMessage: errorMessage, showError: showError, @@ -680,228 +690,625 @@ controlCenterModule.service('$copy', function ($modal, $rootScope, $q) { }); // Tables support service. -controlCenterModule.service('$table', [ - '$common', '$focus', function ($common, $focus) { - function _swapSimpleItems(a, ix1, ix2) { - var tmp = a[ix1]; +controlCenterModule.service('$table', ['$common', '$focus', function ($common, $focus) { + function _swapSimpleItems(a, ix1, ix2) { + var tmp = a[ix1]; - a[ix1] = a[ix2]; - a[ix2] = tmp; - } + a[ix1] = a[ix2]; + a[ix2] = tmp; + } - function _model(item, field) { - return $common.getModel(item, field); - } + function _model(item, field) { + return $common.getModel(item, field); + } + + var table = {name: 'none', editIndex: -1}; + + function _tableReset() { + table.name = 'none'; + table.editIndex = -1; - var table = {name: 'none', editIndex: -1}; + $common.hidePopover(); + } + + function _tableState(name, editIndex) { + table.name = name; + table.editIndex = editIndex; + } - function _tableReset() { - table.name = 'none'; - table.editIndex = -1; + function _tableUI(field) { + var ui = field.ui; - $common.hidePopover(); + return ui ? ui : field.type; + } + + function _tableFocus(focusId, index) { + $focus((index < 0 ? 'new' : 'cur') + focusId); + } + + function _tableSimpleValue(filed, index) { + return index < 0 ? filed.newValue : filed.curValue; + } + + function _tablePairValue(filed, index) { + return index < 0 ? {key: filed.newKey, value: filed.newValue} : {key: filed.curKey, value: filed.curValue}; + } + + function _tableStartEdit(item, field, index) { + _tableState(field.model, index); + + var val = _model(item, field)[field.model][index]; + + var ui = _tableUI(field); + + if (ui == 'table-simple') { + field.curValue = val; + + _tableFocus(field.focusId, index); } + else if (ui == 'table-pair') { + field.curKey = val[field.keyName]; + field.curValue = val[field.valueName]; - function _tableState(name, editIndex) { - table.name = name; - table.editIndex = editIndex; + _tableFocus('Key' + field.focusId, index); } + else if (ui == 'table-db-fields') { + field.curDatabaseName = val.databaseName; + field.curDatabaseType = val.databaseType; + field.curJavaName = val.javaName; + field.curJavaType = val.javaType; - function _tableUI(field) { - var ui = field.ui; + _tableFocus('DatabaseName' + field.focusId, index); + } + else if (ui == 'table-query-groups') { + field.curGroupName = val.name; + field.curFields = val.fields; - return ui ? ui : field.type; + _tableFocus('GroupName', index); } + } + + function _tableNewItem(field) { + _tableState(field.model, -1); + + var ui = _tableUI(field); + + if (ui == 'table-simple') { + field.newValue = null; - function _tableFocus(focusId, index) { - $focus((index < 0 ? 'new' : 'cur') + focusId); + _tableFocus(field.focusId, -1); } + else if (ui == 'table-pair') { + field.newKey = null; + field.newValue = null; - function _tableSimpleValue(filed, index) { - return index < 0 ? filed.newValue : filed.curValue; + _tableFocus('Key' + field.focusId, -1); } + else if (ui == 'table-db-fields') { + field.newDatabaseName = null; + field.newDatabaseType = 'INTEGER'; + field.newJavaName = null; + field.newJavaType = 'Integer'; - function _tablePairValue(filed, index) { - return index < 0 ? {key: filed.newKey, value: filed.newValue} : {key: filed.curKey, value: filed.curValue}; + _tableFocus('DatabaseName' + field.focusId, -1); } + else if (ui == 'table-query-groups') { + field.newGroupName = null; + field.newFields = null; - function _tableStartEdit(item, field, index) { - _tableState(field.model, index); + _tableFocus('GroupName', -1); + } + else if (ui == 'table-query-group-fields') { + _tableFocus('FieldName', -1); + } + } - var val = _model(item, field)[field.model][index]; + return { + tableState: function (name, editIndex) { + _tableState(name, editIndex); + }, + tableReset: function () { + _tableReset(); + }, + tableNewItem: _tableNewItem, + tableNewItemActive: function (field) { + return table.name == field.model && table.editIndex < 0; + }, + tableEditing: function (field, index) { + return table.name == field.model && table.editIndex == index; + }, + tableStartEdit: _tableStartEdit, + tableRemove: function (item, field, index) { + _tableReset(); + + _model(item, field)[field.model].splice(index, 1); + }, + tableSimpleSave: function (valueValid, item, field, index) { + var simpleValue = _tableSimpleValue(field, index); + + if (valueValid(item, field, simpleValue, index)) { + _tableReset(); - var ui = _tableUI(field); + if (index < 0) { + if (_model(item, field)[field.model]) + _model(item, field)[field.model].push(simpleValue); + else + _model(item, field)[field.model] = [simpleValue]; - if (ui == 'table-simple') { - field.curValue = val; + _tableNewItem(field); + } + else { + var arr = _model(item, field)[field.model]; - _tableFocus(field.focusId, index); - } - else if (ui == 'table-pair') { - field.curKey = val[field.keyName]; - field.curValue = val[field.valueName]; + arr[index] = simpleValue; - _tableFocus('Key' + field.focusId, index); + if (index < arr.length - 1) + _tableStartEdit(item, field, index + 1); + else + _tableNewItem(field); + } } - else if (ui == 'table-db-fields') { - field.curDatabaseName = val.databaseName; - field.curDatabaseType = val.databaseType; - field.curJavaName = val.javaName; - field.curJavaType = val.javaType; + }, + tableSimpleSaveVisible: function (field, index) { + return !$common.isEmptyString(_tableSimpleValue(field, index)); + }, + tableSimpleUp: function (item, field, index) { + _tableReset(); + + _swapSimpleItems(_model(item, field)[field.model], index, index - 1); + }, + tableSimpleDown: function (item, field, index) { + _tableReset(); + + _swapSimpleItems(_model(item, field)[field.model], index, index + 1); + }, + tableSimpleDownVisible: function (item, field, index) { + return index < _model(item, field)[field.model].length - 1; + }, + tablePairValue: _tablePairValue, + tablePairSave: function (pairValid, item, field, index) { + if (pairValid(item, field, index)) { + var pairValue = _tablePairValue(field, index); - _tableFocus('DatabaseName' + field.focusId, index); - } - else if (ui == 'table-query-groups') { - field.curGroupName = val.name; - field.curFields = val.fields; + var pairModel = {}; + + if (index < 0) { + pairModel[field.keyName] = pairValue.key; + pairModel[field.valueName] = pairValue.value; + + if (item[field.model]) + item[field.model].push(pairModel); + else + item[field.model] = [pairModel]; - _tableFocus('GroupName', index); + _tableNewItem(field); + } + else { + pairModel = item[field.model][index]; + + pairModel[field.keyName] = pairValue.key; + pairModel[field.valueName] = pairValue.value; + + if (index < item[field.model].length - 1) + _tableStartEdit(item, field, index + 1); + else + _tableNewItem(field); + } } + }, + tablePairSaveVisible: function (field, index) { + var pairValue = _tablePairValue(field, index); + + return !$common.isEmptyString(pairValue.key) && !$common.isEmptyString(pairValue.value); + }, + tableFocusInvalidField: function (index, id) { + _tableFocus(id, index); + + return false; + }, + tableFieldId: function (index, id) { + return (index < 0 ? 'new' : 'cur') + id; } + } +}]); - function _tableNewItem(field) { - _tableState(field.model, -1); - var ui = _tableUI(field); +// Preview support service. +controlCenterModule.service('$preview', [function () { + return { + previewInit: function (editor) { + editor.setReadOnly(true); + editor.setOption("highlightActiveLine", false); - if (ui == 'table-simple') { - field.newValue = null; + var renderer = editor.renderer; - _tableFocus(field.focusId, -1); - } - else if (ui == 'table-pair') { - field.newKey = null; - field.newValue = null; + renderer.setHighlightGutterLine(false); + renderer.setShowPrintMargin(false); + renderer.setOption('fontSize', '10px'); + + editor.setTheme('ace/theme/chrome'); + } + } +}]); + +// Preview support service. +controlCenterModule.service('$code', ['$common', function ($common) { + function builder() { + var res = []; + + res.deep = 0; + res.lineStart = true; - _tableFocus('Key' + field.focusId, -1); + res.append = function (s) { + if (this.lineStart) { + for (var i = 0; i < this.deep; i++) + this.push(' '); + + this.lineStart = false; } - else if (ui == 'table-db-fields') { - field.newDatabaseName = null; - field.newDatabaseType = 'INTEGER'; - field.newJavaName = null; - field.newJavaType = 'Integer'; - _tableFocus('DatabaseName' + field.focusId, -1); + this.push(s); + + return this; + }; + + res.line = function (s) { + if (s) + this.append(s); + + this.push('\n'); + this.lineStart = true; + + return this; + }; + + res.startBlock = function (s) { + if (s) + this.append(s); + + this.push('\n'); + this.lineStart = true; + this.deep++; + + return this; + }; + + res.endBlock = function (s) { + this.deep--; + + if (s) + this.append(s); + + this.push('\n'); + this.lineStart = true; + + return this; + }; + + res.emptyLineIfNeeded = function () { + if (this.needEmptyLine) { + this.line(); + + this.needEmptyLine = false; + + return true; } - else if (ui == 'table-query-groups') { - field.newGroupName = null; - field.newFields = null; - _tableFocus('GroupName', -1); + return false; + }; + + res.imports = {}; + + res.importClass = function (className) { + var fullClassName = javaBuildInClass(className); + + var dotIdx = fullClassName.lastIndexOf('.'); + + var shortName = dotIdx > 0 ? fullClassName.substr(dotIdx + 1) : fullClassName; + + if (this.imports[shortName]) { + if (this.imports[shortName] != fullClassName) + return fullClassName; // Short class names conflict. Return full name. } - else if (ui == 'table-query-group-fields') { - _tableFocus('FieldName', -1); + else + this.imports[shortName] = fullClassName; + + return shortName; + }; + + /** + * @returns String with "java imports" section. + */ + res.generateImports = function () { + var res = []; + + for (var clsName in this.imports) { + if (this.imports.hasOwnProperty(clsName) && this.imports[clsName].lastIndexOf('java.lang.', 0) != 0) + res.push('import ' + this.imports[clsName] + ';'); } + + res.sort(); + + return res.join('\n') + }; + + return res; + } + + function escapeAttr(s) { + if (typeof(s) != 'string') + return s; + + return s.replace(/&/g, '&').replace(/"/g, '"'); + } + + function addElement(res, tag, attr1, val1, attr2, val2) { + var elem = '<' + tag; + + if (attr1) { + elem += ' ' + attr1 + '="' + val1 + '"' } - return { - tableState: function (name, editIndex) { - _tableState(name, editIndex); - }, - tableReset: function () { - _tableReset(); - }, - tableNewItem: _tableNewItem, - tableNewItemActive: function (field) { - return table.name == field.model && table.editIndex < 0; - }, - tableEditing: function (field, index) { - return table.name == field.model && table.editIndex == index; - }, - tableStartEdit: _tableStartEdit, - tableRemove: function (item, field, index) { - _tableReset(); + if (attr2) { + elem += ' ' + attr2 + '="' + val2 + '"' + } - _model(item, field)[field.model].splice(index, 1); - }, - tableSimpleSave: function (valueValid, item, field, index) { - var simpleValue = _tableSimpleValue(field, index); + elem += '/>'; - if (valueValid(item, field, simpleValue, index)) { - _tableReset(); + res.emptyLineIfNeeded(); + res.line(elem); + } - if (index < 0) { - if (_model(item, field)[field.model]) - _model(item, field)[field.model].push(simpleValue); - else - _model(item, field)[field.model] = [simpleValue]; + function addProperty(res, obj, propName, setterName) { + var val = obj[propName]; - _tableNewItem(field); - } - else { - var arr = _model(item, field)[field.model]; + if ($common.isDefined(val)) + addElement(res, 'property', 'name', setterName ? setterName : propName, 'value', escapeAttr(val)); + + return val; + } + + function addClassNameProperty(res, obj, propName) { + var val = obj[propName]; + + if ($common.isDefined(val)) + addElement(res, 'property', 'name', propName, 'value', generatorCommon.javaBuildInClass(val)); + + return val; + } + + function addListProperty(res, obj, propName, listType, rowFactory) { + var val = obj[propName]; + + if (val && val.length > 0) { + res.emptyLineIfNeeded(); + + if (!listType) + listType = 'list'; + + if (!rowFactory) + rowFactory = function (val) { + return '<value>' + escape(val) + '</value>' + }; - arr[index] = simpleValue; + res.startBlock('<property name="' + propName + '">'); + res.startBlock('<' + listType + '>'); - if (index < arr.length - 1) - _tableStartEdit(item, field, index + 1); + for (var i = 0; i < val.length; i++) + res.line(rowFactory(val[i])); + + res.endBlock('</' + listType + '>'); + res.endBlock('</property>'); + } + } + + function ClassDescriptor(className, fields) { + this.className = className; + this.fields = fields; + } + + atomicConfiguration = new ClassDescriptor('org.apache.ignite.configuration.AtomicConfiguration', { + backups: null, + cacheMode: {type: 'enum', enumClass: 'CacheMode'}, + atomicSequenceReserveSize: null + }); + + knownClasses = { + Oracle: new ClassDescriptor('org.apache.ignite.cache.store.jdbc.dialect.OracleDialect', {}), + DB2: new ClassDescriptor('org.apache.ignite.cache.store.jdbc.dialect.DB2Dialect', {}), + SQLServer: new ClassDescriptor('org.apache.ignite.cache.store.jdbc.dialect.SQLServerDialect', {}), + MySQL: new ClassDescriptor('org.apache.ignite.cache.store.jdbc.dialect.MySQLDialect', {}), + PostgreSQL: new ClassDescriptor('org.apache.ignite.cache.store.jdbc.dialect.BasicJdbcDialect', {}), + H2: new ClassDescriptor('org.apache.ignite.cache.store.jdbc.dialect.H2Dialect', {}) + }; + + function addBeanWithProperties(res, bean, beanPropName, beanClass, props, createBeanAlthoughNoProps) { + if (bean && $common.hasProperty(bean, props)) { + res.emptyLineIfNeeded(); + res.startBlock('<property name="' + beanPropName + '">'); + res.startBlock('<bean class="' + beanClass + '">'); + + for (var propName in props) { + if (props.hasOwnProperty(propName)) { + var descr = props[propName]; + + if (descr) { + if (descr.type == 'list') { + addListProperty(res, bean, propName, descr.setterName); + } + else if (descr.type == 'className') { + if (bean[propName]) { + res.startBlock('<property name="' + propName + '">'); + res.line('<bean class="' + knownClasses[bean[propName]].className + '"/>'); + res.endBlock('</property>'); + } + } + else if (descr.type == 'propertiesAsList') { + var val = bean[propName]; + + if (val && val.length > 0) { + res.startBlock('<property name="' + propName + '">'); + res.startBlock('<props>'); + + for (var i = 0; i < val.length; i++) { + var nameAndValue = val[i]; + + var eqIndex = nameAndValue.indexOf('='); + if (eqIndex >= 0) { + res.line('<prop key="' + escapeAttr(nameAndValue.substring(0, eqIndex)) + '">' + + escape(nameAndValue.substr(eqIndex + 1)) + '</prop>'); + } + } + + res.endBlock('</props>'); + res.endBlock('</property>'); + } + } else - _tableNewItem(field); + addProperty(res, bean, propName, descr.setterName); } + else + addProperty(res, bean, propName); } - }, - tableSimpleSaveVisible: function (field, index) { - return !$common.isEmptyString(_tableSimpleValue(field, index)); - }, - tableSimpleUp: function (item, field, index) { - _tableReset(); + } - _swapSimpleItems(_model(item, field)[field.model], index, index - 1); - }, - tableSimpleDown: function (item, field, index) { - _tableReset(); + res.endBlock('</bean>'); + res.endBlock('</property>'); + } + else if (createBeanAlthoughNoProps) { + res.emptyLineIfNeeded(); + res.line('<property name="' + beanPropName + '">'); + res.line(' <bean class="' + beanClass + '"/>'); + res.line('</property>'); + } + } - _swapSimpleItems(_model(item, field)[field.model], index, index + 1); - }, - tableSimpleDownVisible: function (item, field, index) { - return index < _model(item, field)[field.model].length - 1; - }, - tablePairValue: _tablePairValue, - tablePairSave: function (pairValid, item, field, index) { - if (pairValid(item, field, index)) { - var pairValue = _tablePairValue(field, index); + return { + xmlClusterGeneral: function (cluster, res) { + if (!res) + res = builder(); - var pairModel = {}; + // Generate discovery. + if (cluster.discovery) { + res.startBlock('<property name="discoverySpi">'); + res.startBlock('<bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">'); + res.startBlock('<property name="ipFinder">'); - if (index < 0) { - pairModel[field.keyName] = pairValue.key; - pairModel[field.valueName] = pairValue.value; + var d = cluster.discovery; - if (item[field.model]) - item[field.model].push(pairModel); - else - item[field.model] = [pairModel]; + switch (d.kind) { + case 'Multicast': + res.startBlock('<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">'); - _tableNewItem(field); - } - else { - pairModel = item[field.model][index]; + addProperty(res, d.Multicast, 'multicastGroup'); + addProperty(res, d.Multicast, 'multicastPort'); + addProperty(res, d.Multicast, 'responseWaitTime'); + addProperty(res, d.Multicast, 'addressRequestAttempts'); + addProperty(res, d.Multicast, 'localAddress'); - pairModel[field.keyName] = pairValue.key; - pairModel[field.valueName] = pairValue.value; + res.endBlock('</bean>'); - if (index < item[field.model].length - 1) - _tableStartEdit(item, field, index + 1); - else - _tableNewItem(field); - } + break; + + case 'Vm': + if (d.Vm.addresses.length > 0) { + res.startBlock('<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">'); + + addListProperty(res, d.Vm, 'addresses'); + + res.endBlock('</bean>'); + } + else { + res.line('<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder"/>'); + } + + break; + + case 'S3': + res.startBlock('<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.s3.TcpDiscoveryS3IpFinder">'); + + if (d.S3 && d.S3.bucketName) + res.line('<property name="bucketName" value="' + escapeAttr(d.S3.bucketName) + '" />'); + + res.endBlock('</bean>'); + + break; + + case 'Cloud': + res.startBlock('<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.cloud.TcpDiscoveryCloudIpFinder">'); + + addProperty(res, d.Cloud, 'credential'); + addProperty(res, d.Cloud, 'credentialPath'); + addProperty(res, d.Cloud, 'identity'); + addProperty(res, d.Cloud, 'provider'); + addListProperty(res, d.Cloud, 'regions'); + addListProperty(res, d.Cloud, 'zones'); + + res.endBlock('</bean>'); + + break; + + case 'GoogleStorage': + res.startBlock('<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.gce.TcpDiscoveryGoogleStorageIpFinder">'); + + addProperty(res, d.GoogleStorage, 'projectName'); + addProperty(res, d.GoogleStorage, 'bucketName'); + addProperty(res, d.GoogleStorage, 'serviceAccountP12FilePath'); + addProperty(res, d.GoogleStorage, 'serviceAccountId'); + + //if (d.GoogleStorage.addrReqAttempts) todo ???? + // res.line('<property name="serviceAccountP12FilePath" value="' + escapeAttr(d.GoogleStorage.addrReqAttempts) + '"/>'); + + res.endBlock('</bean>'); + + break; + + case 'Jdbc': + res.startBlock('<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.jdbc.TcpDiscoveryJdbcIpFinder">'); + res.line('<property name="initSchema" value="' + ($common.isDefined(d.Jdbc.initSchema) && d.Jdbc.initSchema) + '"/>'); + res.endBlock('</bean>'); + + break; + + case 'SharedFs': + if (d.SharedFs.path) { + res.startBlock('<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.sharedfs.TcpDiscoverySharedFsIpFinder">'); + addProperty(res, d.SharedFs, 'path'); + res.endBlock('</bean>'); + } + else { + res.line('<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.sharedfs.TcpDiscoverySharedFsIpFinder"/>'); + } + + break; + + default: + throw "Unknown discovery kind: " + d.kind; } - }, - tablePairSaveVisible: function (field, index) { - var pairValue = _tablePairValue(field, index); - return !$common.isEmptyString(pairValue.key) && !$common.isEmptyString(pairValue.value); - }, - tableFocusInvalidField: function (index, id) { - _tableFocus(id, index); + res.endBlock('</property>'); + res.endBlock('</bean>'); + res.endBlock('</property>'); - return false; - }, - tableFieldId: function(index, id) { - return (index < 0 ? 'new' : 'cur') + id; + res.needEmptyLine = true; } + + return res; + }, + xmlClusterAtomics: function (cluster, res) { + if (!res) + res = builder(); + + // Generate atomics group. + addBeanWithProperties(res, cluster.atomicConfiguration, 'atomicConfiguration', + atomicConfiguration.className, atomicConfiguration.fields); + res.needEmptyLine = true; + + return res; } - }]); + } +}]); + // Filter to decode name using map(value, label). controlCenterModule.filter('displayValue', function () { http://git-wip-us.apache.org/repos/asf/ignite/blob/7aae0ee8/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 ce3b880..e1d2774 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 @@ -16,8 +16,8 @@ */ controlCenterModule.controller('metadataController', [ - '$scope', '$controller', '$http', '$modal', '$common', '$timeout', '$focus', '$confirm', '$copy', '$table', - function ($scope, $controller, $http, $modal, $common, $timeout, $focus, $confirm, $copy, $table) { + '$scope', '$controller', '$http', '$modal', '$common', '$timeout', '$focus', '$confirm', '$copy', '$table', '$preview', + function ($scope, $controller, $http, $modal, $common, $timeout, $focus, $confirm, $copy, $table, $preview) { // Initialize the super class and extend it. angular.extend(this, $controller('agent-download', {$scope: $scope})); $scope.agentGoal = 'load metadata from database schema'; @@ -26,6 +26,7 @@ controlCenterModule.controller('metadataController', [ $scope.joinTip = $common.joinTip; $scope.getModel = $common.getModel; $scope.javaBuildInClasses = $common.javaBuildInClasses; + $scope.compactJavaName = $common.compactJavaName; $scope.tableReset = $table.tableReset; $scope.tableNewItem = $table.tableNewItem; @@ -44,9 +45,10 @@ controlCenterModule.controller('metadataController', [ $scope.tablePairSave = $table.tablePairSave; $scope.tablePairSaveVisible = $table.tablePairSaveVisible; - $scope.compactJavaName = $common.compactJavaName; + $scope.previewInit = $preview.previewInit; $scope.hidePopover = $common.hidePopover; + var showPopoverMessage = $common.showPopoverMessage; var presets = [ http://git-wip-us.apache.org/repos/asf/ignite/blob/7aae0ee8/modules/control-center-web/src/main/js/controllers/models/clusters.json ---------------------------------------------------------------------- diff --git a/modules/control-center-web/src/main/js/controllers/models/clusters.json b/modules/control-center-web/src/main/js/controllers/models/clusters.json index 67dbd33..53d961b 100644 --- a/modules/control-center-web/src/main/js/controllers/models/clusters.json +++ b/modules/control-center-web/src/main/js/controllers/models/clusters.json @@ -26,6 +26,7 @@ { "label": "General", "id": "general-data", + "preview": "general", "fields": [ { "label": "Name", @@ -329,6 +330,7 @@ "advanced": [ { "label": "Atomics configuration", + "preview": "atomics", "tip": [ "Configuration for atomic data structures.", "Atomics are distributed across the cluster, essentially enabling performing atomic operations (such as increment-and-get or compare-and-set) with the same globally-visible value." @@ -375,6 +377,7 @@ }, { "label": "Communication", + "preview": "communication", "tip": [ "Cluster communication network properties." ], @@ -442,6 +445,7 @@ }, { "label": "Deployment", + "preview": "deployment", "tip": [ "Task and resources deployment in cluster." ], @@ -467,6 +471,7 @@ }, { "label": "Events", + "preview": "events", "tip": [ " Grid events are used for notification about what happens within the grid." ], @@ -486,6 +491,7 @@ }, { "label": "Marshaller", + "preview": "marshaller", "tip": [ "Marshaller allows to marshal or unmarshal objects in grid.", "It provides serialization/deserialization mechanism for all instances that are sent across networks or are otherwise serialized." @@ -565,6 +571,7 @@ }, { "label": "Metrics", + "preview": "metrics", "tip": [ "Cluster runtime metrics settings." ], @@ -616,6 +623,7 @@ }, { "label": "Peer Class Loading", + "preview": "p2p", "tip": [ "Cluster peer class loading settings." ], @@ -661,6 +669,7 @@ }, { "label": "Swap", + "preview": "swap", "id": "swap-data", "tip": [ "Settings for overflow data to disk if it cannot fit in memory." @@ -743,6 +752,7 @@ }, { "label": "Time configuration", + "preview": "time", "tip": [ "Time settings for CLOCK write ordering mode." ], @@ -791,6 +801,7 @@ }, { "label": "Thread pools size", + "preview": "pools", "tip": [ "Settings for node thread pools." ], @@ -835,6 +846,7 @@ }, { "label": "Transactions", + "preview": "transactions", "tip": [ "Settings for transactions." ], http://git-wip-us.apache.org/repos/asf/ignite/blob/7aae0ee8/modules/control-center-web/src/main/js/package.json ---------------------------------------------------------------------- diff --git a/modules/control-center-web/src/main/js/package.json b/modules/control-center-web/src/main/js/package.json index 59e4771..8330cfe 100644 --- a/modules/control-center-web/src/main/js/package.json +++ b/modules/control-center-web/src/main/js/package.json @@ -20,7 +20,7 @@ "node": ">=0.12.4" }, "dependencies": { - "archiver": "^0.14.4", + "archiver": "^0.15.0", "body-parser": "~1.13.3", "bootstrap-sass": "^3.3.5", "compression": "1.5.2", @@ -33,15 +33,15 @@ "jade": "~1.11.0", "lodash": "3.10.1", "mongoose": "^4.1.3", - "mongoose-deep-populate": "2.0.0", + "mongoose-deep-populate": "2.0.1", "nconf": "^0.7.2", "node-sass-middleware": "^0.9.0", - "passport": "^0.2.1", + "passport": "^0.3.0", "passport-local": "^1.0.0", "passport-local-mongoose": "^1.0.0", "nodemailer": "1.4.0", "serve-favicon": "~2.3.0", - "ws": "~0.7.2" + "ws": "~0.8.0" }, "devDependencies": { "morgan": "~1.6.1", http://git-wip-us.apache.org/repos/asf/ignite/blob/7aae0ee8/modules/control-center-web/src/main/js/views/includes/controls.jade ---------------------------------------------------------------------- diff --git a/modules/control-center-web/src/main/js/views/includes/controls.jade b/modules/control-center-web/src/main/js/views/includes/controls.jade index 642e836..656eaa4 100644 --- a/modules/control-center-web/src/main/js/views/includes/controls.jade +++ b/modules/control-center-web/src/main/js/views/includes/controls.jade @@ -448,7 +448,7 @@ mixin groups(groups, dataSource) .settings-row(ng-repeat='field in group.fields') +form-row(dataSource) .col-sm-6 - +preview + +preview('group.preview') mixin advanced-options-top .advanced-options @@ -461,5 +461,5 @@ mixin advanced-options-bottom i.fa.fa-chevron-circle-up(ng-click='toggleExpanded()') a(ng-click='toggleExpanded()') {{ui.expanded ? 'Hide advanced settings...' : 'Show advanced settings...'}} -mixin preview - div(ui-ace='{onLoad: aceInit, mode: "xml"}' ng-model='preview') +mixin preview(previewModel) + div(ui-ace='{onLoad: previewInit, mode: "xml"}' ng-model='preview[#{previewModel}]')
