Commit 7c1f2807 authored by Lukas Burgey's avatar Lukas Burgey

Change imports to the new RxJS 6 import style

parent 34a1e517
import {NgModule,Pipe,PipeTransform} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
import {FormsModule} from '@angular/forms';
import {JsonPipe} from '@angular/common';
import {HttpModule} from '@angular/http';
import {HttpClientModule, HttpClientXsrfModule} from '@angular/common/http';
import { NgModule,Pipe,PipeTransform } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { FormsModule } from '@angular/forms';
import { JsonPipe } from '@angular/common';
import { HttpModule } from '@angular/http';
import { HttpClientModule, HttpClientXsrfModule } from '@angular/common/http';
// Other libs
import {StompRService} from '@stomp/ng2-stompjs';
import {CookieService} from 'ngx-cookie-service';
import { StompRService } from '@stomp/ng2-stompjs';
import { CookieService } from 'ngx-cookie-service';
// rxjs
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/catch';
import 'rxjs/add/operator/filter';
import 'rxjs/add/observable/of';
// Our stuff
//
// services
import {UserService} from './user.service';
import {SnackBarService} from './snackbar.service';
import { UserService } from './user.service';
import { SnackBarService } from './snackbar.service';
// imports
import {DialoguesModule} from './dialogues/dialogues.module';
import {MaterialModule} from './material/material.module';
import {SharedModule} from './shared/shared.module';
import { DialoguesModule } from './dialogues/dialogues.module';
import { MaterialModule } from './material/material.module';
import { SharedModule } from './shared/shared.module';
// declarations
import { AppComponent} from './app.component';
import { BodyComponent} from './body/body.component';
import { ServiceComponent} from './service/service.component';
import { HeaderComponent} from './header/header.component';
import { FooterComponent} from './footer/footer.component';
import { AppComponent } from './app.component';
import { BodyComponent } from './body/body.component';
import { ServiceComponent } from './service/service.component';
import { HeaderComponent } from './header/header.component';
import { FooterComponent } from './footer/footer.component';
import { VoDataComponent } from './vo-data/vo-data.component';
......
import { Component, OnInit } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { Observable } from 'rxjs';
import { UserService } from '../user.service';
import * as t from '../types/types.module';
......
import { CollectionViewer, DataSource } from "@angular/cdk/collections";
import { Observable } from 'rxjs/Observable';
import { Observable } from 'rxjs';
import { UserService } from '../../user.service';
import { SSHKey } from '../../types/types.module';
......
import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {FormsModule} from '@angular/forms';
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
// imports
import {MaterialModule} from '../material/material.module';
import {SharedModule} from '../shared/shared.module';
import { MaterialModule } from '../material/material.module';
import { SharedModule } from '../shared/shared.module';
// declarations
import {QuestionnaireComponent} from './questionnaire/questionnaire.component';
import {ProfileComponent} from './profile/profile.component';
import {AccountComponent} from './account/account.component';
import {CredentialsComponent} from './credentials/credentials.component';
import {MessageComponent} from './message/message.component';
import { QuestionnaireComponent } from './questionnaire/questionnaire.component';
import { ProfileComponent } from './profile/profile.component';
import { AccountComponent } from './account/account.component';
import { CredentialsComponent } from './credentials/credentials.component';
import { MessageComponent } from './message/message.component';
//providers
import {DialogService} from './dialog.service';
import { DialogService } from './dialog.service';
@NgModule({
imports: [
......
import {Component, OnInit,Inject} from '@angular/core';
import {MAT_DIALOG_DATA} from '@angular/material';
import { Component, OnInit, Inject } from '@angular/core';
import { MAT_DIALOG_DATA } from '@angular/material';
import { UserService } from '../../user.service';
import * as t from '../../types/types.module';
......
import {Component, OnInit,Inject} from '@angular/core';
import {MAT_DIALOG_DATA} from '@angular/material';
import { Component, OnInit, Inject } from '@angular/core';
import { MAT_DIALOG_DATA } from '@angular/material';
import { UserService } from '../../user.service';
import * as t from '../../types/types.module';
......
import { Component, OnInit } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { Observable } from 'rxjs';
import { UserService } from '../user.service';
import { AllAuthInfo, IdP } from '../types/types.module';
......
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs/Observable';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import { Observable, BehaviorSubject } from 'rxjs';
import { CookieService } from 'ngx-cookie-service';
import {environment} from '../environments/environment';
import { environment } from '../environments/environment';
import { IdP, AuthInfo } from './types/types.module';
@Injectable({
......
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import {MatButtonModule} from '@angular/material';
import {MatToolbarModule} from '@angular/material';
import {MatTableModule} from '@angular/material/table';
import {MatSnackBarModule} from '@angular/material/snack-bar';
import {MatExpansionModule} from '@angular/material/expansion';
import {MatIconModule} from '@angular/material/icon';
import {MatDialogModule} from '@angular/material/dialog';
import {MatFormFieldModule} from '@angular/material/form-field';
import {MatSelectModule} from '@angular/material/select';
import {MatInputModule} from '@angular/material/input';
import {MatCheckboxModule} from '@angular/material/checkbox';
import {MatTooltipModule} from '@angular/material/tooltip';
import {MatProgressBarModule} from '@angular/material/progress-bar';
import {MatProgressSpinnerModule} from '@angular/material/progress-spinner';
import {MatTabsModule} from '@angular/material/tabs';
import { MatButtonModule } from '@angular/material';
import { MatToolbarModule } from '@angular/material';
import { MatTableModule } from '@angular/material/table';
import { MatSnackBarModule } from '@angular/material/snack-bar';
import { MatExpansionModule } from '@angular/material/expansion';
import { MatIconModule } from '@angular/material/icon';
import { MatDialogModule } from '@angular/material/dialog';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatSelectModule } from '@angular/material/select';
import { MatInputModule } from '@angular/material/input';
import { MatCheckboxModule } from '@angular/material/checkbox';
import { MatTooltipModule } from '@angular/material/tooltip';
import { MatProgressBarModule } from '@angular/material/progress-bar';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { MatTabsModule } from '@angular/material/tabs';
@NgModule({
imports: [
......
import { Component, OnInit, Input } from '@angular/core';
import { MatCheckboxChange } from '@angular/material/checkbox';
import {HttpClient, HttpErrorResponse} from '@angular/common/http';
import { HttpClient, HttpErrorResponse } from '@angular/common/http';
import { UserService } from '../user.service';
import { DialogService } from '../dialogues/dialog.service';
......
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import {ObjKeysPipe} from './obj-keys.pipe';
import { ObjKeysPipe } from './obj-keys.pipe';
@NgModule({
imports: [
......
import { Injectable } from '@angular/core';
import { HttpClient, HttpErrorResponse } from '@angular/common/http';
import { Observable } from 'rxjs/Observable';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import { Observable, BehaviorSubject, of, EMPTY } from 'rxjs';
import { map, catchError } from 'rxjs/operators';
import { CookieService } from 'ngx-cookie-service';
import { StompConfig, StompRService } from '@stomp/ng2-stompjs';
......@@ -48,7 +48,7 @@ export class UserService {
this.subscribeUser().subscribe(
(newUser: User) => {
console.log(newUser);
console.log('user$:', newUser);
if (newUser == undefined || newUser == null) {
// LOGGED OUT
......@@ -203,7 +203,7 @@ export class UserService {
private catchError(fetch: boolean, msg?: string) {
return (error: any) => {
this.handleError(fetch, msg)(error);
return Observable.throw(error);
return EMPTY;
}
}
......@@ -298,15 +298,15 @@ export class UserService {
'type': action,
'group': group.id,
};
return this.http.post<Deployment>('/backend/api/deployments', body).catch(
this.catchError(true, "Error changing deployment"),
return this.http.post<Deployment>('/backend/api/deployments', body).pipe(
catchError(this.catchError(true, "Error changing deployment")),
);
}
// DATA SERVICE API
//
public subscribeSpecific<T>(selector: (user: User) => T): Observable<T> {
return this.subscribeUser().map(selector);
return this.subscribeUser().pipe(map(selector));
}
public subscribeSSHKeys(): Observable<SSHKey[]> {
......@@ -328,22 +328,25 @@ export class UserService {
public subscribeServiceDeployment(service: Service): Observable<Deployment> {
return this.subscribeDeployments().map(
(deployments: Deployment[]) => {
return this.subscribeDeployments().pipe(
map(
(deployments: Deployment[]) => {
return deployments.find(
(dep: Deployment) => dep.service ? dep.service.id == service.id : false
);
}
),
);
}
public subscribeGroupDeployment(group: Group): Observable<Deployment> {
return this.subscribeDeployments().map(
(deployments: Deployment[]) => {
return deployments.find(
(dep: Deployment) => dep.group == group.id
);
}
return this.subscribeDeployments().pipe(
map((deployments: Deployment[]) => {
return deployments.find(
(dep: Deployment) => dep.group == group.id
);
}
),
);
}
}
import { Component, OnInit, Input } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import { Observable, BehaviorSubject } from 'rxjs';
import { map } from 'rxjs/operators';
import { UserService } from '../user.service';
import { DialogService } from '../dialogues/dialog.service';
......@@ -77,24 +78,28 @@ export class VoDataComponent implements OnInit {
}
public servicesAtSite(site: t.Site): Observable<t.Service[]> {
return this.services$$.map(
(services: t.Service[]) => services.filter(
(service: t.Service) => service.site.some(
(s: t.Site) => s.id === site.id
return this.services$$.pipe(
map(
(services: t.Service[]) => services.filter(
(service: t.Service) => service.site.some(
(s: t.Site) => s.id === site.id
)
)
)
),
);
}
public subscribeStateItem(site: t.Site, service: t.Service): Observable<t.DeploymentStateItem> {
return this.deployment$$.map(
(dep: t.Deployment) => {
if (dep.state_items) {
return dep.state_items.find(
(dsi: t.DeploymentStateItem) => dsi.site.id == site.id && dsi.service.id == service.id,
)
}
},
return this.deployment$$.pipe(
map(
(dep: t.Deployment) => {
if (dep.state_items) {
return dep.state_items.find(
(dsi: t.DeploymentStateItem) => dsi.site.id == site.id && dsi.service.id == service.id,
)
}
},
),
);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment