You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2018/12/19 19:57:29 UTC
[02/15] ignite git commit: IGNITE-9839 Web Console: update to RxJS 6.
IGNITE-9839 Web Console: update to RxJS 6.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7d4e1fd1
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7d4e1fd1
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7d4e1fd1
Branch: refs/heads/ignite-1741
Commit: 7d4e1fd118845f6e14638520ac10881deadd570c
Parents: 388f7ff
Author: Ilya Borisov <kl...@gmail.com>
Authored: Wed Dec 19 10:03:31 2018 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Wed Dec 19 10:03:31 2018 +0700
----------------------------------------------------------------------
.../components/cluster-selector/controller.js | 17 +-
.../connected-clusters-badge/controller.js | 11 +-
.../components/cache-edit-form/controller.js | 10 +-
.../components/cluster-edit-form/controller.js | 10 +-
.../controller.js | 36 +-
.../controller.js | 29 +-
.../page-configure-advanced-igfs/controller.js | 49 +-
.../controller.js | 45 +-
.../page-configure-basic/controller.js | 87 ++-
.../page-configure-basic/controller.spec.js | 6 +-
.../page-configure-overview/controller.js | 11 +-
.../components/modal-import-models/component.js | 111 ++--
.../app/components/page-configure/controller.js | 15 +-
.../app/components/page-configure/index.d.ts | 29 +-
.../app/components/page-configure/index.ts | 26 +-
.../services/ConfigChangesGuard.js | 11 +-
.../services/ConfigSelectionManager.js | 75 +--
.../page-configure/services/ConfigureState.js | 11 +-
.../page-configure/services/PageConfigure.js | 49 +-
.../services/PageConfigure.spec.js | 17 +-
.../app/components/page-configure/states.js | 62 +-
.../components/page-configure/store/effects.js | 638 ++++++++++---------
.../page-configure/store/effects.spec.js | 7 +-
.../page-configure/store/selectors.js | 159 ++---
.../components/queries-notebook/controller.ts | 30 +-
.../app/modules/agent/AgentManager.service.js | 25 +-
.../frontend/app/modules/user/User.service.js | 2 +-
.../frontend/app/services/Clusters.js | 9 +-
.../frontend/app/services/Version.service.js | 2 +-
.../web-console/frontend/app/services/store.ts | 10 +-
.../web-console/frontend/app/store/ofType.ts | 2 +-
.../frontend/app/utils/SimpleWorkerPool.js | 19 +-
modules/web-console/frontend/package.json | 4 +-
33 files changed, 869 insertions(+), 755 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/7d4e1fd1/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 fb64b9f..484a5eb 100644
--- a/modules/web-console/frontend/app/components/cluster-selector/controller.js
+++ b/modules/web-console/frontend/app/components/cluster-selector/controller.js
@@ -17,8 +17,8 @@
import _ from 'lodash';
-import { BehaviorSubject } from 'rxjs/BehaviorSubject';
-import 'rxjs/add/operator/combineLatest';
+import { BehaviorSubject } from 'rxjs';
+import {tap, filter, combineLatest} from 'rxjs/operators';
export default class {
static $inject = ['AgentManager', 'IgniteConfirm', 'IgniteVersion', 'IgniteMessages'];
@@ -46,15 +46,16 @@ export default class {
this.inProgress$ = this._inProgressSubject.asObservable();
- this.clusters$ = this.agentMgr.connectionSbj
- .combineLatest(this.inProgress$)
- .do(([sbj, inProgress]) => this.inProgress = inProgress)
- .filter(([sbj, inProgress]) => !inProgress)
- .do(([{cluster, clusters}]) => {
+ this.clusters$ = this.agentMgr.connectionSbj.pipe(
+ combineLatest(this.inProgress$),
+ tap(([sbj, inProgress]) => this.inProgress = inProgress),
+ filter(([sbj, inProgress]) => !inProgress),
+ tap(([{cluster, clusters}]) => {
this.cluster = cluster ? {...cluster} : null;
this.clusters = _.orderBy(clusters, ['name'], ['asc']);
})
- .subscribe(() => {});
+ )
+ .subscribe(() => {});
}
$onDestroy() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/7d4e1fd1/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 807c3ba..294f955 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,6 +15,8 @@
* limitations under the License.
*/
+import {tap} from 'rxjs/operators';
+
export default class {
static $inject = ['AgentManager', 'ConnectedClustersDialog'];
@@ -36,10 +38,11 @@ export default class {
}
$onInit() {
- this.connectedClusters$ = this.agentMgr.connectionSbj
- .do(({ clusters }) => this.connectedClusters = clusters.length)
- .do(({ clusters }) => this.clusters = clusters)
- .subscribe();
+ this.connectedClusters$ = this.agentMgr.connectionSbj.pipe(
+ tap(({ clusters }) => this.connectedClusters = clusters.length),
+ tap(({ clusters }) => this.clusters = clusters)
+ )
+ .subscribe();
}
$onDestroy() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/7d4e1fd1/modules/web-console/frontend/app/components/page-configure-advanced/components/cache-edit-form/controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-configure-advanced/components/cache-edit-form/controller.js b/modules/web-console/frontend/app/components/page-configure-advanced/components/cache-edit-form/controller.js
index e044a70..c1beec6 100644
--- a/modules/web-console/frontend/app/components/page-configure-advanced/components/cache-edit-form/controller.js
+++ b/modules/web-console/frontend/app/components/page-configure-advanced/components/cache-edit-form/controller.js
@@ -17,6 +17,7 @@
import cloneDeep from 'lodash/cloneDeep';
import get from 'lodash/get';
+import {tap} from 'rxjs/operators';
export default class CacheEditFormController {
/** @type {ig.menu<string>} */
@@ -61,10 +62,11 @@ export default class CacheEditFormController {
};
- this.subscription = this.IgniteVersion.currentSbj
- .do(rebuildDropdowns)
- .do(filterModel)
- .subscribe();
+ this.subscription = this.IgniteVersion.currentSbj.pipe(
+ tap(rebuildDropdowns),
+ tap(filterModel)
+ )
+ .subscribe();
// TODO: Do we really need this?
this.$scope.ui = this.IgniteFormUtils.formUI();
http://git-wip-us.apache.org/repos/asf/ignite/blob/7d4e1fd1/modules/web-console/frontend/app/components/page-configure-advanced/components/cluster-edit-form/controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-configure-advanced/components/cluster-edit-form/controller.js b/modules/web-console/frontend/app/components/page-configure-advanced/components/cluster-edit-form/controller.js
index 5020d7b..7400b43 100644
--- a/modules/web-console/frontend/app/components/page-configure-advanced/components/cluster-edit-form/controller.js
+++ b/modules/web-console/frontend/app/components/page-configure-advanced/components/cluster-edit-form/controller.js
@@ -19,6 +19,7 @@ import cloneDeep from 'lodash/cloneDeep';
import get from 'lodash/get';
import isEqual from 'lodash/isEqual';
import _ from 'lodash';
+import {tap} from 'rxjs/operators';
export default class ClusterEditFormController {
/** @type {Array<ig.config.cache.ShortCache>} */
@@ -86,10 +87,11 @@ export default class ClusterEditFormController {
}
};
- this.subscription = this.IgniteVersion.currentSbj
- .do(rebuildDropdowns)
- .do(() => filterModel(this.clonedCluster))
- .subscribe();
+ this.subscription = this.IgniteVersion.currentSbj.pipe(
+ tap(rebuildDropdowns),
+ tap(() => filterModel(this.clonedCluster))
+ )
+ .subscribe();
this.supportedJdbcTypes = this.IgniteLegacyUtils.mkOptions(this.IgniteLegacyUtils.SUPPORTED_JDBC_TYPES);
http://git-wip-us.apache.org/repos/asf/ignite/blob/7d4e1fd1/modules/web-console/frontend/app/components/page-configure-advanced/components/page-configure-advanced-caches/controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-configure-advanced/components/page-configure-advanced-caches/controller.js b/modules/web-console/frontend/app/components/page-configure-advanced/components/page-configure-advanced-caches/controller.js
index da17c67..2cfe08a 100644
--- a/modules/web-console/frontend/app/components/page-configure-advanced/components/page-configure-advanced-caches/controller.js
+++ b/modules/web-console/frontend/app/components/page-configure-advanced/components/page-configure-advanced-caches/controller.js
@@ -15,10 +15,9 @@
* limitations under the License.
*/
-import {Subject} from 'rxjs/Subject';
-import {merge} from 'rxjs/observable/merge';
+import {Subject, merge, combineLatest} from 'rxjs';
+import {tap, map, refCount, pluck, publishReplay, switchMap, distinctUntilChanged} from 'rxjs/operators';
import naturalCompare from 'natural-compare-lite';
-import {combineLatest} from 'rxjs/observable/combineLatest';
import {removeClusterItems, advancedSaveCache} from 'app/components/page-configure/store/actionCreators';
import ConfigureState from 'app/components/page-configure/services/ConfigureState';
import ConfigSelectors from 'app/components/page-configure/store/selectors';
@@ -103,16 +102,23 @@ export default class Controller {
}
$onInit() {
- const cacheID$ = this.$uiRouter.globals.params$.pluck('cacheID').publishReplay(1).refCount();
+ const cacheID$ = this.$uiRouter.globals.params$.pipe(
+ pluck('cacheID'),
+ publishReplay(1),
+ refCount()
+ );
- this.shortCaches$ = this.ConfigureState.state$.let(this.ConfigSelectors.selectCurrentShortCaches);
- this.shortModels$ = this.ConfigureState.state$.let(this.ConfigSelectors.selectCurrentShortModels);
- this.shortIGFSs$ = this.ConfigureState.state$.let(this.ConfigSelectors.selectCurrentShortIGFSs);
- this.originalCache$ = cacheID$.distinctUntilChanged().switchMap((id) => {
- return this.ConfigureState.state$.let(this.ConfigSelectors.selectCacheToEdit(id));
- });
+ this.shortCaches$ = this.ConfigureState.state$.pipe(this.ConfigSelectors.selectCurrentShortCaches);
+ this.shortModels$ = this.ConfigureState.state$.pipe(this.ConfigSelectors.selectCurrentShortModels);
+ this.shortIGFSs$ = this.ConfigureState.state$.pipe(this.ConfigSelectors.selectCurrentShortIGFSs);
+ this.originalCache$ = cacheID$.pipe(
+ distinctUntilChanged(),
+ switchMap((id) => {
+ return this.ConfigureState.state$.pipe(this.ConfigSelectors.selectCacheToEdit(id));
+ })
+ );
- this.isNew$ = cacheID$.map((id) => id === 'new');
+ this.isNew$ = cacheID$.pipe(map((id) => id === 'new'));
this.itemEditTitle$ = combineLatest(this.isNew$, this.originalCache$, (isNew, cache) => {
return `${isNew ? 'Create' : 'Edit'} cache ${!isNew && cache.name ? `‘${cache.name}’` : ''}`;
});
@@ -125,13 +131,13 @@ export default class Controller {
this.subscription = merge(
this.originalCache$,
- this.selectionManager.editGoes$.do((id) => this.edit(id)),
- this.selectionManager.editLeaves$.do((options) => this.$state.go('base.configuration.edit.advanced.caches', null, options))
+ this.selectionManager.editGoes$.pipe(tap((id) => this.edit(id))),
+ this.selectionManager.editLeaves$.pipe(tap((options) => this.$state.go('base.configuration.edit.advanced.caches', null, options)))
).subscribe();
this.isBlocked$ = cacheID$;
- this.tableActions$ = this.selectionManager.selectedItemIDs$.map((selectedItems) => [
+ this.tableActions$ = this.selectionManager.selectedItemIDs$.pipe(map((selectedItems) => [
{
action: 'Clone',
click: () => this.clone(selectedItems),
@@ -144,7 +150,7 @@ export default class Controller {
},
available: true
}
- ]);
+ ]));
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/7d4e1fd1/modules/web-console/frontend/app/components/page-configure-advanced/components/page-configure-advanced-cluster/controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-configure-advanced/components/page-configure-advanced-cluster/controller.js b/modules/web-console/frontend/app/components/page-configure-advanced/components/page-configure-advanced-cluster/controller.js
index f0348c3..2aae041 100644
--- a/modules/web-console/frontend/app/components/page-configure-advanced/components/page-configure-advanced-cluster/controller.js
+++ b/modules/web-console/frontend/app/components/page-configure-advanced/components/page-configure-advanced-cluster/controller.js
@@ -18,7 +18,7 @@
import {default as ConfigSelectors} from 'app/components/page-configure/store/selectors';
import {default as ConfigureState} from 'app/components/page-configure/services/ConfigureState';
import {advancedSaveCluster} from 'app/components/page-configure/store/actionCreators';
-import 'rxjs/add/operator/publishReplay';
+import {take, pluck, switchMap, map, filter, distinctUntilChanged, publishReplay, refCount} from 'rxjs/operators';
// Controller for Clusters screen.
export default class PageConfigureAdvancedCluster {
@@ -36,12 +36,27 @@ export default class PageConfigureAdvancedCluster {
}
$onInit() {
- const clusterID$ = this.$uiRouter.globals.params$.take(1).pluck('clusterID').filter((v) => v).take(1);
- this.shortCaches$ = this.ConfigureState.state$.let(this.ConfigSelectors.selectCurrentShortCaches);
- this.originalCluster$ = clusterID$.distinctUntilChanged().switchMap((id) => {
- return this.ConfigureState.state$.let(this.ConfigSelectors.selectClusterToEdit(id));
- }).distinctUntilChanged().publishReplay(1).refCount();
- this.isNew$ = this.$uiRouter.globals.params$.pluck('clusterID').map((id) => id === 'new');
+ const clusterID$ = this.$uiRouter.globals.params$.pipe(
+ take(1),
+ pluck('clusterID'),
+ filter((v) => v),
+ take(1)
+ );
+
+ this.shortCaches$ = this.ConfigureState.state$.pipe(this.ConfigSelectors.selectCurrentShortCaches);
+
+ this.originalCluster$ = clusterID$.pipe(
+ distinctUntilChanged(),
+ switchMap((id) => {
+ return this.ConfigureState.state$.pipe(this.ConfigSelectors.selectClusterToEdit(id));
+ }),
+ distinctUntilChanged(),
+ publishReplay(1),
+ refCount()
+ );
+
+ this.isNew$ = this.$uiRouter.globals.params$.pipe(pluck('clusterID'), map((id) => id === 'new'));
+
this.isBlocked$ = clusterID$;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7d4e1fd1/modules/web-console/frontend/app/components/page-configure-advanced/components/page-configure-advanced-igfs/controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-configure-advanced/components/page-configure-advanced-igfs/controller.js b/modules/web-console/frontend/app/components/page-configure-advanced/components/page-configure-advanced-igfs/controller.js
index 50eee7c..0e6345b 100644
--- a/modules/web-console/frontend/app/components/page-configure-advanced/components/page-configure-advanced-igfs/controller.js
+++ b/modules/web-console/frontend/app/components/page-configure-advanced/components/page-configure-advanced-igfs/controller.js
@@ -15,11 +15,9 @@
* limitations under the License.
*/
-import {Observable} from 'rxjs/Observable';
-import {Subject} from 'rxjs/Subject';
-import {combineLatest} from 'rxjs/observable/combineLatest';
+import {Observable, Subject, combineLatest, merge} from 'rxjs';
+import {tap, map, distinctUntilChanged, pluck, publishReplay, refCount, switchMap} from 'rxjs/operators';
import naturalCompare from 'natural-compare-lite';
-import {merge} from 'rxjs/observable/merge';
import get from 'lodash/get';
import {removeClusterItems, advancedSaveIGFS} from 'app/components/page-configure/store/actionCreators';
import ConfigureState from 'app/components/page-configure/services/ConfigureState';
@@ -82,31 +80,44 @@ export default class PageConfigureAdvancedIGFS {
width: 130
}
];
- this.itemID$ = this.$uiRouter.globals.params$.pluck('igfsID');
+
+ this.itemID$ = this.$uiRouter.globals.params$.pipe(pluck('igfsID'));
/** @type {Observable<ig.config.igfs.ShortIGFS>} */
- this.shortItems$ = this.ConfigureState.state$
- .let(this.ConfigSelectors.selectCurrentShortIGFSs)
- .map((items = []) => items.map((i) => ({
+ this.shortItems$ = this.ConfigureState.state$.pipe(
+ this.ConfigSelectors.selectCurrentShortIGFSs,
+ map((items = []) => items.map((i) => ({
_id: i._id,
name: i.name,
affinnityGroupSize: i.affinnityGroupSize || this.IGFSs.affinnityGroupSize.default,
defaultMode: i.defaultMode || this.IGFSs.defaultMode.default
- })));
- this.originalItem$ = this.itemID$.distinctUntilChanged().switchMap((id) => {
- return this.ConfigureState.state$.let(this.ConfigSelectors.selectIGFSToEdit(id));
- }).distinctUntilChanged().publishReplay(1).refCount();
- this.isNew$ = this.itemID$.map((id) => id === 'new');
+ })))
+ );
+
+ this.originalItem$ = this.itemID$.pipe(
+ distinctUntilChanged(),
+ switchMap((id) => {
+ return this.ConfigureState.state$.pipe(this.ConfigSelectors.selectIGFSToEdit(id));
+ }),
+ distinctUntilChanged(),
+ publishReplay(1),
+ refCount()
+ );
+
+ this.isNew$ = this.itemID$.pipe(map((id) => id === 'new'));
+
this.itemEditTitle$ = combineLatest(this.isNew$, this.originalItem$, (isNew, item) => {
return `${isNew ? 'Create' : 'Edit'} IGFS ${!isNew && get(item, 'name') ? `‘${get(item, 'name')}’` : ''}`;
});
+
this.selectionManager = this.configSelectionManager({
itemID$: this.itemID$,
selectedItemRows$: this.selectedRows$,
visibleRows$: this.visibleRows$,
loadedItems$: this.shortItems$
});
- this.tableActions$ = this.selectionManager.selectedItemIDs$.map((selectedItems) => [
+
+ this.tableActions$ = this.selectionManager.selectedItemIDs$.pipe(map((selectedItems) => [
{
action: 'Clone',
click: () => this.clone(selectedItems),
@@ -119,19 +130,23 @@ export default class PageConfigureAdvancedIGFS {
},
available: true
}
- ]);
+ ]));
+
this.subscription = merge(
this.originalItem$,
- this.selectionManager.editGoes$.do((id) => this.edit(id)),
- this.selectionManager.editLeaves$.do((options) => this.$state.go('base.configuration.edit.advanced.igfs', null, options))
+ this.selectionManager.editGoes$.pipe(tap((id) => this.edit(id))),
+ this.selectionManager.editLeaves$.pipe(tap((options) => this.$state.go('base.configuration.edit.advanced.igfs', null, options)))
).subscribe();
}
+
edit(igfsID) {
this.$state.go('base.configuration.edit.advanced.igfs.igfs', {igfsID});
}
+
save({igfs, download}) {
this.ConfigureState.dispatchAction(advancedSaveIGFS(igfs, download));
}
+
remove(itemIDs) {
this.ConfigureState.dispatchAction(
removeClusterItems(this.$uiRouter.globals.params.clusterID, 'igfss', itemIDs, true, true)
http://git-wip-us.apache.org/repos/asf/ignite/blob/7d4e1fd1/modules/web-console/frontend/app/components/page-configure-advanced/components/page-configure-advanced-models/controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-configure-advanced/components/page-configure-advanced-models/controller.js b/modules/web-console/frontend/app/components/page-configure-advanced/components/page-configure-advanced-models/controller.js
index fd1ccaa..c2e30cf 100644
--- a/modules/web-console/frontend/app/components/page-configure-advanced/components/page-configure-advanced-models/controller.js
+++ b/modules/web-console/frontend/app/components/page-configure-advanced/components/page-configure-advanced-models/controller.js
@@ -15,10 +15,9 @@
* limitations under the License.
*/
-import {Subject} from 'rxjs/Subject';
-import {Observable} from 'rxjs/Observable';
-import {combineLatest} from 'rxjs/observable/combineLatest';
-import {merge} from 'rxjs/observable/merge';
+import {Subject, Observable, combineLatest, merge} from 'rxjs';
+import {pluck, tap, publishReplay, refCount, distinctUntilChanged, switchMap, map} from 'rxjs/operators';
+
import get from 'lodash/get';
import hasIndexTemplate from './hasIndex.template.pug';
@@ -100,25 +99,33 @@ export default class PageConfigureAdvancedModels {
];
/** @type {Observable<string>} */
- this.itemID$ = this.$uiRouter.globals.params$.pluck('modelID');
+ this.itemID$ = this.$uiRouter.globals.params$.pipe(pluck('modelID'));
/** @type {Observable<Array<ig.config.model.ShortDomainModel>>} */
- this.shortItems$ = this.ConfigureState.state$.let(this.ConfigSelectors.selectCurrentShortModels)
- .do((shortModels = []) => {
+ this.shortItems$ = this.ConfigureState.state$.pipe(
+ this.ConfigSelectors.selectCurrentShortModels,
+ tap((shortModels = []) => {
const value = shortModels.every((m) => m.hasIndex);
this.columnDefs[0].visible = !value;
- })
- .publishReplay(1)
- .refCount();
+ }),
+ publishReplay(1),
+ refCount()
+ );
- this.shortCaches$ = this.ConfigureState.state$.let(this.ConfigSelectors.selectCurrentShortCaches);
+ this.shortCaches$ = this.ConfigureState.state$.pipe(this.ConfigSelectors.selectCurrentShortCaches);
/** @type {Observable<ig.config.model.DomainModel>} */
- this.originalItem$ = this.itemID$.distinctUntilChanged().switchMap((id) => {
- return this.ConfigureState.state$.let(this.ConfigSelectors.selectModelToEdit(id));
- }).distinctUntilChanged().publishReplay(1).refCount();
+ this.originalItem$ = this.itemID$.pipe(
+ distinctUntilChanged(),
+ switchMap((id) => {
+ return this.ConfigureState.state$.pipe(this.ConfigSelectors.selectModelToEdit(id));
+ }),
+ distinctUntilChanged(),
+ publishReplay(1),
+ refCount()
+ );
- this.isNew$ = this.itemID$.map((id) => id === 'new');
+ this.isNew$ = this.itemID$.pipe(map((id) => id === 'new'));
this.itemEditTitle$ = combineLatest(this.isNew$, this.originalItem$, (isNew, item) => {
return `${isNew ? 'Create' : 'Edit'} model ${!isNew && get(item, 'valueType') ? `‘${get(item, 'valueType')}’` : ''}`;
@@ -131,7 +138,7 @@ export default class PageConfigureAdvancedModels {
loadedItems$: this.shortItems$
});
- this.tableActions$ = this.selectionManager.selectedItemIDs$.map((selectedItems) => [
+ this.tableActions$ = this.selectionManager.selectedItemIDs$.pipe(map((selectedItems) => [
{
action: 'Clone',
click: () => this.clone(selectedItems),
@@ -144,12 +151,12 @@ export default class PageConfigureAdvancedModels {
},
available: true
}
- ]);
+ ]));
this.subscription = merge(
this.originalItem$,
- this.selectionManager.editGoes$.do((id) => this.edit(id)),
- this.selectionManager.editLeaves$.do((options) => this.$state.go('base.configuration.edit.advanced.models', null, options))
+ this.selectionManager.editGoes$.pipe(tap((id) => this.edit(id))),
+ this.selectionManager.editLeaves$.pipe(tap((options) => this.$state.go('base.configuration.edit.advanced.models', null, options)))
).subscribe();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7d4e1fd1/modules/web-console/frontend/app/components/page-configure-basic/controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-configure-basic/controller.js b/modules/web-console/frontend/app/components/page-configure-basic/controller.js
index f5515fb..14b3a69 100644
--- a/modules/web-console/frontend/app/components/page-configure-basic/controller.js
+++ b/modules/web-console/frontend/app/components/page-configure-basic/controller.js
@@ -15,8 +15,8 @@
* limitations under the License.
*/
-import {Observable} from 'rxjs/Observable';
-import 'rxjs/add/operator/map';
+import {forkJoin, merge} from 'rxjs';
+import {map, tap, pluck, take, filter, distinctUntilChanged, switchMap, publishReplay, refCount} from 'rxjs/operators';
import cloneDeep from 'lodash/cloneDeep';
import get from 'lodash/get';
import naturalCompare from 'natural-compare-lite';
@@ -88,45 +88,64 @@ export default class PageConfigureBasicController {
$transition$.onSuccess({}, () => this.reset());
- return Observable.forkJoin(
- this.ConfigureState.state$.pluck('edit', 'changes').take(1),
- this.clusterID$.switchMap((id) => this.ConfigureState.state$.let(this.ConfigSelectors.selectClusterShortCaches(id))).take(1),
- this.shortCaches$.take(1)
- ).toPromise()
- .then(([changes, originalShortCaches, currentCaches]) => {
- return this.ConfigChangesGuard.guard(
- {
- cluster: this.Clusters.normalize(this.originalCluster),
- caches: originalShortCaches.map(this.Caches.normalize)
- },
- {
- cluster: {...this.Clusters.normalize(this.clonedCluster), caches: changes.caches.ids},
- caches: currentCaches.map(this.Caches.normalize)
- }
- );
- });
+ return forkJoin(
+ this.ConfigureState.state$.pipe(pluck('edit', 'changes'), take(1)),
+ this.clusterID$.pipe(
+ switchMap((id) => this.ConfigureState.state$.pipe(this.ConfigSelectors.selectClusterShortCaches(id))),
+ take(1)
+ ),
+ this.shortCaches$.pipe(take(1))
+ )
+ .toPromise()
+ .then(([changes, originalShortCaches, currentCaches]) => {
+ return this.ConfigChangesGuard.guard(
+ {
+ cluster: this.Clusters.normalize(this.originalCluster),
+ caches: originalShortCaches.map(this.Caches.normalize)
+ },
+ {
+ cluster: {...this.Clusters.normalize(this.clonedCluster), caches: changes.caches.ids},
+ caches: currentCaches.map(this.Caches.normalize)
+ }
+ );
+ });
}
$onInit() {
this.onBeforeTransition = this.$uiRouter.transitionService.onBefore({}, (t) => this._uiCanExit(t));
- this.memorySizeInputVisible$ = this.IgniteVersion.currentSbj
- .map((version) => this.IgniteVersion.since(version.ignite, '2.0.0'));
+ this.memorySizeInputVisible$ = this.IgniteVersion.currentSbj.pipe(
+ map((version) => this.IgniteVersion.since(version.ignite, '2.0.0'))
+ );
- const clusterID$ = this.$uiRouter.globals.params$.take(1).pluck('clusterID').filter((v) => v).take(1);
+ const clusterID$ = this.$uiRouter.globals.params$.pipe(
+ take(1),
+ pluck('clusterID'),
+ filter((v) => v),
+ take(1)
+ );
this.clusterID$ = clusterID$;
- this.isNew$ = this.$uiRouter.globals.params$.pluck('clusterID').map((id) => id === 'new');
- this.shortCaches$ = this.ConfigureState.state$.let(this.ConfigSelectors.selectCurrentShortCaches);
- this.shortClusters$ = this.ConfigureState.state$.let(this.ConfigSelectors.selectShortClustersValue());
- this.originalCluster$ = clusterID$.distinctUntilChanged().switchMap((id) => {
- return this.ConfigureState.state$.let(this.ConfigSelectors.selectClusterToEdit(id));
- }).distinctUntilChanged().publishReplay(1).refCount();
-
- this.subscription = Observable.merge(
- this.shortCaches$.map((caches) => caches.sort((a, b) => naturalCompare(a.name, b.name))).do((v) => this.shortCaches = v),
- this.shortClusters$.do((v) => this.shortClusters = v),
- this.originalCluster$.do((v) => {
+ this.isNew$ = this.$uiRouter.globals.params$.pipe(pluck('clusterID'), map((id) => id === 'new'));
+ this.shortCaches$ = this.ConfigureState.state$.pipe(this.ConfigSelectors.selectCurrentShortCaches);
+ this.shortClusters$ = this.ConfigureState.state$.pipe(this.ConfigSelectors.selectShortClustersValue());
+ this.originalCluster$ = clusterID$.pipe(
+ distinctUntilChanged(),
+ switchMap((id) => {
+ return this.ConfigureState.state$.pipe(this.ConfigSelectors.selectClusterToEdit(id));
+ }),
+ distinctUntilChanged(),
+ publishReplay(1),
+ refCount()
+ );
+
+ this.subscription = merge(
+ this.shortCaches$.pipe(
+ map((caches) => caches.sort((a, b) => naturalCompare(a.name, b.name))),
+ tap((v) => this.shortCaches = v)
+ ),
+ this.shortClusters$.pipe(tap((v) => this.shortClusters = v)),
+ this.originalCluster$.pipe(tap((v) => {
this.originalCluster = v;
// clonedCluster should be set only when particular cluster edit starts.
//
@@ -136,7 +155,7 @@ export default class PageConfigureBasicController {
// made by user and we don't want that. Advanced configuration forms do the same too.
if (get(v, '_id') !== get(this.clonedCluster, '_id')) this.clonedCluster = cloneDeep(v);
this.defaultMemoryPolicy = this.Clusters.getDefaultClusterMemoryPolicy(this.clonedCluster);
- })
+ }))
).subscribe();
this.formActionsMenu = [
http://git-wip-us.apache.org/repos/asf/ignite/blob/7d4e1fd1/modules/web-console/frontend/app/components/page-configure-basic/controller.spec.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-configure-basic/controller.spec.js b/modules/web-console/frontend/app/components/page-configure-basic/controller.spec.js
index a35eb50..a4a1d30 100644
--- a/modules/web-console/frontend/app/components/page-configure-basic/controller.spec.js
+++ b/modules/web-console/frontend/app/components/page-configure-basic/controller.spec.js
@@ -19,10 +19,8 @@ import {suite, test} from 'mocha';
import {assert} from 'chai';
import {spy} from 'sinon';
-import {TestScheduler} from 'rxjs/testing/TestScheduler';
-import {Subject} from 'rxjs/Subject';
-import {BehaviorSubject} from 'rxjs/BehaviorSubject';
-import {Subscriber} from 'rxjs/Subscriber';
+import {TestScheduler} from 'rxjs/testing';
+import {Subscriber, Subject, BehaviorSubject} from 'rxjs';
import Controller from './controller';
const mocks = () => new Map([
http://git-wip-us.apache.org/repos/asf/ignite/blob/7d4e1fd1/modules/web-console/frontend/app/components/page-configure-overview/controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-configure-overview/controller.js b/modules/web-console/frontend/app/components/page-configure-overview/controller.js
index e49e5c6..e170112 100644
--- a/modules/web-console/frontend/app/components/page-configure-overview/controller.js
+++ b/modules/web-console/frontend/app/components/page-configure-overview/controller.js
@@ -15,7 +15,8 @@
* limitations under the License.
*/
-import {Subject} from 'rxjs/Subject';
+import {Subject} from 'rxjs';
+import {map} from 'rxjs/operators';
import naturalCompare from 'natural-compare-lite';
const cellTemplate = (state) => `
@@ -81,7 +82,7 @@ export default class PageConfigureOverviewController {
}
$onInit() {
- this.shortClusters$ = this.ConfigureState.state$.let(this.ConfigSelectors.selectShortClustersValue());
+ this.shortClusters$ = this.ConfigureState.state$.pipe(this.ConfigSelectors.selectShortClustersValue());
/** @type {Array<uiGrid.IColumnDefOf<ig.config.cluster.ShortCluster>>} */
this.clustersColumnDefs = [
@@ -140,9 +141,9 @@ export default class PageConfigureOverviewController {
/** @type {Subject<Array<ig.config.cluster.ShortCluster>>} */
this.selectedRows$ = new Subject();
- this.selectedRowsIDs$ = this.selectedRows$.map((selectedClusters) => selectedClusters.map((cluster) => cluster._id));
+ this.selectedRowsIDs$ = this.selectedRows$.pipe(map((selectedClusters) => selectedClusters.map((cluster) => cluster._id)));
- this.actions$ = this.selectedRows$.map((selectedClusters) => [
+ this.actions$ = this.selectedRows$.pipe(map((selectedClusters) => [
{
action: 'Edit',
click: () => this.editCluster(selectedClusters[0]),
@@ -163,6 +164,6 @@ export default class PageConfigureOverviewController {
click: () => this.removeClusters(selectedClusters),
available: true
}
- ]);
+ ]));
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7d4e1fd1/modules/web-console/frontend/app/components/page-configure/components/modal-import-models/component.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-configure/components/modal-import-models/component.js b/modules/web-console/frontend/app/components/page-configure/components/modal-import-models/component.js
index e4b8253..7181b54 100644
--- a/modules/web-console/frontend/app/components/page-configure/components/modal-import-models/component.js
+++ b/modules/web-console/frontend/app/components/page-configure/components/modal-import-models/component.js
@@ -21,7 +21,8 @@ import _ from 'lodash';
import naturalCompare from 'natural-compare-lite';
import find from 'lodash/fp/find';
import get from 'lodash/fp/get';
-import {Observable} from 'rxjs/Observable';
+import {race, timer, merge, of, from, combineLatest} from 'rxjs';
+import {tap, filter, take, pluck, switchMap} from 'rxjs/operators';
import ObjectID from 'bson-objectid';
import {uniqueName} from 'app/utils/uniqueName';
import {defaultNames} from '../../defaultNames';
@@ -126,34 +127,34 @@ export class ModalImportModels {
}
loadData() {
- return Observable.of(this.clusterID)
- .switchMap((id = 'new') => {
- return this.ConfigureState.state$.let(this.ConfigSelectors.selectClusterToEdit(id, defaultNames.importedCluster));
- })
- .switchMap((cluster) => {
- return (!(cluster.caches || []).length && !(cluster.models || []).length)
- ? Observable.of({
- cluster,
- caches: [],
- models: []
- })
- : Observable.fromPromise(Promise.all([
- this.ConfigEffects.etp('LOAD_SHORT_CACHES', {ids: cluster.caches || [], clusterID: cluster._id}),
- this.ConfigEffects.etp('LOAD_SHORT_MODELS', {ids: cluster.models || [], clusterID: cluster._id})
- ]))
- .switchMap(() => {
- return Observable.combineLatest(
- this.ConfigureState.state$.let(this.ConfigSelectors.selectShortCachesValue()),
- this.ConfigureState.state$.let(this.ConfigSelectors.selectShortModelsValue()),
- (caches, models) => ({
- cluster,
- caches,
- models
- })
- ).take(1);
- });
- })
- .take(1);
+ return of(this.clusterID).pipe(
+ switchMap((id = 'new') => {
+ return this.ConfigureState.state$.pipe(this.ConfigSelectors.selectClusterToEdit(id, defaultNames.importedCluster));
+ }),
+ switchMap((cluster) => {
+ return (!(cluster.caches || []).length && !(cluster.models || []).length)
+ ? of({
+ cluster,
+ caches: [],
+ models: []
+ })
+ : from(Promise.all([
+ this.ConfigEffects.etp('LOAD_SHORT_CACHES', {ids: cluster.caches || [], clusterID: cluster._id}),
+ this.ConfigEffects.etp('LOAD_SHORT_MODELS', {ids: cluster.models || [], clusterID: cluster._id})
+ ])).pipe(switchMap(() => {
+ return combineLatest(
+ this.ConfigureState.state$.pipe(this.ConfigSelectors.selectShortCachesValue()),
+ this.ConfigureState.state$.pipe(this.ConfigSelectors.selectShortModelsValue()),
+ (caches, models) => ({
+ cluster,
+ caches,
+ models
+ })
+ ).pipe(take(1));
+ }));
+ }),
+ take(1)
+ );
}
saveBatch(batch) {
@@ -169,15 +170,20 @@ export class ModalImportModels {
prevActions: []
});
- this.saveSubscription = Observable.race(
- this.ConfigureState.actions$.filter((a) => a.type === 'ADVANCED_SAVE_COMPLETE_CONFIGURATION_OK')
- .do(() => this.onHide()),
- this.ConfigureState.actions$.filter((a) => a.type === 'ADVANCED_SAVE_COMPLETE_CONFIGURATION_ERR')
+ this.saveSubscription = race(
+ this.ConfigureState.actions$.pipe(
+ filter((a) => a.type === 'ADVANCED_SAVE_COMPLETE_CONFIGURATION_OK'),
+ tap(() => this.onHide())
+ ),
+ this.ConfigureState.actions$.pipe(
+ filter((a) => a.type === 'ADVANCED_SAVE_COMPLETE_CONFIGURATION_ERR')
+ )
+ ).pipe(
+ take(1),
+ tap(() => {
+ this.Loading.finish('importDomainFromDb');
+ })
)
- .take(1)
- .do(() => {
- this.Loading.finish('importDomainFromDb');
- })
.subscribe();
}
@@ -231,18 +237,23 @@ export class ModalImportModels {
if (this.loadedCaches[cacheID])
return;
- return this.onCacheSelectSubcription = Observable.merge(
- Observable.timer(0, 1).take(1)
- .do(() => this.ConfigureState.dispatchAction({type: 'LOAD_CACHE', cacheID})),
- Observable.race(
- this.ConfigureState.actions$
- .filter((a) => a.type === 'LOAD_CACHE_OK' && a.cache._id === cacheID).pluck('cache')
- .do((cache) => {
+ return this.onCacheSelectSubcription = merge(
+ timer(0, 1).pipe(
+ take(1),
+ tap(() => this.ConfigureState.dispatchAction({type: 'LOAD_CACHE', cacheID}))
+ ),
+ race(
+ this.ConfigureState.actions$.pipe(
+ filter((a) => a.type === 'LOAD_CACHE_OK' && a.cache._id === cacheID),
+ pluck('cache'),
+ tap((cache) => {
this.loadedCaches[cacheID] = cache;
- }),
- this.ConfigureState.actions$
- .filter((a) => a.type === 'LOAD_CACHE_ERR' && a.action.cacheID === cacheID)
- ).take(1)
+ })
+ ),
+ this.ConfigureState.actions$.pipe(
+ filter((a) => a.type === 'LOAD_CACHE_ERR' && a.action.cacheID === cacheID)
+ )
+ ).pipe(take(1))
)
.subscribe();
}
@@ -291,7 +302,7 @@ export class ModalImportModels {
this.$scope.importCommon = {};
- this.subscription = this.loadData().do((data) => {
+ this.subscription = this.loadData().pipe(tap((data) => {
this.$scope.caches = _mapCaches(data.caches);
this.$scope.domains = data.models;
this.caches = data.caches;
@@ -306,7 +317,7 @@ export class ModalImportModels {
}
this.$scope.$watch('importCommon.action', this._fillCommonCachesOrTemplates(this.$scope.importCommon), true);
this.$scope.importCommon.action = IMPORT_DM_NEW_CACHE;
- }).subscribe();
+ })).subscribe();
// New
this.loadedCaches = {
http://git-wip-us.apache.org/repos/asf/ignite/blob/7d4e1fd1/modules/web-console/frontend/app/components/page-configure/controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-configure/controller.js b/modules/web-console/frontend/app/components/page-configure/controller.js
index 91bdf50..7a83aa6 100644
--- a/modules/web-console/frontend/app/components/page-configure/controller.js
+++ b/modules/web-console/frontend/app/components/page-configure/controller.js
@@ -16,10 +16,8 @@
*/
import get from 'lodash/get';
-import {Observable} from 'rxjs/Observable';
-import 'rxjs/add/observable/merge';
-import {combineLatest} from 'rxjs/observable/combineLatest';
-import 'rxjs/add/operator/distinctUntilChanged';
+import {Observable, combineLatest} from 'rxjs';
+import {pluck, switchMap, map} from 'rxjs/operators';
import {default as ConfigureState} from './services/ConfigureState';
import {default as ConfigSelectors} from './store/selectors';
@@ -39,9 +37,12 @@ export default class PageConfigureController {
$onInit() {
/** @type {Observable<string>} */
- this.clusterID$ = this.$uiRouter.globals.params$.pluck('clusterID');
- const cluster$ = this.clusterID$.switchMap((id) => this.ConfigureState.state$.let(this.ConfigSelectors.selectCluster(id)));
- const isNew$ = this.clusterID$.map((v) => v === 'new');
+ this.clusterID$ = this.$uiRouter.globals.params$.pipe(pluck('clusterID'));
+
+ const cluster$ = this.clusterID$.pipe(switchMap((id) => this.ConfigureState.state$.pipe(this.ConfigSelectors.selectCluster(id))));
+
+ const isNew$ = this.clusterID$.pipe(map((v) => v === 'new'));
+
this.clusterName$ = combineLatest(cluster$, isNew$, (cluster, isNew) => {
return `${isNew ? 'Create' : 'Edit'} cluster configuration ${isNew ? '' : `‘${get(cluster, 'name')}’`}`;
});
http://git-wip-us.apache.org/repos/asf/ignite/blob/7d4e1fd1/modules/web-console/frontend/app/components/page-configure/index.d.ts
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-configure/index.d.ts b/modules/web-console/frontend/app/components/page-configure/index.d.ts
index 96773fa..c0eca6a 100644
--- a/modules/web-console/frontend/app/components/page-configure/index.d.ts
+++ b/modules/web-console/frontend/app/components/page-configure/index.d.ts
@@ -15,11 +15,10 @@
* limitations under the License.
*/
-import {Observable} from 'rxjs/Observable'
/// <reference path="./types/uirouter.d.ts" />
declare namespace ig {
- type menu<T> = Array<{value: T, label: string}>
+ type menu < T > = Array<{value: T, label: string}>;
namespace config {
namespace formFieldSize {
@@ -27,11 +26,12 @@ declare namespace ig {
label: string,
value: number
}
- type ISizeType = Array<ISizeTypeOption>
+ type ISizeType = Array<ISizeTypeOption>;
interface ISizeTypes {
[name: string]: ISizeType
}
}
+
namespace cluster {
export type DiscoveryKinds = 'Vm'
| 'Multicast'
@@ -41,14 +41,14 @@ declare namespace ig {
| 'Jdbc'
| 'SharedFs'
| 'ZooKeeper'
- | 'Kubernetes'
+ | 'Kubernetes';
export type LoadBalancingKinds = 'RoundRobin'
| 'Adaptive'
| 'WeightedRandom'
- | 'Custom'
+ | 'Custom';
- export type FailoverSPIs = 'JobStealing' | 'Never' | 'Always' | 'Custom'
+ export type FailoverSPIs = 'JobStealing' | 'Never' | 'Always' | 'Custom';
export interface ShortCluster {
_id: string,
@@ -59,9 +59,10 @@ declare namespace ig {
igfs: number
}
}
+
namespace cache {
- type CacheModes = 'PARTITIONED' | 'REPLICATED' | 'LOCAL'
- type AtomicityModes = 'ATOMIC' | 'TRANSACTIONAL'
+ type CacheModes = 'PARTITIONED' | 'REPLICATED' | 'LOCAL';
+ type AtomicityModes = 'ATOMIC' | 'TRANSACTIONAL';
export interface ShortCache {
_id: string,
cacheMode: CacheModes,
@@ -69,9 +70,10 @@ declare namespace ig {
backups: number
}
}
+
namespace model {
- type QueryMetadataTypes = 'Annotations' | 'Configuration'
- type DomainModelKinds = 'query' | 'store' | 'both'
+ type QueryMetadataTypes = 'Annotations' | 'Configuration';
+ type DomainModelKinds = 'query' | 'store' | 'both';
export interface KeyField {
databaseFieldName: string,
databaseFieldType: string,
@@ -92,7 +94,7 @@ declare namespace ig {
field: string,
alias: string
}
- type IndexTypes = 'SORTED' | 'FULLTEXT' | 'GEOSPATIAL'
+ type IndexTypes = 'SORTED' | 'FULLTEXT' | 'GEOSPATIAL';
export interface IndexField {
_id: string,
name?: string,
@@ -135,8 +137,9 @@ declare namespace ig {
hasIndex: boolean
}
}
+
namespace igfs {
- type DefaultModes = 'PRIMARY' | 'PROXY' | 'DUAL_SYNC' | 'DUAL_ASYNC'
+ type DefaultModes = 'PRIMARY' | 'PROXY' | 'DUAL_SYNC' | 'DUAL_ASYNC';
export interface ShortIGFS {
_id: string,
name: string,
@@ -148,4 +151,4 @@ declare namespace ig {
}
export as namespace ig
-export = ig
\ No newline at end of file
+export = ig
http://git-wip-us.apache.org/repos/asf/ignite/blob/7d4e1fd1/modules/web-console/frontend/app/components/page-configure/index.ts
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-configure/index.ts b/modules/web-console/frontend/app/components/page-configure/index.ts
index dd2ad20..a2f76e1 100644
--- a/modules/web-console/frontend/app/components/page-configure/index.ts
+++ b/modules/web-console/frontend/app/components/page-configure/index.ts
@@ -49,23 +49,15 @@ import pcSplitButton from './components/pc-split-button';
import {errorState} from './transitionHooks/errorState';
import {default as ActivitiesData} from 'app/core/activities/Activities.data';
-import 'rxjs/add/operator/withLatestFrom';
-import 'rxjs/add/operator/skip';
-
-import {Observable} from 'rxjs/Observable';
+import {withLatestFrom, tap, filter, scan} from 'rxjs/operators';
import {navigationMenuItem, AppStore} from '../../store';
import {default as configurationIcon} from './icons/configuration.icon.svg';
import {default as IconsService} from '../ignite-icon/service';
-Observable.prototype.debug = function(l) {
- return this.do((v) => console.log(l, v), (e) => console.error(l, e), () => console.log(l, 'completed'));
-};
-
import {
editReducer2,
shortObjectsReducer,
- reducer,
editReducer,
loadingReducer,
itemsEditReducerFactory,
@@ -83,7 +75,6 @@ import {
refsReducer
} from './reducer';
-import {reducer as reduxDevtoolsReducer, devTools} from './reduxDevtoolsIntegration';
import {registerStates} from './states';
/**
@@ -156,18 +147,19 @@ export default angular
}
});
- const la = ConfigureState.actions$.scan((acc, action) => [...acc, action], []);
+ const la = ConfigureState.actions$.pipe(scan((acc, action) => [...acc, action], []));
- ConfigureState.actions$
- .filter((a) => a.type === 'UNDO_ACTIONS')
- .withLatestFrom(la, ({actions}, actionsWindow, initialState) => {
+ ConfigureState.actions$.pipe(
+ filter((a) => a.type === 'UNDO_ACTIONS'),
+ withLatestFrom(la, ({actions}, actionsWindow, initialState) => {
return {
type: 'APPLY_ACTIONS_UNDO',
state: actionsWindow.filter((a) => !actions.includes(a)).reduce(ConfigureState._combinedReducer, {})
};
- })
- .do((a) => ConfigureState.dispatchAction(a))
- .subscribe();
+ }),
+ tap((a) => ConfigureState.dispatchAction(a))
+ )
+ .subscribe();
ConfigEffects.connect();
store.dispatch(navigationMenuItem({
http://git-wip-us.apache.org/repos/asf/ignite/blob/7d4e1fd1/modules/web-console/frontend/app/components/page-configure/services/ConfigChangesGuard.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-configure/services/ConfigChangesGuard.js b/modules/web-console/frontend/app/components/page-configure/services/ConfigChangesGuard.js
index 7e2df80..cda9965 100644
--- a/modules/web-console/frontend/app/components/page-configure/services/ConfigChangesGuard.js
+++ b/modules/web-console/frontend/app/components/page-configure/services/ConfigChangesGuard.js
@@ -15,7 +15,8 @@
* limitations under the License.
*/
-import {of} from 'rxjs/observable/of';
+import {of} from 'rxjs';
+import {switchMap, catchError} from 'rxjs/operators';
import {Confirm} from 'app/services/Confirm.service';
import {DiffPatcher} from 'jsondiffpatch';
import {html} from 'jsondiffpatch/public/build/jsondiffpatch-formatters.js';
@@ -92,9 +93,9 @@ export default class ConfigChangesGuard {
if (!a && !b)
return Promise.resolve(true);
- return of(this._hasChanges(a, b))
- .switchMap((changes) => changes ? this._confirm(changes).then(() => true) : of(true))
- .catch(() => of(false))
- .toPromise();
+ return of(this._hasChanges(a, b)).pipe(
+ switchMap((changes) => changes ? this._confirm(changes).then(() => true) : of(true)),
+ catchError(() => of(false))
+ ).toPromise();
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7d4e1fd1/modules/web-console/frontend/app/components/page-configure/services/ConfigSelectionManager.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-configure/services/ConfigSelectionManager.js b/modules/web-console/frontend/app/components/page-configure/services/ConfigSelectionManager.js
index 243302a..b5b46d6 100644
--- a/modules/web-console/frontend/app/components/page-configure/services/ConfigSelectionManager.js
+++ b/modules/web-console/frontend/app/components/page-configure/services/ConfigSelectionManager.js
@@ -15,12 +15,9 @@
* limitations under the License.
*/
-import {Observable} from 'rxjs/Observable';
-import {merge} from 'rxjs/observable/merge';
+import {Observable, merge} from 'rxjs';
+import {share, distinctUntilChanged, startWith, filter, map, pluck, withLatestFrom, mapTo} from 'rxjs/operators';
import {RejectType} from '@uirouter/angularjs';
-import 'rxjs/add/operator/share';
-import 'rxjs/add/operator/mapTo';
-import 'rxjs/add/operator/startWith';
import isEqual from 'lodash/isEqual';
/**
@@ -35,57 +32,63 @@ export default function configSelectionManager($transitions) {
// but decides to stay after screen asks for leave confirmation.
const abortedTransitions$ = Observable.create((observer) => {
return $transitions.onError({}, (t) => observer.next(t));
- })
- .filter((t) => t.error().type === RejectType.ABORTED);
+ }).pipe(filter((t) => t.error().type === RejectType.ABORTED));
- const firstItemID$ = visibleRows$.withLatestFrom(itemID$, loadedItems$)
- .filter(([rows, id, items]) => !id && rows && rows.length === items.length)
- .pluck('0', '0', 'entity', '_id');
+ const firstItemID$ = visibleRows$.pipe(
+ withLatestFrom(itemID$, loadedItems$),
+ filter(([rows, id, items]) => !id && rows && rows.length === items.length),
+ pluck('0', '0', 'entity', '_id')
+ );
- const selectedItemRowsIDs$ = selectedItemRows$.map((rows) => rows.map((r) => r._id)).share();
- const singleSelectionEdit$ = selectedItemRows$.filter((r) => r && r.length === 1).pluck('0', '_id');
- const selectedMultipleOrNone$ = selectedItemRows$.filter((r) => r.length > 1 || r.length === 0);
- const loadedItemIDs$ = loadedItems$.map((rows) => new Set(rows.map((r) => r._id))).share();
- const currentItemWasRemoved$ = loadedItemIDs$
- .withLatestFrom(
- itemID$.filter((v) => v && v !== 'new'),
+ const selectedItemRowsIDs$ = selectedItemRows$.pipe(map((rows) => rows.map((r) => r._id)), share());
+ const singleSelectionEdit$ = selectedItemRows$.pipe(filter((r) => r && r.length === 1), pluck('0', '_id'));
+ const selectedMultipleOrNone$ = selectedItemRows$.pipe(filter((r) => r.length > 1 || r.length === 0));
+ const loadedItemIDs$ = loadedItems$.pipe(map((rows) => new Set(rows.map((r) => r._id))), share());
+ const currentItemWasRemoved$ = loadedItemIDs$.pipe(
+ withLatestFrom(
+ itemID$.pipe(filter((v) => v && v !== 'new')),
/**
* Without startWith currentItemWasRemoved$ won't emit in the following scenario:
* 1. User opens items page (no item id in location).
* 2. Selection manager commands to edit first item.
* 3. User removes said item.
*/
- selectedItemRowsIDs$.startWith([])
- )
- .filter(([existingIDs, itemID, selectedIDs]) => !existingIDs.has(itemID))
- .map(([existingIDs, itemID, selectedIDs]) => selectedIDs.filter((id) => id !== itemID))
- .share();
+ selectedItemRowsIDs$.pipe(startWith([]))
+ ),
+ filter(([existingIDs, itemID, selectedIDs]) => !existingIDs.has(itemID)),
+ map(([existingIDs, itemID, selectedIDs]) => selectedIDs.filter((id) => id !== itemID)),
+ share()
+ );
// Edit first loaded item or when there's only one item selected
- const editGoes$ = merge(firstItemID$, singleSelectionEdit$)
+ const editGoes$ = merge(firstItemID$, singleSelectionEdit$).pipe(
// Don't go to non-existing items.
// Happens when user naviagtes to older history and some items were already removed.
- .withLatestFrom(loadedItemIDs$).filter(([id, loaded]) => id && loaded.has(id)).pluck('0');
+ withLatestFrom(loadedItemIDs$),
+ filter(([id, loaded]) => id && loaded.has(id)),
+ pluck('0')
+ );
// Stop edit when multiple or none items are selected or when current item was removed
const editLeaves$ = merge(
- selectedMultipleOrNone$.mapTo({}),
- currentItemWasRemoved$.mapTo({location: 'replace', custom: {justIDUpdate: true}})
- ).share();
+ selectedMultipleOrNone$.pipe(mapTo({})),
+ currentItemWasRemoved$.pipe(mapTo({location: 'replace', custom: {justIDUpdate: true}}))
+ ).pipe(share());
const selectedItemIDs$ = merge(
// Select nothing when creating an item or select current item
- itemID$.filter((id) => id).map((id) => id === 'new' ? [] : [id]),
+ itemID$.pipe(filter((id) => id), map((id) => id === 'new' ? [] : [id])),
// Restore previous item selection when transition gets aborted
- abortedTransitions$.withLatestFrom(itemID$, (_, id) => [id]),
+ abortedTransitions$.pipe(withLatestFrom(itemID$, (_, id) => [id])),
// Select all incoming selected rows
selectedItemRowsIDs$
- )
- // If nothing's selected and there are zero rows, ui-grid will behave as if all rows are selected
- .startWith([])
- // Some scenarios cause same item to be selected multiple times in a row,
- // so it makes sense to filter out duplicate entries
- .distinctUntilChanged(isEqual)
- .share();
+ ).pipe(
+ // If nothing's selected and there are zero rows, ui-grid will behave as if all rows are selected
+ startWith([]),
+ // Some scenarios cause same item to be selected multiple times in a row,
+ // so it makes sense to filter out duplicate entries
+ distinctUntilChanged(isEqual),
+ share()
+ );
return {selectedItemIDs$, editGoes$, editLeaves$};
};
http://git-wip-us.apache.org/repos/asf/ignite/blob/7d4e1fd1/modules/web-console/frontend/app/components/page-configure/services/ConfigureState.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-configure/services/ConfigureState.js b/modules/web-console/frontend/app/components/page-configure/services/ConfigureState.js
index ed911be..143944c 100644
--- a/modules/web-console/frontend/app/components/page-configure/services/ConfigureState.js
+++ b/modules/web-console/frontend/app/components/page-configure/services/ConfigureState.js
@@ -15,10 +15,8 @@
* limitations under the License.
*/
-import {Subject} from 'rxjs/Subject';
-import {BehaviorSubject} from 'rxjs/BehaviorSubject';
-import 'rxjs/add/operator/do';
-import 'rxjs/add/operator/scan';
+import {Subject, BehaviorSubject} from 'rxjs';
+import {tap, scan} from 'rxjs/operators';
export default class ConfigureState {
constructor() {
@@ -38,7 +36,10 @@ export default class ConfigureState {
}
};
- this.actions$.scan(reducer, {}).do((v) => this.state$.next(v)).subscribe();
+ this.actions$.pipe(
+ scan(reducer, {}),
+ tap((v) => this.state$.next(v))
+ ).subscribe();
}
addReducer(combineFn) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/7d4e1fd1/modules/web-console/frontend/app/components/page-configure/services/PageConfigure.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-configure/services/PageConfigure.js b/modules/web-console/frontend/app/components/page-configure/services/PageConfigure.js
index d81921e..5eaedde 100644
--- a/modules/web-console/frontend/app/components/page-configure/services/PageConfigure.js
+++ b/modules/web-console/frontend/app/components/page-configure/services/PageConfigure.js
@@ -15,21 +15,11 @@
* limitations under the License.
*/
-import {Observable} from 'rxjs/Observable';
-import 'rxjs/add/operator/filter';
-import 'rxjs/add/operator/map';
-import 'rxjs/add/operator/take';
-import 'rxjs/add/operator/switchMap';
-import 'rxjs/add/operator/merge';
-import 'rxjs/add/operator/catch';
-import 'rxjs/add/operator/withLatestFrom';
-import 'rxjs/add/observable/empty';
-import 'rxjs/add/observable/of';
-import 'rxjs/add/observable/from';
-import 'rxjs/add/observable/forkJoin';
-import 'rxjs/add/observable/timer';
import cloneDeep from 'lodash/cloneDeep';
+import {merge, timer} from 'rxjs';
+import {take, tap, ignoreElements, filter, map, pluck} from 'rxjs/operators';
+
import {
ofType
} from '../store/effects';
@@ -50,20 +40,25 @@ export default class PageConfigure {
}
getClusterConfiguration({clusterID, isDemo}) {
- return Observable.merge(
- Observable
- .timer(1)
- .take(1)
- .do(() => this.ConfigureState.dispatchAction({type: 'LOAD_COMPLETE_CONFIGURATION', clusterID, isDemo}))
- .ignoreElements(),
- this.ConfigureState.actions$.let(ofType('LOAD_COMPLETE_CONFIGURATION_ERR')).take(1).pluck('error').map((e) => Promise.reject(e)),
- this.ConfigureState.state$
- .let(this.ConfigSelectors.selectCompleteClusterConfiguration({clusterID, isDemo}))
- .filter((c) => c.__isComplete)
- .take(1)
- .map((data) => ({...data, clusters: [cloneDeep(data.cluster)]}))
- )
- .take(1)
+ return merge(
+ timer(1).pipe(
+ take(1),
+ tap(() => this.ConfigureState.dispatchAction({type: 'LOAD_COMPLETE_CONFIGURATION', clusterID, isDemo})),
+ ignoreElements()
+ ),
+ this.ConfigureState.actions$.pipe(
+ ofType('LOAD_COMPLETE_CONFIGURATION_ERR'),
+ take(1),
+ pluck('error'),
+ map((e) => Promise.reject(e))
+ ),
+ this.ConfigureState.state$.pipe(
+ this.ConfigSelectors.selectCompleteClusterConfiguration({clusterID, isDemo}),
+ filter((c) => c.__isComplete),
+ take(1),
+ map((data) => ({...data, clusters: [cloneDeep(data.cluster)]}))
+ )
+ ).pipe(take(1))
.toPromise();
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7d4e1fd1/modules/web-console/frontend/app/components/page-configure/services/PageConfigure.spec.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-configure/services/PageConfigure.spec.js b/modules/web-console/frontend/app/components/page-configure/services/PageConfigure.spec.js
index bc72cd3..145eed6 100644
--- a/modules/web-console/frontend/app/components/page-configure/services/PageConfigure.spec.js
+++ b/modules/web-console/frontend/app/components/page-configure/services/PageConfigure.spec.js
@@ -18,11 +18,8 @@
import {suite, test} from 'mocha';
import {assert} from 'chai';
import {spy} from 'sinon';
-import {TestScheduler} from 'rxjs/testing/TestScheduler';
-import {Observable} from 'rxjs/Observable';
-
-import 'rxjs/add/observable/of';
-import 'rxjs/add/observable/throw';
+import {of, throwError} from 'rxjs';
+import {TestScheduler} from 'rxjs/testing';
const mocks = () => new Map([
['IgniteConfigurationResource', {}],
@@ -79,7 +76,7 @@ suite.skip('PageConfigure service', () => {
const deps = mocks()
.set('Clusters', {
- saveCluster$: (c) => Observable.of({data: 99})
+ saveCluster$: (c) => of({data: 99})
})
.set('ConfigureState', {
actions$: testScheduler.createHotObservable(actions, values),
@@ -135,8 +132,8 @@ suite.skip('PageConfigure service', () => {
const deps = mocks()
.set('Clusters', {
saveCluster$: (c) => c.name === values.b.clusters[0].name
- ? Observable.of({data: 99})
- : Observable.throw()
+ ? of({data: 99})
+ : throwError()
})
.set('ConfigureState', {
actions$: testScheduler.createHotObservable(actions, values),
@@ -188,7 +185,7 @@ suite.skip('PageConfigure service', () => {
dispatchAction: spy()
})
.set('Clusters', {
- removeCluster$: (v) => Observable.of(v)
+ removeCluster$: (v) => of(v)
});
const s = new PageConfigure(...deps.values());
@@ -232,7 +229,7 @@ suite.skip('PageConfigure service', () => {
dispatchAction: spy()
})
.set('Clusters', {
- removeCluster$: (v) => v._id % 2 ? Observable.of(v) : Observable.throw()
+ removeCluster$: (v) => v._id % 2 ? of(v) : throwError()
});
const s = new PageConfigure(...deps.values());
http://git-wip-us.apache.org/repos/asf/ignite/blob/7d4e1fd1/modules/web-console/frontend/app/components/page-configure/states.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-configure/states.js b/modules/web-console/frontend/app/components/page-configure/states.js
index 3ba5bb7..3b8dec9 100644
--- a/modules/web-console/frontend/app/components/page-configure/states.js
+++ b/modules/web-console/frontend/app/components/page-configure/states.js
@@ -20,19 +20,21 @@ import pageConfigureAdvancedModelsComponent from '../page-configure-advanced/com
import pageConfigureAdvancedCachesComponent from '../page-configure-advanced/components/page-configure-advanced-caches/component';
import pageConfigureAdvancedIGFSComponent from '../page-configure-advanced/components/page-configure-advanced-igfs/component';
-import {Observable} from 'rxjs/Observable';
+import {Observable, from, combineLatest} from 'rxjs';
+import {switchMap, take, map} from 'rxjs/operators';
const idRegex = `new|[a-z0-9]+`;
const shortCachesResolve = ['ConfigSelectors', 'ConfigureState', 'ConfigEffects', '$transition$', function(ConfigSelectors, ConfigureState, {etp}, $transition$) {
if ($transition$.params().clusterID === 'new')
return Promise.resolve();
- return Observable.fromPromise($transition$.injector().getAsync('_cluster'))
- .switchMap(() => ConfigureState.state$.let(ConfigSelectors.selectCluster($transition$.params().clusterID)).take(1))
- .switchMap((cluster) => {
+ return from($transition$.injector().getAsync('_cluster')).pipe(
+ switchMap(() => ConfigureState.state$.pipe(ConfigSelectors.selectCluster($transition$.params().clusterID), take(1))),
+ switchMap((cluster) => {
return etp('LOAD_SHORT_CACHES', {ids: cluster.caches, clusterID: cluster._id});
})
- .toPromise();
+ )
+ .toPromise();
}];
function registerStates($stateProvider) {
@@ -77,17 +79,19 @@ function registerStates($stateProvider) {
redirectTo: ($transition$) => {
const [ConfigureState, ConfigSelectors] = ['ConfigureState', 'ConfigSelectors'].map((t) => $transition$.injector().get(t));
const waitFor = ['_cluster', '_shortClusters'].map((t) => $transition$.injector().getAsync(t));
- return Observable.fromPromise(Promise.all(waitFor)).switchMap(() => {
- return Observable.combineLatest(
- ConfigureState.state$.let(ConfigSelectors.selectCluster($transition$.params().clusterID)).take(1),
- ConfigureState.state$.let(ConfigSelectors.selectShortClusters()).take(1)
- );
- })
- .map(([cluster = {caches: []}, clusters]) => {
- return (clusters.value.size > 10 || cluster.caches.length > 5)
- ? 'base.configuration.edit.advanced'
- : 'base.configuration.edit.basic';
- })
+ return from(Promise.all(waitFor)).pipe(
+ switchMap(() => {
+ return combineLatest(
+ ConfigureState.state$.pipe(ConfigSelectors.selectCluster($transition$.params().clusterID), take(1)),
+ ConfigureState.state$.pipe(ConfigSelectors.selectShortClusters(), take(1))
+ );
+ }),
+ map(([cluster = {caches: []}, clusters]) => {
+ return (clusters.value.size > 10 || cluster.caches.length > 5)
+ ? 'base.configuration.edit.advanced'
+ : 'base.configuration.edit.basic';
+ })
+ )
.toPromise();
},
failState: 'signin',
@@ -138,16 +142,17 @@ function registerStates($stateProvider) {
if ($transition$.params().clusterID === 'new')
return Promise.resolve();
- return Observable.fromPromise($transition$.injector().getAsync('_cluster'))
- .switchMap(() => ConfigureState.state$.let(ConfigSelectors.selectCluster($transition$.params().clusterID)).take(1))
- .map((cluster) => {
+ return from($transition$.injector().getAsync('_cluster')).pipe(
+ switchMap(() => ConfigureState.state$.pipe(ConfigSelectors.selectCluster($transition$.params().clusterID), take(1))),
+ map((cluster) => {
return Promise.all([
etp('LOAD_SHORT_CACHES', {ids: cluster.caches, clusterID: cluster._id}),
etp('LOAD_SHORT_MODELS', {ids: cluster.models, clusterID: cluster._id}),
etp('LOAD_SHORT_IGFSS', {ids: cluster.igfss, clusterID: cluster._id})
]);
})
- .toPromise();
+ )
+ .toPromise();
}]
},
resolvePolicy: {
@@ -163,6 +168,7 @@ function registerStates($stateProvider) {
resolve: {
_cache: ['ConfigEffects', '$transition$', ({etp}, $transition$) => {
const {clusterID, cacheID} = $transition$.params();
+
if (cacheID === 'new')
return Promise.resolve();
@@ -188,15 +194,15 @@ function registerStates($stateProvider) {
if ($transition$.params().clusterID === 'new')
return Promise.resolve();
- return Observable.fromPromise($transition$.injector().getAsync('_cluster'))
- .switchMap(() => ConfigureState.state$.let(ConfigSelectors.selectCluster($transition$.params().clusterID)).take(1))
- .map((cluster) => {
+ return from($transition$.injector().getAsync('_cluster')).pipe(
+ switchMap(() => ConfigureState.state$.pipe(ConfigSelectors.selectCluster($transition$.params().clusterID), take(1))),
+ map((cluster) => {
return Promise.all([
etp('LOAD_SHORT_CACHES', {ids: cluster.caches, clusterID: cluster._id}),
etp('LOAD_SHORT_MODELS', {ids: cluster.models, clusterID: cluster._id})
]);
})
- .toPromise();
+ ).toPromise();
}]
},
resolvePolicy: {
@@ -235,14 +241,14 @@ function registerStates($stateProvider) {
if ($transition$.params().clusterID === 'new')
return Promise.resolve();
- return Observable.fromPromise($transition$.injector().getAsync('_cluster'))
- .switchMap(() => ConfigureState.state$.let(ConfigSelectors.selectCluster($transition$.params().clusterID)).take(1))
- .map((cluster) => {
+ return from($transition$.injector().getAsync('_cluster')).pipe(
+ switchMap(() => ConfigureState.state$.pipe(ConfigSelectors.selectCluster($transition$.params().clusterID), take(1))),
+ map((cluster) => {
return Promise.all([
etp('LOAD_SHORT_IGFSS', {ids: cluster.igfss, clusterID: cluster._id})
]);
})
- .toPromise();
+ ).toPromise();
}]
},
resolvePolicy: {