Upgrade Angular to 9. Update js dependencies to latest versions. Remove js dependencies that are no longer required. Replace angular client gen with official swagger generator. Change build scripts and adapt code to new client.
This commit is contained in:
@@ -5,16 +5,29 @@ import { FlexLayoutModule } from '@angular/flex-layout';
|
||||
import { NgxGaugeModule } from 'ngx-gauge';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
|
||||
import { MatButtonModule, MatIconModule,
|
||||
MatCheckboxModule, MatSidenavModule,
|
||||
MatToolbarModule, MatTooltipModule, MatCardModule,
|
||||
MatInputModule, MatFormFieldModule,
|
||||
MatProgressBarModule, MatProgressSpinnerModule,
|
||||
MatSnackBarModule, MatDialogModule,
|
||||
MatListModule, MatPaginatorModule, MatTableModule,
|
||||
MatPaginatorIntl, MatExpansionModule, MatSelectModule,
|
||||
MatDatepickerModule, MatNativeDateModule,
|
||||
MatTabsModule, MatGridListModule, MatAutocompleteModule } from '@angular/material';
|
||||
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatNativeDateModule } from '@angular/material/core';
|
||||
import { MatDatepickerModule } from '@angular/material/datepicker';
|
||||
import { MatDialogModule } from '@angular/material/dialog';
|
||||
import { MatExpansionModule } from '@angular/material/expansion';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { MatGridListModule } from '@angular/material/grid-list';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { MatListModule } from '@angular/material/list';
|
||||
import { MatPaginatorModule, MatPaginatorIntl } from '@angular/material/paginator';
|
||||
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { MatSelectModule } from '@angular/material/select';
|
||||
import { MatSidenavModule } from '@angular/material/sidenav';
|
||||
import { MatSnackBarModule } from '@angular/material/snack-bar';
|
||||
import { MatTableModule } from '@angular/material/table';
|
||||
import { MatTabsModule } from '@angular/material/tabs';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
|
||||
import { LocationStrategy, PathLocationStrategy, registerLocaleData, DatePipe } from '@angular/common';
|
||||
import LocaleDE from '@angular/common/locales/de';
|
||||
@@ -32,7 +45,7 @@ import { ToolbarButtonComponent } from './widgets/toolbar-button.component';
|
||||
import { LoginComponent } from './views/login.component';
|
||||
import { DelayInterceptor } from './interceptors/delay.interceptor';
|
||||
import { AuthInterceptor } from './interceptors/auth.interceptor';
|
||||
import { ApiClientService } from '../api';
|
||||
import { DefaultService } from '../api/api/api';
|
||||
import { ConsoleService } from './services/console.service';
|
||||
import { UserService } from './services/user.service';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
@@ -71,8 +84,11 @@ import { CityComponent } from './views/city.component';
|
||||
import { MapComponent } from './widgets/map.component';
|
||||
import { WeatherConditionComponent } from './widgets/weather-condition.component';
|
||||
import { WeatherForecastComponent } from './widgets/weather-forecast.component';
|
||||
import { WeatherVideoComponent } from './widgets/weather-video.component';
|
||||
import { WeatherVideoListComponent } from './widgets/weather-video-list.component';
|
||||
import { HumidityPipe, CloudPipe, PressurePipe, TemperaturePipe, SpeedPipe, SnowPipe, PrecipitationPipe, WeatherPipe, DirectionPipe, SourcePipe } from './pipes/weather-pipes';
|
||||
import { LocalTimePipe, LocalDatePipe, LocalNamePipe, BingMapsPipe, GoogleMapsPipe, WikipediaPipe, CityTypePipe } from './pipes/location-pipes';
|
||||
import { Configuration } from '../api/configuration';
|
||||
|
||||
/**
|
||||
* Computes the api domain from the browser location.
|
||||
@@ -127,7 +143,7 @@ registerLocaleData(LocaleDE);
|
||||
SearchFieldComponent,
|
||||
CityComponent,
|
||||
MapComponent,
|
||||
WeatherConditionComponent, WeatherForecastComponent,
|
||||
WeatherConditionComponent, WeatherForecastComponent, WeatherVideoComponent, WeatherVideoListComponent,
|
||||
UseParentFormDirective,
|
||||
HumidityPipe, CloudPipe, PressurePipe, TemperaturePipe, SpeedPipe, SnowPipe, PrecipitationPipe, WeatherPipe, DirectionPipe, SourcePipe,
|
||||
BingMapsPipe, GoogleMapsPipe, WikipediaPipe, LocalTimePipe, LocalDatePipe, LocalNamePipe, CityTypePipe
|
||||
@@ -168,7 +184,7 @@ registerLocaleData(LocaleDE);
|
||||
],
|
||||
providers: [
|
||||
// injection token for http client
|
||||
{ provide: 'domain', useValue: apidomain().http },
|
||||
{ provide: Configuration, useValue: new Configuration({ basePath: apidomain().http }) },
|
||||
{ provide: 'wsdomain', useValue: apidomain().ws },
|
||||
// location stategy for passing that with the router
|
||||
{ provide: LocationStrategy, useClass: PathLocationStrategy },
|
||||
@@ -180,7 +196,7 @@ registerLocaleData(LocaleDE);
|
||||
{ provide: MatPaginatorIntl, useClass: GermanPaginatorProvider },
|
||||
DatePipe,
|
||||
// add our application services (api access, logging, authentication)
|
||||
ApiClientService, ConsoleService, AuthGuard, CityResolver,
|
||||
DefaultService, ConsoleService, AuthGuard, CityResolver,
|
||||
ResourceService, CredentialService, UserService, VersionService, DeviceService,
|
||||
ManageLogService, ManageUserService
|
||||
],
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { CanActivate, Router, ActivatedRouteSnapshot, RouterStateSnapshot, CanActivateChild } from '@angular/router';
|
||||
import { UserService, UserState, UserRole } from '../services/user.service';
|
||||
import { Observable, BehaviorSubject, Subject } from 'rxjs';
|
||||
import { Observable, Subject } from 'rxjs';
|
||||
import { ConsoleService } from '../services/console.service';
|
||||
|
||||
@Injectable()
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import {Injectable, Optional, Inject} from '@angular/core';
|
||||
import {Injectable } from '@angular/core';
|
||||
import {HttpEvent, HttpInterceptor, HttpHandler, HttpRequest} from '@angular/common/http';
|
||||
import { Observable , Subject } from 'rxjs';
|
||||
import { HttpResponse } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
import { ConsoleService } from '../services/console.service';
|
||||
import { Injector } from '@angular/core';
|
||||
import { CredentialService } from '../services/credential.service';
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import {Injectable, Optional, Inject} from '@angular/core';
|
||||
import {HttpEvent, HttpInterceptor, HttpHandler, HttpRequest} from '@angular/common/http';
|
||||
import { Observable , Subject } from 'rxjs';
|
||||
import { HttpResponse } from '@angular/common/http';
|
||||
import { Injectable, Optional, Inject } from '@angular/core';
|
||||
import { HttpEvent, HttpInterceptor, HttpHandler, HttpRequest } from '@angular/common/http';
|
||||
import { Observable, Subject } from 'rxjs';
|
||||
import { ConsoleService } from '../services/console.service';
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { Component, Input, OnInit, OnDestroy } from '@angular/core';
|
||||
import { Router, RouterEvent, NavigationEnd } from '@angular/router';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { UserService, UserRole } from '../services/user.service';
|
||||
import { ResourceService } from '../services/resource.service';
|
||||
|
||||
@@ -11,8 +11,6 @@ import { ResourceService } from '../services/resource.service';
|
||||
})
|
||||
export class FooterComponent {
|
||||
|
||||
constructor(public res: ResourceService) {
|
||||
|
||||
}
|
||||
constructor(public res: ResourceService) { }
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Component, OnInit, OnDestroy, HostListener, ViewChild } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { UserService, UserState } from '../services/user.service';
|
||||
import { UserService } from '../services/user.service';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { MatSidenavContainer, MatSidenav } from '@angular/material';
|
||||
import { MatSidenav } from '@angular/material/sidenav';
|
||||
import { ResourceService } from '../services/resource.service';
|
||||
|
||||
@Component({
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
import { Coordinate, City } from '../../api/models';
|
||||
import { Coordinate, City, LocationHierarchy } from '../../api/model/models';
|
||||
import { ResourceService } from '../services/resource.service';
|
||||
import { Type } from '../../api/models/city.model';
|
||||
|
||||
/**
|
||||
* The pipe to render the url to bing maps.
|
||||
@@ -53,7 +52,7 @@ export class CityTypePipe implements PipeTransform {
|
||||
return this.res.strings('pipe_city_type_capital');
|
||||
}
|
||||
switch (city.type) {
|
||||
case Type.CITY: return this.res.strings('pipe_city_type_city');
|
||||
case LocationHierarchy.TypeEnum.CITY: return this.res.strings('pipe_city_type_city');
|
||||
default: return this.res.strings('pipe_city_type_town');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
import { ResourceService } from '../services/resource.service';
|
||||
import { WindDirection, Type, Source } from '../../api/models/weathercondition.model';
|
||||
import { WeatherCondition } from '../../api/model/models';
|
||||
|
||||
/**
|
||||
* The pipe to print humidity values.
|
||||
@@ -79,7 +79,7 @@ export class SnowPipe implements PipeTransform {
|
||||
export class WeatherPipe implements PipeTransform {
|
||||
constructor(private res: ResourceService) { }
|
||||
|
||||
transform(value: Type): string {
|
||||
transform(value: WeatherCondition.TypeEnum): string {
|
||||
if (!value) { return ''; }
|
||||
return this.res.strings('pipe_weather_' + value.toString().toLowerCase());
|
||||
}
|
||||
@@ -92,7 +92,7 @@ export class WeatherPipe implements PipeTransform {
|
||||
export class DirectionPipe implements PipeTransform {
|
||||
constructor(private res: ResourceService) { }
|
||||
|
||||
transform(value: WindDirection): string {
|
||||
transform(value: WeatherCondition.WindDirectionEnum): string {
|
||||
if (!value) { return ''; }
|
||||
return this.res.strings('pipe_direction_' + value.toString().toLowerCase());
|
||||
}
|
||||
@@ -105,7 +105,7 @@ export class DirectionPipe implements PipeTransform {
|
||||
export class SourcePipe implements PipeTransform {
|
||||
constructor(private res: ResourceService) { }
|
||||
|
||||
transform(value: Source): string {
|
||||
transform(value: WeatherCondition.SourceEnum): string {
|
||||
if (!value) { return ''; }
|
||||
return this.res.strings('pipe_source_' + value.toString().toLowerCase());
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { MatPaginatorIntl } from '@angular/material';
|
||||
import { MatPaginatorIntl } from '@angular/material/paginator';
|
||||
import { ResourceService } from '../services/resource.service';
|
||||
import { Inject } from '@angular/core';
|
||||
import { Inject, Injectable } from '@angular/core';
|
||||
|
||||
@Injectable()
|
||||
export class GermanPaginatorProvider extends MatPaginatorIntl {
|
||||
|
||||
constructor(@Inject(ResourceService) public res: ResourceService) {
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Resolve, ActivatedRouteSnapshot } from '@angular/router';
|
||||
import { City } from '../../api/models';
|
||||
import { ApiClientService } from '../../api';
|
||||
import { City } from '../../api/model/models';
|
||||
import { DefaultService } from '../../api/api/api';
|
||||
import { Subject } from 'rxjs';
|
||||
|
||||
@Injectable()
|
||||
export class CityResolver implements Resolve<City> {
|
||||
|
||||
constructor(private apiClientService: ApiClientService) {}
|
||||
constructor(private apiClientService: DefaultService) {}
|
||||
|
||||
resolve(route: ActivatedRouteSnapshot) {
|
||||
const s = new Subject<City>();
|
||||
this.apiClientService.getCity(+route.paramMap.get('id')).subscribe((r) => {
|
||||
s.next(r.body);
|
||||
this.apiClientService.getCity(+route.paramMap.get('id')).subscribe((city) => {
|
||||
s.next(city);
|
||||
s.complete();
|
||||
});
|
||||
return s.asObservable();
|
||||
|
||||
@@ -8,7 +8,7 @@ import { Subject } from 'rxjs';
|
||||
@Injectable()
|
||||
export class ConsoleService {
|
||||
|
||||
private static LOG = false;
|
||||
private static LOG = true;
|
||||
|
||||
private data: string[] = [];
|
||||
public messages: Subject<string[]> = new Subject<string[]>();
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ConsoleService } from './console.service';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
import { HttpErrorResponse } from '@angular/common/http';
|
||||
|
||||
/**
|
||||
* A service to manage the user's credentials. This service only
|
||||
@@ -142,6 +139,4 @@ export class CredentialService {
|
||||
private isSet(value: string) {
|
||||
return value != null && value.length > 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Subject , Observable, BehaviorSubject } from 'rxjs';
|
||||
import { DataSource } from '@angular/cdk/table';
|
||||
import { Device, DevicePage } from '../../api/models';
|
||||
import { ApiClientService } from '../../api';
|
||||
import { UserService } from './user.service';
|
||||
import { CollectionViewer } from '@angular/cdk/collections';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Device, DevicePage } from '../../api/model/models';
|
||||
import { DefaultService } from '../../api/api/api';
|
||||
import { AbstractPageService } from '../utils/pagination';
|
||||
import { HttpResponse } from '@angular/common/http';
|
||||
|
||||
@@ -14,12 +11,12 @@ import { HttpResponse } from '@angular/common/http';
|
||||
@Injectable()
|
||||
export class DeviceService extends AbstractPageService<Device, DevicePage> {
|
||||
|
||||
constructor(apiClientService: ApiClientService) {
|
||||
constructor(apiClientService: DefaultService) {
|
||||
super(apiClientService);
|
||||
}
|
||||
|
||||
protected loadPage(offset: number, size: number): Observable<HttpResponse<DevicePage>> {
|
||||
return this.apiClientService.getCurrentUserDevices(offset, size);
|
||||
return this.apiClientService.getCurrentUserDevices(offset, size, 'response');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Inject, Injectable } from '@angular/core';
|
||||
import { ConsoleService } from './console.service';
|
||||
import { BehaviorSubject, Observable } from 'rxjs';
|
||||
import { DataSource } from '@angular/cdk/table';
|
||||
import { LogMessage } from '../../api/models';
|
||||
import { LogMessage } from '../../api/model/models';
|
||||
import { CollectionViewer } from '@angular/cdk/collections';
|
||||
import { CredentialService } from './credential.service';
|
||||
|
||||
@@ -14,7 +14,6 @@ export class ManageLogService implements DataSource<LogMessage> {
|
||||
|
||||
readonly connecting: BehaviorSubject<boolean> = new BehaviorSubject(false);
|
||||
private messages: BehaviorSubject<LogMessage[]> = new BehaviorSubject([]);
|
||||
private subscriptions = 0;
|
||||
private socket: WebSocket;
|
||||
private timeout = null;
|
||||
private buffered: LogMessage[] = [];
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { AbstractPageService } from '../utils/pagination';
|
||||
import { User, UserPage } from '../../api/models';
|
||||
import { ApiClientService } from '../../api';
|
||||
import { User, UserPage } from '../../api/model/models';
|
||||
import { DefaultService } from '../../api/api/api';
|
||||
import { Observable, BehaviorSubject, Subject } from 'rxjs';
|
||||
import { HttpResponse } from '@angular/common/http';
|
||||
|
||||
@@ -17,15 +17,15 @@ export class ManageUserService extends AbstractPageService<User, UserPage> {
|
||||
*/
|
||||
private term: string = null;
|
||||
|
||||
constructor(apiClientService: ApiClientService) {
|
||||
constructor(apiClientService: DefaultService) {
|
||||
super(apiClientService);
|
||||
}
|
||||
|
||||
protected loadPage(offset: number, size: number): Observable<HttpResponse<UserPage>> {
|
||||
if (this.term != null) {
|
||||
return this.apiClientService.searchUsers(offset, size, this.term);
|
||||
return this.apiClientService.searchUsers(this.term, offset, size, 'response');
|
||||
} else {
|
||||
return this.apiClientService.getUsers(offset, size);
|
||||
return this.apiClientService.getUsers(offset, size, 'response');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ export class ManageUserService extends AbstractPageService<User, UserPage> {
|
||||
if (this.loading.getValue()) { return new BehaviorSubject<boolean>(false); }
|
||||
this.loading.next(true);
|
||||
const result = new Subject<boolean>();
|
||||
this.apiClientService.setUser(user.id, user).subscribe((response) => {
|
||||
this.apiClientService.setUser(user.id, user, 'response').subscribe((response) => {
|
||||
result.next(true);
|
||||
this.loading.next(false);
|
||||
this.reload();
|
||||
|
||||
@@ -621,7 +621,7 @@ export class ResourceService {
|
||||
* The current selection of languages.
|
||||
*/
|
||||
values = this.values_en;
|
||||
language = new BehaviorSubject<string>('en');
|
||||
language = new BehaviorSubject<'de'|'en'>('en');
|
||||
readonly languages: Language[] = [
|
||||
{value: 'de', title: '', flag: 'assets/flags/de.svg' },
|
||||
{value: 'en', title: '', flag: 'assets/flags/en.svg'},
|
||||
@@ -646,11 +646,11 @@ export class ResourceService {
|
||||
return result;
|
||||
}
|
||||
|
||||
public getLanguage(): string {
|
||||
public getLanguage(): 'de'|'en' {
|
||||
return this.language.getValue();
|
||||
}
|
||||
|
||||
public setLanguage(key: string): void {
|
||||
public setLanguage(key: 'de'|'en'): void {
|
||||
if (key === 'de') { this.values = this.values_de; this.language.next('de'); }
|
||||
if (key === 'en') { this.values = this.values_en; this.language.next('en'); }
|
||||
this.updateLanguages();
|
||||
|
||||
@@ -3,9 +3,8 @@ import { ConsoleService } from './console.service';
|
||||
import { BehaviorSubject , Subject, Observable } from 'rxjs';
|
||||
import { HttpErrorResponse } from '@angular/common/http';
|
||||
import { Router } from '@angular/router';
|
||||
import { User } from '../../api/models/user.model';
|
||||
import { ApiClientService } from '../../api/index';
|
||||
import { UserPassword } from '../../api/models/userpassword.model';
|
||||
import { DefaultService } from '../../api/api/api';
|
||||
import { User, UserPassword } from '../../api/model/models';
|
||||
import { CredentialService } from './credential.service';
|
||||
import { HttpStatusCode } from '../utils/httpcodes';
|
||||
|
||||
@@ -79,7 +78,7 @@ export class UserService {
|
||||
* @param credentailService The credential service to manage the username and password.
|
||||
*/
|
||||
constructor(private consoleService: ConsoleService,
|
||||
private apiClientService: ApiClientService,
|
||||
private apiClientService: DefaultService,
|
||||
private credentailService: CredentialService) {
|
||||
if (credentailService.hasCredential()) {
|
||||
this.login();
|
||||
@@ -144,7 +143,7 @@ export class UserService {
|
||||
this.consoleService.log('Issuing login request.');
|
||||
this.state.next(UserState.Changing);
|
||||
this.user.next(null);
|
||||
this.apiClientService.getCurrentUser().subscribe(result => {
|
||||
this.apiClientService.getCurrentUser('response').subscribe(result => {
|
||||
this.user.next(result.body);
|
||||
this.state.next(UserState.Available);
|
||||
}, this.createErrorHandler());
|
||||
@@ -173,7 +172,7 @@ export class UserService {
|
||||
if (this.state.getValue() === UserState.Changing) { return false; }
|
||||
this.state.next(UserState.Changing);
|
||||
this.user.next(null);
|
||||
this.apiClientService.setCurrentPassword({ password: newPassword }).subscribe(result => {
|
||||
this.apiClientService.setCurrentPassword({ password: newPassword }, 'response').subscribe(result => {
|
||||
this.credentailService.setCredential(this.credentailService.getLogin(), newPassword);
|
||||
this.user.next(result.body);
|
||||
this.state.next(UserState.Available);
|
||||
@@ -214,7 +213,7 @@ export class UserService {
|
||||
if (this.state.getValue() === UserState.Changing) { return false; }
|
||||
this.state.next(UserState.Changing);
|
||||
this.user.next(null);
|
||||
this.apiClientService.setCurrentUser(user).subscribe(result => {
|
||||
this.apiClientService.setCurrentUser(user, 'response').subscribe(result => {
|
||||
this.user.next(result.body);
|
||||
this.state.next(UserState.Available);
|
||||
}, error => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Subject , BehaviorSubject, Subscription } from 'rxjs';
|
||||
import { BuildVersion } from '../../api/models';
|
||||
import { ApiClientService } from '../../api';
|
||||
import { BehaviorSubject, Subscription } from 'rxjs';
|
||||
import { BuildVersion } from '../../api/model/models';
|
||||
import { DefaultService } from '../../api/api/api';
|
||||
|
||||
/**
|
||||
* A service to download the current version
|
||||
@@ -13,12 +13,12 @@ export class VersionService {
|
||||
private version = new BehaviorSubject<BuildVersion>(null);
|
||||
private loading = false;
|
||||
|
||||
constructor(private apiClientService: ApiClientService) { }
|
||||
constructor(private apiClientService: DefaultService) { }
|
||||
|
||||
subscribe(handler: (version: BuildVersion) => void): Subscription {
|
||||
if (!this.loading && this.version.getValue() == null) {
|
||||
this.loading = true;
|
||||
this.apiClientService.getBuildVersion().subscribe((v) => {
|
||||
this.apiClientService.getBuildVersion('response').subscribe((v) => {
|
||||
this.version.next(v.body);
|
||||
this.loading = false;
|
||||
}, (e) => {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { DataSource } from '@angular/cdk/table';
|
||||
import { CollectionViewer } from '@angular/cdk/collections';
|
||||
import { Observable, BehaviorSubject, Subscription } from 'rxjs';
|
||||
import { ApiClientService } from '../../api';
|
||||
import { DefaultService } from '../../api/api/api';
|
||||
import { HttpResponse } from '@angular/common/http';
|
||||
import { MatPaginator } from '@angular/material';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
|
||||
export interface Page<E> {
|
||||
offset: number;
|
||||
@@ -45,7 +45,7 @@ export abstract class AbstractPageService<D, P extends Page<D>> extends DataSour
|
||||
private subscriptions = 0;
|
||||
readonly loading = new BehaviorSubject<boolean>(false);
|
||||
|
||||
constructor(protected apiClientService: ApiClientService) {
|
||||
constructor(protected apiClientService: DefaultService) {
|
||||
super();
|
||||
this.page.subscribe((page) => {
|
||||
this.elements.next(page.elements);
|
||||
@@ -93,7 +93,7 @@ export abstract class AbstractReferencePageService<D, P extends Page<D>, R> exte
|
||||
readonly references: Map<number, R> = new Map<number, R>();
|
||||
private referenceRequests = 0;
|
||||
|
||||
constructor(protected apiClientService: ApiClientService) {
|
||||
constructor(protected apiClientService: DefaultService) {
|
||||
super(apiClientService);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { MatSnackBar } from '@angular/material';
|
||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||
|
||||
export class Snackbars {
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { MatTable } from '@angular/material';
|
||||
import { MatTable } from '@angular/material/table';
|
||||
import { ElementRef } from '@angular/core';
|
||||
|
||||
export interface TableColumn {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ApiClientService } from '../../api';
|
||||
import { MatDialog } from '@angular/material';
|
||||
import { DefaultService } from '../../api/api/api';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { MessageDialogComponent } from '../widgets/message-dialog.component';
|
||||
import { HttpErrorResponse } from '@angular/common/http';
|
||||
@@ -17,7 +17,7 @@ import { ResourceService } from '../services/resource.service';
|
||||
|
||||
constructor(
|
||||
public res: ResourceService,
|
||||
private apiClientService: ApiClientService,
|
||||
private apiClientService: DefaultService,
|
||||
private dialog: MatDialog,
|
||||
private router: Router,
|
||||
private route: ActivatedRoute) { }
|
||||
@@ -27,7 +27,7 @@ import { ResourceService } from '../services/resource.service';
|
||||
if (!token) {
|
||||
this.router.navigate(['/']);
|
||||
} else {
|
||||
this.apiClientService.verifyUserEmail(token).subscribe((result) => {
|
||||
this.apiClientService.verifyUserEmail(token, 'response').subscribe((result) => {
|
||||
this.showMessage = false;
|
||||
MessageDialogComponent.open(this.dialog, {
|
||||
title: this.res.strings('activate_success_title'),
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core';
|
||||
import { UserState, UserService } from '../services/user.service';
|
||||
import { BehaviorSubject, Subscription } from 'rxjs';
|
||||
import { Router, ActivatedRoute } from '@angular/router';
|
||||
import { FormErrorCode, FormErrorEncoder } from '../utils/formcodes';
|
||||
import { LoginFieldComponent } from '../widgets/login-field.component';
|
||||
import { PasswordFieldComponent } from '../widgets/password-field.component';
|
||||
import { HttpStatusCode } from '../utils/httpcodes';
|
||||
import { MatSnackBar, MatDialog } from '@angular/material';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||
import { NgForm } from '@angular/forms';
|
||||
import { Snackbars } from '../utils/snackbars';
|
||||
import { ApiClientService } from '../../api';
|
||||
import { DefaultService } from '../../api/api/api';
|
||||
import { HttpErrorResponse } from '@angular/common/http';
|
||||
import { MessageDialogComponent } from '../widgets/message-dialog.component';
|
||||
import { ResourceService } from '../services/resource.service';
|
||||
@@ -30,7 +27,7 @@ export class ChangeComponent implements OnInit, OnDestroy {
|
||||
|
||||
constructor(
|
||||
public res: ResourceService,
|
||||
private apiClientService: ApiClientService,
|
||||
private apiClientService: DefaultService,
|
||||
private snackbar: MatSnackBar,
|
||||
private dialog: MatDialog,
|
||||
private router: Router,
|
||||
@@ -46,7 +43,7 @@ export class ChangeComponent implements OnInit, OnDestroy {
|
||||
if (!this.idle || !this.resetForm.valid) { return; }
|
||||
this.setIdle(false);
|
||||
this.changeSubscription = this.apiClientService.resetUserPassword
|
||||
(this.token, { password: this.passwordField.password }).subscribe((result) => {
|
||||
(this.token, { password: this.passwordField.password }, 'response').subscribe((result) => {
|
||||
this.setIdle(true);
|
||||
MessageDialogComponent.open(this.dialog, {
|
||||
title: this.res.strings('change_reset_success_title'),
|
||||
|
||||
@@ -70,5 +70,8 @@
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
</div>
|
||||
<div>
|
||||
<app-weather-video-list *ngIf="videos | async" [videos]="videos | async" [timezone]="city.timezone"></app-weather-video-list>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -1,17 +1,10 @@
|
||||
import { Component, ViewChild, OnInit, OnDestroy, ElementRef, DoCheck } from '@angular/core';
|
||||
import { MatPaginator, MatTableDataSource, PageEvent, MatPaginatorIntl, MatDialog, MatSnackBar } from '@angular/material';
|
||||
import { DeviceService } from '../services/device.service';
|
||||
import { City, Geometry, WeatherCondition, WeatherForecast } from '../../api/models';
|
||||
import { DataSource } from '@angular/cdk/table';
|
||||
import { Component, OnInit, OnDestroy } from '@angular/core';
|
||||
import { City, Geometry, WeatherCondition, WeatherForecast, WeatherVideo } from '../../api/model/models';
|
||||
import { Subscription, BehaviorSubject } from 'rxjs';
|
||||
import { PaginationHandler } from '../utils/pagination';
|
||||
import { ConfirmationDialogComponent, ConfirmationDialogResult } from '../widgets/confirmation-dialog.component';
|
||||
import { ApiClientService } from '../../api';
|
||||
import { Snackbars } from '../utils/snackbars';
|
||||
import { TableHandler, TableColumn } from '../utils/tables';
|
||||
|
||||
import { ResourceService } from '../services/resource.service';
|
||||
import { Router, ActivatedRoute } from '@angular/router';
|
||||
import { Type } from '../../api/models/city.model';
|
||||
import { DefaultService } from '../../api/api/api';
|
||||
|
||||
@Component({
|
||||
selector: 'app-city',
|
||||
@@ -23,12 +16,13 @@ export class CityComponent implements OnInit, OnDestroy {
|
||||
boundary = new BehaviorSubject<Geometry>(null);
|
||||
condition = new BehaviorSubject<WeatherCondition>(null);
|
||||
forecast = new BehaviorSubject<WeatherForecast>(null);
|
||||
videos = new BehaviorSubject<WeatherVideo[]>(null);
|
||||
routeSubscription: Subscription;
|
||||
date: Date;
|
||||
|
||||
constructor(
|
||||
public res: ResourceService,
|
||||
private apiClientService: ApiClientService,
|
||||
private apiClientService: DefaultService,
|
||||
private router: Router, private route: ActivatedRoute) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
@@ -38,20 +32,26 @@ export class CityComponent implements OnInit, OnDestroy {
|
||||
this.boundary.next(null);
|
||||
this.condition.next(null);
|
||||
this.forecast.next(null);
|
||||
this.videos.next(null);
|
||||
const cityId = this.city.id;
|
||||
this.apiClientService.getCityBoundary(cityId).subscribe((response) => {
|
||||
this.apiClientService.getCityBoundary(cityId).subscribe((boundary) => {
|
||||
if (this.city.id === cityId) {
|
||||
this.boundary.next(response.body);
|
||||
this.boundary.next(boundary);
|
||||
}
|
||||
});
|
||||
this.apiClientService.getCityCondition(cityId).subscribe((response) => {
|
||||
this.apiClientService.getCityCondition(cityId).subscribe((condition) => {
|
||||
if (this.city.id === cityId) {
|
||||
this.condition.next(response.body);
|
||||
this.condition.next(condition);
|
||||
}
|
||||
});
|
||||
this.apiClientService.getCityForecast(cityId).subscribe((response) => {
|
||||
this.apiClientService.getCityForecast(cityId).subscribe((forecast) => {
|
||||
if (this.city.id === cityId) {
|
||||
this.forecast.next(response.body);
|
||||
this.forecast.next(forecast);
|
||||
}
|
||||
});
|
||||
this.apiClientService.getLatestCityVideos(cityId).subscribe((videos) => {
|
||||
if (this.city.id === cityId) {
|
||||
this.videos.next(videos);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
import { Component, ViewChild, OnInit, OnDestroy, ElementRef, DoCheck } from '@angular/core';
|
||||
import { MatPaginator, MatTableDataSource, PageEvent, MatPaginatorIntl, MatDialog, MatSnackBar } from '@angular/material';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { MatPaginator, PageEvent, MatPaginatorIntl } from '@angular/material/paginator';
|
||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||
import { DeviceService } from '../services/device.service';
|
||||
import { Device, DevicePage } from '../../api/models';
|
||||
import { Device, DevicePage } from '../../api/model/models';
|
||||
import { DataSource } from '@angular/cdk/table';
|
||||
import { Subscription, BehaviorSubject } from 'rxjs';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
import { PaginationHandler } from '../utils/pagination';
|
||||
import { ConfirmationDialogComponent, ConfirmationDialogResult } from '../widgets/confirmation-dialog.component';
|
||||
import { ApiClientService } from '../../api';
|
||||
import { ConfirmationDialogComponent } from '../widgets/confirmation-dialog.component';
|
||||
import { DefaultService } from '../../api/api/api';
|
||||
import { Snackbars } from '../utils/snackbars';
|
||||
import { TableHandler, TableColumn } from '../utils/tables';
|
||||
import { ResourceService } from '../services/resource.service';
|
||||
@@ -39,7 +41,7 @@ export class DevicesComponent implements OnInit, OnDestroy, DoCheck {
|
||||
|
||||
constructor(
|
||||
public res: ResourceService,
|
||||
private apiClientService: ApiClientService,
|
||||
private apiClientService: DefaultService,
|
||||
private deviceSerivce: DeviceService,
|
||||
private snackbar: MatSnackBar,
|
||||
private dialog: MatDialog) {
|
||||
@@ -100,7 +102,7 @@ export class DevicesComponent implements OnInit, OnDestroy, DoCheck {
|
||||
|
||||
private doDelete(id: number): void {
|
||||
this.deleting.next(true);
|
||||
this.apiClientService.deleteDevice(id).subscribe((result) => {
|
||||
this.apiClientService.deleteDevice(id, 'response').subscribe((result) => {
|
||||
this.deleting.next(false);
|
||||
this.deviceSerivce.reload();
|
||||
Snackbars.showMessage(this.snackbar, this.res.strings('devices_delete_success'), Snackbars.DURATION_SHORT);
|
||||
|
||||
@@ -3,15 +3,14 @@ import { DatePipe } from '@angular/common';
|
||||
import { UserState, UserService } from '../services/user.service';
|
||||
import { BehaviorSubject, Subscription } from 'rxjs';
|
||||
import { Router } from '@angular/router';
|
||||
import { FormErrorCode, FormErrorEncoder } from '../utils/formcodes';
|
||||
import { LoginFieldComponent } from '../widgets/login-field.component';
|
||||
import { PasswordFieldComponent } from '../widgets/password-field.component';
|
||||
import { HttpStatusCode } from '../utils/httpcodes';
|
||||
import { MatSnackBar } from '@angular/material';
|
||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||
import { NgForm } from '@angular/forms';
|
||||
import { Snackbars } from '../utils/snackbars';
|
||||
import { VersionService } from '../services/version.service';
|
||||
import { BuildVersion } from '../../api/models';
|
||||
import { BuildVersion } from '../../api/model/models';
|
||||
import { ResourceService } from '../services/resource.service';
|
||||
|
||||
@Component({
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import { Component, OnInit, OnDestroy, ViewChild, DoCheck, ElementRef } from '@angular/core';
|
||||
import { BehaviorSubject, Observable } from 'rxjs';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
import { DataSource } from '@angular/cdk/table';
|
||||
import { LogMessage } from '../../api/models';
|
||||
import { CollectionViewer } from '@angular/cdk/collections';
|
||||
import { LogMessage } from '../../api/model/models';
|
||||
import { ManageLogService } from '../services/manage-log.service';
|
||||
import { LogDialogComponent } from '../widgets/log-dialog.component';
|
||||
import { MatDialog } from '@angular/material';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { TableColumn, TableHandler } from '../utils/tables';
|
||||
import { ResourceService } from '../services/resource.service';
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Component, OnInit, OnDestroy, HostListener } from '@angular/core';
|
||||
import { SystemStatistic, EntityStatistic, LoadStatistic } from '../../api/models';
|
||||
import { ApiClientService } from '../../api';
|
||||
import { SystemStatistic, EntityStatistic, LoadStatistic } from '../../api/model/models';
|
||||
import { DefaultService } from '../../api/api/api';
|
||||
import { Subscription, Observable, BehaviorSubject } from 'rxjs';
|
||||
import { DataSource } from '@angular/cdk/table';
|
||||
import { CollectionViewer } from '@angular/cdk/collections';
|
||||
@@ -43,7 +43,7 @@ export class ManageSystemComponent implements OnInit, OnDestroy {
|
||||
private entityTimer: any = null;
|
||||
private systemTimer: any = null;
|
||||
|
||||
constructor(public res: ResourceService, private apiClientService: ApiClientService) { }
|
||||
constructor(public res: ResourceService, private apiClientService: DefaultService) { }
|
||||
|
||||
@HostListener('window:resize', ['$event'])
|
||||
onResize(event: Event) {
|
||||
@@ -80,7 +80,7 @@ export class ManageSystemComponent implements OnInit, OnDestroy {
|
||||
|
||||
private updateLoad(): Subscription {
|
||||
return this.apiClientService.getLoadStatistic().subscribe((result) => {
|
||||
this.load = result.body;
|
||||
this.load = result;
|
||||
this.loadTimer = setTimeout(() => this.loadSubscription = this.updateLoad(), ManageSystemComponent.TIMEOUT_LOAD);
|
||||
}, (error) => {
|
||||
this.loadTimer = setTimeout(() => this.loadSubscription = this.updateLoad(), ManageSystemComponent.TIMEOUT_ERROR);
|
||||
@@ -89,7 +89,7 @@ export class ManageSystemComponent implements OnInit, OnDestroy {
|
||||
|
||||
private updateEntities(): Subscription {
|
||||
return this.apiClientService.getEntityStatistics().subscribe((result) => {
|
||||
this.entities.entities.next(result.body);
|
||||
this.entities.entities.next(result);
|
||||
this.entityTimer = setTimeout(() => this.entitySubscription = this.updateEntities(), ManageSystemComponent.TIMEOUT_ENTITY);
|
||||
}, (error) => {
|
||||
this.entityTimer = setTimeout(() => this.entitySubscription = this.updateEntities(), ManageSystemComponent.TIMEOUT_ERROR);
|
||||
@@ -98,7 +98,7 @@ export class ManageSystemComponent implements OnInit, OnDestroy {
|
||||
|
||||
private updateSystem(): Subscription {
|
||||
return this.apiClientService.getSystemStatistic().subscribe((result) => {
|
||||
this.system = result.body;
|
||||
this.system = result;
|
||||
}, (error) => {
|
||||
this.systemTimer = setTimeout(() => this.systemSubscription = this.updateSystem(), ManageSystemComponent.TIMEOUT_ERROR);
|
||||
});
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
import {Component, ViewChild, OnInit, OnDestroy, ElementRef, DoCheck} from '@angular/core';
|
||||
import {MatPaginator, MatTableDataSource, PageEvent, MatPaginatorIntl, MatDialog, MatSnackBar} from '@angular/material';
|
||||
import { DeviceService } from '../services/device.service';
|
||||
import { Device, DevicePage, User, UserPage } from '../../api/models';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||
import { User, UserPage } from '../../api/model/models';
|
||||
import { DataSource } from '@angular/cdk/table';
|
||||
import { Subscription, BehaviorSubject } from 'rxjs';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
import { PaginationHandler } from '../utils/pagination';
|
||||
import { ConfirmationDialogComponent, ConfirmationDialogResult } from '../widgets/confirmation-dialog.component';
|
||||
import { ApiClientService } from '../../api';
|
||||
import { Snackbars } from '../utils/snackbars';
|
||||
import { ManageUserService } from '../services/manage-user.service';
|
||||
import { FormErrorEncoder } from '../utils/formcodes';
|
||||
@@ -42,15 +40,12 @@ export class ManageUsersComponent extends FormErrorEncoder implements OnInit, On
|
||||
|
||||
private tableHandler: TableHandler;
|
||||
private pageHandler: PaginationHandler<User, UserPage>;
|
||||
|
||||
|
||||
|
||||
constructor(
|
||||
public res: ResourceService,
|
||||
private apiClientService: ApiClientService,
|
||||
private userService: UserService,
|
||||
private manageUserService: ManageUserService,
|
||||
private snackbar: MatSnackBar,
|
||||
private dialog: MatDialog) {
|
||||
private snackbar: MatSnackBar) {
|
||||
super();
|
||||
this.dataSource = manageUserService;
|
||||
this.loading = manageUserService.loading;
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
import { Component, OnInit, OnDestroy, ViewChild, HostListener } from '@angular/core';
|
||||
import { UserState, UserService } from '../services/user.service';
|
||||
import { BehaviorSubject, Subscription } from 'rxjs';
|
||||
import { Router } from '@angular/router';
|
||||
import { FormErrorCode, FormErrorEncoder } from '../utils/formcodes';
|
||||
import { LoginFieldComponent } from '../widgets/login-field.component';
|
||||
import { PasswordFieldComponent } from '../widgets/password-field.component';
|
||||
import { HttpStatusCode } from '../utils/httpcodes';
|
||||
import { MatSnackBar, MatDialog } from '@angular/material';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||
import { NgForm } from '@angular/forms';
|
||||
import { NameFieldComponent } from '../widgets/name-field.component';
|
||||
import { EmailFieldComponent } from '../widgets/email-field.component';
|
||||
import { UserRegistration } from '../../api/models';
|
||||
import { ApiClientService} from '../../api/index';
|
||||
import { UserRegistration } from '../../api/model/models';
|
||||
import { DefaultService } from '../../api/api/api';
|
||||
import { HttpErrorResponse } from '@angular/common/http';
|
||||
import { Snackbars } from '../utils/snackbars';
|
||||
import { MessageDialogComponent } from '../widgets/message-dialog.component';
|
||||
@@ -38,7 +37,7 @@ export class RegisterComponent implements OnInit, OnDestroy {
|
||||
|
||||
private registrationSubscription: Subscription;
|
||||
|
||||
constructor(public res: ResourceService, private apiClientService: ApiClientService,
|
||||
constructor(public res: ResourceService, private apiClientService: DefaultService,
|
||||
private snackbar: MatSnackBar, private router: Router, private dialog: MatDialog) { }
|
||||
|
||||
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core';
|
||||
import { UserState, UserService } from '../services/user.service';
|
||||
import { UserService } from '../services/user.service';
|
||||
import { BehaviorSubject, Subscription } from 'rxjs';
|
||||
import { Router } from '@angular/router';
|
||||
import { FormErrorCode, FormErrorEncoder } from '../utils/formcodes';
|
||||
import { LoginFieldComponent } from '../widgets/login-field.component';
|
||||
import { PasswordFieldComponent } from '../widgets/password-field.component';
|
||||
import { HttpStatusCode } from '../utils/httpcodes';
|
||||
import { MatSnackBar, MatDialog } from '@angular/material';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||
import { NgForm } from '@angular/forms';
|
||||
import { Snackbars } from '../utils/snackbars';
|
||||
import { ApiClientService } from '../../api';
|
||||
import { DefaultService } from '../../api/api/api';
|
||||
import { HttpErrorResponse } from '@angular/common/http';
|
||||
import { MessageDialogComponent } from '../widgets/message-dialog.component';
|
||||
import { ResourceService } from '../services/resource.service';
|
||||
@@ -30,7 +29,7 @@ export class ResetComponent implements OnInit, OnDestroy {
|
||||
login: string;
|
||||
|
||||
constructor(public res: ResourceService, private userService: UserService,
|
||||
private apiClientService: ApiClientService, private snackbar: MatSnackBar,
|
||||
private apiClientService: DefaultService, private snackbar: MatSnackBar,
|
||||
private dialog: MatDialog, private router: Router) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
|
||||
@@ -1,21 +1,18 @@
|
||||
import { Component, OnInit, OnDestroy, ViewChild, HostListener } from '@angular/core';
|
||||
import { UserState, UserService, UserRole } from '../services/user.service';
|
||||
import { BehaviorSubject, Subscription , Observable } from 'rxjs';
|
||||
import { UserService, UserRole } from '../services/user.service';
|
||||
import { BehaviorSubject, Subscription } from 'rxjs';
|
||||
import { Router } from '@angular/router';
|
||||
import { FormErrorCode, FormErrorEncoder } from '../utils/formcodes';
|
||||
import { LoginFieldComponent } from '../widgets/login-field.component';
|
||||
import { PasswordFieldComponent } from '../widgets/password-field.component';
|
||||
import { HttpStatusCode } from '../utils/httpcodes';
|
||||
import { MatSnackBar, MatDialog, MatSelect, MatOption } from '@angular/material';
|
||||
import { NgForm } from '@angular/forms';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { MatSelect } from '@angular/material/select';
|
||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||
import { Snackbars } from '../utils/snackbars';
|
||||
import { User, Email } from '../../api/models';
|
||||
import { User, Email } from '../../api/model/models';
|
||||
import { NameFieldComponent } from '../widgets/name-field.component';
|
||||
import { EmailFieldComponent } from '../widgets/email-field.component';
|
||||
import { MessageDialogComponent } from '../widgets/message-dialog.component';
|
||||
import { ResourceService } from '../services/resource.service';
|
||||
import { ConfirmationDialogComponent } from '../widgets/confirmation-dialog.component';
|
||||
import { AuthGuard } from '../guards/auth.guard';
|
||||
|
||||
@Component({
|
||||
selector: 'app-user',
|
||||
@@ -23,18 +20,18 @@ import { AuthGuard } from '../guards/auth.guard';
|
||||
})
|
||||
export class UserComponent implements OnInit, OnDestroy {
|
||||
|
||||
@ViewChild(NameFieldComponent, { static: false }) nameField: NameFieldComponent;
|
||||
@ViewChild(MatSelect, { static: false }) emailSelect: MatSelect;
|
||||
@ViewChild(NameFieldComponent) nameField: NameFieldComponent;
|
||||
@ViewChild(MatSelect) emailSelect: MatSelect;
|
||||
|
||||
// add email
|
||||
@ViewChild(EmailFieldComponent, { static: false }) emailField: EmailFieldComponent;
|
||||
@ViewChild(EmailFieldComponent) emailField: EmailFieldComponent;
|
||||
|
||||
// change passwords
|
||||
@ViewChild('oldPassword', { static: false }) oldPasswordField: PasswordFieldComponent;
|
||||
@ViewChild('newPassword', { static: false }) newPasswordField: PasswordFieldComponent;
|
||||
@ViewChild('oldPassword') oldPasswordField: PasswordFieldComponent;
|
||||
@ViewChild('newPassword') newPasswordField: PasswordFieldComponent;
|
||||
|
||||
// delete account
|
||||
@ViewChild('deletePassword', { static: false }) deletePasswordField: PasswordFieldComponent;
|
||||
@ViewChild('deletePassword') deletePasswordField: PasswordFieldComponent;
|
||||
|
||||
readonly idle = new BehaviorSubject<boolean>(true);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Component, Inject } from '@angular/core';
|
||||
import { MatDialogRef, MAT_DIALOG_DATA, MatDialog } from '@angular/material';
|
||||
import { MatDialogRef, MAT_DIALOG_DATA, MatDialog } from '@angular/material/dialog';
|
||||
import { Observable } from 'rxjs';
|
||||
import { ResourceService } from '../services/resource.service';
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Component, Inject } from '@angular/core';
|
||||
import { MatDialogRef, MAT_DIALOG_DATA, MatDialog } from '@angular/material';
|
||||
import { MatDialogRef, MAT_DIALOG_DATA, MatDialog } from '@angular/material/dialog';
|
||||
import { Observable } from 'rxjs';
|
||||
import { LogMessage } from '../../api/models';
|
||||
import { LogMessage } from '../../api/model/models';
|
||||
import { ResourceService } from '../services/resource.service';
|
||||
|
||||
@Component({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Component, OnInit, DoCheck, ElementRef, ViewChild, Input } from '@angular/core';
|
||||
import { ResourceService } from '../services/resource.service';
|
||||
import * as L from 'leaflet';
|
||||
import { Coordinate, Geometry } from '../../api/models';
|
||||
import { Coordinate, Geometry } from '../../api/model/models';
|
||||
|
||||
/**
|
||||
* Implements a map to display a location with optional boundaries
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Component, Inject } from '@angular/core';
|
||||
import { MatDialogRef, MAT_DIALOG_DATA, MatDialog } from '@angular/material';
|
||||
import { MatDialogRef, MAT_DIALOG_DATA, MatDialog } from '@angular/material/dialog';
|
||||
import { Observable } from 'rxjs';
|
||||
import { ResourceService } from '../services/resource.service';
|
||||
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import { Component, Input, OnInit, OnDestroy } from '@angular/core';
|
||||
import { Router, RouterEvent, NavigationEnd } from '@angular/router';
|
||||
import { Component, OnInit, OnDestroy } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { FormControl } from '@angular/forms';
|
||||
import { ApiClientService, Language } from '../../api';
|
||||
import { DefaultService } from '../../api/api/api';
|
||||
import { ResourceService } from '../services/resource.service';
|
||||
import { LocationHierarchy } from '../../api/models';
|
||||
import { Type } from '../../api/models/locationhierarchy.model';
|
||||
import { MatAutocompleteSelectedEvent } from '@angular/material';
|
||||
import { LocationHierarchy } from '../../api/model/models';
|
||||
import { MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
|
||||
/**
|
||||
* Implements a search field for locations.
|
||||
*/
|
||||
@@ -26,7 +25,7 @@ export class SearchFieldComponent implements OnInit, OnDestroy {
|
||||
*
|
||||
* @param router The router.
|
||||
*/
|
||||
constructor(private router: Router, private res: ResourceService, private apiClientService: ApiClientService) { }
|
||||
constructor(private router: Router, private res: ResourceService, private apiClientService: DefaultService) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.subscription = this.term.valueChanges.subscribe(() => {
|
||||
@@ -36,9 +35,9 @@ export class SearchFieldComponent implements OnInit, OnDestroy {
|
||||
if (value.length > 0) {
|
||||
setTimeout(() => {
|
||||
if (this.requestId === id) {
|
||||
this.apiClientService.searchLocations(0, 20, this.getLanguage(), null, value).subscribe((page) => {
|
||||
this.apiClientService.searchLocations(this.res.getLanguage(), value, 0, 20, null).subscribe((page) => {
|
||||
if (id === this.requestId) {
|
||||
this.locations = page.body.elements;
|
||||
this.locations = page.elements;
|
||||
}
|
||||
}, (error) => {
|
||||
console.log('request failed for: ' + value);
|
||||
@@ -53,11 +52,11 @@ export class SearchFieldComponent implements OnInit, OnDestroy {
|
||||
const location = event.option.value;
|
||||
let url = '';
|
||||
switch (location.type) {
|
||||
case Type.CITY:
|
||||
case LocationHierarchy.TypeEnum.CITY:
|
||||
url = 'cities'; break;
|
||||
case Type.COUNTRY:
|
||||
case LocationHierarchy.TypeEnum.COUNTRY:
|
||||
url = 'countries'; break;
|
||||
case Type.STATE:
|
||||
case LocationHierarchy.TypeEnum.STATE:
|
||||
url = 'states'; break;
|
||||
}
|
||||
this.term.setValue('');
|
||||
@@ -66,14 +65,14 @@ export class SearchFieldComponent implements OnInit, OnDestroy {
|
||||
|
||||
getLocationName(location: LocationHierarchy, first: boolean): string {
|
||||
if (location) {
|
||||
const names = location.names as Map<string, string>;
|
||||
const names = location.names;
|
||||
let name: string = names['acronym'];
|
||||
if (first || name == null) {
|
||||
name = names[this.res.getLanguage()];
|
||||
}
|
||||
if (name == null) {
|
||||
name = names['local'];
|
||||
}
|
||||
}
|
||||
if (location.parent !== null) {
|
||||
return name + ', ' + this.getLocationName(location.parent, false);
|
||||
} else {
|
||||
@@ -86,21 +85,15 @@ export class SearchFieldComponent implements OnInit, OnDestroy {
|
||||
|
||||
getLocationIcon(location: LocationHierarchy): string {
|
||||
switch (location.type) {
|
||||
case Type.CITY:
|
||||
case LocationHierarchy.TypeEnum.CITY:
|
||||
return 'place';
|
||||
case Type.STATE:
|
||||
case LocationHierarchy.TypeEnum.STATE:
|
||||
return 'map';
|
||||
default:
|
||||
return 'public';
|
||||
}
|
||||
}
|
||||
|
||||
private getLanguage(): Language {
|
||||
const ref = this.res.getLanguage().toUpperCase() as keyof typeof Language;
|
||||
const lang = Language[ref];
|
||||
return lang;
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.subscription.unsubscribe();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { Component, OnInit, DoCheck, ElementRef, ViewChild, Input } from '@angular/core';
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { ResourceService } from '../services/resource.service';
|
||||
import * as L from 'leaflet';
|
||||
import { Coordinate, Geometry, WeatherCondition } from '../../api/models';
|
||||
import { WeatherCondition } from '../../api/model/models';
|
||||
|
||||
/**
|
||||
* Implements a component to display a single
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import { Component,Input, OnChanges } from '@angular/core';
|
||||
import { ResourceService } from '../services/resource.service';
|
||||
import * as L from 'leaflet';
|
||||
import { WeatherForecast } from '../../api/models';
|
||||
import { WindDirection } from '../../api/models/weathercondition.model';
|
||||
import { WeatherForecast, WeatherCondition } from '../../api/model/models';
|
||||
|
||||
/**
|
||||
* Implements a component to aggregte the weather
|
||||
@@ -35,7 +33,7 @@ export class WeatherForecastComponent implements OnChanges {
|
||||
windSpeed: number[] = [0, 0];
|
||||
|
||||
/** direction for min and max speed */
|
||||
windDirection: WindDirection[] = [null, null];
|
||||
windDirection: WeatherCondition.WindDirectionEnum[] = [null, null];
|
||||
|
||||
/** min and max humdity */
|
||||
humidity: number[] = [0, 0];
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<div class="match-parent">
|
||||
<mat-form-field>
|
||||
<mat-label>Select video</mat-label>
|
||||
<mat-select [(value)]="selected">
|
||||
<mat-option *ngFor="let video of videos" [value]="video">{{ getName(video) }}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
{{ getName(selected) }}
|
||||
<ng-container *ngIf="selected">
|
||||
<app-weather-video [video]="selected" [timezone]="timezone" width="600"></app-weather-video>
|
||||
</ng-container>
|
||||
</div>
|
||||
@@ -0,0 +1,42 @@
|
||||
import { Component, ElementRef, ViewChild, Input, OnChanges, OnDestroy, AfterViewChecked, SimpleChanges } from '@angular/core';
|
||||
import { ResourceService } from '../services/resource.service';
|
||||
import { WeatherVideo } from '../../api/model/models';
|
||||
|
||||
|
||||
/**
|
||||
* Implements a component to display weather videos.
|
||||
*/
|
||||
@Component({
|
||||
selector: 'app-weather-video-list',
|
||||
templateUrl: './weather-video-list.component.html'
|
||||
})
|
||||
export class WeatherVideoListComponent implements OnChanges {
|
||||
|
||||
/** The video to play. */
|
||||
@Input() videos: WeatherVideo[] = [];
|
||||
|
||||
/** The mandatory timezone to compute time stamps. */
|
||||
@Input() timezone: string = null;
|
||||
|
||||
selected: WeatherVideo = null;
|
||||
|
||||
constructor(public res: ResourceService) {
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
console.log(changes);
|
||||
if (changes['videos']) {
|
||||
if (this.videos && this.videos.length > 0) {
|
||||
this.selected = this.videos[0];
|
||||
} else {
|
||||
this.videos = [];
|
||||
this.selected = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getName(video: WeatherVideo) {
|
||||
const date = new Date(video.time).toLocaleDateString(this.res.getLanguage(), { timeZone: this.timezone });
|
||||
return date + ' ' + video.source + ' ' + video.type;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<div class="match-parent">
|
||||
<p> {{ url }}</p>
|
||||
<video #video class="video-js vjs-default-skin" controls preload="metadata" [width]="width" [height]="height">
|
||||
<source [src]="url" type="video/mp4" />
|
||||
<p class="vjs-no-js">Video playback requires HTML5.</p>
|
||||
</video>
|
||||
</div>
|
||||
@@ -0,0 +1,88 @@
|
||||
import { Component, ElementRef, ViewChild, Input, OnChanges, OnDestroy, AfterViewChecked, AfterViewInit } from '@angular/core';
|
||||
import { ResourceService } from '../services/resource.service';
|
||||
import videojs from 'video.js';
|
||||
import 'videojs-overlay';
|
||||
import { WeatherVideo } from '../../api/model/models';
|
||||
|
||||
|
||||
/**
|
||||
* Implements a component to display weather videos.
|
||||
*/
|
||||
@Component({
|
||||
selector: 'app-weather-video',
|
||||
templateUrl: './weather-video.component.html'
|
||||
})
|
||||
export class WeatherVideoComponent implements OnChanges, OnDestroy, AfterViewChecked, AfterViewInit {
|
||||
|
||||
/** The video to play. */
|
||||
@Input() video: WeatherVideo = null;
|
||||
|
||||
/** The (optional) width of the video in pixels. */
|
||||
@Input() width: number = null;
|
||||
|
||||
/** The (optional) height of the video in pixels. */
|
||||
@Input() height: number = null;
|
||||
|
||||
/** The mandatory timezone to compute time stamps. */
|
||||
@Input() timezone: string = null;
|
||||
|
||||
@ViewChild('video') videoElement: ElementRef;
|
||||
|
||||
player: any;
|
||||
|
||||
url: string;
|
||||
|
||||
loadedUrl: string;
|
||||
|
||||
constructor(public res: ResourceService) {
|
||||
}
|
||||
|
||||
ngOnChanges() {
|
||||
if (this.video) {
|
||||
this.url = this.video.url;
|
||||
if (this.height == null && this.width != null) {
|
||||
this.height = this.video.height * this.width / this.video.width;
|
||||
} else if (this.width == null && this.height != null) {
|
||||
this.width = this.video.width * this.height / this.video.height;
|
||||
} else {
|
||||
this.width = this.video.width;
|
||||
this.height = this.video.height;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
if (!this.player && document.body.contains(this.videoElement.nativeElement)) {
|
||||
this.player = videojs(this.videoElement.nativeElement);
|
||||
this.loadedUrl = this.url;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ngAfterViewChecked() {
|
||||
if (this.player && this.loadedUrl !== this.url) {
|
||||
this.loadedUrl = this.url;
|
||||
this.player.src({ type: 'video/mp4', src: this.url});
|
||||
const overlays: { start: number, end: number, align: string, content: string}[] = [];
|
||||
for (let i = 0; i < this.video.duration; i++) {
|
||||
const date = new Date(this.video.time);
|
||||
date.setHours(date.getHours() + i + this.video.start);
|
||||
const time = '<div class="video-overlay">'
|
||||
+ date.toLocaleDateString(this.res.getLanguage(), { timeZone: this.timezone }) + ' '
|
||||
+ date.toLocaleTimeString(this.res.getLanguage(), { timeZone: this.timezone }) + '</div>';
|
||||
overlays.push({ start: i, end: i + 1, align: 'top-right', content: time});
|
||||
}
|
||||
this.player.overlay({
|
||||
debug: false, showBackground: false, overlays: overlays
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
if (this.player) {
|
||||
this.player.dispose();
|
||||
this.player = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,6 @@ import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||
import { AppModule } from './app/app.module';
|
||||
import { environment } from './environments/environment';
|
||||
|
||||
import 'hammerjs';
|
||||
|
||||
if (environment.production) {
|
||||
enableProdMode();
|
||||
}
|
||||
|
||||
@@ -220,4 +220,14 @@ mat-form-field {
|
||||
|
||||
.search-result {
|
||||
width: 280px;
|
||||
}
|
||||
|
||||
.video-overlay {
|
||||
background-color: rgba(mat-color($app-accent), 0.8);
|
||||
justify-content: center;
|
||||
font-size: 16px;
|
||||
font-style: italic;
|
||||
padding: 10px;
|
||||
border-radius: round(5px);
|
||||
color: black;
|
||||
}
|
||||
@@ -5,8 +5,11 @@
|
||||
"baseUrl": "./",
|
||||
"types": []
|
||||
},
|
||||
"exclude": [
|
||||
"test.ts",
|
||||
"**/*.spec.ts"
|
||||
"files": [
|
||||
"main.ts",
|
||||
"polyfills.ts"
|
||||
],
|
||||
"include": [
|
||||
"src/**/*.d.ts"
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user