mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-12 16:22:55 -07:00
Add dummy for request counter
This commit is contained in:
parent
1bfbfdbe00
commit
7ef2a1679d
7 changed files with 51 additions and 6 deletions
|
@ -489,7 +489,9 @@ namespace Ombi.Core.Engine
|
|||
{
|
||||
return new RequestQuotaCountModel()
|
||||
{
|
||||
HasLimit = false,
|
||||
HasLimit = true,
|
||||
Limit = 5,
|
||||
Remaining = 4,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
5
src/Ombi/ClientApp/app/interfaces/IRemainingRequests.ts
Normal file
5
src/Ombi/ClientApp/app/interfaces/IRemainingRequests.ts
Normal file
|
@ -0,0 +1,5 @@
|
|||
export interface IRemainingRequests {
|
||||
hasLimit: boolean;
|
||||
limit: number;
|
||||
remaining: number;
|
||||
}
|
|
@ -7,6 +7,7 @@ import { debounceTime, distinctUntilChanged } from "rxjs/operators";
|
|||
import { AuthService } from "../auth/auth.service";
|
||||
import { FilterType, IFilter, IIssueCategory, IMovieRequests, IPagenator, IRadarrProfile, IRadarrRootFolder, OrderType } from "../interfaces";
|
||||
import { NotificationService, RadarrService, RequestService } from "../services";
|
||||
import { IRemainingRequests } from "../interfaces/IRemainingRequests";
|
||||
|
||||
@Component({
|
||||
selector: "movie-requests",
|
||||
|
@ -38,6 +39,8 @@ export class MovieRequestsComponent implements OnInit {
|
|||
public orderType: OrderType = OrderType.RequestedDateDesc;
|
||||
public OrderType = OrderType;
|
||||
|
||||
public remaining: IRemainingRequests;
|
||||
|
||||
public totalMovies: number = 100;
|
||||
private currentlyLoaded: number;
|
||||
private amountToLoad: number;
|
||||
|
@ -80,6 +83,7 @@ export class MovieRequestsComponent implements OnInit {
|
|||
};
|
||||
this.loadInit();
|
||||
this.isAdmin = this.auth.hasRole("admin") || this.auth.hasRole("poweruser");
|
||||
|
||||
}
|
||||
|
||||
public paginate(event: IPagenator) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<!-- Movie tab -->
|
||||
<div role="tabpanel" class="tab-pane active" id="MoviesTab">
|
||||
|
||||
<div class="input-group">
|
||||
<input id="search" type="text" class="form-control form-control-custom form-control-search form-control-withbuttons" (keyup)="search($event)">
|
||||
<div class="input-group-addon right-radius">
|
||||
|
@ -18,8 +19,14 @@
|
|||
<i class="fa fa-search"></i>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<h4 *ngIf="remaining?.hasLimit" id="remainingRequests" class="text-center">
|
||||
{{remaining.remaining}}/{{remaining.limit}} requests remaining.
|
||||
</h4>
|
||||
|
||||
<br *ngIf="!remaining?.hasLimit" />
|
||||
<br *ngIf="!remaining?.hasLimit" />
|
||||
|
||||
<!-- Movie content -->
|
||||
<div id="movieList">
|
||||
<div *ngIf="searchApplied && movieResults?.length <= 0" class='no-search-results'>
|
||||
|
|
|
@ -8,6 +8,7 @@ import { debounceTime, distinctUntilChanged } from "rxjs/operators";
|
|||
import { AuthService } from "../auth/auth.service";
|
||||
import { IIssueCategory, IRequestEngineResult, ISearchMovieResult } from "../interfaces";
|
||||
import { NotificationService, RequestService, SearchService } from "../services";
|
||||
import { IRemainingRequests } from "../interfaces/IRemainingRequests";
|
||||
|
||||
@Component({
|
||||
selector: "movie-search",
|
||||
|
@ -19,6 +20,7 @@ export class MovieSearchComponent implements OnInit {
|
|||
public searchChanged: Subject<string> = new Subject<string>();
|
||||
public movieResults: ISearchMovieResult[];
|
||||
public result: IRequestEngineResult;
|
||||
public remaining: IRemainingRequests;
|
||||
public searchApplied = false;
|
||||
|
||||
@Input() public issueCategories: IIssueCategory[];
|
||||
|
@ -35,7 +37,6 @@ export class MovieSearchComponent implements OnInit {
|
|||
private notificationService: NotificationService, private authService: AuthService,
|
||||
private readonly translate: TranslateService, private sanitizer: DomSanitizer,
|
||||
private readonly platformLocation: PlatformLocation) {
|
||||
|
||||
this.searchChanged.pipe(
|
||||
debounceTime(600), // Wait Xms after the last event before emitting last event
|
||||
distinctUntilChanged(), // only emit if value is different from previous value
|
||||
|
@ -69,10 +70,21 @@ export class MovieSearchComponent implements OnInit {
|
|||
result: false,
|
||||
errorMessage: "",
|
||||
};
|
||||
this.popularMovies();
|
||||
}
|
||||
this.remaining = {
|
||||
hasLimit: false,
|
||||
limit: 0,
|
||||
remaining: 0,
|
||||
};
|
||||
|
||||
this.popularMovies();
|
||||
|
||||
this.requestService.getRemainingMovieRequests().subscribe(remaining => {
|
||||
this.remaining = remaining;
|
||||
});
|
||||
|
||||
}
|
||||
public search(text: any) {
|
||||
|
||||
this.searchChanged.next(text.target.value);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ import { TreeNode } from "primeng/primeng";
|
|||
import { FilterType, IChildRequests, IFilter, IMovieRequestModel, IMovieRequests, IMovieUpdateModel, IRequestEngineResult, IRequestsViewModel, ITvRequests, ITvUpdateModel, OrderType } from "../interfaces";
|
||||
import { ITvRequestViewModel } from "../interfaces";
|
||||
import { ServiceHelpers } from "./service.helpers";
|
||||
import { IRemainingRequests } from "../interfaces/IRemainingRequests";
|
||||
|
||||
@Injectable()
|
||||
export class RequestService extends ServiceHelpers {
|
||||
|
@ -15,6 +16,10 @@ export class RequestService extends ServiceHelpers {
|
|||
super(http, "/api/v1/Request/", platformLocation);
|
||||
}
|
||||
|
||||
public getRemainingMovieRequests(): Observable<IRemainingRequests> {
|
||||
return this.http.get<IRemainingRequests>(`${this.url}movie/remaining`, {headers: this.headers});
|
||||
}
|
||||
|
||||
public requestMovie(movie: IMovieRequestModel): Observable<IRequestEngineResult> {
|
||||
return this.http.post<IRequestEngineResult>(`${this.url}Movie/`, JSON.stringify(movie), {headers: this.headers});
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ using Ombi.Attributes;
|
|||
using Ombi.Core.Models.UI;
|
||||
using Ombi.Models;
|
||||
using Ombi.Store.Entities;
|
||||
using Ombi.Core.Models;
|
||||
|
||||
namespace Ombi.Controllers
|
||||
{
|
||||
|
@ -464,5 +465,14 @@ namespace Ombi.Controllers
|
|||
await TvRequestEngine.UnSubscribeRequest(requestId, RequestType.TvShow);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets model containing remaining number of requests.
|
||||
/// </summary>
|
||||
[HttpGet("movie/remaining")]
|
||||
public async Task<RequestQuotaCountModel> GetRemainingRequests()
|
||||
{
|
||||
return await MovieRequestEngine.GetRemainingRequests();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue