Add proper TypeScript typing for disk space status
This commit is contained in:
parent
27398ba993
commit
57ea1b3881
3 changed files with 12 additions and 4 deletions
6
client/src/app/models/disk-space-status.model.ts
Normal file
6
client/src/app/models/disk-space-status.model.ts
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
export interface DiskSpaceStatus {
|
||||
isPaused: boolean;
|
||||
availableSpaceGB: number;
|
||||
thresholdGB: number;
|
||||
lastCheckTime: Date;
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { Torrent } from '../models/torrent.model';
|
||||
import { DiskSpaceStatus } from '../models/disk-space-status.model';
|
||||
import { TorrentService } from '../torrent.service';
|
||||
import { forkJoin, Observable } from 'rxjs';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
|
@ -48,7 +49,7 @@ export class TorrentTableComponent implements OnInit {
|
|||
public updateSettingsDeleteOnError: number;
|
||||
public updateSettingsTorrentLifetime: number;
|
||||
|
||||
public diskSpaceStatus: any = null;
|
||||
public diskSpaceStatus: DiskSpaceStatus | null = null;
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import { Inject, Injectable } from '@angular/core';
|
|||
import * as signalR from '@microsoft/signalr';
|
||||
import { Observable, Subject } from 'rxjs';
|
||||
import { Torrent, TorrentFileAvailability } from './models/torrent.model';
|
||||
import { DiskSpaceStatus } from './models/disk-space-status.model';
|
||||
import { APP_BASE_HREF } from '@angular/common';
|
||||
|
||||
@Injectable({
|
||||
|
|
@ -10,7 +11,7 @@ import { APP_BASE_HREF } from '@angular/common';
|
|||
})
|
||||
export class TorrentService {
|
||||
public update$: Subject<Torrent[]> = new Subject();
|
||||
public diskSpaceStatus$: Subject<any> = new Subject();
|
||||
public diskSpaceStatus$: Subject<DiskSpaceStatus> = new Subject();
|
||||
|
||||
private connection: signalR.HubConnection;
|
||||
|
||||
|
|
@ -49,8 +50,8 @@ export class TorrentService {
|
|||
return this.http.get<Torrent>(`${this.baseHref}Api/Torrents/Get/${torrentId}`);
|
||||
}
|
||||
|
||||
public getDiskSpaceStatus(): Observable<any> {
|
||||
return this.http.get<any>(`${this.baseHref}Api/Torrents/DiskSpaceStatus`);
|
||||
public getDiskSpaceStatus(): Observable<DiskSpaceStatus | null> {
|
||||
return this.http.get<DiskSpaceStatus | null>(`${this.baseHref}Api/Torrents/DiskSpaceStatus`);
|
||||
}
|
||||
|
||||
public uploadMagnet(magnetLink: string, torrent: Torrent): Observable<void> {
|
||||
|
|
|
|||
Loading…
Reference in a new issue