Linting
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import { Component, DestroyRef, inject, OnInit, OnDestroy } from '@angular/core';
|
import { Component, DestroyRef, inject, OnInit, OnDestroy } from '@angular/core';
|
||||||
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
||||||
import { FormControl, FormGroup, FormBuilder, FormArray, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
import { /*FormControl,*/ FormGroup, FormBuilder, FormArray, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||||
import { ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute } from '@angular/router';
|
||||||
import { MatButtonModule } from '@angular/material/button';
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
import { MatCardModule } from '@angular/material/card';
|
import { MatCardModule } from '@angular/material/card';
|
||||||
|
|||||||
@@ -1,9 +1,4 @@
|
|||||||
import {
|
import { Directive, AfterContentChecked } from '@angular/core';
|
||||||
Directive,
|
|
||||||
OnInit,
|
|
||||||
AfterViewInit,
|
|
||||||
AfterContentChecked
|
|
||||||
} from '@angular/core';
|
|
||||||
import { Router, NavigationEnd } from '@angular/router';
|
import { Router, NavigationEnd } from '@angular/router';
|
||||||
|
|
||||||
import { AccordionLinkDirective } from './accordionlink.directive';
|
import { AccordionLinkDirective } from './accordionlink.directive';
|
||||||
@@ -51,7 +46,7 @@ export class AccordionDirective implements AfterContentChecked {
|
|||||||
ngAfterContentChecked(): void {
|
ngAfterContentChecked(): void {
|
||||||
this.router.events
|
this.router.events
|
||||||
.pipe(filter(event => event instanceof NavigationEnd))
|
.pipe(filter(event => event instanceof NavigationEnd))
|
||||||
.subscribe(e => this.checkOpenLinks());
|
.subscribe(() => this.checkOpenLinks());
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(private router: Router) {
|
constructor(private router: Router) {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ export class AccordionAnchorDirective {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@HostListener('click', ['$event'])
|
@HostListener('click', ['$event'])
|
||||||
onClick(e: any) {
|
onClick() {
|
||||||
this.navlink.toggle();
|
this.navlink.toggle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import { AccordionDirective } from './accordion.directive';
|
|||||||
})
|
})
|
||||||
export class AccordionLinkDirective implements OnInit, OnDestroy {
|
export class AccordionLinkDirective implements OnInit, OnDestroy {
|
||||||
@Input()
|
@Input()
|
||||||
public group: any;
|
public group!: string;
|
||||||
|
|
||||||
@HostBinding('class.selected')
|
@HostBinding('class.selected')
|
||||||
@Input()
|
@Input()
|
||||||
@@ -37,15 +37,15 @@ export class AccordionLinkDirective implements OnInit, OnDestroy {
|
|||||||
this.nav = nav;
|
this.nav = nav;
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): any {
|
ngOnInit() {
|
||||||
this.nav.addLink(this);
|
this.nav.addLink(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): any {
|
ngOnDestroy(){
|
||||||
this.nav.removeGroup(this);
|
this.nav.removeGroup(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
toggle(): any {
|
toggle() {
|
||||||
this.selected = !this.selected;
|
this.selected = !this.selected;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<canvas baseChart class="w-100 h-auto"
|
<canvas baseChart class="w-100 h-auto"
|
||||||
[data]="chartConfig.barChartData"
|
[data]="chartConfig.barChartData"
|
||||||
[options]="chartConfig.barChartOptions"
|
[options]="chartConfig.barChartOptions"
|
||||||
[plugins]="chartConfig.barChartPlugins"
|
[plugins]="chartConfig.barChartPlugins!"
|
||||||
[legend]="chartConfig.barChartLegend"
|
[legend]="chartConfig.barChartLegend"
|
||||||
[type]="'bar'">
|
[type]="'bar'">
|
||||||
</canvas>
|
</canvas>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<canvas baseChart
|
<canvas baseChart
|
||||||
[data]="chartConfig.barChartData"
|
[data]="chartConfig.barChartData"
|
||||||
[options]="chartConfig.barChartOptions"
|
[options]="chartConfig.barChartOptions"
|
||||||
[plugins]="chartConfig.barChartPlugins"
|
[plugins]="chartConfig.barChartPlugins!"
|
||||||
[legend]="chartConfig.barChartLegend"
|
[legend]="chartConfig.barChartLegend"
|
||||||
[type]="'bar'">
|
[type]="'bar'">
|
||||||
</canvas>
|
</canvas>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<canvas baseChart class="w-100 h-auto"
|
<canvas baseChart class="w-100 h-auto"
|
||||||
[data]="chartConfig.barChartData"
|
[data]="chartConfig.barChartData"
|
||||||
[options]="chartConfig.barChartOptions"
|
[options]="chartConfig.barChartOptions"
|
||||||
[plugins]="chartConfig.barChartPlugins"
|
[plugins]="chartConfig.barChartPlugins!"
|
||||||
[legend]="chartConfig.barChartLegend"
|
[legend]="chartConfig.barChartLegend"
|
||||||
[type]="'bar'">
|
[type]="'bar'">
|
||||||
</canvas>
|
</canvas>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Component, Input, OnChanges, AfterContentChecked } from '@angular/core';
|
import { Component, Input, AfterContentChecked } from '@angular/core';
|
||||||
import { NgIf, NgFor } from '@angular/common';
|
import { NgIf, NgFor } from '@angular/common';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -10,7 +10,7 @@ import { NgIf, NgFor } from '@angular/common';
|
|||||||
templateUrl: './history-table.component.html',
|
templateUrl: './history-table.component.html',
|
||||||
styleUrls: []
|
styleUrls: []
|
||||||
})
|
})
|
||||||
export class HistoryTableComponent implements OnChanges, AfterContentChecked {
|
export class HistoryTableComponent implements AfterContentChecked {
|
||||||
public seriesColTotal: number[] = [];
|
public seriesColTotal: number[] = [];
|
||||||
public grandTotal: number = 0;
|
public grandTotal: number = 0;
|
||||||
|
|
||||||
@@ -22,10 +22,10 @@ export class HistoryTableComponent implements OnChanges, AfterContentChecked {
|
|||||||
@Input() rows: Array<Array<number>> = [];
|
@Input() rows: Array<Array<number>> = [];
|
||||||
@Input() colors: string[] = [];
|
@Input() colors: string[] = [];
|
||||||
|
|
||||||
ngOnChanges() {
|
/*ngOnChanges() {
|
||||||
//this._loadHistoryTable();
|
//this._loadHistoryTable();
|
||||||
//console.log('onChanges');
|
//console.log('onChanges');
|
||||||
}
|
}*/
|
||||||
|
|
||||||
ngAfterContentChecked() {
|
ngAfterContentChecked() {
|
||||||
if (this.rows !== undefined && this.rows.length) {
|
if (this.rows !== undefined && this.rows.length) {
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
import { Component, OnInit, OnDestroy, Input, computed, Signal, WritableSignal } from '@angular/core';
|
import { Component, OnInit, OnDestroy, Input } from '@angular/core';
|
||||||
import { NgClass, DatePipe } from '@angular/common';
|
import { NgClass, DatePipe } from '@angular/common';
|
||||||
import { RouterLink } from '@angular/router';
|
import { RouterLink } from '@angular/router';
|
||||||
import { MatButtonModule } from '@angular/material/button';
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
import { MatIconModule } from '@angular/material/icon';
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||||
import { Observable, Subscription } from 'rxjs';
|
import { Observable, Subscription } from 'rxjs';
|
||||||
import { take } from 'rxjs/operators';
|
|
||||||
|
|
||||||
import { Errors, Jump, JumpList, JumpListConfig } from 'src/app/core/models';
|
import { Errors, Jump, JumpList, JumpListConfig } from 'src/app/core/models';
|
||||||
import { JumpsService } from 'src/app/core/services';
|
import { JumpsService } from 'src/app/core/services';
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ export class JumpPreviewComponent implements OnDestroy {
|
|||||||
|
|
||||||
deleteJump() {
|
deleteJump() {
|
||||||
this.isDeleting = true;
|
this.isDeleting = true;
|
||||||
const jump$: Observable<any> = this.jumpsService.destroy(this.jump.slug);
|
const jump$: Observable<boolean> = this.jumpsService.destroy(this.jump.slug);
|
||||||
this._jump = jump$.subscribe({
|
this._jump = jump$.subscribe({
|
||||||
next: () => {
|
next: () => {
|
||||||
this.router.navigateByUrl('/');
|
this.router.navigateByUrl('/');
|
||||||
|
|||||||
@@ -311,58 +311,4 @@
|
|||||||
</ng-container>
|
</ng-container>
|
||||||
<tr mat-header-row *matHeaderRowDef="displayedColumns; sticky: true" class="accent"></tr>
|
<tr mat-header-row *matHeaderRowDef="displayedColumns; sticky: true" class="accent"></tr>
|
||||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;" class="text-middle accent"></tr>
|
<tr mat-row *matRowDef="let row; columns: displayedColumns;" class="text-middle accent"></tr>
|
||||||
</table>
|
</table>
|
||||||
<!--
|
|
||||||
<table mat-table [dataSource]="jumps">
|
|
||||||
<ng-container [matColumnDef]="col.key" *ngFor="let col of columnsSchema">
|
|
||||||
<th mat-header-cell *matHeaderCellDef [ngSwitch]="col.key">
|
|
||||||
<span *ngSwitchCase="'isSelected'">
|
|
||||||
<mat-checkbox (change)="selectAll($event)" [checked]="isAllSelected()" [indeterminate]="!isAllSelected() && isAnySelected()"></mat-checkbox>
|
|
||||||
</span>
|
|
||||||
<span *ngSwitchDefault>{{ col.label }}</span>
|
|
||||||
</th>
|
|
||||||
<td mat-cell *matCellDef="let element">
|
|
||||||
<div [ngSwitch]="col.type" *ngIf="!element.isEdit">
|
|
||||||
<ng-container *ngSwitchCase="'isSelected'">
|
|
||||||
<mat-checkbox (change)="element.isSelected = $event.checked" [checked]="element.isSelected">
|
|
||||||
</mat-checkbox>
|
|
||||||
</ng-container>
|
|
||||||
<div class="btn-edit" *ngSwitchCase="'isEdit'">
|
|
||||||
<button mat-button (click)="element.isEdit = !element.isEdit">
|
|
||||||
Modifier
|
|
||||||
</button>
|
|
||||||
<button mat-button class="button-remove" (click)="openDeleteDialog(element)">
|
|
||||||
Supprimer
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<span *ngSwitchCase="'date'">
|
|
||||||
{{ element[col.key] | date: 'mediumDate' }}
|
|
||||||
</span>
|
|
||||||
<span *ngSwitchDefault>
|
|
||||||
{{ element[col.key] }}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div [ngSwitch]="col.type" *ngIf="element.isEdit">
|
|
||||||
<div *ngSwitchCase="'isSelected'"></div>
|
|
||||||
<div class="btn-edit" *ngSwitchCase="'isEdit'">
|
|
||||||
<button mat-icon-button color="primary" [hidden]="!showAdd" (click)="openEditDialog(element)" [disabled]="disableSubmit(element.id)">
|
|
||||||
<mat-icon aria-label="Modifier" fontIcon="edit"></mat-icon>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<mat-form-field class="form-input" *ngSwitchCase="'date'" appearance="fill">
|
|
||||||
<mat-label>Choose a date</mat-label>
|
|
||||||
<input matInput [matDatepicker]="picker" [(ngModel)]="element[col.key]" />
|
|
||||||
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
|
|
||||||
<mat-datepicker #picker></mat-datepicker>
|
|
||||||
</mat-form-field>
|
|
||||||
<mat-form-field class="form-input" *ngSwitchDefault>
|
|
||||||
<input matInput [required]="col.required!" [pattern]="col.pattern!" [type]="col.type"
|
|
||||||
[(ngModel)]="element[col.key]" (change)="inputHandler($event, element.id, col.key)" />
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</ng-container>
|
|
||||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
|
||||||
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
|
|
||||||
</table>
|
|
||||||
-->
|
|
||||||
@@ -11,7 +11,8 @@ export class ShowAuthedDirective implements OnInit, OnDestroy {
|
|||||||
private _auth: Subscription = new Subscription();
|
private _auth: Subscription = new Subscription();
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private templateRef: TemplateRef<any>,
|
//private templateRef: TemplateRef<any>,
|
||||||
|
private templateRef: TemplateRef<never>,
|
||||||
private userService: UserService,
|
private userService: UserService,
|
||||||
private viewContainer: ViewContainerRef
|
private viewContainer: ViewContainerRef
|
||||||
) { }
|
) { }
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { inject } from '@angular/core';
|
import { inject } from '@angular/core';
|
||||||
import { ActivatedRouteSnapshot, CanActivateFn, Router, RouterStateSnapshot } from '@angular/router';
|
import { CanActivateFn, Router } from '@angular/router';
|
||||||
import { map, take } from 'rxjs/operators';
|
import { map, take } from 'rxjs/operators';
|
||||||
|
|
||||||
import { UserService } from 'src/app/core/services';
|
import { UserService } from 'src/app/core/services';
|
||||||
|
|
||||||
export const adminGuard: CanActivateFn = (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => {
|
export const adminGuard: CanActivateFn = () => {
|
||||||
const router = inject(Router);
|
const router = inject(Router);
|
||||||
const userService = inject(UserService);
|
const userService = inject(UserService);
|
||||||
return userService.currentUser.pipe(take(1)).pipe(map(data => {
|
return userService.currentUser.pipe(take(1)).pipe(map(data => {
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { inject } from '@angular/core';
|
import { inject } from '@angular/core';
|
||||||
import { ActivatedRouteSnapshot, CanActivateFn, Router, RouterStateSnapshot } from '@angular/router';
|
import { CanActivateFn, Router } from '@angular/router';
|
||||||
import { map, take } from 'rxjs/operators';
|
import { map, take } from 'rxjs/operators';
|
||||||
|
|
||||||
import { UserService } from 'src/app/core/services';
|
import { UserService } from 'src/app/core/services';
|
||||||
|
|
||||||
export const authGuard: CanActivateFn = (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => {
|
export const authGuard: CanActivateFn = () => {
|
||||||
const router = inject(Router);
|
const router = inject(Router);
|
||||||
const userService = inject(UserService);
|
const userService = inject(UserService);
|
||||||
return userService.isAuthenticated.pipe(take(1)).pipe(map(data => {
|
return userService.isAuthenticated.pipe(take(1)).pipe(map(data => {
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { inject } from '@angular/core';
|
import { inject } from '@angular/core';
|
||||||
import { ActivatedRouteSnapshot, CanActivateFn, Router, RouterStateSnapshot } from '@angular/router';
|
import { CanActivateFn } from '@angular/router';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { map, take } from 'rxjs/operators';
|
import { map, take } from 'rxjs/operators';
|
||||||
|
|
||||||
import { UserService } from 'src/app/core/services';
|
import { UserService } from 'src/app/core/services';
|
||||||
|
|
||||||
export const noauthGuard: CanActivateFn = (route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> => {
|
export const noauthGuard: CanActivateFn = (): Observable<boolean> => {
|
||||||
/*
|
/*
|
||||||
const router = inject(Router);
|
const router = inject(Router);
|
||||||
const userService = inject(UserService);
|
const userService = inject(UserService);
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
import { Application } from './application.model';
|
||||||
|
|
||||||
|
export interface ApplicationList {
|
||||||
|
applications: Array<Application>;
|
||||||
|
applicationsCount: number;
|
||||||
|
}
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
export interface CanopySize {
|
|
||||||
id: string;
|
|
||||||
key: any;
|
|
||||||
value: any;
|
|
||||||
doc?: CanopySizeDoc;
|
|
||||||
}
|
|
||||||
export interface CanopySizeDoc {
|
|
||||||
_id: string;
|
|
||||||
_rev: string;
|
|
||||||
type: string;
|
|
||||||
weight: number;
|
|
||||||
values: [];
|
|
||||||
}
|
|
||||||
@@ -3,27 +3,27 @@ import { ChartConfiguration, ChartOptions } from 'chart.js';
|
|||||||
export interface BarConfig {
|
export interface BarConfig {
|
||||||
barChartData: ChartConfiguration<'bar'>['data'],
|
barChartData: ChartConfiguration<'bar'>['data'],
|
||||||
barChartOptions: ChartConfiguration<'bar'>['options'],
|
barChartOptions: ChartConfiguration<'bar'>['options'],
|
||||||
barChartPlugins: any[],
|
barChartPlugins: ChartConfiguration<'bar'>['plugins'],
|
||||||
barChartLegend: boolean
|
barChartLegend: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CircleConfig {
|
export interface CircleConfig {
|
||||||
circleChartLabels: string[],
|
circleChartLabels: string[],
|
||||||
circleChartDatasets: ChartConfiguration<'doughnut'>['data']['datasets'],
|
circleChartDatasets: ChartConfiguration<'doughnut'>['data']['datasets'],
|
||||||
circleChartOptions: ChartConfiguration<'doughnut'>['options'],
|
circleChartOptions: ChartConfiguration<'doughnut'>['options'],
|
||||||
circleChartPlugins: ChartConfiguration<'doughnut'>['plugins'],
|
circleChartPlugins: ChartConfiguration<'doughnut'>['plugins'],
|
||||||
circleChartLegend: boolean
|
circleChartLegend: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DoughnutConfig {
|
export interface DoughnutConfig {
|
||||||
doughnutChartLabels: string[],
|
doughnutChartLabels: string[],
|
||||||
doughnutChartDatasets: ChartConfiguration<'doughnut'>['data']['datasets'],
|
doughnutChartDatasets: ChartConfiguration<'doughnut'>['data']['datasets'],
|
||||||
doughnutChartOptions: ChartConfiguration<'doughnut'>['options'],
|
doughnutChartOptions: ChartConfiguration<'doughnut'>['options'],
|
||||||
doughnutChartLegend: boolean
|
doughnutChartLegend: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface LineConfig {
|
export interface LineConfig {
|
||||||
lineChartData: ChartConfiguration<'line'>['data'],
|
lineChartData: ChartConfiguration<'line'>['data'],
|
||||||
lineChartOptions: ChartOptions<'line'>,
|
lineChartOptions: ChartOptions<'line'>,
|
||||||
lineChartLegend: boolean
|
lineChartLegend: boolean
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
export * from './aeronef.model';
|
export * from './aeronef.model';
|
||||||
export * from './aeronef-list.model';
|
export * from './aeronef-list.model';
|
||||||
export * from './application.model';
|
export * from './application.model';
|
||||||
|
export * from './application-list.model';
|
||||||
export * from './application-list-config.model';
|
export * from './application-list-config.model';
|
||||||
export * from './calculator.model';
|
export * from './calculator.model';
|
||||||
export * from './canopy.model';
|
export * from './canopy.model';
|
||||||
export * from './canopysize.model';
|
|
||||||
export * from './chart.model';
|
export * from './chart.model';
|
||||||
export * from './dropzone.model';
|
export * from './dropzone.model';
|
||||||
export * from './errors.model';
|
export * from './errors.model';
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
//import { environment } from 'src/environments/environment';
|
|
||||||
import { HttpClient, HttpParams } from '@angular/common/http';
|
import { HttpClient, HttpParams } from '@angular/common/http';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
|
//import { environment } from 'src/environments/environment';
|
||||||
|
|
||||||
@Injectable({ providedIn: 'root' })
|
@Injectable({ providedIn: 'root' })
|
||||||
export class ApiService {
|
export class ApiService {
|
||||||
constructor(
|
constructor(
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { HttpParams } from '@angular/common/http';
|
|||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
import { ApiService } from './api.service';
|
import { ApiService } from './api.service';
|
||||||
import { Application, ApplicationListConfig, ApplicationListFilters } from 'src/app/core/models';
|
import { Application, ApplicationList, ApplicationListConfig, ApplicationListFilters } from 'src/app/core/models';
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
|
|
||||||
@Injectable({ providedIn: 'root' })
|
@Injectable({ providedIn: 'root' })
|
||||||
@@ -12,7 +12,7 @@ export class ApplicationsService {
|
|||||||
private apiService: ApiService
|
private apiService: ApiService
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
query(config: ApplicationListConfig): Observable<{ applications: Application[], applicationsCount: number }> {
|
query(config: ApplicationListConfig): Observable<ApplicationList> {
|
||||||
// Convert any filters over to Angular's URLSearchParams
|
// Convert any filters over to Angular's URLSearchParams
|
||||||
const params: ApplicationListFilters = {
|
const params: ApplicationListFilters = {
|
||||||
apikey: config.filters.apikey,
|
apikey: config.filters.apikey,
|
||||||
@@ -34,8 +34,8 @@ export class ApplicationsService {
|
|||||||
.pipe(map(data => data.application));
|
.pipe(map(data => data.application));
|
||||||
}
|
}
|
||||||
|
|
||||||
destroy(slug: string) {
|
destroy(slug: string): Observable<boolean> {
|
||||||
return this.apiService.delete(`/applications/${slug}`);
|
return this.apiService.delete(`/applications/${slug}`).pipe(map(data => data.deleted));
|
||||||
}
|
}
|
||||||
|
|
||||||
save(application: Application): Observable<Application> {
|
save(application: Application): Observable<Application> {
|
||||||
|
|||||||
@@ -1,244 +0,0 @@
|
|||||||
import { Injectable } from '@angular/core';
|
|
||||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
|
||||||
import { Observable } from 'rxjs';
|
|
||||||
|
|
||||||
import { Jump } from 'src/app/core/models';
|
|
||||||
import { environment } from 'src/environments/environment';
|
|
||||||
|
|
||||||
export interface JumpDoc {
|
|
||||||
_id?: string;
|
|
||||||
_rev?: string;
|
|
||||||
type: string;
|
|
||||||
date: string;
|
|
||||||
numero: number,
|
|
||||||
lieu?: string;
|
|
||||||
oaci?: string;
|
|
||||||
aeronef?: string;
|
|
||||||
imat?: string;
|
|
||||||
hauteur?: number,
|
|
||||||
voile?: string;
|
|
||||||
taille?: number,
|
|
||||||
categorie?: string;
|
|
||||||
module?: string;
|
|
||||||
participants?: number,
|
|
||||||
programme?: string;
|
|
||||||
accessoires?: string;
|
|
||||||
zone?: string;
|
|
||||||
dossier?: string;
|
|
||||||
video?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface JumpViewResults {
|
|
||||||
rows: Array<Jump>;
|
|
||||||
total_rows: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Injectable({ providedIn: 'root' })
|
|
||||||
export class BackendService {
|
|
||||||
private _couchdbUrl = environment.couchdbUrl;
|
|
||||||
private _couchdbDatabase = environment.couchdbDatabase;
|
|
||||||
private _couchdbDesign = environment.couchdbDesign;
|
|
||||||
private _couchdbCredential = environment.couchdbCredential;
|
|
||||||
//private _couchdbUrl = "http://couchdb.unespace.com/material_grow/_design/netgrowing_app/_view/allDevices";
|
|
||||||
|
|
||||||
httpOptions = {
|
|
||||||
headers: new HttpHeaders({
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'Authorization': 'Basic ' + this._couchdbCredential
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor(private _http: HttpClient) { }
|
|
||||||
|
|
||||||
writeDoc(doc: Object): Promise<Object | undefined> {
|
|
||||||
const url = this._couchdbUrl + '/' + this._couchdbDatabase;
|
|
||||||
return this._http.post<Object>(url, doc, this.httpOptions).toPromise();
|
|
||||||
}
|
|
||||||
|
|
||||||
updateDoc(doc: JumpDoc): Promise<Object | undefined> {
|
|
||||||
const url = `${this._couchdbUrl}/${this._couchdbDatabase}/${doc._id}`;
|
|
||||||
return this._http.put<Object>(url, doc, this.httpOptions).toPromise();
|
|
||||||
}
|
|
||||||
|
|
||||||
deleteDoc(id: string, rev: string): Promise<Object | undefined> {
|
|
||||||
//const url = this._couchdbUrl + '/' + this._couchdbDatabase + '/' + id + '?rev=' + rev;
|
|
||||||
const url = `${this._couchdbUrl}/${this._couchdbDatabase}/${id}?rev=${rev}`;
|
|
||||||
return this._http.delete(url, this.httpOptions).toPromise();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* get all docs from couchDB view 'allJumps' */
|
|
||||||
getJumps(): Observable<JumpViewResults> {
|
|
||||||
//const url = this._couchdbUrl + '/' + this._couchdbDatabase + '/_design/' + this._couchdbDesign + '/_view/allJumps/';
|
|
||||||
//return this._http.get(url, this.httpOptions);
|
|
||||||
const payload = {
|
|
||||||
"include_docs": false,
|
|
||||||
"reduce": false,
|
|
||||||
"descending": false
|
|
||||||
}
|
|
||||||
const url = `${this._couchdbUrl}/${this._couchdbDatabase}/_design/${this._couchdbDesign}/_view/allJumps/`;
|
|
||||||
return this._http.post<JumpViewResults>(url, payload, this.httpOptions);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* get all docs from couchDB view 'allJumpsByDate' */
|
|
||||||
getJumpsByDate(level: number): Observable<Object> {
|
|
||||||
const payload = {
|
|
||||||
"reduce": true,
|
|
||||||
"group": true,
|
|
||||||
"group_level": level
|
|
||||||
}
|
|
||||||
const url = `${this._couchdbUrl}/${this._couchdbDatabase}/_design/${this._couchdbDesign}/_view/allJumpsByDate/`;
|
|
||||||
return this._http.post(url, payload, this.httpOptions);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* get all docs from couchDB view 'filterAeronef' */
|
|
||||||
getAeronefs(): Observable<Object> {
|
|
||||||
const payload = {
|
|
||||||
"reduce": true,
|
|
||||||
"group": true
|
|
||||||
}
|
|
||||||
const url = `${this._couchdbUrl}/${this._couchdbDatabase}/_design/${this._couchdbDesign}/_view/filterAeronef/`;
|
|
||||||
return this._http.post(url, payload, this.httpOptions);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* get all docs from couchDB view 'filterAeronefByDate' */
|
|
||||||
getAeronefsByDate(level: number): Observable<Object> {
|
|
||||||
const payload = {
|
|
||||||
"reduce": true,
|
|
||||||
"group": true,
|
|
||||||
"group_level": level
|
|
||||||
}
|
|
||||||
const url = `${this._couchdbUrl}/${this._couchdbDatabase}/_design/${this._couchdbDesign}/_view/filterAeronefByDate/`;
|
|
||||||
return this._http.post(url, payload, this.httpOptions);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* get all docs from couchDB view 'filterCanopyModel' */
|
|
||||||
getCanopyModels(): Observable<Object> {
|
|
||||||
const payload = {
|
|
||||||
"reduce": true,
|
|
||||||
"group": true
|
|
||||||
}
|
|
||||||
const url = `${this._couchdbUrl}/${this._couchdbDatabase}/_design/${this._couchdbDesign}/_view/filterCanopyModel/`;
|
|
||||||
return this._http.post(url, payload, this.httpOptions);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* get all docs from couchDB view 'filterCanopyModelByDate' */
|
|
||||||
getCanopyModelsByDate(level: number): Observable<Object> {
|
|
||||||
const payload = {
|
|
||||||
"reduce": true,
|
|
||||||
"group": true,
|
|
||||||
"group_level": level
|
|
||||||
}
|
|
||||||
const url = `${this._couchdbUrl}/${this._couchdbDatabase}/_design/${this._couchdbDesign}/_view/filterCanopyModelByDate/`;
|
|
||||||
return this._http.post(url, payload, this.httpOptions);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* get all docs from couchDB view 'filterCanopySize' */
|
|
||||||
getCanopySizes(): Observable<Object> {
|
|
||||||
const payload = {
|
|
||||||
"reduce": true,
|
|
||||||
"group": true
|
|
||||||
}
|
|
||||||
const url = `${this._couchdbUrl}/${this._couchdbDatabase}/_design/${this._couchdbDesign}/_view/filterCanopySize/`;
|
|
||||||
return this._http.post(url, payload, this.httpOptions);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* get all docs from couchDB view 'filterCanopySizeByDate' */
|
|
||||||
getCanopySizesByDate(level: number): Observable<Object> {
|
|
||||||
const payload = {
|
|
||||||
"reduce": true,
|
|
||||||
"group": true,
|
|
||||||
"group_level": level
|
|
||||||
}
|
|
||||||
const url = `${this._couchdbUrl}/${this._couchdbDatabase}/_design/${this._couchdbDesign}/_view/filterCanopySizeByDate/`;
|
|
||||||
return this._http.post(url, payload, this.httpOptions);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* get all docs from couchDB view 'allDropZones' */
|
|
||||||
getDropZones(): Observable<Object> {
|
|
||||||
const payload = {
|
|
||||||
"reduce": true,
|
|
||||||
"group": true
|
|
||||||
}
|
|
||||||
const url = `${this._couchdbUrl}/${this._couchdbDatabase}/_design/${this._couchdbDesign}/_view/allDropZones/`;
|
|
||||||
return this._http.post(url, payload, this.httpOptions);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* get all docs from couchDB view 'allDropZonesByDate' */
|
|
||||||
getDropZonesByDate(level: number): Observable<Object> {
|
|
||||||
const payload = {
|
|
||||||
"reduce": true,
|
|
||||||
"group": true,
|
|
||||||
"group_level": level
|
|
||||||
}
|
|
||||||
const url = `${this._couchdbUrl}/${this._couchdbDatabase}/_design/${this._couchdbDesign}/_view/allDropZonesByDate/`;
|
|
||||||
return this._http.post(url, payload, this.httpOptions);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* get all docs from couchDB view 'allJumps' */
|
|
||||||
getTotalJumps(): Observable<Object> {
|
|
||||||
const payload = {
|
|
||||||
"reduce": true,
|
|
||||||
"group": true,
|
|
||||||
"group_level": 1
|
|
||||||
}
|
|
||||||
const url = `${this._couchdbUrl}/${this._couchdbDatabase}/_design/${this._couchdbDesign}/_view/allJumps/`;
|
|
||||||
return this._http.post(url, payload, this.httpOptions);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* get all docs from couchDB view 'allDevices' */
|
|
||||||
getDeviceActivities(deviceId: string, limit: number, start: number, end: number): Observable<Object> {
|
|
||||||
const payload = {
|
|
||||||
"selector": {
|
|
||||||
"type": {
|
|
||||||
"$eq": "activity"
|
|
||||||
},
|
|
||||||
"device_id": {
|
|
||||||
"$eq": deviceId
|
|
||||||
},
|
|
||||||
"created_time": {
|
|
||||||
"$gte": start,
|
|
||||||
"$lte": end
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"fields": [
|
|
||||||
"created_time",
|
|
||||||
"device_id",
|
|
||||||
"values"
|
|
||||||
],
|
|
||||||
"sort": [
|
|
||||||
{
|
|
||||||
"created_time": "desc"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"limit": limit
|
|
||||||
}
|
|
||||||
//const url = this._couchdbUrl + '/' + this._couchdbDatabase + '/_find';
|
|
||||||
const url = `${this._couchdbUrl}/material_grow/_find`;
|
|
||||||
return this._http.post(url, payload, this.httpOptions);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* get all docs from couchDB view 'getDevicesActivities' */
|
|
||||||
getDevicesActivities(key: string, limit: number, start: any, end: any): Observable<Object> {
|
|
||||||
/*
|
|
||||||
const payload = {
|
|
||||||
"start_key": [deviceId, end],
|
|
||||||
"end_key": [deviceId, start],
|
|
||||||
"descending": true,
|
|
||||||
"limit": limit,
|
|
||||||
"reduce": false
|
|
||||||
}
|
|
||||||
const url = this._couchdbUrl + '/' + this._couchdbDatabase + '/_design/' + this._couchdbDesign + '/_view/allActivitiesByDevice/';
|
|
||||||
*/
|
|
||||||
const payload = {
|
|
||||||
"start_key": [key, 1, start],
|
|
||||||
"end_key": [key, 1, end],
|
|
||||||
"limit": limit,
|
|
||||||
"descending": true,
|
|
||||||
"include_docs": true,
|
|
||||||
"reduce": false
|
|
||||||
}
|
|
||||||
const url = `${this._couchdbUrl}/netgrowing/_design/app/_view/getDevicesActivities`;
|
|
||||||
return this._http.post(url, payload, this.httpOptions);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
export * from './aeronefs.service';
|
export * from './aeronefs.service';
|
||||||
export * from './api.service';
|
export * from './api.service';
|
||||||
export * from './applications.service';
|
export * from './applications.service';
|
||||||
export * from './backend.service';
|
|
||||||
export * from './calculator.service';
|
export * from './calculator.service';
|
||||||
export * from './canopies.service';
|
export * from './canopies.service';
|
||||||
export * from './dropzones.service';
|
export * from './dropzones.service';
|
||||||
|
|||||||
@@ -111,8 +111,8 @@ export class JumpsService {
|
|||||||
return this.apiService.put(`/jumps/${jump.slug}`, { jump: jump }).pipe(map(data => data.jump));
|
return this.apiService.put(`/jumps/${jump.slug}`, { jump: jump }).pipe(map(data => data.jump));
|
||||||
}
|
}
|
||||||
|
|
||||||
destroy(slug: string) {
|
destroy(slug: string): Observable<boolean> {
|
||||||
return this.apiService.delete(`/jumps/${slug}`);
|
return this.apiService.delete(`/jumps/${slug}`).pipe(map(data => data.deleted));
|
||||||
}
|
}
|
||||||
|
|
||||||
save(jump: Jump): Observable<Jump> {
|
save(jump: Jump): Observable<Jump> {
|
||||||
|
|||||||
@@ -3,9 +3,5 @@ export const environment = {
|
|||||||
api_url:<string> 'http://localhost:3200/api', //'https://api.rampeur.com/api'
|
api_url:<string> 'http://localhost:3200/api', //'https://api.rampeur.com/api'
|
||||||
api_key:<string> '9f5a9b80a39b4788be2f12941b766aba',
|
api_key:<string> '9f5a9b80a39b4788be2f12941b766aba',
|
||||||
use_api_key:<boolean> true,
|
use_api_key:<boolean> true,
|
||||||
refresh_interval:<number> 30000,
|
refresh_interval:<number> 30000
|
||||||
couchdbUrl:<string> 'http://couchdb.unespace.com',
|
|
||||||
couchdbDatabase:<string> 'headupdb',
|
|
||||||
couchdbDesign:<string> 'headup_app',
|
|
||||||
couchdbCredential:<string> 'cmFtcGV1cjpES3hwMjRQUw=='
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,9 +3,5 @@ export const environment = {
|
|||||||
api_url:<string> 'http://localhost:3200/api', //'https://api.rampeur.com/api'
|
api_url:<string> 'http://localhost:3200/api', //'https://api.rampeur.com/api'
|
||||||
api_key:<string> '9f5a9b80a39b4788be2f12941b766aba',
|
api_key:<string> '9f5a9b80a39b4788be2f12941b766aba',
|
||||||
use_api_key:<boolean> true,
|
use_api_key:<boolean> true,
|
||||||
refresh_interval:<number> 30000,
|
refresh_interval:<number> 30000
|
||||||
couchdbUrl:<string> 'http://couchdb.unespace.com',
|
|
||||||
couchdbDatabase:<string> 'headupdb',
|
|
||||||
couchdbDesign:<string> 'headup_app',
|
|
||||||
couchdbCredential:<string> 'cmFtcGV1cjpES3hwMjRQUw=='
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,9 +3,5 @@ export const environment = {
|
|||||||
api_url:<string> 'http://localhost:3200/api', //'https://api.rampeur.com/api'
|
api_url:<string> 'http://localhost:3200/api', //'https://api.rampeur.com/api'
|
||||||
api_key:<string> '9f5a9b80a39b4788be2f12941b766aba',
|
api_key:<string> '9f5a9b80a39b4788be2f12941b766aba',
|
||||||
use_api_key:<boolean> true,
|
use_api_key:<boolean> true,
|
||||||
refresh_interval:<number> 30000,
|
refresh_interval:<number> 30000
|
||||||
couchdbUrl:<string> 'http://couchdb.unespace.com',
|
|
||||||
couchdbDatabase:<string> 'headupdb',
|
|
||||||
couchdbDesign:<string> 'headup_app',
|
|
||||||
couchdbCredential:<string> 'cmFtcGV1cjpES3hwMjRQUw=='
|
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user