IGNITE-9569 Web console: Refactored DI to use $inject instead of arrays.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6e6e8bff Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6e6e8bff Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6e6e8bff Branch: refs/heads/ignite-gg-14206 Commit: 6e6e8bfffa4893206fa26ee918a32166ce8e994b Parents: 813f097 Author: Ilya Borisov <klast...@gmail.com> Authored: Thu Sep 27 11:09:58 2018 +0700 Committer: Alexey Kuznetsov <akuznet...@apache.org> Committed: Thu Sep 27 11:10:34 2018 +0700 ---------------------------------------------------------------------- modules/web-console/frontend/app/app.js | 165 +++++---- .../components/activities-user-dialog/index.js | 9 +- .../connected-clusters-badge/controller.js | 7 +- .../components/cell-logout/index.js | 7 +- .../components/list/controller.js | 1 + .../app/components/ignite-chart/controller.js | 2 +- .../app/components/ignite-icon/directive.js | 19 +- .../app/components/ignite-icon/service.js | 17 + .../input-dialog/input-dialog.controller.js | 2 + .../input-dialog/input-dialog.service.js | 9 +- .../page-password-reset/controller.js | 6 +- .../app/components/page-profile/controller.js | 21 +- .../app/components/page-queries/component.js | 11 +- .../components/page-queries/notebook.data.js | 5 + .../components/page-queries/notebook.service.js | 8 +- .../app/components/page-signin/controller.js | 2 + .../app/components/page-signup/controller.js | 3 + .../components/user-notifications/service.js | 11 +- .../app/components/version-picker/component.js | 5 + .../frontend/app/core/admin/Admin.data.js | 21 +- .../app/directives/auto-focus.directive.js | 15 +- .../app/directives/bs-affix-update.directive.js | 10 +- .../directives/centered/centered.directive.js | 4 +- .../directives/copy-to-clipboard.directive.js | 15 +- .../hide-on-state-change.directive.js | 15 +- .../information/information.directive.js | 4 +- .../app/directives/on-click-focus.directive.js | 22 +- .../directives/on-enter-focus-move.directive.js | 22 +- .../app/directives/on-enter.directive.js | 22 +- .../app/directives/on-escape.directive.js | 22 +- .../directives/restore-input-focus.directive.js | 12 +- .../directives/retain-selection.directive.js | 21 +- .../ui-ace-docker/ui-ace-docker.controller.js | 6 +- .../ui-ace-docker/ui-ace-docker.directive.js | 4 +- .../ui-ace-pojos/ui-ace-pojos.controller.js | 7 +- .../ui-ace-pojos/ui-ace-pojos.directive.js | 4 +- .../ui-ace-pom/ui-ace-pom.controller.js | 6 +- .../ui-ace-pom/ui-ace-pom.directive.js | 4 +- .../ui-ace-sharp/ui-ace-sharp.controller.js | 11 +- .../ui-ace-sharp/ui-ace-sharp.directive.js | 18 +- .../app/directives/ui-ace-tabs.directive.js | 4 +- .../frontend/app/filters/byName.filter.js | 6 +- .../frontend/app/filters/bytes.filter.js | 8 +- .../frontend/app/filters/default-name.filter.js | 16 +- .../app/filters/domainsValidation.filter.js | 42 ++- .../frontend/app/filters/duration.filter.js | 10 +- .../frontend/app/filters/hasPojo.filter.js | 4 +- .../app/filters/uiGridSubcategories.filter.js | 6 +- .../app/modules/agent/AgentManager.service.js | 21 +- .../app/modules/agent/AgentModal.service.js | 36 +- .../agent/components/cluster-login/component.js | 6 + .../agent/components/cluster-login/service.js | 9 +- .../app/modules/branding/branding.module.js | 12 +- .../app/modules/branding/branding.service.js | 3 + .../app/modules/branding/features.directive.js | 9 +- .../app/modules/branding/footer.directive.js | 9 +- .../modules/branding/header-logo.directive.js | 9 +- .../modules/branding/header-title.directive.js | 9 +- .../branding/powered-by-apache.directive.js | 9 +- .../app/modules/branding/terms.directive.js | 9 +- .../generator/PlatformGenerator.js | 11 +- .../frontend/app/modules/demo/Demo.module.js | 161 ++++++--- .../modules/dialog/dialog-content.directive.js | 4 +- .../modules/dialog/dialog-title.directive.js | 4 +- .../app/modules/dialog/dialog.directive.js | 4 +- .../app/modules/dialog/dialog.factory.js | 9 +- .../app/modules/dialog/dialog.module.js | 8 +- .../field/bs-select-placeholder.directive.js | 10 +- .../form/field/input/autofocus.directive.js | 16 +- .../frontend/app/modules/form/form.module.js | 24 +- .../modules/form/services/FormGUID.service.js | 4 +- .../form/validator/ipaddress.directive.js | 17 +- .../validator/java-built-in-class.directive.js | 17 +- .../form/validator/java-identifier.directive.js | 17 +- .../form/validator/java-keywords.directive.js | 17 +- .../validator/java-package-name.directive.js | 17 +- .../java-package-specified.directive.js | 17 +- .../form/validator/property-unique.directive.js | 17 +- .../property-value-specified.directive.js | 12 +- .../modules/form/validator/unique.directive.js | 11 +- .../modules/form/validator/uuid.directive.js | 17 +- .../getting-started/GettingStarted.provider.js | 163 +++++---- .../app/modules/loading/loading.directive.js | 10 +- .../app/modules/loading/loading.module.js | 4 +- .../app/modules/loading/loading.service.js | 10 +- .../app/modules/navbar/Navbar.provider.js | 10 +- .../app/modules/navbar/Userbar.provider.js | 10 +- .../app/modules/navbar/navbar.directive.js | 6 +- .../app/modules/navbar/navbar.module.js | 8 +- .../app/modules/navbar/userbar.directive.js | 57 ++-- .../frontend/app/modules/nodes/Nodes.service.js | 4 +- .../modules/nodes/nodes-dialog.controller.js | 6 +- .../frontend/app/modules/socket.module.js | 14 +- .../frontend/app/modules/states/admin.state.js | 2 +- .../frontend/app/modules/states/errors.state.js | 2 +- .../frontend/app/modules/states/logout.state.js | 2 +- .../app/modules/states/settings.state.js | 2 +- .../frontend/app/modules/user/Auth.service.js | 4 + .../frontend/app/modules/user/User.service.js | 31 +- .../frontend/app/modules/user/user.module.js | 48 ++- .../app/services/ChartColors.service.js | 4 +- .../frontend/app/services/Confirm.service.js | 15 +- .../app/services/CopyToClipboard.service.js | 18 +- .../frontend/app/services/Countries.service.js | 16 +- .../frontend/app/services/DefaultState.js | 3 + .../app/services/ErrorParser.service.js | 2 +- .../app/services/ErrorPopover.service.js | 14 +- .../frontend/app/services/Focus.service.js | 14 +- .../frontend/app/services/FormUtils.service.js | 14 +- .../web-console/frontend/app/services/IGFSs.js | 8 +- .../app/services/InetAddress.service.js | 10 +- .../app/services/LegacyTable.service.js | 338 ++++++++++--------- .../app/services/LegacyUtils.service.js | 10 +- .../frontend/app/services/Messages.service.js | 19 +- .../app/services/ModelNormalizer.service.js | 6 +- .../frontend/app/services/SqlTypes.service.js | 6 +- .../frontend/app/services/Version.service.js | 4 +- .../frontend/app/services/exceptionHandler.js | 3 + modules/web-console/frontend/package.json | 1 + 119 files changed, 1456 insertions(+), 668 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/app.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/app.js b/modules/web-console/frontend/app/app.js index 3fb6ae0..ced73a9 100644 --- a/modules/web-console/frontend/app/app.js +++ b/modules/web-console/frontend/app/app.js @@ -15,6 +15,8 @@ * limitations under the License. */ +import _ from 'lodash'; + import './style.scss'; import './vendor'; @@ -262,23 +264,23 @@ export default angular.module('ignite-console', [ ]) .service('$exceptionHandler', $exceptionHandler) // Directives. -.directive(...igniteAutoFocus) -.directive(...igniteBsAffixUpdate) -.directive(...igniteCentered) -.directive(...igniteCopyToClipboard) -.directive(...igniteHideOnStateChange) -.directive(...igniteInformation) +.directive('igniteAutoFocus', igniteAutoFocus) +.directive('igniteBsAffixUpdate', igniteBsAffixUpdate) +.directive('centered', igniteCentered) +.directive('igniteCopyToClipboard', igniteCopyToClipboard) +.directive('hideOnStateChange', igniteHideOnStateChange) +.directive('igniteInformation', igniteInformation) .directive('igniteMatch', igniteMatch) -.directive(...igniteOnClickFocus) -.directive(...igniteOnEnter) -.directive(...igniteOnEnterFocusMove) -.directive(...igniteOnEscape) -.directive(...igniteUiAceCSharp) -.directive(...igniteUiAcePojos) -.directive(...igniteUiAcePom) -.directive(...igniteUiAceDocker) -.directive(...igniteUiAceTabs) -.directive(...igniteRetainSelection) +.directive('igniteOnClickFocus', igniteOnClickFocus) +.directive('igniteOnEnter', igniteOnEnter) +.directive('igniteOnEnterFocusMove', igniteOnEnterFocusMove) +.directive('igniteOnEscape', igniteOnEscape) +.directive('igniteUiAceSharp', igniteUiAceCSharp) +.directive('igniteUiAcePojos', igniteUiAcePojos) +.directive('igniteUiAcePom', igniteUiAcePom) +.directive('igniteUiAceDocker', igniteUiAceDocker) +.directive('igniteUiAceTabs', igniteUiAceTabs) +.directive('igniteRetainSelection', igniteRetainSelection) .directive('igniteOnFocusOut', igniteOnFocusOut) .directive('igniteRestoreInputFocus', igniteRestoreInputFocus) .directive('btnIgniteLinkDashedSuccess', btnIgniteLink) @@ -287,20 +289,20 @@ export default angular.module('ignite-console', [ .service('IgniteErrorPopover', ErrorPopover) .service('JavaTypes', JavaTypes) .service('SqlTypes', SqlTypes) -.service(...ChartColors) -.service(...IgniteConfirm) +.service('IgniteChartColors', ChartColors) +.service('IgniteConfirm', IgniteConfirm) .service('Confirm', Confirm) .service('IgniteConfirmBatch', ConfirmBatch) -.service(...CopyToClipboard) -.service(...Countries) -.service(...Focus) -.service(...InetAddress) -.service(...Messages) +.service('IgniteCopyToClipboard', CopyToClipboard) +.service('IgniteCountries', Countries) +.service('IgniteFocus', Focus) +.service('IgniteInetAddress', InetAddress) +.service('IgniteMessages', Messages) .service('IgniteErrorParser', ErrorParser) -.service(...ModelNormalizer) -.service(...LegacyTable) -.service(...FormUtils) -.service(...LegacyUtils) +.service('IgniteModelNormalizer', ModelNormalizer) +.service('IgniteLegacyTable', LegacyTable) +.service('IgniteFormUtils', FormUtils) +.service('IgniteLegacyUtils', LegacyUtils) .service('IgniteActivitiesUserDialog', IgniteActivitiesUserDialog) .service('Caches', Caches) .service('CSV', CSV) @@ -315,55 +317,85 @@ export default angular.module('ignite-console', [ .filter('hasPojo', hasPojo) .filter('uiGridSubcategories', uiGridSubcategories) .filter('id8', id8) -.config(['$translateProvider', '$stateProvider', '$locationProvider', '$urlRouterProvider', ($translateProvider, $stateProvider, $locationProvider, $urlRouterProvider) => { - $translateProvider.translations('en', i18n); - $translateProvider.preferredLanguage('en'); +.config(['$translateProvider', '$stateProvider', '$locationProvider', '$urlRouterProvider', + /** + * @param {angular.translate.ITranslateProvider} $translateProvider + * @param {import('@uirouter/angularjs').StateProvider} $stateProvider + * @param {ng.ILocationProvider} $locationProvider + * @param {import('@uirouter/angularjs').UrlRouterProvider} $urlRouterProvider + */ + ($translateProvider, $stateProvider, $locationProvider, $urlRouterProvider) => { + $translateProvider.translations('en', i18n); + $translateProvider.preferredLanguage('en'); - // Set up the states. - $stateProvider + // Set up the states. + $stateProvider .state('base', { url: '', abstract: true, template: baseTemplate }); - $urlRouterProvider.otherwise('/404'); - $locationProvider.html5Mode(true); -}]) -.run(['$rootScope', '$state', 'gettingStarted', ($root, $state, gettingStarted) => { - $root._ = _; - $root.$state = $state; - $root.gettingStarted = gettingStarted; -}]) -.run(['$rootScope', 'AgentManager', ($root, agentMgr) => { - let lastUser; + $urlRouterProvider.otherwise('/404'); + $locationProvider.html5Mode(true); + }]) +.run(['$rootScope', '$state', 'gettingStarted', + /** + * @param {ng.IRootScopeService} $root + * @param {import('@uirouter/angularjs').StateService} $state + * @param {ReturnType<typeof import('./modules/getting-started/GettingStarted.provider').service>} gettingStarted + */ + ($root, $state, gettingStarted) => { + $root._ = _; + $root.$state = $state; + $root.gettingStarted = gettingStarted; + } +]) +.run(['$rootScope', 'AgentManager', + /** + * @param {ng.IRootScopeService} $root + * @param {import('./modules/agent/AgentManager.service').default} agentMgr + */ + ($root, agentMgr) => { + let lastUser; - $root.$on('user', (e, user) => { - if (lastUser) - return; + $root.$on('user', (e, user) => { + if (lastUser) + return; - lastUser = user; + lastUser = user; - agentMgr.connect(); - }); -}]) -.run(['$transitions', ($transitions) => { - $transitions.onSuccess({ }, (trans) => { - try { - const {name, unsaved} = trans.$to(); - const params = trans.params(); + agentMgr.connect(); + }); + } +]) +.run(['$transitions', + /** + * @param {import('@uirouter/angularjs').TransitionService} $transitions + */ + ($transitions) => { + $transitions.onSuccess({ }, (trans) => { + try { + const {name, unsaved} = trans.$to(); + const params = trans.params(); - if (unsaved) - localStorage.removeItem('lastStateChangeSuccess'); - else - localStorage.setItem('lastStateChangeSuccess', JSON.stringify({name, params})); - } - catch (ignored) { + if (unsaved) + localStorage.removeItem('lastStateChangeSuccess'); + else + localStorage.setItem('lastStateChangeSuccess', JSON.stringify({name, params})); + } + catch (ignored) { // No-op. - } - }); -}]) + } + }); + } +]) .run(['$rootScope', '$http', '$state', 'IgniteMessages', 'User', 'IgniteNotebookData', + /** + * @param {ng.IRootScopeService} $root + * @param {ng.IHttpService} $http + * @param {ReturnType<typeof import('./services/Messages.service').default>} Messages + */ ($root, $http, $state, Messages, User, Notebook) => { // eslint-disable-line no-shadow $root.revertIdentity = () => { $http.get('/api/v1/admin/revert/identity') @@ -374,4 +406,9 @@ export default angular.module('ignite-console', [ }; } ]) -.run(['IgniteIcon', (IgniteIcon) => IgniteIcon.registerIcons(icons)]); +.run(['IgniteIcon', + /** + * @param {import('./components/ignite-icon/service').default} IgniteIcon + */ + (IgniteIcon) => IgniteIcon.registerIcons(icons) +]); http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/components/activities-user-dialog/index.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/components/activities-user-dialog/index.js b/modules/web-console/frontend/app/components/activities-user-dialog/index.js index ab3acbb..ace3821 100644 --- a/modules/web-console/frontend/app/components/activities-user-dialog/index.js +++ b/modules/web-console/frontend/app/components/activities-user-dialog/index.js @@ -18,7 +18,10 @@ import controller from './activities-user-dialog.controller'; import templateUrl from './activities-user-dialog.tpl.pug'; -export default ['$modal', function($modal) { +/** + * @param {mgcrea.ngStrap.modal.IModalService} $modal + */ +export default function service($modal) { return function({ show = true, user }) { const ActivitiesUserDialog = $modal({ templateUrl, @@ -33,4 +36,6 @@ export default ['$modal', function($modal) { return ActivitiesUserDialog.$promise .then(() => ActivitiesUserDialog); }; -}]; +} + +service.$inject = ['$modal']; http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/components/connected-clusters-badge/controller.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/components/connected-clusters-badge/controller.js b/modules/web-console/frontend/app/components/connected-clusters-badge/controller.js index 8a622d9..807c3ba 100644 --- a/modules/web-console/frontend/app/components/connected-clusters-badge/controller.js +++ b/modules/web-console/frontend/app/components/connected-clusters-badge/controller.js @@ -15,17 +15,14 @@ * limitations under the License. */ -import AgentManager from 'app/modules/agent/AgentManager.service'; - export default class { static $inject = ['AgentManager', 'ConnectedClustersDialog']; - /** @type {Number} */ connectedClusters = 0; /** - * @param {AgentManager} agentMgr - * @param connectedClustersDialog + * @param {import('app/modules/agent/AgentManager.service').default} agentMgr + * @param {import('../connected-clusters-dialog/service').default} connectedClustersDialog */ constructor(agentMgr, connectedClustersDialog) { this.agentMgr = agentMgr; http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/components/connected-clusters-dialog/components/cell-logout/index.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/components/connected-clusters-dialog/components/cell-logout/index.js b/modules/web-console/frontend/app/components/connected-clusters-dialog/components/cell-logout/index.js index 1f7af80..e5bdd2c 100644 --- a/modules/web-console/frontend/app/components/connected-clusters-dialog/components/cell-logout/index.js +++ b/modules/web-console/frontend/app/components/connected-clusters-dialog/components/cell-logout/index.js @@ -17,13 +17,14 @@ import template from './template.pug'; -import AgentManager from 'app/modules/agent/AgentManager.service'; - class controller { + /** @type {string} */ + clusterId; + static $inject = ['AgentManager']; /** - * @param {AgentManager} agentMgr + * @param {import('app/modules/agent/AgentManager.service').default} agentMgr */ constructor(agentMgr) { this.agentMgr = agentMgr; http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/components/connected-clusters-dialog/components/list/controller.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/components/connected-clusters-dialog/components/list/controller.js b/modules/web-console/frontend/app/components/connected-clusters-dialog/components/list/controller.js index c4b0f93..2d0ca26 100644 --- a/modules/web-console/frontend/app/components/connected-clusters-dialog/components/list/controller.js +++ b/modules/web-console/frontend/app/components/connected-clusters-dialog/components/list/controller.js @@ -24,6 +24,7 @@ export default class SnapshotsListCachesCtrl { /** * @param {ng.IScope} $scope + * @param {import('app/modules/agent/AgentManager.service').default} agentMgr */ constructor($scope, agentMgr) { this.$scope = $scope; http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/components/ignite-chart/controller.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/components/ignite-chart/controller.js b/modules/web-console/frontend/app/components/ignite-chart/controller.js index 2012aec..5ae536e 100644 --- a/modules/web-console/frontend/app/components/ignite-chart/controller.js +++ b/modules/web-console/frontend/app/components/ignite-chart/controller.js @@ -53,7 +53,7 @@ export class IgniteChartController { /** * @param {JQLite} $element - * @param {ng.IScope} $scope + * @param {Array<string>} IgniteChartColors * @param {ng.IFilterService} $filter */ constructor($element, IgniteChartColors, $filter) { http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/components/ignite-icon/directive.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/components/ignite-icon/directive.js b/modules/web-console/frontend/app/components/ignite-icon/directive.js index b72c4f9..9838fe2 100644 --- a/modules/web-console/frontend/app/components/ignite-icon/directive.js +++ b/modules/web-console/frontend/app/components/ignite-icon/directive.js @@ -21,8 +21,21 @@ export default function() { controller: class { static $inject = ['$scope', '$attrs', '$sce', '$element', '$window', 'IgniteIcon']; + /** + * @param {ng.IScope} $scope + * @param {ng.IAttributes} $attrs + * @param {ng.ISCEService} $sce + * @param {JQLite} $element + * @param {ng.IWindowService} $window + * @param {import('./service').default} IgniteIcon + */ constructor($scope, $attrs, $sce, $element, $window, IgniteIcon) { - Object.assign(this, {$scope, $attrs, $sce, $element, $window, IgniteIcon}); + this.$scope = $scope; + this.$attrs = $attrs; + this.$sce = $sce; + this.$element = $element; + this.$window = $window; + this.IgniteIcon = IgniteIcon; } $onInit() { @@ -40,6 +53,7 @@ export default function() { } $postLink() { + /** @type {string} */ this.name = this.$attrs.igniteIcon; this.$element.attr('viewBox', this.IgniteIcon.getIcon(this.name).viewBox); @@ -52,6 +66,9 @@ export default function() { return `${url.split('#')[0]}#${this.name}`; } + /** + * @param {string} url + */ render(url) { // templateNamespace: 'svg' does not work in IE11 this.wrapper.innerHTML = `<svg><use xlink:href="${url}" href="${url}" /></svg>`; http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/components/ignite-icon/service.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/components/ignite-icon/service.js b/modules/web-console/frontend/app/components/ignite-icon/service.js index e142a2d..34ea074 100644 --- a/modules/web-console/frontend/app/components/ignite-icon/service.js +++ b/modules/web-console/frontend/app/components/ignite-icon/service.js @@ -15,13 +15,30 @@ * limitations under the License. */ +/** + * @typedef {{id: string, viewBox: string, content: string}} SpriteSymbol + */ + +/** + * @typedef {{[name: string]: SpriteSymbol}} Icons + */ + export default class IgniteIcon { + /** + * @type {Icons} + */ _icons = {}; + /** + * @param {Icons} icons + */ registerIcons(icons) { return Object.assign(this._icons, icons); } + /** + * @param {string} name + */ getIcon(name) { return this._icons[name]; } http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/components/input-dialog/input-dialog.controller.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/components/input-dialog/input-dialog.controller.js b/modules/web-console/frontend/app/components/input-dialog/input-dialog.controller.js index 3f6e97b..a2dd035 100644 --- a/modules/web-console/frontend/app/components/input-dialog/input-dialog.controller.js +++ b/modules/web-console/frontend/app/components/input-dialog/input-dialog.controller.js @@ -15,6 +15,8 @@ * limitations under the License. */ +import _ from 'lodash'; + export default class InputDialogController { static $inject = ['deferred', 'ui']; http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/components/input-dialog/input-dialog.service.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/components/input-dialog/input-dialog.service.js b/modules/web-console/frontend/app/components/input-dialog/input-dialog.service.js index cfd6171..7ef9c07 100644 --- a/modules/web-console/frontend/app/components/input-dialog/input-dialog.service.js +++ b/modules/web-console/frontend/app/components/input-dialog/input-dialog.service.js @@ -15,6 +15,7 @@ * limitations under the License. */ +import _ from 'lodash'; import controller from './input-dialog.controller'; import templateUrl from './input-dialog.tpl.pug'; import {CancellationError} from 'app/errors/CancellationError'; @@ -22,6 +23,10 @@ import {CancellationError} from 'app/errors/CancellationError'; export default class InputDialog { static $inject = ['$modal', '$q']; + /** + * @param {mgcrea.ngStrap.modal.IModalService} $modal + * @param {ng.IQService} $q + */ constructor($modal, $q) { this.$modal = $modal; this.$q = $q; @@ -34,7 +39,7 @@ export default class InputDialog { * @param {String} label Input field label. * @param {String} value Default value. * @param {Function} [toValidValue] Validator function. - * @returns {Promise.<String>} User input. + * @returns {ng.IPromise<string>} User input. */ input(title, label, value, toValidValue) { const deferred = this.$q.defer(); @@ -67,7 +72,7 @@ export default class InputDialog { * * @param {String} srcName Name of source object. * @param {Array.<String>} names List of already exist names. - * @returns {Promise.<String>} New name + * @returns {ng.IPromise<string>} New name */ clone(srcName, names) { const uniqueName = (value) => { http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/components/page-password-reset/controller.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/components/page-password-reset/controller.js b/modules/web-console/frontend/app/components/page-password-reset/controller.js index 6b40228..53d6c69 100644 --- a/modules/web-console/frontend/app/components/page-password-reset/controller.js +++ b/modules/web-console/frontend/app/components/page-password-reset/controller.js @@ -20,9 +20,9 @@ export default class { /** * @param {mgcrea.ngStrap.modal.IModalService} $modal - * @param $http - * @param {StateProvider} $state - * @param Messages + * @param {ng.IHttpService} $http + * @param {import('@uirouter/angularjs').StateService} $state + * @param {ReturnType<typeof import('app/services/Messages.service').default>} Messages */ constructor($modal, $http, $state, Messages) { this.$http = $http; http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/components/page-profile/controller.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/components/page-profile/controller.js b/modules/web-console/frontend/app/components/page-profile/controller.js index 2c786f0..8586656 100644 --- a/modules/web-console/frontend/app/components/page-profile/controller.js +++ b/modules/web-console/frontend/app/components/page-profile/controller.js @@ -22,8 +22,27 @@ export default class PageProfileController { '$rootScope', '$scope', '$http', 'IgniteLegacyUtils', 'IgniteMessages', 'IgniteFocus', 'IgniteConfirm', 'IgniteCountries', 'User' ]; + /** + * @param {ng.IRootScopeService} $root + * @param {ng.IScope} $scope + * @param {ng.IHttpService} $http + * @param {ReturnType<typeof import('app/services/LegacyUtils.service').default>} LegacyUtils + * @param {ReturnType<typeof import('app/services/Messages.service').default>} Messages + * @param {ReturnType<typeof import('app/services/Focus.service').default>} Focus + * @param {import('app/services/Confirm.service').Confirm} Confirm + * @param {ReturnType<typeof import('app/services/Countries.service').default>} Countries + * @param {ReturnType<typeof import('app/modules/user/User.service').default>} User + */ constructor($root, $scope, $http, LegacyUtils, Messages, Focus, Confirm, Countries, User) { - Object.assign(this, {$root, $scope, $http, LegacyUtils, Messages, Focus, Confirm, Countries, User}); + this.$root = $root; + this.$scope = $scope; + this.$http = $http; + this.LegacyUtils = LegacyUtils; + this.Messages = Messages; + this.Focus = Focus; + this.Confirm = Confirm; + this.Countries = Countries; + this.User = User; } $onInit() { http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/components/page-queries/component.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/components/page-queries/component.js b/modules/web-console/frontend/app/components/page-queries/component.js index 056b120..e0c1083 100644 --- a/modules/web-console/frontend/app/components/page-queries/component.js +++ b/modules/web-console/frontend/app/components/page-queries/component.js @@ -27,8 +27,17 @@ export default { controller: class Ctrl { static $inject = ['$element', '$rootScope', '$state', 'IgniteNotebook']; + /** + * @param {JQLite} $element + * @param {ng.IRootScopeService} $rootScope + * @param {import('@uirouter/angularjs').StateService} $state + * @param {import('./notebook.service').default} IgniteNotebook + */ constructor($element, $rootScope, $state, IgniteNotebook) { - Object.assign(this, {$element, $rootScope, $state, IgniteNotebook}); + this.$element = $element; + this.$rootScope = $rootScope; + this.$state = $state; + this.IgniteNotebook = IgniteNotebook; } $onInit() { http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/components/page-queries/notebook.data.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/components/page-queries/notebook.data.js b/modules/web-console/frontend/app/components/page-queries/notebook.data.js index d83101d..6c784bf 100644 --- a/modules/web-console/frontend/app/components/page-queries/notebook.data.js +++ b/modules/web-console/frontend/app/components/page-queries/notebook.data.js @@ -80,6 +80,11 @@ const DEMO_NOTEBOOK = { export default class NotebookData { static $inject = ['$rootScope', '$http', '$q']; + /** + * @param {ng.IRootScopeService} $root + * @param {ng.IHttpService} $http + * @param {ng.IQService} $q + */ constructor($root, $http, $q) { this.demo = $root.IgniteDemoMode; http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/components/page-queries/notebook.service.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/components/page-queries/notebook.service.js b/modules/web-console/frontend/app/components/page-queries/notebook.service.js index 3004447..dbfd6a6 100644 --- a/modules/web-console/frontend/app/components/page-queries/notebook.service.js +++ b/modules/web-console/frontend/app/components/page-queries/notebook.service.js @@ -19,10 +19,10 @@ export default class Notebook { static $inject = ['$state', 'IgniteConfirm', 'IgniteMessages', 'IgniteNotebookData']; /** - * @param $state - * @param confirmModal - * @param Messages - * @param {NotebookData} NotebookData + * @param {import('@uirouter/angularjs').StateService} $state + * @param {ReturnType<typeof import('app/services/Confirm.service').default>} confirmModal + * @param {ReturnType<typeof import('app/services/Messages.service').default>} Messages + * @param {import('./notebook.data').default} NotebookData */ constructor($state, confirmModal, Messages, NotebookData) { this.$state = $state; http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/components/page-signin/controller.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/components/page-signin/controller.js b/modules/web-console/frontend/app/components/page-signin/controller.js index f2d28e8..c2ca6fe 100644 --- a/modules/web-console/frontend/app/components/page-signin/controller.js +++ b/modules/web-console/frontend/app/components/page-signin/controller.js @@ -30,6 +30,8 @@ export default class { /** * @param {import('app/modules/user/Auth.service').default} Auth + * @param {ReturnType<typeof import('app/services/Messages.service').default>} IgniteMessages + * @param {ReturnType<typeof import('app/services/FormUtils.service').default>} IgniteFormUtils */ constructor(Auth, IgniteMessages, IgniteFormUtils) { this.Auth = Auth; http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/components/page-signup/controller.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/components/page-signup/controller.js b/modules/web-console/frontend/app/components/page-signup/controller.js index 57f404a..1039776 100644 --- a/modules/web-console/frontend/app/components/page-signup/controller.js +++ b/modules/web-console/frontend/app/components/page-signup/controller.js @@ -33,7 +33,10 @@ export default class PageSignup { static $inject = ['IgniteCountries', 'Auth', 'IgniteMessages', 'IgniteFormUtils']; /** + * @param {ReturnType<typeof import('app/services/Countries.service').default>} Countries * @param {import('app/modules/user/Auth.service').default} Auth + * @param {ReturnType<typeof import('app/services/Messages.service').default>} IgniteMessages + * @param {ReturnType<typeof import('app/services/FormUtils.service').default>} IgniteFormUtils */ constructor(Countries, Auth, IgniteMessages, IgniteFormUtils) { this.Auth = Auth; http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/components/user-notifications/service.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/components/user-notifications/service.js b/modules/web-console/frontend/app/components/user-notifications/service.js index d008482..5ee3257 100644 --- a/modules/web-console/frontend/app/components/user-notifications/service.js +++ b/modules/web-console/frontend/app/components/user-notifications/service.js @@ -27,8 +27,17 @@ export default class UserNotificationsService { /** @type {ng.IQService} */ $q; + /** + * @param {ng.IHttpService} $http + * @param {mgcrea.ngStrap.modal.IModalService} $modal + * @param {ng.IQService} $q + * @param {ReturnType<typeof import('app/services/Messages.service').default>} Messages + */ constructor($http, $modal, $q, Messages) { - Object.assign(this, {$http, $modal, $q, Messages}); + this.$http = $http; + this.$modal = $modal; + this.$q = $q; + this.Messages = Messages; this.message = null; this.isShown = false; http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/components/version-picker/component.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/components/version-picker/component.js b/modules/web-console/frontend/app/components/version-picker/component.js index 68382ee..16fcb7e 100644 --- a/modules/web-console/frontend/app/components/version-picker/component.js +++ b/modules/web-console/frontend/app/components/version-picker/component.js @@ -15,6 +15,7 @@ * limitations under the License. */ +import _ from 'lodash'; import template from './template.pug'; import './style.scss'; @@ -23,6 +24,10 @@ export default { controller: class { static $inject = ['IgniteVersion', '$scope']; + /** + * @param {import('app/services/Version.service').default} Version + * @param {ng.IRootScopeService} $scope + */ constructor(Version, $scope) { this.currentSbj = Version.currentSbj; this.supportedVersions = Version.supportedVersions; http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/core/admin/Admin.data.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/core/admin/Admin.data.js b/modules/web-console/frontend/app/core/admin/Admin.data.js index 5c4fe10..9ebe599 100644 --- a/modules/web-console/frontend/app/core/admin/Admin.data.js +++ b/modules/web-console/frontend/app/core/admin/Admin.data.js @@ -15,15 +15,25 @@ * limitations under the License. */ +import _ from 'lodash'; + export default class IgniteAdminData { static $inject = ['$http', 'IgniteMessages', 'IgniteCountries']; + /** + * @param {ng.IHttpService} $http + * @param {ReturnType<typeof import('app/services/Messages.service').default>} Messages + * @param {ReturnType<typeof import('app/services/Countries.service').default>} Countries + */ constructor($http, Messages, Countries) { this.$http = $http; this.Messages = Messages; this.Countries = Countries; } + /** + * @param {string} viewedUserId + */ becomeUser(viewedUserId) { return this.$http.get('/api/v1/admin/become', { params: {viewedUserId} @@ -31,6 +41,9 @@ export default class IgniteAdminData { .catch(this.Messages.showError); } + /** + * @param {import('app/modules/user/User.service').User} user + */ removeUser(user) { return this.$http.post('/api/v1/admin/remove', { userId: user._id @@ -46,6 +59,9 @@ export default class IgniteAdminData { }); } + /** + * @param {import('app/modules/user/User.service').User} user + */ toggleAdmin(user) { const adminFlag = !user.admin; @@ -59,10 +75,13 @@ export default class IgniteAdminData { this.Messages.showInfo(`Admin rights was successfully ${adminFlag ? 'granted' : 'revoked'} for user: "${user.userName}"`); }) .catch((res) => { - this.Messages.showError(`Failed to ${adminFlag ? 'grant' : 'revok'} admin rights for user: "${user.userName}"`, res); + this.Messages.showError(`Failed to ${adminFlag ? 'grant' : 'revoke'} admin rights for user: "${user.userName}"`, res); }); } + /** + * @param {import('app/modules/user/User.service').User} user + */ prepareUsers(user) { const { Countries } = this; http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/directives/auto-focus.directive.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/directives/auto-focus.directive.js b/modules/web-console/frontend/app/directives/auto-focus.directive.js index 9c17192..8d269ce 100644 --- a/modules/web-console/frontend/app/directives/auto-focus.directive.js +++ b/modules/web-console/frontend/app/directives/auto-focus.directive.js @@ -15,12 +15,21 @@ * limitations under the License. */ -// Directive to auto-focus specified element. -export default ['igniteAutoFocus', ['$timeout', function($timeout) { +/** + * Directive to auto-focus specified element. + * @param {ng.ITimeoutService} $timeout + */ +export default function directive($timeout) { return { restrict: 'AC', + /** + * @param {ng.IScope} scope + * @param {JQLite} element + */ link(scope, element) { $timeout(() => element[0].focus()); } }; -}]]; +} + +directive.$inject = ['$timeout']; http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/directives/bs-affix-update.directive.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/directives/bs-affix-update.directive.js b/modules/web-console/frontend/app/directives/bs-affix-update.directive.js index c2b1323..a462dcb 100644 --- a/modules/web-console/frontend/app/directives/bs-affix-update.directive.js +++ b/modules/web-console/frontend/app/directives/bs-affix-update.directive.js @@ -17,7 +17,11 @@ import angular from 'angular'; -export default ['igniteBsAffixUpdate', ['$window', '$timeout', function($window, $timeout) { +/** + * @param {ng.IWindowService} $window + * @param {ng.ITimeoutService} $timeout + */ +export default function directive($window, $timeout) { let update = null; const link = ({$last}) => { @@ -31,4 +35,6 @@ export default ['igniteBsAffixUpdate', ['$window', '$timeout', function($window, restrict: 'A', link }; -}]]; +} + +directive.$inject = ['$window', '$timeout']; http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/directives/centered/centered.directive.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/directives/centered/centered.directive.js b/modules/web-console/frontend/app/directives/centered/centered.directive.js index 5e3b1c8..967e0c2 100644 --- a/modules/web-console/frontend/app/directives/centered/centered.directive.js +++ b/modules/web-console/frontend/app/directives/centered/centered.directive.js @@ -17,10 +17,10 @@ import './centered.scss'; -export default ['centered', [function() { +export default function() { return { restrict: 'E', transclude: true, template: '<div class="center-container"><div class="centered"><div ng-transclude></div></div></div>' }; -}]]; +} http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/directives/copy-to-clipboard.directive.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/directives/copy-to-clipboard.directive.js b/modules/web-console/frontend/app/directives/copy-to-clipboard.directive.js index 027cb09..399e1f3 100644 --- a/modules/web-console/frontend/app/directives/copy-to-clipboard.directive.js +++ b/modules/web-console/frontend/app/directives/copy-to-clipboard.directive.js @@ -15,10 +15,17 @@ * limitations under the License. */ -// Directive for copy to clipboard. -export default ['igniteCopyToClipboard', ['IgniteCopyToClipboard', function(CopyToClipboard) { +/** + * @param {ReturnType<typeof import('../services/CopyToClipboard.service').default>} CopyToClipboard + */ +export default function directive(CopyToClipboard) { return { restrict: 'A', + /** + * @param {ng.IScope} scope + * @param {JQLite} element + * @param {ng.IAttributes} attrs + */ link(scope, element, attrs) { element.bind('click', () => CopyToClipboard.copy(attrs.igniteCopyToClipboard)); @@ -26,4 +33,6 @@ export default ['igniteCopyToClipboard', ['IgniteCopyToClipboard', function(Copy element.hide(); } }; -}]]; +} + +directive.$inject = ['IgniteCopyToClipboard']; http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/directives/hide-on-state-change/hide-on-state-change.directive.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/directives/hide-on-state-change/hide-on-state-change.directive.js b/modules/web-console/frontend/app/directives/hide-on-state-change/hide-on-state-change.directive.js index 6c8d702..cd1f45a 100644 --- a/modules/web-console/frontend/app/directives/hide-on-state-change/hide-on-state-change.directive.js +++ b/modules/web-console/frontend/app/directives/hide-on-state-change/hide-on-state-change.directive.js @@ -15,13 +15,22 @@ * limitations under the License. */ -export default ['hideOnStateChange', ['$transitions', function($transitions) { +/** + * @param {import('@uirouter/angularjs').TransitionService} $transitions + */ +export default function directive($transitions) { + /** + * @param {ng.IScope} scope + * @param {JQLite} element + */ const link = (scope, element) => { - $transitions.onSuccess({}, () => element.fadeOut('slow')); + $transitions.onSuccess({}, () => {element.fadeOut('slow');}); }; return { restrict: 'AE', link }; -}]]; +} + +directive.$inject = ['$transitions']; http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/directives/information/information.directive.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/directives/information/information.directive.js b/modules/web-console/frontend/app/directives/information/information.directive.js index 3036262..8e95791 100644 --- a/modules/web-console/frontend/app/directives/information/information.directive.js +++ b/modules/web-console/frontend/app/directives/information/information.directive.js @@ -17,7 +17,7 @@ import template from './information.pug'; -export default ['igniteInformation', [function() { +export default function() { return { scope: { title: '@' @@ -27,4 +27,4 @@ export default ['igniteInformation', [function() { replace: true, transclude: true }; -}]]; +} http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/directives/on-click-focus.directive.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/directives/on-click-focus.directive.js b/modules/web-console/frontend/app/directives/on-click-focus.directive.js index 593a677..bbc46d1 100644 --- a/modules/web-console/frontend/app/directives/on-click-focus.directive.js +++ b/modules/web-console/frontend/app/directives/on-click-focus.directive.js @@ -15,12 +15,24 @@ * limitations under the License. */ -// Directive to describe element that should be focused on click. -export default ['igniteOnClickFocus', ['IgniteFocus', function(Focus) { - return function(scope, elem, attrs) { +/** + * Directive to describe element that should be focused on click. + * @param {ReturnType<typeof import('../services/Focus.service').default>} Focus + */ +export default function directive(Focus) { + /** + * @param {ng.IScope} scope + * @param {JQLite} elem + * @param {ng.IAttributes} attrs + */ + function directive(scope, elem, attrs) { elem.on('click', () => Focus.move(attrs.igniteOnClickFocus)); // Removes bound events in the element itself when the scope is destroyed scope.$on('$destroy', () => elem.off('click')); - }; -}]]; + } + + return directive; +} + +directive.$inject = ['IgniteFocus']; http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/directives/on-enter-focus-move.directive.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/directives/on-enter-focus-move.directive.js b/modules/web-console/frontend/app/directives/on-enter-focus-move.directive.js index 75ae1e2..9cb9913 100644 --- a/modules/web-console/frontend/app/directives/on-enter-focus-move.directive.js +++ b/modules/web-console/frontend/app/directives/on-enter-focus-move.directive.js @@ -15,9 +15,17 @@ * limitations under the License. */ -// Directive to move focus to specified element on ENTER key. -export default ['igniteOnEnterFocusMove', ['IgniteFocus', function(Focus) { - return function(scope, elem, attrs) { +/** + * Directive to move focus to specified element on ENTER key. + * @param {ReturnType<typeof import('../services/Focus.service').default>} Focus + */ +export default function directive(Focus) { + /** + * @param {ng.IScope} scope + * @param {JQLite} elem + * @param {ng.IAttributes} attrs + */ + function directive(scope, elem, attrs) { elem.on('keydown keypress', (event) => { if (event.which === 13) { event.preventDefault(); @@ -25,5 +33,9 @@ export default ['igniteOnEnterFocusMove', ['IgniteFocus', function(Focus) { Focus.move(attrs.igniteOnEnterFocusMove); } }); - }; -}]]; + } + + return directive; +} + +directive.$inject = ['IgniteFocus']; http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/directives/on-enter.directive.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/directives/on-enter.directive.js b/modules/web-console/frontend/app/directives/on-enter.directive.js index 2ec75f9..1bc3e48 100644 --- a/modules/web-console/frontend/app/directives/on-enter.directive.js +++ b/modules/web-console/frontend/app/directives/on-enter.directive.js @@ -15,9 +15,17 @@ * limitations under the License. */ -// Directive to bind ENTER key press with some user action. -export default ['igniteOnEnter', ['$timeout', function($timeout) { - return function(scope, elem, attrs) { +/** + * Directive to bind ENTER key press with some user action. + * @param {ng.ITimeoutService} $timeout + */ +export default function directive($timeout) { + /** + * @param {ng.IScope} scope + * @param {JQLite} elem + * @param {ng.IAttributes} attrs + */ + function directive(scope, elem, attrs) { elem.on('keydown keypress', (event) => { if (event.which === 13) { scope.$apply(() => $timeout(() => scope.$eval(attrs.igniteOnEnter))); @@ -28,5 +36,9 @@ export default ['igniteOnEnter', ['$timeout', function($timeout) { // Removes bound events in the element itself when the scope is destroyed. scope.$on('$destroy', () => elem.off('keydown keypress')); - }; -}]]; + } + + return directive; +} + +directive.$inject = ['$timeout']; http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/directives/on-escape.directive.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/directives/on-escape.directive.js b/modules/web-console/frontend/app/directives/on-escape.directive.js index dafc176..b1f1648 100644 --- a/modules/web-console/frontend/app/directives/on-escape.directive.js +++ b/modules/web-console/frontend/app/directives/on-escape.directive.js @@ -15,9 +15,17 @@ * limitations under the License. */ -// Directive to bind ESC key press with some user action. -export default ['igniteOnEscape', ['$timeout', function($timeout) { - return function(scope, elem, attrs) { +/** + * Directive to bind ESC key press with some user action. + * @param {ng.ITimeoutService} $timeout + */ +export default function directive($timeout) { + /** + * @param {ng.IScope} scope + * @param {JQLite} elem + * @param {ng.IAttributes} attrs + */ + function directive(scope, elem, attrs) { elem.on('keydown keypress', (event) => { if (event.which === 27) { scope.$apply(() => $timeout(() => scope.$eval(attrs.igniteOnEscape))); @@ -28,5 +36,9 @@ export default ['igniteOnEscape', ['$timeout', function($timeout) { // Removes bound events in the element itself when the scope is destroyed. scope.$on('$destroy', () => elem.off('keydown keypress')); - }; -}]]; + } + + return directive; +} + +directive.$inject = ['$timeout']; http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/directives/restore-input-focus.directive.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/directives/restore-input-focus.directive.js b/modules/web-console/frontend/app/directives/restore-input-focus.directive.js index 97a1491..829b888 100644 --- a/modules/web-console/frontend/app/directives/restore-input-focus.directive.js +++ b/modules/web-console/frontend/app/directives/restore-input-focus.directive.js @@ -15,10 +15,16 @@ * limitations under the License. */ -export default [function() { - return ($scope, $element) => { +export default function() { + /** + * @param {ng.IScope} $scope + * @param {JQuery} $element + */ + const directive = ($scope, $element) => { $element.on('click', () => { $element.siblings('.input-tip').find('input').focus(); }); }; -}]; + + return directive; +} http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/directives/retain-selection.directive.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/directives/retain-selection.directive.js b/modules/web-console/frontend/app/directives/retain-selection.directive.js index 24a55d1..fb7321a 100644 --- a/modules/web-console/frontend/app/directives/retain-selection.directive.js +++ b/modules/web-console/frontend/app/directives/retain-selection.directive.js @@ -15,11 +15,18 @@ * limitations under the License. */ -// Directive to workaround known issue with type ahead edit lost cursor position. -export default ['igniteRetainSelection', ['$timeout', function($timeout) { +/** + * Directive to workaround known issue with type ahead edit lost cursor position. + * @param {ng.ITimeoutService} $timeout + */ +export default function directive($timeout) { let promise; - return function(scope, elem) { + /** + * @param {ng.IScope} scope + * @param {JQLite} elem [description] + */ + function directive(scope, elem) { elem.on('keydown', function(evt) { const key = evt.which; const ctrlDown = evt.ctrlKey || evt.metaKey; @@ -63,5 +70,9 @@ export default ['igniteRetainSelection', ['$timeout', function($timeout) { scope.$on('$destroy', function() { elem.off('keydown'); }); - }; -}]]; + } + + return directive; +} + +directive.$inject = ['$timeout']; http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/directives/ui-ace-docker/ui-ace-docker.controller.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/directives/ui-ace-docker/ui-ace-docker.controller.js b/modules/web-console/frontend/app/directives/ui-ace-docker/ui-ace-docker.controller.js index 4f443ae..c3928c7 100644 --- a/modules/web-console/frontend/app/directives/ui-ace-docker/ui-ace-docker.controller.js +++ b/modules/web-console/frontend/app/directives/ui-ace-docker/ui-ace-docker.controller.js @@ -15,7 +15,7 @@ * limitations under the License. */ -export default ['$scope', 'IgniteVersion', 'IgniteDockerGenerator', function($scope, Version, docker) { +export default function controller($scope, Version, docker) { const ctrl = this; this.$onInit = () => { @@ -36,4 +36,6 @@ export default ['$scope', 'IgniteVersion', 'IgniteDockerGenerator', function($sc $scope.$watch('cluster', clusterWatcher); }; -}]; +} + +controller.$inject = ['$scope', 'IgniteVersion', 'IgniteDockerGenerator']; http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/directives/ui-ace-docker/ui-ace-docker.directive.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/directives/ui-ace-docker/ui-ace-docker.directive.js b/modules/web-console/frontend/app/directives/ui-ace-docker/ui-ace-docker.directive.js index e83c315..188f11f 100644 --- a/modules/web-console/frontend/app/directives/ui-ace-docker/ui-ace-docker.directive.js +++ b/modules/web-console/frontend/app/directives/ui-ace-docker/ui-ace-docker.directive.js @@ -18,7 +18,7 @@ import template from './ui-ace-docker.pug'; import controller from './ui-ace-docker.controller'; -export default ['igniteUiAceDocker', [function() { +export default function() { const link = ($scope, $el, $attrs, [igniteUiAceTabs]) => { if (igniteUiAceTabs.onLoad) $scope.onLoad = igniteUiAceTabs.onLoad; @@ -43,4 +43,4 @@ export default ['igniteUiAceDocker', [function() { controllerAs: 'ctrl', require: ['?^igniteUiAceTabs'] }; -}]]; +} http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/directives/ui-ace-pojos/ui-ace-pojos.controller.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/directives/ui-ace-pojos/ui-ace-pojos.controller.js b/modules/web-console/frontend/app/directives/ui-ace-pojos/ui-ace-pojos.controller.js index 3f9580f..bb4d1c4 100644 --- a/modules/web-console/frontend/app/directives/ui-ace-pojos/ui-ace-pojos.controller.js +++ b/modules/web-console/frontend/app/directives/ui-ace-pojos/ui-ace-pojos.controller.js @@ -15,9 +15,10 @@ * limitations under the License. */ +import _ from 'lodash'; import {nonNil} from 'app/utils/lodashMixins'; -export default ['$scope', 'JavaTypes', 'JavaTransformer', function($scope, JavaTypes, generator) { +export default function controller($scope, JavaTypes, generator) { const ctrl = this; this.$onInit = () => { @@ -96,4 +97,6 @@ export default ['$scope', 'JavaTypes', 'JavaTransformer', function($scope, JavaT $scope.$watch('ctrl.pojos', updatePojosData); $scope.$watch('ctrl.class', updatePojosData); }; -}]; +} + +controller.$inject = ['$scope', 'JavaTypes', 'JavaTransformer']; http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/directives/ui-ace-pojos/ui-ace-pojos.directive.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/directives/ui-ace-pojos/ui-ace-pojos.directive.js b/modules/web-console/frontend/app/directives/ui-ace-pojos/ui-ace-pojos.directive.js index 864f705..c9f97cc 100644 --- a/modules/web-console/frontend/app/directives/ui-ace-pojos/ui-ace-pojos.directive.js +++ b/modules/web-console/frontend/app/directives/ui-ace-pojos/ui-ace-pojos.directive.js @@ -18,7 +18,7 @@ import template from './ui-ace-pojos.pug'; import controller from './ui-ace-pojos.controller'; -export default ['igniteUiAcePojos', [function() { +export default function() { const link = ($scope, $el, $attrs, [igniteUiAceTabs]) => { if (igniteUiAceTabs.onLoad) $scope.onLoad = igniteUiAceTabs.onLoad; @@ -43,4 +43,4 @@ export default ['igniteUiAcePojos', [function() { controllerAs: 'ctrl', require: ['?^igniteUiAceTabs'] }; -}]]; +} http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/directives/ui-ace-pom/ui-ace-pom.controller.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/directives/ui-ace-pom/ui-ace-pom.controller.js b/modules/web-console/frontend/app/directives/ui-ace-pom/ui-ace-pom.controller.js index 2e421b2..ae64022 100644 --- a/modules/web-console/frontend/app/directives/ui-ace-pom/ui-ace-pom.controller.js +++ b/modules/web-console/frontend/app/directives/ui-ace-pom/ui-ace-pom.controller.js @@ -15,7 +15,7 @@ * limitations under the License. */ -export default ['$scope', 'IgniteVersion', 'IgniteMavenGenerator', function($scope, Version, maven) { +export default function controller($scope, Version, maven) { const ctrl = this; this.$onInit = () => { @@ -36,4 +36,6 @@ export default ['$scope', 'IgniteVersion', 'IgniteMavenGenerator', function($sco $scope.$watch('cluster', clusterWatcher); }; -}]; +} + +controller.$inject = ['$scope', 'IgniteVersion', 'IgniteMavenGenerator']; http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/directives/ui-ace-pom/ui-ace-pom.directive.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/directives/ui-ace-pom/ui-ace-pom.directive.js b/modules/web-console/frontend/app/directives/ui-ace-pom/ui-ace-pom.directive.js index 87083ab..f2ba0ae 100644 --- a/modules/web-console/frontend/app/directives/ui-ace-pom/ui-ace-pom.directive.js +++ b/modules/web-console/frontend/app/directives/ui-ace-pom/ui-ace-pom.directive.js @@ -18,7 +18,7 @@ import template from './ui-ace-pom.pug'; import controller from './ui-ace-pom.controller'; -export default ['igniteUiAcePom', [function() { +export default function() { const link = ($scope, $el, $attrs, [igniteUiAceTabs]) => { if (igniteUiAceTabs.onLoad) $scope.onLoad = igniteUiAceTabs.onLoad; @@ -38,4 +38,4 @@ export default ['igniteUiAcePom', [function() { controllerAs: 'ctrl', require: ['?^igniteUiAceTabs'] }; -}]]; +} http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/directives/ui-ace-sharp/ui-ace-sharp.controller.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/directives/ui-ace-sharp/ui-ace-sharp.controller.js b/modules/web-console/frontend/app/directives/ui-ace-sharp/ui-ace-sharp.controller.js index e87caca..09f7a01 100644 --- a/modules/web-console/frontend/app/directives/ui-ace-sharp/ui-ace-sharp.controller.js +++ b/modules/web-console/frontend/app/directives/ui-ace-sharp/ui-ace-sharp.controller.js @@ -18,7 +18,12 @@ const SERVER_CFG = 'ServerConfigurationFactory'; const CLIENT_CFG = 'ClientConfigurationFactory'; -export default ['$scope', 'IgniteSharpTransformer', function($scope, generator) { +/** + * @param {ng.IScope} $scope + * @param {import('app/modules/configuration/generator/SharpTransformer.service').default} generator + */ +export default function controller($scope, generator) { + /** @type {ThisType} */ const ctrl = this; this.$onInit = () => { @@ -31,4 +36,6 @@ export default ['$scope', 'IgniteSharpTransformer', function($scope, generator) return generator.cluster(cluster, 'config', type, $scope.cfg); }; }; -}]; +} + +controller.$inject = ['$scope', 'IgniteSharpTransformer']; http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/directives/ui-ace-sharp/ui-ace-sharp.directive.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/directives/ui-ace-sharp/ui-ace-sharp.directive.js b/modules/web-console/frontend/app/directives/ui-ace-sharp/ui-ace-sharp.directive.js index 094028b..d6e366b 100644 --- a/modules/web-console/frontend/app/directives/ui-ace-sharp/ui-ace-sharp.directive.js +++ b/modules/web-console/frontend/app/directives/ui-ace-sharp/ui-ace-sharp.directive.js @@ -20,8 +20,18 @@ import _ from 'lodash'; import template from './ui-ace-sharp.pug'; import controller from './ui-ace-sharp.controller'; -export default ['igniteUiAceSharp', ['IgniteSharpTransformer', function(generator) { - const link = (scope, $el, attrs, [ctrl, igniteUiAceTabs, formCtrl, ngModelCtrl]) => { +/** + * @param {import('app/modules/configuration/generator/SharpTransformer.service').default} generator + */ +export default function directive(generator) { + /** + * @param {ng.IScope} scope + * @param {JQLite} $el + * @param {ng.IAttributes} attrs + * @param {[typeof controller, any?, ng.IFormController?, ng.INgModelController?]} controllers + */ + const link = (scope, $el, attrs, controllers) => { + const [ctrl, igniteUiAceTabs, formCtrl, ngModelCtrl] = controllers; if (formCtrl && ngModelCtrl) formCtrl.$removeControl(ngModelCtrl); @@ -132,4 +142,6 @@ export default ['igniteUiAceSharp', ['IgniteSharpTransformer', function(generato controllerAs: 'ctrl', require: ['igniteUiAceSharp', '?^igniteUiAceTabs', '?^form', '?ngModel'] }; -}]]; +} + +directive.$inject = ['IgniteSharpTransformer']; http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/directives/ui-ace-tabs.directive.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/directives/ui-ace-tabs.directive.js b/modules/web-console/frontend/app/directives/ui-ace-tabs.directive.js index 6d11f58..a174b98 100644 --- a/modules/web-console/frontend/app/directives/ui-ace-tabs.directive.js +++ b/modules/web-console/frontend/app/directives/ui-ace-tabs.directive.js @@ -17,10 +17,10 @@ import _ from 'lodash'; -export default ['igniteUiAceTabs', [function() { +export default function() { return { scope: true, restrict: 'AE', controller: _.noop }; -}]]; +} http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/filters/byName.filter.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/filters/byName.filter.js b/modules/web-console/frontend/app/filters/byName.filter.js index 2769189..6ec56f4 100644 --- a/modules/web-console/frontend/app/filters/byName.filter.js +++ b/modules/web-console/frontend/app/filters/byName.filter.js @@ -15,9 +15,11 @@ * limitations under the License. */ -export default [() => (arr, search) => { +import _ from 'lodash'; + +export default () => (arr, search) => { if (!(arr && arr.length) || !search) return arr; return _.filter(arr, ({ name }) => name.indexOf(search) >= 0); -}]; +}; http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/filters/bytes.filter.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/filters/bytes.filter.js b/modules/web-console/frontend/app/filters/bytes.filter.js index 7576dad..71e77d4 100644 --- a/modules/web-console/frontend/app/filters/bytes.filter.js +++ b/modules/web-console/frontend/app/filters/bytes.filter.js @@ -16,7 +16,11 @@ */ export default () => { - return (bytes, precision) => { + /** + * @param {number} bytes + * @param {number} [precision] + */ + const filter = (bytes, precision) => { if (bytes === 0) return '0 bytes'; @@ -31,4 +35,6 @@ export default () => { return (bytes / Math.pow(1024, Math.floor(number))).toFixed(precision) + ' ' + units[number]; }; + + return filter; }; http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/filters/default-name.filter.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/filters/default-name.filter.js b/modules/web-console/frontend/app/filters/default-name.filter.js index 687ff84..a8b182e 100644 --- a/modules/web-console/frontend/app/filters/default-name.filter.js +++ b/modules/web-console/frontend/app/filters/default-name.filter.js @@ -15,7 +15,15 @@ * limitations under the License. */ -// Filter that will check name and return `<default>` if needed. -export default [() => { - return (name, html) => _.isEmpty(name) ? (html ? '<default>' : '<default>') : name; -}]; +import _ from 'lodash'; + +export default () => { + /** + * Filter that will check name and return `<default>` if needed. + * @param {string} name + * @param {string} html + */ + const filter = (name, html) => _.isEmpty(name) ? (html ? '<default>' : '<default>') : name; + + return filter; +}; http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/filters/domainsValidation.filter.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/filters/domainsValidation.filter.js b/modules/web-console/frontend/app/filters/domainsValidation.filter.js index eec0ff1..d551ca5 100644 --- a/modules/web-console/frontend/app/filters/domainsValidation.filter.js +++ b/modules/web-console/frontend/app/filters/domainsValidation.filter.js @@ -15,19 +15,37 @@ * limitations under the License. */ -// Filter domain models with key fields configuration. -export default ['IgniteLegacyUtils', (LegacyUtils) => (domains, valid, invalid) => { - if (valid && invalid) - return domains; +import _ from 'lodash'; - const out = []; +/** + * @param {ReturnType<typeof import('../services/LegacyUtils.service').default>} LegacyUtils [description] + */ +export default function factory(LegacyUtils) { + /** + * Filter domain models with key fields configuration. + * @template T + * @param {Array<T>} domains + * @param {boolean} valid + * @param {boolean} invalid + */ + const filter = (domains, valid, invalid) => { + if (valid && invalid) + return domains; + + /** @type {Array<T>} */ + const out = []; + + _.forEach(domains, function(domain) { + const _valid = !LegacyUtils.domainForStoreConfigured(domain) || LegacyUtils.isJavaBuiltInClass(domain.keyType) || !_.isEmpty(domain.keyFields); + + if (valid && _valid || invalid && !_valid) + out.push(domain); + }); - _.forEach(domains, function(domain) { - const _valid = !LegacyUtils.domainForStoreConfigured(domain) || LegacyUtils.isJavaBuiltInClass(domain.keyType) || !_.isEmpty(domain.keyFields); + return out; + }; - if (valid && _valid || invalid && !_valid) - out.push(domain); - }); + return filter; +} - return out; -}]; +factory.$inject = ['IgniteLegacyUtils']; http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/filters/duration.filter.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/filters/duration.filter.js b/modules/web-console/frontend/app/filters/duration.filter.js index 55ec7e0..810cc4d 100644 --- a/modules/web-console/frontend/app/filters/duration.filter.js +++ b/modules/web-console/frontend/app/filters/duration.filter.js @@ -15,11 +15,11 @@ * limitations under the License. */ -export default [() => { +export default () => { /** - * @param {Number} t Time in ms. + * @param {number} t Time in ms. */ - return (t) => { + const filter = (t) => { if (t === 9223372036854775807) return 'Infinite'; @@ -38,4 +38,6 @@ export default [() => { return a(d, 'd') + a(h, 'h') + a(m, 'm') + a(s, 's') + (t < 1000 || (t < cm && ms !== 0) ? ms + 'ms' : ''); }; -}]; + + return filter; +}; http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/filters/hasPojo.filter.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/filters/hasPojo.filter.js b/modules/web-console/frontend/app/filters/hasPojo.filter.js index 57530db..4186928 100644 --- a/modules/web-console/frontend/app/filters/hasPojo.filter.js +++ b/modules/web-console/frontend/app/filters/hasPojo.filter.js @@ -16,6 +16,6 @@ */ // Filter that return 'true' if caches has at least one domain with 'generatePojo' flag. -export default [() => ({caches} = []) => +export default () => ({caches} = []) => _.find(caches, (cache) => cache.domains && cache.domains.length && - cache.domains.find((domain) => domain.generatePojo))]; + cache.domains.find((domain) => domain.generatePojo)); http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/filters/uiGridSubcategories.filter.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/filters/uiGridSubcategories.filter.js b/modules/web-console/frontend/app/filters/uiGridSubcategories.filter.js index f36ae6e..859192d 100644 --- a/modules/web-console/frontend/app/filters/uiGridSubcategories.filter.js +++ b/modules/web-console/frontend/app/filters/uiGridSubcategories.filter.js @@ -15,10 +15,12 @@ * limitations under the License. */ -export default [() => { +import _ from 'lodash'; + +export default () => { return (arr, category) => { return _.filter(arr, (item) => { return item.colDef.categoryDisplayName === category; }); }; -}]; +}; http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/modules/agent/AgentManager.service.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/modules/agent/AgentManager.service.js b/modules/web-console/frontend/app/modules/agent/AgentManager.service.js index c5fcc99..f667374 100644 --- a/modules/web-console/frontend/app/modules/agent/AgentManager.service.js +++ b/modules/web-console/frontend/app/modules/agent/AgentManager.service.js @@ -142,7 +142,7 @@ export default class AgentManager { pool = new SimpleWorkerPool('decompressor', Worker, 4); - /** @type {Set<ng.IDifferend>} */ + /** @type {Set<ng.IPromise<unknown>>} */ promises = new Set(); socket = null; @@ -159,8 +159,25 @@ export default class AgentManager { } } + /** + * @param {ng.IRootScopeService} $root + * @param {ng.IQService} $q + * @param {import('@uirouter/angularjs').TransitionService} $transitions + * @param {unknown} socketFactory + * @param {import('./AgentModal.service').default} agentModal + * @param {import('app/components/user-notifications/service').default} UserNotifications + * @param {import('app/services/Version.service').default} Version + * @param {import('./components/cluster-login/service').default} ClusterLoginSrv + */ constructor($root, $q, $transitions, socketFactory, agentModal, UserNotifications, Version, ClusterLoginSrv) { - Object.assign(this, {$root, $q, $transitions, socketFactory, agentModal, UserNotifications, Version, ClusterLoginSrv}); + this.$root = $root; + this.$q = $q; + this.$transitions = $transitions; + this.socketFactory = socketFactory; + this.agentModal = agentModal; + this.UserNotifications = UserNotifications; + this.Version = Version; + this.ClusterLoginSrv = ClusterLoginSrv; let prevCluster; http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/modules/agent/AgentModal.service.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/modules/agent/AgentModal.service.js b/modules/web-console/frontend/app/modules/agent/AgentModal.service.js index 857a71e..e4b41ac 100644 --- a/modules/web-console/frontend/app/modules/agent/AgentModal.service.js +++ b/modules/web-console/frontend/app/modules/agent/AgentModal.service.js @@ -15,20 +15,28 @@ * limitations under the License. */ +import angular from 'angular'; +import _ from 'lodash'; import templateUrl from 'views/templates/agent-download.tpl.pug'; export default class AgentModal { static $inject = ['$rootScope', '$state', '$modal', 'IgniteMessages']; + /** + * @param {ng.IRootScopeService} $root + * @param {import('@uirouter/angularjs').StateService} $state + * @param {mgcrea.ngStrap.modal.IModalService} $modal + * @param {ReturnType<typeof import('app/services/Messages.service').default>} Messages + */ constructor($root, $state, $modal, Messages) { const self = this; this.$root = $root; - self.$state = $state; - self.Messages = Messages; + this.$state = $state; + this.Messages = Messages; // Pre-fetch modal dialogs. - self.modal = $modal({ + this.modal = $modal({ templateUrl, show: false, backdrop: 'static', @@ -37,7 +45,7 @@ export default class AgentModal { controllerAs: 'ctrl' }); - $root.$on('user', (event, user) => self.user = user); + $root.$on('user', (event, user) => this.user = user); } hide() { @@ -63,14 +71,12 @@ export default class AgentModal { * @param {String} [backText] */ agentDisconnected(backText, backState) { - const self = this; + this.backText = backText; + this.backState = backState; - self.backText = backText; - self.backState = backState; + this.status = 'agentMissing'; - self.status = 'agentMissing'; - - self.modal.$promise.then(self.modal.show); + this.modal.$promise.then(() => this.modal.show()); } /** @@ -78,14 +84,12 @@ export default class AgentModal { * @param {String} [backText] */ clusterDisconnected(backText, backState) { - const self = this; - - self.backText = backText; - self.backState = backState; + this.backText = backText; + this.backState = backState; - self.status = 'nodeMissing'; + this.status = 'nodeMissing'; - self.modal.$promise.then(self.modal.show); + this.modal.$promise.then(() => this.modal.show()); } get securityToken() { http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/modules/agent/components/cluster-login/component.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/modules/agent/components/cluster-login/component.js b/modules/web-console/frontend/app/modules/agent/components/cluster-login/component.js index 5f1d9e3..e932bad 100644 --- a/modules/web-console/frontend/app/modules/agent/components/cluster-login/component.js +++ b/modules/web-console/frontend/app/modules/agent/components/cluster-login/component.js @@ -27,6 +27,12 @@ export const component = { controller: class { /** @type {ClusterSecrets} */ secrets; + /** @type {ng.ICompiledExpression} */ + onLogin; + /** @type {ng.ICompiledExpression} */ + onHide; + /** @type {ng.IFormController} */ + form; login() { if (this.form.$invalid) http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/modules/agent/components/cluster-login/service.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/modules/agent/components/cluster-login/service.js b/modules/web-console/frontend/app/modules/agent/components/cluster-login/service.js index a066bcf..128f3cc 100644 --- a/modules/web-console/frontend/app/modules/agent/components/cluster-login/service.js +++ b/modules/web-console/frontend/app/modules/agent/components/cluster-login/service.js @@ -17,20 +17,23 @@ import _ from 'lodash'; -import {ClusterSecrets} from '../../types/ClusterSecrets'; import {CancellationError} from 'app/errors/CancellationError'; export default class ClusterLoginService { static $inject = ['$modal', '$q']; + /** + * @param {mgcrea.ngStrap.modal.IModalService} $modal + * @param {ng.IQService} $q + */ constructor($modal, $q) { this.$modal = $modal; this.$q = $q; } /** - * @param {ClusterSecrets} baseSecrets - * @return {ng.IDifferend<ClusterSecrets>} + * @param {import('../../types/ClusterSecrets').ClusterSecrets} baseSecrets + * @returns {ng.IPromise<import('../../types/ClusterSecrets').ClusterSecrets>} */ askCredentials(baseSecrets) { const deferred = this.$q.defer(); http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/modules/branding/branding.module.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/modules/branding/branding.module.js b/modules/web-console/frontend/app/modules/branding/branding.module.js index 2313728..20cd93e 100644 --- a/modules/web-console/frontend/app/modules/branding/branding.module.js +++ b/modules/web-console/frontend/app/modules/branding/branding.module.js @@ -41,9 +41,9 @@ angular tfMetaTagsProvider.setTitleSuffix(' â Apache Ignite Web Console'); }]) -.directive(...ignitePoweredByApache) -.directive(...igniteHeaderLogo) -.directive(...igniteHeaderTitle) -.directive(...igniteTerms) -.directive(...igniteFeatures) -.directive(...igniteFooter); +.directive('ignitePoweredByApache', ignitePoweredByApache) +.directive('igniteHeaderLogo', igniteHeaderLogo) +.directive('igniteHeaderTitle', igniteHeaderTitle) +.directive('igniteTerms', igniteTerms) +.directive('igniteFeatures', igniteFeatures) +.directive('igniteFooter', igniteFooter); http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/modules/branding/branding.service.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/modules/branding/branding.service.js b/modules/web-console/frontend/app/modules/branding/branding.service.js index ebef881..667dbfd 100644 --- a/modules/web-console/frontend/app/modules/branding/branding.service.js +++ b/modules/web-console/frontend/app/modules/branding/branding.service.js @@ -18,6 +18,9 @@ export default class { static $inject = ['IgniteVersion']; + /** + * @param {import('app/services/Version.service').default} Version + */ constructor(Version) { this.titleSuffix = ' - Apache Ignite Web Console'; http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/modules/branding/features.directive.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/modules/branding/features.directive.js b/modules/web-console/frontend/app/modules/branding/features.directive.js index d99b885..39c639c 100644 --- a/modules/web-console/frontend/app/modules/branding/features.directive.js +++ b/modules/web-console/frontend/app/modules/branding/features.directive.js @@ -17,7 +17,10 @@ const template = '<div class="features" ng-bind-html="features.html"></div>'; -export default ['igniteFeatures', ['IgniteBranding', function(branding) { +/** + * @param {import('./branding.service').default} branding + */ +export default function factory(branding) { function controller() { const ctrl = this; @@ -31,5 +34,7 @@ export default ['igniteFeatures', ['IgniteBranding', function(branding) { controllerAs: 'features', replace: true }; -}]]; +} + +factory.$inject = ['IgniteBranding']; http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/modules/branding/footer.directive.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/modules/branding/footer.directive.js b/modules/web-console/frontend/app/modules/branding/footer.directive.js index 7f09e11..3c0bb83 100644 --- a/modules/web-console/frontend/app/modules/branding/footer.directive.js +++ b/modules/web-console/frontend/app/modules/branding/footer.directive.js @@ -17,7 +17,10 @@ const template = '<div class="footer" ng-bind-html="footer.html"></div>'; -export default ['igniteFooter', ['IgniteBranding', function(branding) { +/** + * @param {import('./branding.service').default} branding + */ +export default function factory(branding) { function controller() { const ctrl = this; @@ -31,4 +34,6 @@ export default ['igniteFooter', ['IgniteBranding', function(branding) { controllerAs: 'footer', replace: true }; -}]]; +} + +factory.$inject = ['IgniteBranding']; http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/modules/branding/header-logo.directive.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/modules/branding/header-logo.directive.js b/modules/web-console/frontend/app/modules/branding/header-logo.directive.js index 18dff1c..60e5d5d 100644 --- a/modules/web-console/frontend/app/modules/branding/header-logo.directive.js +++ b/modules/web-console/frontend/app/modules/branding/header-logo.directive.js @@ -17,7 +17,10 @@ import template from './header-logo.pug'; -export default ['igniteHeaderLogo', ['IgniteBranding', function(branding) { +/** + * @param {import('./branding.service').default} branding + */ +export default function factory(branding) { function controller() { const ctrl = this; @@ -31,4 +34,6 @@ export default ['igniteHeaderLogo', ['IgniteBranding', function(branding) { controllerAs: 'logo', replace: true }; -}]]; +} + +factory.$inject = ['IgniteBranding']; http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/modules/branding/header-title.directive.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/modules/branding/header-title.directive.js b/modules/web-console/frontend/app/modules/branding/header-title.directive.js index aedd4b9..f67439c 100644 --- a/modules/web-console/frontend/app/modules/branding/header-title.directive.js +++ b/modules/web-console/frontend/app/modules/branding/header-title.directive.js @@ -21,7 +21,10 @@ const template = ` >{{::title.text}}</h1> `; -export default ['igniteHeaderTitle', ['IgniteBranding', (branding) => { +/** + * @param {import('./branding.service').default} branding + */ +export default function factory(branding) { function controller() { const ctrl = this; @@ -35,5 +38,7 @@ export default ['igniteHeaderTitle', ['IgniteBranding', (branding) => { controllerAs: 'title', replace: true }; -}]]; +} + +factory.$inject = ['IgniteBranding']; http://git-wip-us.apache.org/repos/asf/ignite/blob/6e6e8bff/modules/web-console/frontend/app/modules/branding/powered-by-apache.directive.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/modules/branding/powered-by-apache.directive.js b/modules/web-console/frontend/app/modules/branding/powered-by-apache.directive.js index e88f71f..3f8b3de 100644 --- a/modules/web-console/frontend/app/modules/branding/powered-by-apache.directive.js +++ b/modules/web-console/frontend/app/modules/branding/powered-by-apache.directive.js @@ -17,7 +17,10 @@ import template from './powered-by-apache.pug'; -export default ['ignitePoweredByApache', ['IgniteBranding', (branding) => { +/** + * @param {import('./branding.service').default} branding + */ +export default function factory(branding) { function controller() { const ctrl = this; @@ -30,5 +33,7 @@ export default ['ignitePoweredByApache', ['IgniteBranding', (branding) => { controller, controllerAs: 'poweredBy' }; -}]]; +} + +factory.$inject = ['IgniteBranding'];