http://git-wip-us.apache.org/repos/asf/ignite/blob/eb5ac0ae/modules/web-console/src/main/js/app/modules/form/group/add.directive.js ---------------------------------------------------------------------- diff --git a/modules/web-console/src/main/js/app/modules/form/group/add.directive.js b/modules/web-console/src/main/js/app/modules/form/group/add.directive.js new file mode 100644 index 0000000..98560b5 --- /dev/null +++ b/modules/web-console/src/main/js/app/modules/form/group/add.directive.js @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const template = '<i class="group-legend-btn fa fa-plus"></i>'; + +export default ['igniteFormGroupAdd', ['$tooltip', ($tooltip) => { + const link = ($scope, $element, $attrs, $ctrls, $transclude) => { + const content = Array.prototype.slice + .apply($transclude($scope)) + .reduce((html, el) => html += el.outerHTML || el.textContent || el, ''); + + $tooltip($element, { title: content }); + + $element.closest('.group').find('.group-legend').append($element); + }; + + return { + restrict: 'E', + scope: {}, + template, + link, + replace: true, + transclude: true, + require: ['^form', '^igniteFormGroup'] + }; +}]];
http://git-wip-us.apache.org/repos/asf/ignite/blob/eb5ac0ae/modules/web-console/src/main/js/app/modules/form/group/group.directive.js ---------------------------------------------------------------------- diff --git a/modules/web-console/src/main/js/app/modules/form/group/group.directive.js b/modules/web-console/src/main/js/app/modules/form/group/group.directive.js new file mode 100644 index 0000000..5039d6f --- /dev/null +++ b/modules/web-console/src/main/js/app/modules/form/group/group.directive.js @@ -0,0 +1,81 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import template from './group.jade!'; + +export default ['igniteFormGroup', [() => { + const controller = [function() { }]; + + const link = (scope, el, attrs, [ngModelCtrl, ownFormCtrl, parentFormCtrl]) => { + if (!ownFormCtrl) + return; + + const name = attrs.ngForm; + ngModelCtrl.$name = name; + + parentFormCtrl.$addControl(ngModelCtrl); + parentFormCtrl.$removeControl(ownFormCtrl); + + scope.ngModel = scope.ngModel || []; + parentFormCtrl.$defaults = parentFormCtrl.$defaults || {}; + + if (parentFormCtrl.$pristine) { + if (!(_.isNull(parentFormCtrl.$defaults[name]) || _.isUndefined(parentFormCtrl.$defaults[name]))) + scope.ngModel = parentFormCtrl.$defaults[name]; + else + parentFormCtrl.$defaults[name] = _.cloneDeep(scope.ngModel); + } + + const setAsDefault = () => { + if (!parentFormCtrl.$pristine) + return; + + scope.ngModel = scope.ngModel || []; + parentFormCtrl.$defaults = parentFormCtrl.$defaults || {}; + parentFormCtrl.$defaults[name] = _.cloneDeep(scope.ngModel); + }; + + const setAsDirty = () => { + if (JSON.stringify(scope.ngModel) !== JSON.stringify(parentFormCtrl.$defaults[name])) + ngModelCtrl.$setDirty(); + else + ngModelCtrl.$setPristine(); + }; + + scope.$watch(() => parentFormCtrl.$pristine, setAsDefault); + + scope.$watch('ngModel', setAsDefault); + scope.$watch('ngModel', setAsDirty, true); + }; + + return { + restrict: 'E', + scope: { + ngModel: '=ngModel' + }, + bindToController: { + label: '@' + }, + link, + template, + controller, + controllerAs: 'group', + replace: true, + transclude: true, + require: ['?ngModel', '?form', '^^form'] + }; +}]]; http://git-wip-us.apache.org/repos/asf/ignite/blob/eb5ac0ae/modules/web-console/src/main/js/app/modules/form/group/group.jade ---------------------------------------------------------------------- diff --git a/modules/web-console/src/main/js/app/modules/form/group/group.jade b/modules/web-console/src/main/js/app/modules/form/group/group.jade new file mode 100644 index 0000000..ba3a8f2 --- /dev/null +++ b/modules/web-console/src/main/js/app/modules/form/group/group.jade @@ -0,0 +1,21 @@ +//- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +.group-section + .group + .group-legend + label {{::group.label}} + div(ng-transclude='') http://git-wip-us.apache.org/repos/asf/ignite/blob/eb5ac0ae/modules/web-console/src/main/js/app/modules/form/group/table.directive.js ---------------------------------------------------------------------- diff --git a/modules/web-console/src/main/js/app/modules/form/group/table.directive.js b/modules/web-console/src/main/js/app/modules/form/group/table.directive.js new file mode 100644 index 0000000..520f8c2 --- /dev/null +++ b/modules/web-console/src/main/js/app/modules/form/group/table.directive.js @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import template from './table.jade!'; + +export default ['igniteFormGroupTable', [() => { + return { + restrict: 'E', + scope: {}, + template, + replace: true, + transclude: true, + require: ['^form', '^igniteFormGroup'] + }; +}]]; http://git-wip-us.apache.org/repos/asf/ignite/blob/eb5ac0ae/modules/web-console/src/main/js/app/modules/form/group/table.jade ---------------------------------------------------------------------- diff --git a/modules/web-console/src/main/js/app/modules/form/group/table.jade b/modules/web-console/src/main/js/app/modules/form/group/table.jade new file mode 100644 index 0000000..6f9486d --- /dev/null +++ b/modules/web-console/src/main/js/app/modules/form/group/table.jade @@ -0,0 +1,17 @@ +//- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +div \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/eb5ac0ae/modules/web-console/src/main/js/app/modules/form/group/tooltip.directive.js ---------------------------------------------------------------------- diff --git a/modules/web-console/src/main/js/app/modules/form/group/tooltip.directive.js b/modules/web-console/src/main/js/app/modules/form/group/tooltip.directive.js new file mode 100644 index 0000000..2202e7b --- /dev/null +++ b/modules/web-console/src/main/js/app/modules/form/group/tooltip.directive.js @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const template = '<i class="group-legend-btn fa fa-question-circle"></i>'; + +export default ['igniteFormGroupTooltip', ['$tooltip', ($tooltip) => { + const link = ($scope, $element, $attrs, $ctrls, $transclude) => { + const content = Array.prototype.slice + .apply($transclude($scope)) + .reduce((html, el) => html += el.outerHTML || el.textContent || el, ''); + + $tooltip($element, { title: content }); + + $element.closest('.group').find('.group-legend').append($element); + }; + + return { + restrict: 'E', + scope: {}, + template, + link, + replace: true, + transclude: true, + require: ['^form', '^igniteFormGroup'] + }; +}]]; http://git-wip-us.apache.org/repos/asf/ignite/blob/eb5ac0ae/modules/web-console/src/main/js/app/modules/form/panel/chevron.directive.js ---------------------------------------------------------------------- diff --git a/modules/web-console/src/main/js/app/modules/form/panel/chevron.directive.js b/modules/web-console/src/main/js/app/modules/form/panel/chevron.directive.js new file mode 100644 index 0000000..6af560b --- /dev/null +++ b/modules/web-console/src/main/js/app/modules/form/panel/chevron.directive.js @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const template = `<i class='fa' ng-class='isOpen ? "fa-chevron-circle-down" : "fa-chevron-circle-right"'></i>`; // eslint-disable-line quotes + +export default ['igniteFormPanelChevron', [() => { + const controller = [() => {}]; + + const link = ($scope, $element, $attrs, [bsCollapseCtrl]) => { + const $target = $element.parent().parent().find('.panel-collapse'); + + bsCollapseCtrl.$viewChangeListeners.push(function() { + const index = bsCollapseCtrl.$targets.reduce((acc, el, i) => { + if (el[0] === $target[0]) + acc.push(i); + + return acc; + }, [])[0]; + + $scope.isOpen = false; + + const active = bsCollapseCtrl.$activeIndexes(); + + if ((active instanceof Array) && active.indexOf(index) !== -1 || active === index) + $scope.isOpen = true; + }); + }; + + return { + restrict: 'E', + scope: {}, + link, + template, + controller, + replace: true, + transclude: true, + require: ['^bsCollapse'] + }; +}]]; http://git-wip-us.apache.org/repos/asf/ignite/blob/eb5ac0ae/modules/web-console/src/main/js/app/modules/form/panel/panel.directive.js ---------------------------------------------------------------------- diff --git a/modules/web-console/src/main/js/app/modules/form/panel/panel.directive.js b/modules/web-console/src/main/js/app/modules/form/panel/panel.directive.js new file mode 100644 index 0000000..b8e7c25 --- /dev/null +++ b/modules/web-console/src/main/js/app/modules/form/panel/panel.directive.js @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export default ['form', [() => { + const link = (scope, $element, $attrs, [form]) => { + const $form = $element.parent().closest('form'); + + scope.$watch(() => { + return $form.hasClass('ng-pristine'); + }, (value) => { + if (!value) + return; + + form.$setPristine(); + }); + }; + + return { + restrict: 'E', + link, + require: ['^form'] + }; +}]]; http://git-wip-us.apache.org/repos/asf/ignite/blob/eb5ac0ae/modules/web-console/src/main/js/app/modules/form/panel/revert.directive.js ---------------------------------------------------------------------- diff --git a/modules/web-console/src/main/js/app/modules/form/panel/revert.directive.js b/modules/web-console/src/main/js/app/modules/form/panel/revert.directive.js new file mode 100644 index 0000000..2bf4c8c --- /dev/null +++ b/modules/web-console/src/main/js/app/modules/form/panel/revert.directive.js @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const template = '<i ng-show="form.$dirty" class="fa fa-undo pull-right" ng-click="revert($event)"></i>'; + +export default ['igniteFormRevert', ['$tooltip', '$table', ($tooltip, $table) => { + const link = (scope, $element, $attrs, [form]) => { + $tooltip($element, { title: 'Undo unsaved changes' }); + + scope.form = form; + + scope.revert = (e) => { + e.stopPropagation(); + + $table.tableReset(); + + _.forOwn(form.$defaults, (value, name) => { + const field = form[name]; + + if (field) { + field.$setViewValue(value); + field.$setPristine(); + field.$render(); + } + }); + + form.$setPristine(); + }; + }; + + return { + restrict: 'E', + scope: { }, + template, + link, + replace: true, + require: ['^form'] + }; +}]]; http://git-wip-us.apache.org/repos/asf/ignite/blob/eb5ac0ae/modules/web-console/src/main/js/app/modules/form/validator/ipaddress.directive.js ---------------------------------------------------------------------- diff --git a/modules/web-console/src/main/js/app/modules/form/validator/ipaddress.directive.js b/modules/web-console/src/main/js/app/modules/form/validator/ipaddress.directive.js new file mode 100644 index 0000000..2ddc786 --- /dev/null +++ b/modules/web-console/src/main/js/app/modules/form/validator/ipaddress.directive.js @@ -0,0 +1,86 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export default ['ipaddress', ['IgniteInetAddress', (InetAddress) => { + const onlyDigits = (str) => (/^\d+$/.test(str)); + + const strictParseInt = (str) => onlyDigits(str) ? parseInt(str, 10) : Number.NaN; + + const parse = (commonIpAddress) => { + const [ipOrHost, portRange] = commonIpAddress.split(':'); + const ports = _.isUndefined(portRange) ? [] : portRange.split('..').map(strictParseInt); + + return {ipOrHost, ports}; + }; + + const link = (scope, el, attrs, [ngModel]) => { + const isEmpty = (modelValue) => { + return ngModel.$isEmpty(modelValue) || _.isUndefined(attrs.ipaddress) || attrs.ipaddress !== 'true'; + }; + + const portRange = !_.isNil(attrs.ipaddressWithPortRange); + + if (attrs.ipaddressWithPort) { + ngModel.$validators.ipaddressPort = (modelValue, viewValue) => { + if (isEmpty(modelValue) || viewValue.indexOf(':') === -1) + return true; + + if ((viewValue.match(/:/g) || []).length > 1) + return false; + + const {ports} = parse(viewValue); + + if (ports.length !== 1) + return portRange; + + return InetAddress.validPort(ports[0]); + }; + } + + if (portRange) { + ngModel.$validators.ipaddressPortRange = (modelValue, viewValue) => { + if (isEmpty(modelValue) || viewValue.indexOf('..') === -1) + return true; + + const {ports} = parse(viewValue); + + if (ports.length !== 2) + return false; + + return InetAddress.validPort(ports[0]) && InetAddress.validPort(ports[1]) && ports[0] < ports[1]; + }; + } + + ngModel.$validators.ipaddress = (modelValue, viewValue) => { + if (isEmpty(modelValue)) + return true; + + const {ipOrHost, ports} = parse(viewValue); + + if (attrs.ipaddressWithPort || attrs.ipaddressWithPortRange || ports.length === 0) + return InetAddress.validHost(ipOrHost); + + return false; + }; + }; + + return { + restrict: 'A', + link, + require: ['ngModel'] + }; +}]]; http://git-wip-us.apache.org/repos/asf/ignite/blob/eb5ac0ae/modules/web-console/src/main/js/app/modules/form/validator/java-built-in-class.directive.js ---------------------------------------------------------------------- diff --git a/modules/web-console/src/main/js/app/modules/form/validator/java-built-in-class.directive.js b/modules/web-console/src/main/js/app/modules/form/validator/java-built-in-class.directive.js new file mode 100644 index 0000000..1a4b504 --- /dev/null +++ b/modules/web-console/src/main/js/app/modules/form/validator/java-built-in-class.directive.js @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export default ['javaBuiltInClass', ['JavaTypes', (JavaTypes) => { + const link = (scope, el, attrs, [ngModel]) => { + if (_.isUndefined(attrs.javaBuiltInClass) || !attrs.javaBuiltInClass) + return; + + ngModel.$validators.javaBuiltInClass = (value) => JavaTypes.nonBuiltInClass(value); + }; + + return { + restrict: 'A', + link, + require: ['ngModel'] + }; +}]]; http://git-wip-us.apache.org/repos/asf/ignite/blob/eb5ac0ae/modules/web-console/src/main/js/app/modules/form/validator/java-identifier.directive.js ---------------------------------------------------------------------- diff --git a/modules/web-console/src/main/js/app/modules/form/validator/java-identifier.directive.js b/modules/web-console/src/main/js/app/modules/form/validator/java-identifier.directive.js new file mode 100644 index 0000000..5cbf7fb --- /dev/null +++ b/modules/web-console/src/main/js/app/modules/form/validator/java-identifier.directive.js @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export default ['javaIdentifier', ['JavaTypes', (JavaTypes) => { + const link = (scope, el, attrs, [ngModel]) => { + if (_.isUndefined(attrs.javaIdentifier) || !attrs.javaIdentifier) + return; + + ngModel.$validators.javaIdentifier = (value) => JavaTypes.validIdentifier(value); + }; + + return { + restrict: 'A', + link, + require: ['ngModel'] + }; +}]]; http://git-wip-us.apache.org/repos/asf/ignite/blob/eb5ac0ae/modules/web-console/src/main/js/app/modules/form/validator/java-keywords.directive.js ---------------------------------------------------------------------- diff --git a/modules/web-console/src/main/js/app/modules/form/validator/java-keywords.directive.js b/modules/web-console/src/main/js/app/modules/form/validator/java-keywords.directive.js new file mode 100644 index 0000000..841c48b --- /dev/null +++ b/modules/web-console/src/main/js/app/modules/form/validator/java-keywords.directive.js @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export default ['javaKeywords', ['JavaTypes', (JavaTypes) => { + const link = (scope, el, attrs, [ngModel]) => { + if (_.isUndefined(attrs.javaKeywords) || !attrs.javaKeywords) + return; + + ngModel.$validators.javaKeywords = (value) => { + if (value) { + if (!JavaTypes.validIdentifier(value) || !JavaTypes.packageSpecified(value)) + return true; + + for (const item of value.split('.')) { + if (JavaTypes.isKeywords(item)) + return false; + } + } + + return true; + }; + }; + + return { + restrict: 'A', + link, + require: ['ngModel'] + }; +}]]; http://git-wip-us.apache.org/repos/asf/ignite/blob/eb5ac0ae/modules/web-console/src/main/js/app/modules/form/validator/java-package-name.directive.js ---------------------------------------------------------------------- diff --git a/modules/web-console/src/main/js/app/modules/form/validator/java-package-name.directive.js b/modules/web-console/src/main/js/app/modules/form/validator/java-package-name.directive.js new file mode 100644 index 0000000..ac38179 --- /dev/null +++ b/modules/web-console/src/main/js/app/modules/form/validator/java-package-name.directive.js @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export default ['javaPackageName', ['JavaTypes', (JavaTypes) => { + const link = (scope, el, attrs, [ngModel]) => { + if (_.isUndefined(attrs.javaPackageName) || !attrs.javaPackageName) + return; + + ngModel.$validators.javaPackageName = (value) => JavaTypes.validPackage(value); + }; + + return { + restrict: 'A', + link, + require: ['ngModel'] + }; +}]]; http://git-wip-us.apache.org/repos/asf/ignite/blob/eb5ac0ae/modules/web-console/src/main/js/app/modules/form/validator/java-package-specified.directive.js ---------------------------------------------------------------------- diff --git a/modules/web-console/src/main/js/app/modules/form/validator/java-package-specified.directive.js b/modules/web-console/src/main/js/app/modules/form/validator/java-package-specified.directive.js new file mode 100644 index 0000000..451d7ec --- /dev/null +++ b/modules/web-console/src/main/js/app/modules/form/validator/java-package-specified.directive.js @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export default ['javaPackageSpecified', ['JavaTypes', (JavaTypes) => { + const link = (scope, el, attrs, [ngModel]) => { + if (_.isUndefined(attrs.javaPackageSpecified)) + return; + + const allowBuiltIn = attrs.javaPackageSpecified === 'allow-built-in'; + + ngModel.$validators.javaPackageSpecified = (value) => !value || !JavaTypes.validIdentifier(value) || JavaTypes.packageSpecified(value) || + (allowBuiltIn && !JavaTypes.nonBuiltInClass(value)); + }; + + return { + restrict: 'A', + link, + require: ['ngModel'] + }; +}]]; http://git-wip-us.apache.org/repos/asf/ignite/blob/eb5ac0ae/modules/web-console/src/main/js/app/modules/form/validator/property-unique.directive.js ---------------------------------------------------------------------- diff --git a/modules/web-console/src/main/js/app/modules/form/validator/property-unique.directive.js b/modules/web-console/src/main/js/app/modules/form/validator/property-unique.directive.js new file mode 100644 index 0000000..8cfae89 --- /dev/null +++ b/modules/web-console/src/main/js/app/modules/form/validator/property-unique.directive.js @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export default ['ignitePropertyUnique', ['$parse', ($parse) => { + const link = (scope, el, attrs, [ngModel]) => { + if (_.isUndefined(attrs.ignitePropertyUnique) || !attrs.ignitePropertyUnique) + return; + + ngModel.$validators.ignitePropertyUnique = (value) => { + const arr = $parse(attrs.ignitePropertyUnique)(scope); + + // Return true in case if array not exist, array empty. + if (!value || !arr || !arr.length) + return true; + + const key = value.split('=')[0]; + const idx = _.findIndex(arr, (item) => item.split('=')[0] === key); + + // In case of new element check all items. + if (attrs.name === 'new') + return idx < 0; + + // Check for $index in case of editing in-place. + return (_.isNumber(scope.$index) && (idx < 0 || scope.$index === idx)); + }; + }; + + return { + restrict: 'A', + link, + require: ['ngModel'] + }; +}]]; http://git-wip-us.apache.org/repos/asf/ignite/blob/eb5ac0ae/modules/web-console/src/main/js/app/modules/form/validator/property-value-specified.directive.js ---------------------------------------------------------------------- diff --git a/modules/web-console/src/main/js/app/modules/form/validator/property-value-specified.directive.js b/modules/web-console/src/main/js/app/modules/form/validator/property-value-specified.directive.js new file mode 100644 index 0000000..d113a4f --- /dev/null +++ b/modules/web-console/src/main/js/app/modules/form/validator/property-value-specified.directive.js @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export default ['ignitePropertyValueSpecified', [() => { + const link = (scope, el, attrs, [ngModel]) => { + if (_.isUndefined(attrs.ignitePropertyValueSpecified) || !attrs.ignitePropertyValueSpecified) + return; + + ngModel.$validators.ignitePropertyValueSpecified = (value) => value ? value.indexOf('=') > 0 : true; + }; + + return { + restrict: 'A', + link, + require: ['ngModel'] + }; +}]]; http://git-wip-us.apache.org/repos/asf/ignite/blob/eb5ac0ae/modules/web-console/src/main/js/app/modules/form/validator/unique.directive.js ---------------------------------------------------------------------- diff --git a/modules/web-console/src/main/js/app/modules/form/validator/unique.directive.js b/modules/web-console/src/main/js/app/modules/form/validator/unique.directive.js new file mode 100644 index 0000000..0e6af18 --- /dev/null +++ b/modules/web-console/src/main/js/app/modules/form/validator/unique.directive.js @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export default ['igniteUnique', ['$parse', ($parse) => { + const link = (scope, el, attrs, [ngModel]) => { + if (_.isUndefined(attrs.igniteUnique) || !attrs.igniteUnique) + return; + + const isNew = _.startsWith(attrs.name, 'new'); + const property = attrs.igniteUniqueProperty; + + ngModel.$validators.igniteUnique = (value) => { + const arr = $parse(attrs.igniteUnique)(scope); + + // Return true in case if array not exist, array empty. + if (!arr || !arr.length) + return true; + + const idx = _.findIndex(arr, (item) => (property ? item[property] : item) === value); + + // In case of new element check all items. + if (isNew) + return idx < 0; + + // Check for $index in case of editing in-place. + return (_.isNumber(scope.$index) && (idx < 0 || scope.$index === idx)); + }; + }; + + return { + restrict: 'A', + link, + require: ['ngModel'] + }; +}]]; http://git-wip-us.apache.org/repos/asf/ignite/blob/eb5ac0ae/modules/web-console/src/main/js/app/modules/getting-started/GettingStarted.provider.js ---------------------------------------------------------------------- diff --git a/modules/web-console/src/main/js/app/modules/getting-started/GettingStarted.provider.js b/modules/web-console/src/main/js/app/modules/getting-started/GettingStarted.provider.js new file mode 100644 index 0000000..74c24c2 --- /dev/null +++ b/modules/web-console/src/main/js/app/modules/getting-started/GettingStarted.provider.js @@ -0,0 +1,112 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import angular from 'angular'; + +// Getting started pages. +import PAGES from 'app/data/getting-started.json!'; + +angular + .module('ignite-console.getting-started', []) + .provider('igniteGettingStarted', function() { + const items = PAGES; + + this.push = (before, data) => { + const idx = _.findIndex(items, {title: before}); + + if (idx < 0) + items.push(data); + else + items.splice(idx, 0, data); + }; + + this.update = (before, data) => { + const idx = _.findIndex(items, {title: before}); + + if (idx >= 0) + items[idx] = data; + }; + + this.$get = [function() { + return items; + }]; + }) + .service('gettingStarted', ['$rootScope', '$modal', 'igniteGettingStarted', function($root, $modal, igniteGettingStarted) { + const _model = igniteGettingStarted; + + let _page = 0; + + const scope = $root.$new(); + + scope.ui = { + showGettingStarted: false + }; + + function _fillPage() { + scope.title = _model[_page].title; + scope.message = _model[_page].message.join(' '); + } + + scope.isFirst = () => _page === 0; + + scope.isLast = () => _page === _model.length - 1; + + scope.next = () => { + _page += 1; + + _fillPage(); + }; + + scope.prev = () => { + _page -= 1; + + _fillPage(); + }; + + const dialog = $modal({templateUrl: '/templates/getting-started.html', scope, placement: 'center', show: false, backdrop: 'static'}); + + scope.close = () => { + try { + localStorage.showGettingStarted = scope.ui.showGettingStarted; + } + catch (ignore) { + // No-op. + } + + dialog.hide(); + }; + + return { + tryShow: (force) => { + try { + scope.ui.showGettingStarted = _.isNil(localStorage.showGettingStarted) + || localStorage.showGettingStarted === 'true'; + } + catch (ignore) { + // No-op. + } + + if (force || scope.ui.showGettingStarted) { + _page = 0; + + _fillPage(); + + dialog.$promise.then(dialog.show); + } + } + }; + }]); http://git-wip-us.apache.org/repos/asf/ignite/blob/eb5ac0ae/modules/web-console/src/main/js/app/modules/loading/loading.css ---------------------------------------------------------------------- diff --git a/modules/web-console/src/main/js/app/modules/loading/loading.css b/modules/web-console/src/main/js/app/modules/loading/loading.css new file mode 100644 index 0000000..fac7517 --- /dev/null +++ b/modules/web-console/src/main/js/app/modules/loading/loading.css @@ -0,0 +1,73 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +[ignite-loading] { + position: relative; +} + +.loading { + position: absolute; + bottom: 0; + left: 0; + right: 0; + top: 0; + z-index: 1002; + opacity: 0; + visibility: hidden; + background-color: white; + transition: visibility 0s 0.5s, opacity 0.5s linear; +} + +.loading-active { + opacity: 1; + visibility: visible; + transition: opacity 0.5s linear; +} + +.loading:before { + content: ''; + display: inline-block; + height: 100%; + vertical-align: middle; +} + +.loading .loading-wrapper { + display: inline-block; + vertical-align: middle; + position: relative; + width: 100%; +} + +.loading.loading-top .loading-wrapper { + position: absolute; + top: 100px; + display: block; +} + +.loading .loading-text { + font-size: 18px; + margin: 20px 0; + text-align: center; +} + +.loading-opacity-80 { + opacity: 0.8; +} + +.loading-max-foreground { + z-index: 99999; +} http://git-wip-us.apache.org/repos/asf/ignite/blob/eb5ac0ae/modules/web-console/src/main/js/app/modules/loading/loading.directive.js ---------------------------------------------------------------------- diff --git a/modules/web-console/src/main/js/app/modules/loading/loading.directive.js b/modules/web-console/src/main/js/app/modules/loading/loading.directive.js new file mode 100644 index 0000000..fc3e1e6 --- /dev/null +++ b/modules/web-console/src/main/js/app/modules/loading/loading.directive.js @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import template from './loading.jade!'; +import './loading.css!'; + +export default ['igniteLoading', ['$loading', '$compile', ($loading, $compile) => { + const link = (scope, element) => { + const compiledTemplate = $compile(template()); + + const build = () => { + scope.position = scope.position || 'middle'; + + const loading = compiledTemplate(scope); + + if (!scope.loading) { + scope.loading = loading; + + $loading.add(scope.key || 'defaultSpinnerKey', scope.loading); + element.append(scope.loading); + } + }; + + build(); + }; + + return { + scope: { + key: '@igniteLoading', + text: '@?igniteLoadingText', + class: '@?igniteLoadingClass', + position: '@?igniteLoadingPosition' + }, + restrict: 'A', + link + }; +}]]; http://git-wip-us.apache.org/repos/asf/ignite/blob/eb5ac0ae/modules/web-console/src/main/js/app/modules/loading/loading.jade ---------------------------------------------------------------------- diff --git a/modules/web-console/src/main/js/app/modules/loading/loading.jade b/modules/web-console/src/main/js/app/modules/loading/loading.jade new file mode 100644 index 0000000..cc6cf45 --- /dev/null +++ b/modules/web-console/src/main/js/app/modules/loading/loading.jade @@ -0,0 +1,23 @@ +//- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +.loading.loading-opacity-80(ng-class='[class, "loading-" + position]') + .loading-wrapper + .spinner + .bounce1 + .bounce2 + .bounce3 + .loading-text {{ text }} http://git-wip-us.apache.org/repos/asf/ignite/blob/eb5ac0ae/modules/web-console/src/main/js/app/modules/loading/loading.module.js ---------------------------------------------------------------------- diff --git a/modules/web-console/src/main/js/app/modules/loading/loading.module.js b/modules/web-console/src/main/js/app/modules/loading/loading.module.js new file mode 100644 index 0000000..889cd6b --- /dev/null +++ b/modules/web-console/src/main/js/app/modules/loading/loading.module.js @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import angular from 'angular'; + +import IgniteLoadingDirective from './loading.directive'; +import IgniteLoadingService from './loading.service'; + +angular + .module('ignite-console.loading', []) + .directive(...IgniteLoadingDirective) + .service(...IgniteLoadingService); http://git-wip-us.apache.org/repos/asf/ignite/blob/eb5ac0ae/modules/web-console/src/main/js/app/modules/loading/loading.service.js ---------------------------------------------------------------------- diff --git a/modules/web-console/src/main/js/app/modules/loading/loading.service.js b/modules/web-console/src/main/js/app/modules/loading/loading.service.js new file mode 100644 index 0000000..0664884 --- /dev/null +++ b/modules/web-console/src/main/js/app/modules/loading/loading.service.js @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export default ['$loading', ['$timeout', ($timeout) => { + const _overlays = {}; + + const start = (key) => { + $timeout(() => { + const loadingOverlay = _overlays[key]; + + loadingOverlay && loadingOverlay.addClass('loading-active'); + }); + }; + + const finish = (key) => { + $timeout(() => { + const loadingOverlay = _overlays[key]; + + loadingOverlay && loadingOverlay.removeClass('loading-active'); + }); + }; + + const add = (key, element) => { + _overlays[key] = element; + + return element; + }; + + return { + add, + start, + finish + }; +}]]; http://git-wip-us.apache.org/repos/asf/ignite/blob/eb5ac0ae/modules/web-console/src/main/js/app/modules/navbar/Navbar.provider.js ---------------------------------------------------------------------- diff --git a/modules/web-console/src/main/js/app/modules/navbar/Navbar.provider.js b/modules/web-console/src/main/js/app/modules/navbar/Navbar.provider.js new file mode 100644 index 0000000..f1ae1b2 --- /dev/null +++ b/modules/web-console/src/main/js/app/modules/navbar/Navbar.provider.js @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export default ['IgniteNavbar', [function() { + const items = []; + + this.push = function(data) { + items.push(data); + }; + + this.$get = [function() { + return items; + }]; +}]]; http://git-wip-us.apache.org/repos/asf/ignite/blob/eb5ac0ae/modules/web-console/src/main/js/app/modules/navbar/Userbar.provider.js ---------------------------------------------------------------------- diff --git a/modules/web-console/src/main/js/app/modules/navbar/Userbar.provider.js b/modules/web-console/src/main/js/app/modules/navbar/Userbar.provider.js new file mode 100644 index 0000000..9513641 --- /dev/null +++ b/modules/web-console/src/main/js/app/modules/navbar/Userbar.provider.js @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export default ['IgniteUserbar', [function() { + const items = []; + + this.push = function(data) { + items.push(data); + }; + + this.$get = [function() { + return items; + }]; +}]]; http://git-wip-us.apache.org/repos/asf/ignite/blob/eb5ac0ae/modules/web-console/src/main/js/app/modules/navbar/navbar.directive.js ---------------------------------------------------------------------- diff --git a/modules/web-console/src/main/js/app/modules/navbar/navbar.directive.js b/modules/web-console/src/main/js/app/modules/navbar/navbar.directive.js new file mode 100644 index 0000000..020cfe4 --- /dev/null +++ b/modules/web-console/src/main/js/app/modules/navbar/navbar.directive.js @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export default ['igniteNavbar', ['IgniteNavbar', (IgniteNavbar) => { + function controller() { + const ctrl = this; + + ctrl.items = IgniteNavbar; + } + + return { + restrict: 'A', + controller, + controllerAs: 'navbar' + }; +}]]; http://git-wip-us.apache.org/repos/asf/ignite/blob/eb5ac0ae/modules/web-console/src/main/js/app/modules/navbar/navbar.module.js ---------------------------------------------------------------------- diff --git a/modules/web-console/src/main/js/app/modules/navbar/navbar.module.js b/modules/web-console/src/main/js/app/modules/navbar/navbar.module.js new file mode 100644 index 0000000..b845cbc --- /dev/null +++ b/modules/web-console/src/main/js/app/modules/navbar/navbar.module.js @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import angular from 'angular'; + +import IgniteNavbar from './Navbar.provider'; +import IgniteUserbar from './Userbar.provider'; + +import igniteNavbar from './navbar.directive'; +import igniteUserbar from './userbar.directive'; + +angular +.module('ignite-console.navbar', [ + +]) +.provider(...IgniteNavbar) +.provider(...IgniteUserbar) +.directive(...igniteNavbar) +.directive(...igniteUserbar); http://git-wip-us.apache.org/repos/asf/ignite/blob/eb5ac0ae/modules/web-console/src/main/js/app/modules/navbar/userbar.directive.js ---------------------------------------------------------------------- diff --git a/modules/web-console/src/main/js/app/modules/navbar/userbar.directive.js b/modules/web-console/src/main/js/app/modules/navbar/userbar.directive.js new file mode 100644 index 0000000..0e94063 --- /dev/null +++ b/modules/web-console/src/main/js/app/modules/navbar/userbar.directive.js @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export default ['igniteUserbar', [function() { + return { + restrict: 'A', + controller: ['$rootScope', 'IgniteUserbar', function($root, IgniteUserbar) { + const ctrl = this; + + ctrl.items = [ + {text: 'Profile', sref: 'settings.profile'}, + {text: 'Getting Started', click: 'gettingStarted.tryShow(true)'} + ]; + + const _rebuildSettings = (event, user) => { + ctrl.items.splice(2); + + if (!user.becomeUsed && user.admin) + ctrl.items.push({text: 'Admin Panel', sref: 'settings.admin'}); + + ctrl.items.push(...IgniteUserbar); + + if (!user.becomeUsed) + ctrl.items.push({text: 'Log Out', sref: 'logout'}); + }; + + if ($root.user) + _rebuildSettings(null, $root.user); + + $root.$on('user', _rebuildSettings); + }], + controllerAs: 'userbar' + }; +}]]; http://git-wip-us.apache.org/repos/asf/ignite/blob/eb5ac0ae/modules/web-console/src/main/js/app/modules/socket.module.js ---------------------------------------------------------------------- diff --git a/modules/web-console/src/main/js/app/modules/socket.module.js b/modules/web-console/src/main/js/app/modules/socket.module.js new file mode 100644 index 0000000..17856c4 --- /dev/null +++ b/modules/web-console/src/main/js/app/modules/socket.module.js @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import angular from 'angular'; +import io from 'socket.io-client'; // eslint-disable-line no-unused-vars + +angular +.module('ignite-console.socket', [ +]) +.provider('igniteSocketFactory', [function() { + let _options = {}; + + /** + * @param {Object} options Socket io options. + */ + this.set = (options) => { + _options = options; + }; + + this.$get = ['socketFactory', function(socketFactory) { + return () => { + const ioSocket = io.connect(_options); + + return socketFactory({ioSocket}); + }; + }]; +}]); http://git-wip-us.apache.org/repos/asf/ignite/blob/eb5ac0ae/modules/web-console/src/main/js/app/modules/states/admin.state.js ---------------------------------------------------------------------- diff --git a/modules/web-console/src/main/js/app/modules/states/admin.state.js b/modules/web-console/src/main/js/app/modules/states/admin.state.js new file mode 100644 index 0000000..af1fbde --- /dev/null +++ b/modules/web-console/src/main/js/app/modules/states/admin.state.js @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import angular from 'angular'; + +angular +.module('ignite-console.states.admin', [ + 'ui.router' +]) +.config(['$stateProvider', function($stateProvider) { + // set up the states + $stateProvider + .state('settings.admin', { + url: '/admin', + templateUrl: '/settings/admin.html', + metaTags: { + title: 'List of registered users' + } + }); +}]); http://git-wip-us.apache.org/repos/asf/ignite/blob/eb5ac0ae/modules/web-console/src/main/js/app/modules/states/configuration.state.js ---------------------------------------------------------------------- diff --git a/modules/web-console/src/main/js/app/modules/states/configuration.state.js b/modules/web-console/src/main/js/app/modules/states/configuration.state.js new file mode 100644 index 0000000..4a0578c --- /dev/null +++ b/modules/web-console/src/main/js/app/modules/states/configuration.state.js @@ -0,0 +1,202 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import angular from 'angular'; + +// Common directives. +import previewPanel from './configuration/preview-panel.directive.js'; + +// Clusters screen. +import clustersGeneral from './configuration/clusters/general.directive'; + +import clustersGeneralDiscoveryCloud from './configuration/clusters/general/discovery/cloud.directive'; +import clustersGeneralDiscoveryGoogle from './configuration/clusters/general/discovery/google.directive'; +import clustersGeneralDiscoveryJdbc from './configuration/clusters/general/discovery/jdbc.directive'; +import clustersGeneralDiscoveryMulticast from './configuration/clusters/general/discovery/multicast.directive'; +import clustersGeneralDiscoveryS3 from './configuration/clusters/general/discovery/s3.directive'; +import clustersGeneralDiscoveryShared from './configuration/clusters/general/discovery/shared.directive'; +import clustersGeneralDiscoveryVm from './configuration/clusters/general/discovery/vm.directive'; + +import clustersGeneralDiscoveryZookeeper from './configuration/clusters/general/discovery/zookeeper.directive'; +import clustersGeneralDiscoveryZookeeperRetryExponential from './configuration/clusters/general/discovery/zookeeper/retrypolicy/exponential-backoff.directive'; +import clustersGeneralDiscoveryZookeeperRetryBoundedExponential from './configuration/clusters/general/discovery/zookeeper/retrypolicy/bounded-exponential-backoff.directive'; +import clustersGeneralDiscoveryZookeeperRetryUntilElapsed from './configuration/clusters/general/discovery/zookeeper/retrypolicy/until-elapsed.directive'; +import clustersGeneralDiscoveryZookeeperRetryNTimes from './configuration/clusters/general/discovery/zookeeper/retrypolicy/n-times.directive'; +import clustersGeneralDiscoveryZookeeperRetryOneTime from './configuration/clusters/general/discovery/zookeeper/retrypolicy/one-time.directive'; +import clustersGeneralDiscoveryZookeeperRetryForever from './configuration/clusters/general/discovery/zookeeper/retrypolicy/forever.directive'; +import clustersGeneralDiscoveryZookeeperRetryCustom from './configuration/clusters/general/discovery/zookeeper/retrypolicy/custom.directive'; + +import clustersAtomic from './configuration/clusters/atomic.directive'; +import clustersBinary from './configuration/clusters/binary.directive'; +import clustersCommunication from './configuration/clusters/communication.directive'; +import clustersConnector from './configuration/clusters/connector.directive'; +import clustersDeployment from './configuration/clusters/deployment.directive'; +import clustersDiscovery from './configuration/clusters/discovery.directive'; +import clustersEvents from './configuration/clusters/events.directive'; +import clustersIgfs from './configuration/clusters/igfs.directive'; +import clustersMarshaller from './configuration/clusters/marshaller.directive'; +import clustersMetrics from './configuration/clusters/metrics.directive'; +import clustersSsl from './configuration/clusters/ssl.directive'; +import clustersSwap from './configuration/clusters/swap.directive'; +import clustersTime from './configuration/clusters/time.directive'; +import clustersThread from './configuration/clusters/thread.directive'; +import clustersTransactions from './configuration/clusters/transactions.directive'; + +// Domains screen. +import domainsGeneral from './configuration/domains/general.directive'; +import domainsQuery from './configuration/domains/query.directive'; +import domainsStore from './configuration/domains/store.directive'; + +// Caches screen. +import cachesGeneral from './configuration/caches/general.directive'; +import cachesMemory from './configuration/caches/memory.directive'; +import cachesQuery from './configuration/caches/query.directive'; +import cachesStore from './configuration/caches/store.directive'; +import cachesConcurrency from './configuration/caches/concurrency.directive'; +import cachesRebalance from './configuration/caches/rebalance.directive'; +import cachesServerNearCache from './configuration/caches/server-near-cache.directive'; +import cachesStatistics from './configuration/caches/statistics.directive'; + +// IGFS screen. +import igfsGeneral from './configuration/igfs/general.directive'; +import igfsIpc from './configuration/igfs/ipc.directive'; +import igfsFragmentizer from './configuration/igfs/fragmentizer.directive'; +import igfsDual from './configuration/igfs/dual.directive'; +import igfsSecondary from './configuration/igfs/secondary.directive'; +import igfsMisc from './configuration/igfs/misc.directive'; + +// Summary screen. +import ConfigurationSummaryCtrl from './configuration/summary/summary.controller'; +import ConfigurationSummaryResource from './configuration/summary/summary.resource'; +import summaryTabs from './configuration/summary/summary-tabs.directive'; + +angular.module('ignite-console.states.configuration', ['ui.router']) + // Clusters screen. + .directive(...previewPanel) + .directive(...clustersTransactions) + .directive(...clustersThread) + .directive(...clustersTime) + .directive(...clustersSwap) + .directive(...clustersSsl) + .directive(...clustersMetrics) + .directive(...clustersMarshaller) + .directive(...clustersIgfs) + .directive(...clustersEvents) + .directive(...clustersDiscovery) + .directive(...clustersDeployment) + .directive(...clustersConnector) + .directive(...clustersCommunication) + .directive(...clustersBinary) + .directive(...clustersAtomic) + .directive(...clustersGeneral) + .directive(...clustersGeneralDiscoveryCloud) + .directive(...clustersGeneralDiscoveryGoogle) + .directive(...clustersGeneralDiscoveryJdbc) + .directive(...clustersGeneralDiscoveryMulticast) + .directive(...clustersGeneralDiscoveryS3) + .directive(...clustersGeneralDiscoveryShared) + .directive(...clustersGeneralDiscoveryVm) + .directive(...clustersGeneralDiscoveryZookeeper) + .directive(...clustersGeneralDiscoveryZookeeperRetryExponential) + .directive(...clustersGeneralDiscoveryZookeeperRetryBoundedExponential) + .directive(...clustersGeneralDiscoveryZookeeperRetryUntilElapsed) + .directive(...clustersGeneralDiscoveryZookeeperRetryNTimes) + .directive(...clustersGeneralDiscoveryZookeeperRetryOneTime) + .directive(...clustersGeneralDiscoveryZookeeperRetryForever) + .directive(...clustersGeneralDiscoveryZookeeperRetryCustom) + // Domains screen + .directive(...domainsGeneral) + .directive(...domainsQuery) + .directive(...domainsStore) + // Caches screen + .directive(...cachesGeneral) + .directive(...cachesMemory) + .directive(...cachesQuery) + .directive(...cachesStore) + .directive(...cachesConcurrency) + .directive(...cachesRebalance) + .directive(...cachesServerNearCache) + .directive(...cachesStatistics) + // IGFS screen + .directive(...igfsGeneral) + .directive(...igfsIpc) + .directive(...igfsFragmentizer) + .directive(...igfsDual) + .directive(...igfsSecondary) + .directive(...igfsMisc) + // Summary screen + .directive(...summaryTabs) + // Services. + .service(...ConfigurationSummaryResource) + // Configure state provider. + .config(['$stateProvider', ($stateProvider) => { + // Setup the states. + $stateProvider + .state('base.configuration', { + url: '/configuration', + templateUrl: '/configuration/sidebar.html' + }) + .state('base.configuration.clusters', { + url: '/clusters', + templateUrl: '/configuration/clusters.html', + params: { + id: null + }, + metaTags: { + title: 'Configure Clusters' + } + }) + .state('base.configuration.caches', { + url: '/caches', + templateUrl: '/configuration/caches.html', + params: { + id: null + }, + metaTags: { + title: 'Configure Caches' + } + }) + .state('base.configuration.domains', { + url: '/domains', + templateUrl: '/configuration/domains.html', + params: { + id: null + }, + metaTags: { + title: 'Configure Domain Model' + } + }) + .state('base.configuration.igfs', { + url: '/igfs', + templateUrl: '/configuration/igfs.html', + params: { + id: null + }, + metaTags: { + title: 'Configure IGFS' + } + }) + .state('base.configuration.summary', { + url: '/summary', + templateUrl: '/configuration/summary.html', + controller: ConfigurationSummaryCtrl, + controllerAs: 'ctrl', + metaTags: { + title: 'Configurations Summary' + } + }); + }]); http://git-wip-us.apache.org/repos/asf/ignite/blob/eb5ac0ae/modules/web-console/src/main/js/app/modules/states/configuration/caches/concurrency.directive.js ---------------------------------------------------------------------- diff --git a/modules/web-console/src/main/js/app/modules/states/configuration/caches/concurrency.directive.js b/modules/web-console/src/main/js/app/modules/states/configuration/caches/concurrency.directive.js new file mode 100644 index 0000000..0e00a4b --- /dev/null +++ b/modules/web-console/src/main/js/app/modules/states/configuration/caches/concurrency.directive.js @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import template from './concurrency.jade!'; + +export default ['igniteConfigurationCachesConcurrency', [() => { + return { + scope: true, + restrict: 'E', + template, + replace: true + }; +}]]; http://git-wip-us.apache.org/repos/asf/ignite/blob/eb5ac0ae/modules/web-console/src/main/js/app/modules/states/configuration/caches/concurrency.jade ---------------------------------------------------------------------- diff --git a/modules/web-console/src/main/js/app/modules/states/configuration/caches/concurrency.jade b/modules/web-console/src/main/js/app/modules/states/configuration/caches/concurrency.jade new file mode 100644 index 0000000..7cf8371 --- /dev/null +++ b/modules/web-console/src/main/js/app/modules/states/configuration/caches/concurrency.jade @@ -0,0 +1,65 @@ +//- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +include ../../../../../app/helpers/jade/mixins.jade + +-var form = 'concurrency' +-var model = 'backupItem' + +form.panel.panel-default(name=form novalidate) + .panel-heading(bs-collapse-toggle='' ng-click='ui.loadPanel("#{form}")') + ignite-form-panel-chevron + label Concurrency control + ignite-form-field-tooltip.tipLabel + | Cache concurrent usage settings + ignite-form-revert + .panel-collapse(role='tabpanel' bs-collapse-target id=form) + .panel-body(ng-if='ui.isPanelLoaded("#{form}")') + .col-sm-6 + .settings-row + +number('Max async operations:', model + '.maxConcurrentAsyncOperations', 'maxConcurrentAsyncOperations', 'true', '500', '0', + 'Maximum number of allowed concurrent asynchronous operations<br/>\ + If 0 then number of concurrent asynchronous operations is unlimited') + .settings-row + +number('Default lock timeout:', model + '.defaultLockTimeout', 'defaultLockTimeout', 'true', '0', '0', + 'Default lock acquisition timeout<br/>\ + If 0 then lock acquisition will never timeout') + .settings-row(ng-hide='#{model}.atomicityMode === "TRANSACTIONAL"') + +dropdown('Entry versioning:', model + '.atomicWriteOrderMode', 'atomicWriteOrderMode', 'true', 'Choose versioning', + '[\ + {value: "CLOCK", label: "CLOCK"},\ + {value: "PRIMARY", label: "PRIMARY"}\ + ]', + 'Write ordering mode determines which node assigns the write version, sender or the primary node:\ + <ul>\ + <li>CLOCK - in this mode write versions are assigned on a sender node which generally leads to better performance</li>\ + <li>PRIMARY - in this mode version is assigned only on primary node. This means that sender will only send write request to primary node, which in turn will assign write version and forward it to backups</li>\ + </ul>') + .settings-row + +dropdown('Write synchronization mode:', model + '.writeSynchronizationMode', 'writeSynchronizationMode', 'true', 'PRIMARY_SYNC', + '[\ + {value: "FULL_SYNC", label: "FULL_SYNC"},\ + {value: "FULL_ASYNC", label: "FULL_ASYNC"},\ + {value: "PRIMARY_SYNC", label: "PRIMARY_SYNC"}\ + ]', + 'Write synchronization mode:\ + <ul>\ + <li>FULL_SYNC - Ignite will wait for write or commit replies from all nodes</li>\ + <li>FULL_ASYNC - Ignite will not wait for write or commit responses from participating nodes</li>\ + <li>PRIMARY_SYNC - Makes sense for PARTITIONED mode. Ignite will wait for write or commit to complete on primary node</li>\ + </ul>') + .col-sm-6 + +preview-xml-java(model, 'cacheConcurrency') http://git-wip-us.apache.org/repos/asf/ignite/blob/eb5ac0ae/modules/web-console/src/main/js/app/modules/states/configuration/caches/general.directive.js ---------------------------------------------------------------------- diff --git a/modules/web-console/src/main/js/app/modules/states/configuration/caches/general.directive.js b/modules/web-console/src/main/js/app/modules/states/configuration/caches/general.directive.js new file mode 100644 index 0000000..d3f5f45 --- /dev/null +++ b/modules/web-console/src/main/js/app/modules/states/configuration/caches/general.directive.js @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import template from './general.jade!'; + +export default ['igniteConfigurationCachesGeneral', [() => { + return { + scope: true, + restrict: 'E', + template, + replace: true + }; +}]]; http://git-wip-us.apache.org/repos/asf/ignite/blob/eb5ac0ae/modules/web-console/src/main/js/app/modules/states/configuration/caches/general.jade ---------------------------------------------------------------------- diff --git a/modules/web-console/src/main/js/app/modules/states/configuration/caches/general.jade b/modules/web-console/src/main/js/app/modules/states/configuration/caches/general.jade new file mode 100644 index 0000000..2285825 --- /dev/null +++ b/modules/web-console/src/main/js/app/modules/states/configuration/caches/general.jade @@ -0,0 +1,65 @@ +//- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +include ../../../../../app/helpers/jade/mixins.jade + +-var model = 'backupItem' + +form.panel.panel-default(name='general' novalidate) + .panel-heading(bs-collapse-toggle) + ignite-form-panel-chevron + label General + ignite-form-revert + .panel-collapse(role='tabpanel' bs-collapse-target id='general') + .panel-body + .col-sm-6 + .settings-row + +text('Name:', model + '.name', 'cacheName', 'true', 'Input name', 'Cache name') + .settings-row + +clusters(model, 'Associate clusters with the current cache') + .settings-row + +dropdown-multiple('<span>Domain models:</span><a ui-sref="base.configuration.domains({id: ' + model + '._id})"> (add)</a>', + model + '.domains', 'domains', 'true', 'Choose domain models', 'No domain models configured', 'domains', + 'Select domain models to describe types in cache') + .settings-row + +cacheMode('Mode:', model + '.cacheMode', 'cacheMode', 'PARTITIONED') + .settings-row + +dropdown('Atomicity:', model + '.atomicityMode', 'atomicityMode', 'true', 'ATOMIC', + '[\ + {value: "ATOMIC", label: "ATOMIC"},\ + {value: "TRANSACTIONAL", label: "TRANSACTIONAL"}\ + ]', + 'Atomicity:\ + <ul>\ + <li>Atomic - in this mode distributed transactions and distributed locking are not supported</li>\ + <li>Transactional - in this mode specified fully ACID-compliant transactional cache behavior</li>\ + </ul>') + .settings-row(data-ng-show='#{model}.cacheMode === "PARTITIONED"') + +number('Backups:', model + '.backups', 'backups', 'true', '0', '0', 'Number of nodes used to back up single partition for partitioned cache') + .settings-row(data-ng-show='#{model}.backups && #{model}.cacheMode !== "LOCAL"') + +checkbox('Read from backup', model + '.readFromBackup', 'readFromBackup', + 'Flag indicating whether data can be read from backup<br/>\ + If not set then always get data from primary node (never from backup)') + .settings-row + +checkbox('Copy on read', model + '.copyOnRead', 'copyOnRead', + 'Flag indicating whether copy of the value stored in cache should be created for cache operation implying return value<br/>\ + Also if this flag is set copies are created for values passed to CacheInterceptor and to CacheEntryProcessor') + .settings-row(ng-show='#{model}.cacheMode === "PARTITIONED" && #{model}.atomicityMode === "TRANSACTIONAL"') + +checkbox('Invalidate near cache', model + '.invalidate', 'invalidate', + 'Invalidation flag for near cache entries in transaction<br/>\ + If set then values will be invalidated (nullified) upon commit in near cache') + .col-sm-6 + +preview-xml-java(model, 'cacheGeneral') http://git-wip-us.apache.org/repos/asf/ignite/blob/eb5ac0ae/modules/web-console/src/main/js/app/modules/states/configuration/caches/memory.directive.js ---------------------------------------------------------------------- diff --git a/modules/web-console/src/main/js/app/modules/states/configuration/caches/memory.directive.js b/modules/web-console/src/main/js/app/modules/states/configuration/caches/memory.directive.js new file mode 100644 index 0000000..0f8662d --- /dev/null +++ b/modules/web-console/src/main/js/app/modules/states/configuration/caches/memory.directive.js @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import template from './memory.jade!'; + +export default ['igniteConfigurationCachesMemory', [() => { + return { + scope: true, + restrict: 'E', + template, + replace: true + }; +}]];
