Basic migration to RxJS 6, Ref: #154

This commit is contained in:
ziajka 2018-07-06 11:31:44 +02:00
parent b7ef2fe643
commit 06269bf2a2
31 changed files with 1032 additions and 3151 deletions

View File

@ -1,66 +0,0 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"project": {
"name": "gns3-web-ui"
},
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
"styles": [
"../node_modules/bootstrap/dist/css/bootstrap.min.css",
"styles.css",
"theme.scss"
],
"scripts": [],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts",
"electronProd": "environments/environment.electron.prod.ts",
"electronDev": "environments/environment.electron.ts",
"githubProd": "environments/environment.github.prod.ts"
}
}
],
"e2e": {
"protractor": {
"config": "./protractor.conf.js"
}
},
"lint": [
{
"project": "src/tsconfig.app.json",
"exclude": "**/node_modules/**"
},
{
"project": "src/tsconfig.spec.json",
"exclude": "**/node_modules/**"
},
{
"project": "e2e/tsconfig.e2e.json",
"exclude": "**/node_modules/**"
}
],
"test": {
"karma": {
"config": "./karma.conf.js"
}
},
"defaults": {
"styleExt": "scss",
"component": {
}
}
}

187
angular.json Normal file
View File

@ -0,0 +1,187 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"gns3-web-ui": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist",
"index": "src/index.html",
"main": "src/main.ts",
"tsConfig": "src/tsconfig.app.json",
"polyfills": "src/polyfills.ts",
"assets": [
"src/assets",
"src/favicon.ico"
],
"styles": [
"node_modules/bootstrap/dist/css/bootstrap.min.css",
"src/styles.css",
"src/theme.scss"
],
"scripts": []
},
"configurations": {
"production": {
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
]
},
"electronProd": {
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.electron.prod.ts"
}
]
},
"electronDev": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.electron.ts"
}
]
},
"githubProd": {
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.github.prod.ts"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "gns3-web-ui:build"
},
"configurations": {
"production": {
"browserTarget": "gns3-web-ui:build:production"
},
"electronProd": {
"browserTarget": "gns3-web-ui:build:electronProd"
},
"electronDev": {
"browserTarget": "gns3-web-ui:build:electronDev"
},
"githubProd": {
"browserTarget": "gns3-web-ui:build:githubProd"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "gns3-web-ui:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"karmaConfig": "./karma.conf.js",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"scripts": [],
"styles": [
"node_modules/bootstrap/dist/css/bootstrap.min.css",
"src/styles.css",
"src/theme.scss"
],
"assets": [
"src/assets",
"src/favicon.ico"
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"gns3-web-ui-e2e": {
"root": "",
"sourceRoot": "e2e",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "./protractor.conf.js",
"devServerTarget": "gns3-web-ui:serve"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"e2e/tsconfig.e2e.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "gns3-web-ui",
"schematics": {
"@schematics/angular:component": {
"prefix": "app",
"styleext": "scss"
},
"@schematics/angular:directive": {
"prefix": "app"
}
}
}

View File

@ -4,24 +4,22 @@
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular/cli'],
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular/cli/plugins/karma')
require('@angular-devkit/build-angular/plugins/karma')
],
client:{
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
reports: [ 'html', 'lcovonly' ],
dir: require('path').join(__dirname, 'coverage'), reports: [ 'html', 'lcovonly' ],
fixWebpackSourcePaths: true
},
angularCli: {
environment: 'dev'
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,

View File

@ -26,62 +26,63 @@
},
"private": true,
"dependencies": {
"@angular/animations": "^5.2.9",
"@angular/cdk": "^5.2.4",
"@angular/common": "^5.2.9",
"@angular/compiler": "^5.2.9",
"@angular/core": "^5.2.9",
"@angular/forms": "^5.2.9",
"@angular/http": "^5.2.9",
"@angular/material": "^5.2.4",
"@angular/platform-browser": "^5.2.9",
"@angular/platform-browser-dynamic": "^5.2.9",
"@angular/router": "^5.2.9",
"@ng-bootstrap/ng-bootstrap": "^2.0.0-alpha.0",
"@angular/animations": "^6.0.7",
"@angular/cdk": "^6.3.2",
"@angular/common": "^6.0.7",
"@angular/compiler": "^6.0.7",
"@angular/core": "^6.0.7",
"@angular/forms": "^6.0.7",
"@angular/http": "^6.0.7",
"@angular/material": "^6.3.2",
"@angular/platform-browser": "^6.0.7",
"@angular/platform-browser-dynamic": "^6.0.7",
"@angular/router": "^6.0.7",
"@ng-bootstrap/ng-bootstrap": "^2.2.0",
"angular-persistence": "^1.0.1",
"angular2-hotkeys": "^2.0.4",
"angular2-hotkeys": "^2.1.2",
"angular2-indexeddb": "^1.2.2",
"bootstrap": "4.1.0",
"core-js": "^2.5.5",
"css-tree": "^1.0.0-alpha.28",
"bootstrap": "4.1.1",
"core-js": "^2.5.7",
"css-tree": "^1.0.0-alpha.29",
"d3-ng2-service": "^2.1.0",
"electron-settings": "^3.1.4",
"electron-settings": "^3.2.0",
"material-design-icons": "^3.0.1",
"ngx-electron": "^1.0.4",
"npm-check-updates": "^2.14.1",
"raven-js": "^3.24.1",
"rxjs": "^5.5.9",
"rxjs": "^6.2.1",
"typeface-roboto": "^0.0.54",
"yargs": "^11.0.0",
"yargs": "^12.0.1",
"zone.js": "^0.8.26"
},
"devDependencies": {
"@angular/cli": "^1.7.4",
"@angular/compiler-cli": "^5.2.9",
"@angular/language-service": "^5.2.9",
"@sentry/electron": "^0.5.0",
"@types/jasmine": "~2.8.6",
"@angular/cli": "^6.0.8",
"@angular/compiler-cli": "^6.0.7",
"@angular/language-service": "^6.0.7",
"@sentry/electron": "^0.5.5",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "~2.0.2",
"@types/node": "~9.6.4",
"codelyzer": "~4.2.1",
"electron": "1.8.4",
"electron-builder": "^20.8.1",
"@types/node": "~10.5.2",
"codelyzer": "~4.4.2",
"electron": "2.0.4",
"electron-builder": "^20.19.2",
"jasmine-core": "~3.1.0",
"jasmine-spec-reporter": "~4.2.1",
"jquery": "^3.3.1",
"karma": "~2.0.0",
"karma": "~2.0.4",
"karma-chrome-launcher": "~2.2.0",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.4.2",
"karma-coverage-istanbul-reporter": "^2.0.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^1.0.0",
"node-sass": "^4.8.3",
"karma-jasmine-html-reporter": "^1.2.0",
"node-sass": "^4.9.1",
"popper.js": "^1.14.3",
"protractor": "~5.3.1",
"ts-mockito": "^2.3.0",
"ts-node": "~5.0.1",
"tslint": "~5.9.1",
"typescript": ">=2.4.2 <2.7.0"
"ts-node": "~7.0.0",
"tslint": "~5.10.0",
"typescript": "^2.9.2",
"@angular-devkit/build-angular": "~0.6.8"
},
"greenkeeper": {
"ignore": [

View File

@ -1,4 +1,4 @@
import { BehaviorSubject } from "rxjs/BehaviorSubject";
import { BehaviorSubject } from "rxjs";
export abstract class DataSource<T> {
protected data: T[] = [];

View File

@ -1,4 +1,4 @@
import { Subject} from "rxjs/Subject";
import { Subject} from "rxjs";
import { Node } from "../models/node";
import { Link } from "../models/link";

View File

@ -1,7 +1,7 @@
import { Injectable } from "@angular/core";
import { Subject } from "rxjs/Subject";
import { Subscription } from "rxjs/Subscription";
import { Subject } from "rxjs";
import { Subscription } from "rxjs";
import { NodesDataSource } from "../datasources/nodes-datasource";
import { LinksDataSource } from "../datasources/links-datasource";

View File

@ -1,6 +1,6 @@
import { Injectable } from "@angular/core";
import { mouse, select } from "d3-selection";
import { Subject } from "rxjs/Subject";
import { Subject } from "rxjs";
import { SVGSelection } from "../models/types";
import { Context } from "../models/context";

View File

@ -5,7 +5,7 @@ import { MatIconModule, MatProgressSpinnerModule } from "@angular/material";
import { ProgressService } from "./progress.service";
import { RouterTestingModule } from "@angular/router/testing";
import { Router } from "@angular/router";
import { BehaviorSubject } from "rxjs/BehaviorSubject";
import { BehaviorSubject } from "rxjs";
class MockedRouter {

View File

@ -1,7 +1,7 @@
import { Component, OnDestroy, OnInit } from '@angular/core';
import { ProgressService } from "./progress.service";
import { Router } from "@angular/router";
import { Subscription } from "rxjs/Subscription";
import { Subscription } from "rxjs";
@Component({
selector: 'app-progress',

View File

@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { BehaviorSubject } from "rxjs/BehaviorSubject";
import { BehaviorSubject } from "rxjs";
export class State {

View File

@ -1,21 +1,14 @@
import {Component, ElementRef, Inject, OnInit, ViewChild} from '@angular/core';
import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material";
import {DataSource} from "@angular/cdk/collections";
import { Component, ElementRef, Inject, OnInit, ViewChild } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from "@angular/material";
import { DataSource } from "@angular/cdk/collections";
import {Observable} from "rxjs/Observable";
import {BehaviorSubject} from "rxjs/BehaviorSubject";
import { Observable, BehaviorSubject, fromEvent, merge } from "rxjs";
import { debounceTime, distinctUntilChanged, map } from "rxjs/operators";
import { Server } from "../../../models/server";
import { ApplianceService } from "../../../services/appliance.service";
import { Appliance } from "../../../models/appliance";
import 'rxjs/add/operator/startWith';
import 'rxjs/add/observable/merge';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/debounceTime';
import 'rxjs/add/operator/distinctUntilChanged';
import 'rxjs/add/observable/fromEvent';
@Component({
selector: 'app-appliance-list-dialog',
@ -41,13 +34,14 @@ export class ApplianceListDialogComponent implements OnInit {
this.applianceDatabase = new ApplianceDatabase(this.server, this.applianceService);
this.dataSource = new ApplianceDataSource(this.applianceDatabase);
Observable.fromEvent(this.filter.nativeElement, 'keyup')
.debounceTime(150)
.distinctUntilChanged()
.subscribe(() => {
if (!this.dataSource) { return; }
this.dataSource.filter = this.filter.nativeElement.value;
});
fromEvent(this.filter.nativeElement, 'keyup').pipe(
debounceTime(150),
distinctUntilChanged()
)
.subscribe(() => {
if (!this.dataSource) { return; }
this.dataSource.filter = this.filter.nativeElement.value;
});
}
@ -95,12 +89,12 @@ export class ApplianceDataSource extends DataSource<Appliance> {
this.filterChange,
];
return Observable.merge(...displayDataChanges).map(() => {
return merge(...displayDataChanges).pipe(map(() => {
return this.applianceDatabase.data.slice().filter((item: Appliance) => {
const searchStr = (item.name).toLowerCase();
return searchStr.indexOf(this.filter.toLowerCase()) !== -1;
});
});
}));
}
disconnect() {}

View File

@ -4,7 +4,7 @@ import { inject } from "@angular/core/testing";
import { mock, instance, capture, when } from "ts-mockito";
import { HotkeyModule, HotkeysService, Hotkey } from "angular2-hotkeys";
import { Observable } from "rxjs";
import { Observable, of } from "rxjs";
import { ProjectMapShortcutsComponent } from './project-map-shortcuts.component';
import { ToasterService, } from "../../../services/toaster.service";
@ -18,6 +18,7 @@ import { ProjectService } from "../../../services/project.service";
import { MockedProjectService } from "../../../services/project.service.spec";
import { SettingsService } from "../../../services/settings.service";
import { MockedToasterService } from "../../../services/toaster.service.spec";
import { mapTo } from "rxjs/internal/operators";
describe('ProjectMapShortcutsComponent', () => {
@ -82,7 +83,7 @@ describe('ProjectMapShortcutsComponent', () => {
when(selectionManagerMock.getSelectedNodes()).thenReturn([node]);
when(nodeServiceMock.delete(server, node))
.thenReturn(Observable.of(node).mapTo(null));
.thenReturn(of(node).pipe(mapTo(null)));
component.project = project;
component.server = server;

View File

@ -1,15 +1,9 @@
import { Component, Inject, OnDestroy, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
import { ActivatedRoute, ParamMap } from '@angular/router';
import { Observable } from 'rxjs/Observable';
import { Subject } from "rxjs/Subject";
import 'rxjs/add/operator/switchMap';
import 'rxjs/add/operator/mergeMap';
import 'rxjs/add/observable/forkJoin';
import 'rxjs/add/observable/fromPromise';
import 'rxjs/add/observable/dom/webSocket';
import { Observable, Subject, Subscription, from } from 'rxjs';
import { webSocket } from "rxjs/webSocket";
import { map, mergeMap } from "rxjs/operators";
import { Project } from '../../models/project';
import { Node } from '../../cartography/models/node';
@ -39,7 +33,6 @@ import { ProjectWebServiceHandler } from "../../handlers/project-web-service-han
import { SelectionManager } from "../../cartography/managers/selection-manager";
import { InRectangleHelper } from "../../cartography/components/map/helpers/in-rectangle-helper";
import { DrawingsDataSource } from "../../cartography/datasources/drawings-datasource";
import { Subscription } from "rxjs/Subscription";
import { SettingsService } from "../../services/settings.service";
import { ProgressService } from "../../common/progress/progress.service";
@ -102,19 +95,19 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
const routeSub = this.route.paramMap.subscribe((paramMap: ParamMap) => {
const server_id = parseInt(paramMap.get('server_id'), 10);
Observable
.fromPromise(this.serverService.get(server_id))
.flatMap((server: Server) => {
from(this.serverService.get(server_id)).pipe(
mergeMap((server: Server) => {
this.server = server;
return this.projectService.get(server, paramMap.get('project_id')).map((project) => {
return this.projectService.get(server, paramMap.get('project_id')).pipe(map((project) => {
return project;
});
})
.flatMap((project: Project) => {
}));
}),
mergeMap((project: Project) => {
this.project = project;
if (this.project.status === 'opened') {
return new Observable((observer) => {
return new Observable<Project>((observer) => {
observer.next(this.project);
});
} else {
@ -122,13 +115,14 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
this.server, this.project.project_id);
}
})
.subscribe((project: Project) => {
this.onProjectLoad(project);
}, (error) => {
this.progressService.setError(error);
}, () => {
this.progressService.deactivate();
});
)
.subscribe((project: Project) => {
this.onProjectLoad(project);
}, (error) => {
this.progressService.setError(error);
}, () => {
this.progressService.deactivate();
});
});
this.subscriptions.push(routeSub);
@ -172,17 +166,19 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
const subscription = this.symbolService
.load(this.server)
.flatMap(() => {
return this.projectService.nodes(this.server, project.project_id);
})
.flatMap((nodes: Node[]) => {
this.nodesDataSource.set(nodes);
return this.projectService.links(this.server, project.project_id);
})
.flatMap((links: Link[]) => {
this.linksDataSource.set(links);
return this.projectService.drawings(this.server, project.project_id);
})
.pipe(
mergeMap(() => {
return this.projectService.nodes(this.server, project.project_id);
}),
mergeMap((nodes: Node[]) => {
this.nodesDataSource.set(nodes);
return this.projectService.links(this.server, project.project_id);
}),
mergeMap((links: Link[]) => {
this.linksDataSource.set(links);
return this.projectService.drawings(this.server, project.project_id);
})
)
.subscribe((drawings: Drawing[]) => {
this.drawingsDataSource.set(drawings);
@ -195,7 +191,7 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
}
setUpWS(project: Project) {
this.ws = Observable.webSocket(
this.ws = webSocket(
this.projectService.notificationsPath(this.server, project.project_id));
this.subscriptions.push(

View File

@ -1,8 +1,11 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { MatIconModule, MatSortModule, MatTableModule, MatTooltipModule } from "@angular/material";
import { RouterTestingModule } from "@angular/router/testing";
import { NoopAnimationsModule } from "@angular/platform-browser/animations";
import { Observable, of } from "rxjs";
import { ProjectsComponent } from './projects.component';
import { RouterTestingModule } from "@angular/router/testing";
import { ServerService } from "../../services/server.service";
import { MockedServerService } from "../../services/server.service.spec";
import { ProjectService } from "../../services/project.service";
@ -10,9 +13,7 @@ import { MockedProjectService } from "../../services/project.service.spec";
import { SettingsService } from "../../services/settings.service";
import { MockedSettingsService } from "../../services/settings.service.spec";
import { ProgressService } from "../../common/progress/progress.service";
import { NoopAnimationsModule } from "@angular/platform-browser/animations";
import { Server } from "../../models/server";
import { Observable } from "rxjs/Observable";
import { Settings } from "../../services/settings.service";
import { Project } from "../../models/project";
@ -58,7 +59,7 @@ describe('ProjectsComponent', () => {
spyOn(serverService, 'get').and.returnValue(Promise.resolve(server));
spyOn(settingsService, 'getAll').and.returnValue(settings);
spyOn(projectService, 'list').and.returnValue(Observable.of([]));
spyOn(projectService, 'list').and.returnValue(of([]));
spyOn(progressService, 'activate');
spyOn(progressService, 'deactivate');
@ -82,7 +83,7 @@ describe('ProjectsComponent', () => {
project = new Project();
project.project_id = "1";
spyOn(projectService, 'open').and.returnValue(Observable.of(project));
spyOn(projectService, 'open').and.returnValue(of(project));
component.server = server;
});
@ -104,7 +105,7 @@ describe('ProjectsComponent', () => {
project = new Project();
project.project_id = "1";
spyOn(projectService, 'close').and.returnValue(Observable.of(project));
spyOn(projectService, 'close').and.returnValue(of(project));
component.server = server;
});

View File

@ -2,13 +2,15 @@ import { Component, OnInit, ViewChild } from '@angular/core';
import { ActivatedRoute, ParamMap } from '@angular/router';
import { MatSort, MatSortable } from "@angular/material";
import { DataSource } from "@angular/cdk/collections";
import { map, switchMap } from "rxjs//operators";
import { BehaviorSubject, Observable, merge } from "rxjs";
import { Project } from "../../models/project";
import { ProjectService } from "../../services/project.service";
import { Server } from "../../models/server";
import { ServerService } from "../../services/server.service";
import { BehaviorSubject } from "rxjs/BehaviorSubject";
import { DataSource } from "@angular/cdk/collections";
import { Observable } from "rxjs/Observable";
import { SettingsService, Settings } from "../../services/settings.service";
import { ProgressService } from "../../common/progress/progress.service";
@ -45,10 +47,12 @@ export class ProjectsComponent implements OnInit {
this.dataSource = new ProjectDataSource(this.projectDatabase, this.sort);
this.route.paramMap
.switchMap((params: ParamMap) => {
const server_id = params.get('server_id');
return this.serverService.get(parseInt(server_id, 10));
})
.pipe(
switchMap((params: ParamMap) => {
const server_id = params.get('server_id');
return this.serverService.get(parseInt(server_id, 10));
})
)
.subscribe((server: Server) => {
this.server = server;
this.refresh();
@ -127,7 +131,7 @@ export class ProjectDataSource extends DataSource<any> {
this.sort.sortChange,
];
return Observable.merge(...displayDataChanges).map(() => {
return merge(...displayDataChanges).pipe(map(() => {
if (!this.sort.active || this.sort.direction === '') {
return this.projectDatabase.data;
}
@ -141,7 +145,7 @@ export class ProjectDataSource extends DataSource<any> {
return (valueA < valueB ? -1 : 1) * (this.sort.direction === 'asc' ? 1 : -1);
});
});
}));
}
disconnect() {}

View File

@ -2,15 +2,15 @@ import { Component, Inject, OnInit } from '@angular/core';
import { DataSource } from "@angular/cdk/collections";
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
import { Observable } from "rxjs/Observable";
import { BehaviorSubject } from "rxjs/BehaviorSubject";
import { Observable, BehaviorSubject, merge } from "rxjs";
import { map } from "rxjs/operators";
import 'rxjs/add/operator/startWith';
import 'rxjs/add/observable/merge';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/debounceTime';
import 'rxjs/add/operator/distinctUntilChanged';
import 'rxjs/add/observable/fromEvent';
// import 'rxjs/add/operator/startWith';
// import 'rxjs/add/observable/merge';
// import 'rxjs/add/operator/map';
// import 'rxjs/add/operator/debounceTime';
// import 'rxjs/add/operator/distinctUntilChanged';
// import 'rxjs/add/observable/fromEvent';
import { Server } from "../../models/server";
import { ServerService } from "../../services/server.service";
@ -121,9 +121,10 @@ export class ServerDataSource extends DataSource<Server> {
}
connect(): Observable<Server[]> {
return Observable.merge(this.serverDatabase.dataChange).map(() => {
return merge(this.serverDatabase.dataChange).pipe(
map(() => {
return this.serverDatabase.data;
});
}));
}
disconnect() {}

View File

@ -1,6 +1,6 @@
import { inject, TestBed } from "@angular/core/testing";
import { Subject } from "rxjs/Subject";
import { Subject } from "rxjs";
import { ProjectWebServiceHandler, WebServiceMessage } from "./project-web-service-handler";
import { NodesDataSource } from "../cartography/datasources/nodes-datasource";

View File

@ -1,5 +1,5 @@
import { Injectable } from "@angular/core";
import { Subject } from "rxjs/Subject";
import { Subject } from "rxjs";
import { NodesDataSource } from "../cartography/datasources/nodes-datasource";
import { LinksDataSource } from "../cartography/datasources/links-datasource";

View File

@ -4,7 +4,7 @@ import 'rxjs/add/operator/map';
import { Server } from "../models/server";
import { HttpServer } from "./http-server.service";
import {Appliance} from "../models/appliance";
import {Observable} from "rxjs/Observable";
import {Observable} from "rxjs";
@Injectable()
export class ApplianceService {

View File

@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { HttpHeaders, HttpClient, HttpParams, HttpErrorResponse } from '@angular/common/http';
import { Observable } from 'rxjs/Observable';
import { Observable } from 'rxjs';
import {Server} from "../models/server";
import { catchError } from "rxjs/operators";

View File

@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { Project } from '../models/project';
import { Node } from '../cartography/models/node';
import { Observable } from 'rxjs/Observable';
import { Observable } from 'rxjs';
import 'rxjs/add/operator/map';
import { Server } from "../models/server";

View File

@ -1,4 +1,4 @@
import { TestBed, inject } from '@angular/core/testing';
import { TestBed } from '@angular/core/testing';
import { HttpClient } from '@angular/common/http';
import { HttpTestingController, HttpClientTestingModule } from '@angular/common/http/testing';
@ -8,7 +8,7 @@ import { getTestServer } from './testing';
import { ProjectService } from './project.service';
import { SettingsService } from "./settings.service";
import { MockedSettingsService } from "./settings.service.spec";
import { Observable } from "rxjs/Observable";
import { Observable, of } from "rxjs";
import { Project } from "../models/project";
import { AppTestingModule } from "../testing/app-testing/app-testing.module";
@ -21,15 +21,15 @@ export class MockedProjectService {
public projects: Project[] = [];
list(server: Server) {
return Observable.of(this.projects);
return of(this.projects);
}
open(server: Server, project: Project) {
return Observable.of(project);
return of(project);
}
close(server: Server, project: Project) {
return Observable.of(project);
return of(project);
}
isReadOnly(project) {

View File

@ -1,13 +1,12 @@
import { Injectable } from '@angular/core';
import { Project } from '../models/project';
import { Node } from '../cartography/models/node';
import { Observable } from 'rxjs/Observable';
import { Observable } from 'rxjs';
import 'rxjs/add/operator/map';
import { Link } from "../cartography/models/link";
import { Server } from "../models/server";
import { HttpServer } from "./http-server.service";
import {Drawing} from "../cartography/models/drawing";
import { Drawing } from "../cartography/models/drawing";
import { SettingsService } from "./settings.service";
@Injectable()

View File

@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import {IndexedDbService} from "./indexed-db.service";
import {Server} from "../models/server";
import { Observable } from "rxjs/Observable";
import { Observable } from "rxjs";
@Injectable()

View File

@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { PersistenceService, StorageType } from "angular-persistence";
import { Subject } from "rxjs/Subject";
import { BehaviorSubject } from "rxjs/BehaviorSubject";
import { Subject } from "rxjs";
import { BehaviorSubject } from "rxjs";
export interface Settings {

View File

@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import {Server} from "../models/server";
import {Observable} from "rxjs/Observable";
import {Observable} from "rxjs";
import {HttpServer} from "./http-server.service";
import {Snapshot} from "../models/snapshot";

View File

@ -1,10 +1,5 @@
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { BehaviorSubject } from "rxjs/BehaviorSubject";
import 'rxjs/add/operator/map';
import 'rxjs/add/observable/forkJoin';
import 'rxjs/add/observable/of';
import { BehaviorSubject, forkJoin, Observable } from 'rxjs';
import { Symbol } from '../cartography/models/symbol';
import { Server } from "../models/server";
@ -26,7 +21,7 @@ export class SymbolService {
load(server: Server): Observable<Symbol[]> {
const subscription = this.list(server).subscribe((symbols: Symbol[]) => {
const streams = symbols.map(symbol => this.raw(server, symbol.symbol_id));
Observable.forkJoin(streams).subscribe((results) => {
forkJoin(streams).subscribe((results) => {
symbols.forEach((symbol: Symbol, i: number) => {
symbol.raw = results[i];
});

View File

@ -11,7 +11,8 @@
]
},
"files": [
"test.ts"
"test.ts",
"polyfills.ts"
],
"include": [
"**/*.spec.ts",

View File

@ -14,8 +14,7 @@
"eofline": true,
"forin": true,
"import-blacklist": [
true,
"rxjs"
true
],
"import-spacing": true,
"indent": [

3618
yarn.lock

File diff suppressed because it is too large Load Diff