IGNITE-10433 Web Console: Fixed "Import models" dialog cleanup on exit logic.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3606b21b Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3606b21b Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3606b21b Branch: refs/heads/ignite-9720 Commit: 3606b21bfe0d254864b284571a3f2692d4d4870a Parents: 8e170d6 Author: Alexander Kalinin <verba...@yandex.ru> Authored: Wed Nov 28 14:52:14 2018 +0700 Committer: Alexey Kuznetsov <akuznet...@apache.org> Committed: Wed Nov 28 14:52:14 2018 +0700 ---------------------------------------------------------------------- .../components/modal-import-models/service.js | 24 +++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/3606b21b/modules/web-console/frontend/app/components/page-configure/components/modal-import-models/service.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/components/page-configure/components/modal-import-models/service.js b/modules/web-console/frontend/app/components/page-configure/components/modal-import-models/service.js index 3c0ecbb..e17721db 100644 --- a/modules/web-console/frontend/app/components/page-configure/components/modal-import-models/service.js +++ b/modules/web-console/frontend/app/components/page-configure/components/modal-import-models/service.js @@ -16,12 +16,18 @@ */ export default class ModalImportModels { - static $inject = ['$modal', 'AgentManager', '$uiRouter']; - constructor($modal, AgentManager, $uiRouter) { - Object.assign(this, {$modal, AgentManager, $uiRouter}); + static $inject = ['$modal', '$uiRouter', 'AgentManager']; + + constructor($modal, $uiRouter, AgentManager) { + this.$modal = $modal; + this.$uiRouter = $uiRouter; + this.AgentManager = AgentManager; } + _goToDynamicState() { - if (this._state) this.$uiRouter.stateRegistry.deregister(this._state); + if (this._state) + this.$uiRouter.stateRegistry.deregister(this._state); + this._state = this.$uiRouter.stateRegistry.register({ name: 'importModels', parent: this.$uiRouter.stateService.current, @@ -29,11 +35,15 @@ export default class ModalImportModels { this._open(); }, onExit: () => { + this.AgentManager.stopWatch(); + this._modal && this._modal.hide(); } }); + return this.$uiRouter.stateService.go(this._state, this.$uiRouter.stateService.params); } + _open() { this._modal = this.$modal({ template: ` @@ -46,10 +56,12 @@ export default class ModalImportModels { controllerAs: '$ctrl', show: false }); + return this.AgentManager.startAgentWatch('Back', this.$uiRouter.globals.current.name) - .then(() => this._modal.$promise) - .then(() => this._modal.show()); + .then(() => this._modal.$promise) + .then(() => this._modal.show()); } + open() { this._goToDynamicState(); }