mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-16 02:02:55 -07:00
More on the UI !wip
This commit is contained in:
parent
e8c6b23304
commit
806cf7c0ff
17 changed files with 243 additions and 83 deletions
|
@ -56,6 +56,7 @@ namespace Ombi.Store.Context
|
|||
public DbSet<RequestSubscription> RequestSubscription { get; set; }
|
||||
public DbSet<UserNotificationPreferences> UserNotificationPreferences { get; set; }
|
||||
public DbSet<UserQualityProfiles> UserQualityProfileses { get; set; }
|
||||
public DbSet<RequestQueue> RequestQueue { get; set; }
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace Ombi.Store.Migrations
|
||||
{
|
||||
public partial class RequestQueue : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,7 +9,7 @@ using Ombi.Store.Context;
|
|||
namespace Ombi.Store.Migrations
|
||||
{
|
||||
[DbContext(typeof(OmbiContext))]
|
||||
[Migration("20181203213532_RequestQueue")]
|
||||
[Migration("20181204084915_RequestQueue")]
|
||||
partial class RequestQueue
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
|
@ -510,6 +510,28 @@ namespace Ombi.Store.Migrations
|
|||
b.ToTable("RecentlyAddedLog");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.RequestQueue", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<DateTime?>("Completed");
|
||||
|
||||
b.Property<DateTime>("Dts");
|
||||
|
||||
b.Property<string>("Error");
|
||||
|
||||
b.Property<int>("RequestId");
|
||||
|
||||
b.Property<int>("RetryCount");
|
||||
|
||||
b.Property<int>("Type");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("RequestQueue");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.Requests.AlbumRequest", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
35
src/Ombi.Store/Migrations/20181204084915_RequestQueue.cs
Normal file
35
src/Ombi.Store/Migrations/20181204084915_RequestQueue.cs
Normal file
|
@ -0,0 +1,35 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace Ombi.Store.Migrations
|
||||
{
|
||||
public partial class RequestQueue : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "RequestQueue",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
RequestId = table.Column<int>(nullable: false),
|
||||
Type = table.Column<int>(nullable: false),
|
||||
Dts = table.Column<DateTime>(nullable: false),
|
||||
Error = table.Column<string>(nullable: true),
|
||||
Completed = table.Column<DateTime>(nullable: true),
|
||||
RetryCount = table.Column<int>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_RequestQueue", x => x.Id);
|
||||
});
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "RequestQueue");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -508,6 +508,28 @@ namespace Ombi.Store.Migrations
|
|||
b.ToTable("RecentlyAddedLog");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.RequestQueue", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<DateTime?>("Completed");
|
||||
|
||||
b.Property<DateTime>("Dts");
|
||||
|
||||
b.Property<string>("Error");
|
||||
|
||||
b.Property<int>("RequestId");
|
||||
|
||||
b.Property<int>("RetryCount");
|
||||
|
||||
b.Property<int>("Type");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("RequestQueue");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.Requests.AlbumRequest", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
|
|
11
src/Ombi/ClientApp/app/interfaces/IFailedRequests.ts
Normal file
11
src/Ombi/ClientApp/app/interfaces/IFailedRequests.ts
Normal file
|
@ -0,0 +1,11 @@
|
|||
import { RequestType } from ".";
|
||||
export interface IFailedRequestsViewModel {
|
||||
failedId: number;
|
||||
title: string;
|
||||
releaseYear: Date;
|
||||
requestId: number;
|
||||
requestType: RequestType;
|
||||
dts: Date;
|
||||
error: string;
|
||||
retryCount: number;
|
||||
}
|
|
@ -3,7 +3,7 @@
|
|||
export enum RequestType {
|
||||
movie = 1,
|
||||
tvShow = 2,
|
||||
|
||||
album = 3,
|
||||
}
|
||||
|
||||
// NEW WORLD
|
||||
|
|
|
@ -17,3 +17,4 @@ export * from "./IRecentlyAdded";
|
|||
export * from "./ILidarr";
|
||||
export * from "./ISearchMusicResult";
|
||||
export * from "./IVote";
|
||||
export * from "./IFailedRequests";
|
||||
|
|
|
@ -15,3 +15,4 @@ export * from "./mobile.service";
|
|||
export * from "./notificationMessage.service";
|
||||
export * from "./recentlyAdded.service";
|
||||
export * from "./vote.service";
|
||||
export * from "./requestretry.service";
|
||||
|
|
|
@ -4,7 +4,7 @@ import { Injectable } from "@angular/core";
|
|||
import { HttpClient } from "@angular/common/http";
|
||||
import { Observable } from "rxjs";
|
||||
|
||||
import { IMobileUsersViewModel } from "../interfaces";
|
||||
import { IFailedRequestsViewModel } from "../interfaces";
|
||||
import { ServiceHelpers } from "./service.helpers";
|
||||
|
||||
@Injectable()
|
||||
|
@ -12,7 +12,7 @@ export class RequestRetryService extends ServiceHelpers {
|
|||
constructor(http: HttpClient, public platformLocation: PlatformLocation) {
|
||||
super(http, "/api/v1/requestretry/", platformLocation);
|
||||
}
|
||||
public getUserDeviceList(): Observable<IMobileUsersViewModel[]> {
|
||||
return this.http.get<IMobileUsersViewModel[]>(`${this.url}notification/`, {headers: this.headers});
|
||||
public getFailedRequests(): Observable<IFailedRequestsViewModel[]> {
|
||||
return this.http.get<IFailedRequestsViewModel[]>(this.url, {headers: this.headers});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,28 @@
|
|||
|
||||
<settings-menu></settings-menu>
|
||||
|
||||
|
||||
<table class="table table-striped table-hover table-responsive table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Title</td>
|
||||
<td>Type</td>
|
||||
<td>Retry Count</td>
|
||||
<td>Error Description</td>
|
||||
<td>Retry</td>
|
||||
<td>Delete</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let v of vm">
|
||||
<td class="vcenter">
|
||||
{{v.title}}
|
||||
</td>
|
||||
<td>{{RequestType[v.type] | humanize}}</td>
|
||||
<td class="vcenter">{{v.retryCount}}</td>
|
||||
<td class="vcenter"> <i [pTooltip]="v.error" class="fa fa-info-circle"></i></td>
|
||||
<td class="vcenter"><button></button></td>
|
||||
<td class="vcenter"><button></button></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
@ -1,25 +1,18 @@
|
|||
import { Component, OnInit } from "@angular/core";
|
||||
import { IAbout } from "../../interfaces/ISettings";
|
||||
import { JobService, SettingsService } from "../../services";
|
||||
import { IFailedRequestsViewModel, RequestType } from "../../interfaces";
|
||||
import { RequestRetryService } from "../../services";
|
||||
|
||||
@Component({
|
||||
templateUrl: "./about.component.html",
|
||||
templateUrl: "./failedrequest.component.html",
|
||||
})
|
||||
export class AboutComponent implements OnInit {
|
||||
export class FailedRequestsComponent implements OnInit {
|
||||
|
||||
public about: IAbout;
|
||||
public newUpdate: boolean;
|
||||
public vm: IFailedRequestsViewModel[];
|
||||
public RequestType = RequestType;
|
||||
|
||||
constructor(private readonly settingsService: SettingsService,
|
||||
private readonly jobService: JobService) { }
|
||||
constructor(private retry: RequestRetryService) { }
|
||||
|
||||
public ngOnInit() {
|
||||
this.settingsService.about().subscribe(x => this.about = x);
|
||||
this.jobService.getCachedUpdate().subscribe(x => {
|
||||
if (x === true) {
|
||||
this.newUpdate = true;
|
||||
}
|
||||
});
|
||||
|
||||
this.retry.getFailedRequests().subscribe(x => this.vm = x);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ export class JobsComponent implements OnInit {
|
|||
plexRecentlyAddedSync: [x.plexRecentlyAddedSync, Validators.required],
|
||||
lidarrArtistSync: [x.lidarrArtistSync, Validators.required],
|
||||
issuesPurge: [x.issuesPurge, Validators.required],
|
||||
retryRequests: [x.retryRequests, Validators.required],
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import { AuthGuard } from "../auth/auth.guard";
|
|||
import { AuthService } from "../auth/auth.service";
|
||||
import {
|
||||
CouchPotatoService, EmbyService, IssuesService, JobService, LidarrService, MobileService, NotificationMessageService, PlexService, RadarrService,
|
||||
SonarrService, TesterService, ValidationService,
|
||||
RequestRetryService, SonarrService, TesterService, ValidationService,
|
||||
} from "../services";
|
||||
|
||||
import { PipeModule } from "../pipes/pipe.module";
|
||||
|
@ -152,6 +152,7 @@ const routes: Routes = [
|
|||
MobileService,
|
||||
NotificationMessageService,
|
||||
LidarrService,
|
||||
RequestRetryService,
|
||||
],
|
||||
|
||||
})
|
||||
|
|
92
src/Ombi/Controllers/RequestRetryController.cs
Normal file
92
src/Ombi/Controllers/RequestRetryController.cs
Normal file
|
@ -0,0 +1,92 @@
|
|||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Ombi.Store.Entities.Requests;
|
||||
using Ombi.Store.Repository;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Ombi.Attributes;
|
||||
using Ombi.Models;
|
||||
using Ombi.Store.Entities;
|
||||
using Ombi.Store.Repository.Requests;
|
||||
|
||||
namespace Ombi.Controllers
|
||||
{
|
||||
[ApiV1]
|
||||
[Admin]
|
||||
[Produces("application/json")]
|
||||
public class RequestRetryController : Controller
|
||||
{
|
||||
public RequestRetryController(IRepository<RequestQueue> requestQueue, IMovieRequestRepository movieRepo,
|
||||
ITvRequestRepository tvRepo, IMusicRequestRepository musicRepo)
|
||||
{
|
||||
_requestQueueRepository = requestQueue;
|
||||
_movieRequestRepository = movieRepo;
|
||||
_tvRequestRepository = tvRepo;
|
||||
_musicRequestRepository = musicRepo;
|
||||
}
|
||||
|
||||
private readonly IRepository<RequestQueue> _requestQueueRepository;
|
||||
private readonly IMovieRequestRepository _movieRequestRepository;
|
||||
private readonly ITvRequestRepository _tvRequestRepository;
|
||||
private readonly IMusicRequestRepository _musicRequestRepository;
|
||||
|
||||
/// <summary>
|
||||
/// Get's all the failed requests that are currently in the queue
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<IEnumerable<FailedRequestViewModel>> GetFailedRequests()
|
||||
{
|
||||
var failed = await _requestQueueRepository.GetAll().Where(x => !x.Completed.HasValue).ToListAsync();
|
||||
|
||||
var vm = new List<FailedRequestViewModel>();
|
||||
foreach (var f in failed)
|
||||
{
|
||||
var vmModel = new FailedRequestViewModel
|
||||
{
|
||||
RequestId = f.RequestId,
|
||||
RetryCount = f.RetryCount,
|
||||
Dts = f.Dts,
|
||||
Error = f.Error,
|
||||
FailedId = f.Id,
|
||||
Type = f.Type
|
||||
};
|
||||
|
||||
if (f.Type == RequestType.Movie)
|
||||
{
|
||||
var request = await _movieRequestRepository.Find(f.RequestId);
|
||||
vmModel.Title = request.Title;
|
||||
vmModel.ReleaseYear = request.ReleaseDate;
|
||||
}
|
||||
|
||||
if (f.Type == RequestType.Album)
|
||||
{
|
||||
var request = await _musicRequestRepository.Find(f.RequestId);
|
||||
vmModel.Title = request.Title;
|
||||
vmModel.ReleaseYear = request.ReleaseDate;
|
||||
}
|
||||
|
||||
if (f.Type == RequestType.TvShow)
|
||||
{
|
||||
var request = await _tvRequestRepository.GetChild().Include(x => x.ParentRequest).FirstOrDefaultAsync(x => x.Id == f.RequestId);
|
||||
vmModel.Title = request.Title;
|
||||
vmModel.ReleaseYear = request.ParentRequest.ReleaseDate;
|
||||
}
|
||||
vm.Add(vmModel);
|
||||
}
|
||||
|
||||
return vm;
|
||||
}
|
||||
|
||||
[HttpDelete("{queueId:int}")]
|
||||
public async Task<IActionResult> Delete(int queueId)
|
||||
{
|
||||
var queueItem = await _requestQueueRepository.GetAll().FirstOrDefaultAsync(x => x.Id == queueId);
|
||||
await _requestQueueRepository.Delete(queueItem);
|
||||
return Ok();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Ombi.Store.Entities.Requests;
|
||||
using Ombi.Store.Repository;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Ombi.Attributes;
|
||||
using Ombi.Store.Entities;
|
||||
|
||||
namespace Ombi.Controllers
|
||||
{
|
||||
[ApiV1]
|
||||
[Admin]
|
||||
[Produces("application/json")]
|
||||
public class RequestRetyController : Controller
|
||||
{
|
||||
public RequestRetyController(IRepository<RequestQueue> requestQueue)
|
||||
{
|
||||
_requestQueueRepository = requestQueue;
|
||||
}
|
||||
|
||||
private readonly IRepository<RequestQueue> _requestQueueRepository;
|
||||
|
||||
/// <summary>
|
||||
/// Get's all the failed requests that are currently in the queue
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<IEnumerable<RequestQueue>> Categories()
|
||||
{
|
||||
return await _requestQueueRepository.GetAll().Where(x => !x.Completed.HasValue).ToListAsync();
|
||||
}
|
||||
|
||||
[HttpDelete("{queueId:int}")]
|
||||
public async Task<IActionResult> Delete(int queueId)
|
||||
{
|
||||
var queueItem = await _requestQueueRepository.GetAll().FirstOrDefaultAsync(x => x.Id == queueId);
|
||||
await _requestQueueRepository.Delete(queueItem);
|
||||
return Ok();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
17
src/Ombi/Models/FailedRequestViewModel.cs
Normal file
17
src/Ombi/Models/FailedRequestViewModel.cs
Normal file
|
@ -0,0 +1,17 @@
|
|||
using System;
|
||||
using Ombi.Store.Entities;
|
||||
|
||||
namespace Ombi.Models
|
||||
{
|
||||
public class FailedRequestViewModel
|
||||
{
|
||||
public int FailedId { get; set; }
|
||||
public string Title { get; set; }
|
||||
public DateTime ReleaseYear { get; set; }
|
||||
public int RequestId { get; set; }
|
||||
public RequestType Type { get; set; }
|
||||
public DateTime Dts { get; set; }
|
||||
public string Error { get; set; }
|
||||
public int RetryCount { get; set; }
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue