IGNITE-9136 Web Console: Do not show (de)activate switcher for clusters older than v2.0.0.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/bcda7a1f Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/bcda7a1f Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/bcda7a1f Branch: refs/heads/ignite-8446 Commit: bcda7a1f584af3f8c3d1db3020ddc952dd4bb918 Parents: bea6fe3 Author: Alexey Kuznetsov <akuznet...@apache.org> Authored: Tue Jul 31 18:41:01 2018 +0700 Committer: Alexey Kuznetsov <akuznet...@apache.org> Committed: Tue Jul 31 18:41:01 2018 +0700 ---------------------------------------------------------------------- .../app/components/cluster-selector/controller.js | 13 ++++++++++--- .../app/components/cluster-selector/template.pug | 8 ++++---- 2 files changed, 14 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/bcda7a1f/modules/web-console/frontend/app/components/cluster-selector/controller.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/components/cluster-selector/controller.js b/modules/web-console/frontend/app/components/cluster-selector/controller.js index 4aebd62..63421b1 100644 --- a/modules/web-console/frontend/app/components/cluster-selector/controller.js +++ b/modules/web-console/frontend/app/components/cluster-selector/controller.js @@ -21,15 +21,18 @@ import { BehaviorSubject } from 'rxjs/BehaviorSubject'; import 'rxjs/add/operator/combineLatest'; export default class { - static $inject = ['AgentManager', 'IgniteConfirm']; + static $inject = ['AgentManager', 'IgniteConfirm', 'IgniteVersion']; /** * @param agentMgr Agent manager. - * @param Confirm Confirmation service. + * @param Confirm Confirmation service. + * @param Version Version check service. */ - constructor(agentMgr, Confirm) { + constructor(agentMgr, Confirm, Version) { this.agentMgr = agentMgr; this.Confirm = Confirm; + this.Version = Version; + this.clusters = []; this.isDemo = agentMgr.isDemoMode(); this._inProgressSubject = new BehaviorSubject(false); @@ -61,6 +64,10 @@ export default class { this.agentMgr.switchCluster(this.cluster); } + isChangeStateAvailable() { + return !this.isDemo && this.cluster && this.Version.since(this.cluster.clusterVersion, '2.0.0'); + } + toggle($event) { $event.preventDefault(); http://git-wip-us.apache.org/repos/asf/ignite/blob/bcda7a1f/modules/web-console/frontend/app/components/cluster-selector/template.pug ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/components/cluster-selector/template.pug b/modules/web-console/frontend/app/components/cluster-selector/template.pug index d397164..f1e80db 100644 --- a/modules/web-console/frontend/app/components/cluster-selector/template.pug +++ b/modules/web-console/frontend/app/components/cluster-selector/template.pug @@ -63,15 +63,15 @@ svg( ignite-icon='info' bs-tooltip='' data-title='Multi-Cluster Support<br/>\ - <a href="https://apacheignite-tools.readme.io/docs/multi-cluster-support" target="_blank">More info</a>' + <a href="https://apacheignite-tools.readme.io/docs/multi-cluster-support" target="_blank">More info</a>' data-placement='bottom' ) -.cluster-selector--state(ng-if='!$ctrl.isDemo && $ctrl.cluster') +.cluster-selector--state(ng-if='$ctrl.isChangeStateAvailable()') | Cluster {{ $ctrl.cluster.active ? 'active' : 'inactive' }} +switcher()( - ng-if='!$ctrl.isDemo && $ctrl.cluster' + ng-if='$ctrl.isChangeStateAvailable()' ng-click='$ctrl.toggle($event)' ng-checked='$ctrl.cluster.active' ng-disabled='$ctrl.inProgress' @@ -80,5 +80,5 @@ svg( is-in-progress='{{ $ctrl.inProgress }}' ) -div(ng-if='$ctrl.inProgress') +div(ng-if='$ctrl.inProgress && $ctrl.isChangeStateAvailable()') | {{ !$ctrl.cluster.active ? 'Activating...' : 'Deactivating...' }}