mirror of https://github.com/Ombi-app/Ombi
commit
436c7a73fb
@ -1,3 +0,0 @@
|
||||
<div *ngIf="movie && radarrEnabled" class="text-center">
|
||||
<button mat-raised-button color="warn" class="text-center" (click)="openAdvancedOptions();">{{'MediaDetails.AdvancedOptions' | translate }}</button>
|
||||
</div>
|
@ -1,76 +0,0 @@
|
||||
import { Component, Input, OnInit, EventEmitter, Output } from "@angular/core";
|
||||
import { RadarrService } from "../../../../../services";
|
||||
import { IRadarrProfile, IRadarrRootFolder, IMovieRequests, IAdvancedData } from "../../../../../interfaces";
|
||||
import { MatDialog } from "@angular/material/dialog";
|
||||
import { MovieAdvancedOptionsComponent } from "../movie-advanced-options/movie-advanced-options.component";
|
||||
import { RequestServiceV2 } from "../../../../../services/requestV2.service";
|
||||
|
||||
@Component({
|
||||
templateUrl: "./movie-admin-panel.component.html",
|
||||
selector: "movie-admin-panel",
|
||||
})
|
||||
export class MovieAdminPanelComponent implements OnInit {
|
||||
|
||||
@Input() public movie: IMovieRequests;
|
||||
@Output() public advancedOptionsChanged = new EventEmitter<IAdvancedData>();
|
||||
@Output() public radarrEnabledChange = new EventEmitter<boolean>();
|
||||
|
||||
public radarrEnabled: boolean;
|
||||
public radarrProfiles: IRadarrProfile[];
|
||||
public selectedRadarrProfile: IRadarrProfile;
|
||||
public radarrRootFolders: IRadarrRootFolder[];
|
||||
public selectRadarrRootFolders: IRadarrRootFolder;
|
||||
|
||||
constructor(private radarrService: RadarrService, private requestService: RequestServiceV2, private dialog: MatDialog) { }
|
||||
|
||||
public async ngOnInit() {
|
||||
this.radarrEnabled = await this.radarrService.isRadarrEnabled();
|
||||
if (this.radarrEnabled) {
|
||||
this.radarrService.getQualityProfilesFromSettings().subscribe(c => {
|
||||
this.radarrProfiles = c;
|
||||
this.setQualityOverrides();
|
||||
});
|
||||
this.radarrService.getRootFoldersFromSettings().subscribe(c => {
|
||||
this.radarrRootFolders = c;
|
||||
this.setRootFolderOverrides();
|
||||
});
|
||||
}
|
||||
|
||||
this.radarrEnabledChange.emit(this.radarrEnabled);
|
||||
}
|
||||
|
||||
public async openAdvancedOptions() {
|
||||
const dialog = this.dialog.open(MovieAdvancedOptionsComponent, { width: "700px", data: <IAdvancedData>{ profiles: this.radarrProfiles, rootFolders: this.radarrRootFolders }, panelClass: 'modal-panel' })
|
||||
await dialog.afterClosed().subscribe(async result => {
|
||||
if(result) {
|
||||
// get the name and ids
|
||||
result.rootFolder = result.rootFolders.filter(f => f.id === +result.rootFolderId)[0];
|
||||
result.profile = result.profiles.filter(f => f.id === +result.profileId)[0];
|
||||
await this.requestService.updateMovieAdvancedOptions({qualityOverride: result.profileId, rootPathOverride: result.rootFolderId, requestId: this.movie.id}).toPromise();
|
||||
this.advancedOptionsChanged.emit(result);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private setQualityOverrides(): void {
|
||||
if (this.radarrProfiles) {
|
||||
const profile = this.radarrProfiles.filter((p) => {
|
||||
return p.id === this.movie.qualityOverride;
|
||||
});
|
||||
if (profile.length > 0) {
|
||||
this.movie.qualityOverrideTitle = profile[0].name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private setRootFolderOverrides(): void {
|
||||
if (this.radarrRootFolders) {
|
||||
const path = this.radarrRootFolders.filter((folder) => {
|
||||
return folder.id === this.movie.rootPathOverride;
|
||||
});
|
||||
if (path.length > 0) {
|
||||
this.movie.rootPathOverrideTitle = path[0].path;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,14 +1,55 @@
|
||||
import { Component, Inject } from "@angular/core";
|
||||
import { Component, Inject, OnInit } from "@angular/core";
|
||||
import { MatDialogRef, MAT_DIALOG_DATA } from "@angular/material/dialog";
|
||||
import { IAdvancedData } from "../../../../../interfaces";
|
||||
import { IAdvancedData, IRadarrProfile, IRadarrRootFolder } from "../../../../../interfaces";
|
||||
import { RadarrService } from "../../../../../services";
|
||||
|
||||
@Component({
|
||||
templateUrl: "./movie-advanced-options.component.html",
|
||||
selector: "movie-advanced-options",
|
||||
})
|
||||
export class MovieAdvancedOptionsComponent {
|
||||
export class MovieAdvancedOptionsComponent implements OnInit {
|
||||
|
||||
public radarrProfiles: IRadarrProfile[];
|
||||
public radarrRootFolders: IRadarrRootFolder[];
|
||||
|
||||
constructor(public dialogRef: MatDialogRef<MovieAdvancedOptionsComponent>, @Inject(MAT_DIALOG_DATA) public data: IAdvancedData,
|
||||
) {
|
||||
}
|
||||
private radarrService: RadarrService
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
public async ngOnInit() {
|
||||
this.radarrService.getQualityProfilesFromSettings().subscribe(c => {
|
||||
this.radarrProfiles = c;
|
||||
this.data.profiles = c;
|
||||
this.setQualityOverrides();
|
||||
});
|
||||
this.radarrService.getRootFoldersFromSettings().subscribe(c => {
|
||||
this.radarrRootFolders = c;
|
||||
this.data.rootFolders = c;
|
||||
this.setRootFolderOverrides();
|
||||
});
|
||||
}
|
||||
|
||||
private setQualityOverrides(): void {
|
||||
if (this.radarrProfiles) {
|
||||
const profile = this.radarrProfiles.filter((p) => {
|
||||
return p.id === this.data.movieRequest.qualityOverride;
|
||||
});
|
||||
if (profile.length > 0) {
|
||||
this.data.movieRequest.qualityOverrideTitle = profile[0].name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private setRootFolderOverrides(): void {
|
||||
if (this.radarrRootFolders) {
|
||||
const path = this.radarrRootFolders.filter((folder) => {
|
||||
return folder.id === this.data.movieRequest.rootPathOverride;
|
||||
});
|
||||
if (path.length > 0) {
|
||||
this.data.movieRequest.rootPathOverrideTitle = path[0].path;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,22 @@
|
||||
<h1 mat-dialog-title>{{ 'MediaDetails.RequestOnBehalf' | translate}}</h1>
|
||||
<div mat-dialog-content>
|
||||
<form class="example-form">
|
||||
<mat-form-field class="example-full-width">
|
||||
<input type="text"
|
||||
placeholder="{{ 'MediaDetails.PleaseSelectUser' | translate}}"
|
||||
aria-label="Number"
|
||||
matInput
|
||||
[formControl]="myControl"
|
||||
[matAutocomplete]="auto">
|
||||
<mat-autocomplete #auto="matAutocomplete" [displayWith]="displayFn">
|
||||
<mat-option *ngFor="let option of filteredOptions | async" [value]="option">
|
||||
{{option.username}}
|
||||
</mat-option>
|
||||
</mat-autocomplete>
|
||||
</mat-form-field>
|
||||
</form>
|
||||
</div>
|
||||
<div mat-dialog-actions>
|
||||
<button mat-raised-button (click)="onNoClick()"> Cancel</button>
|
||||
<button mat-raised-button (click)="request()" color="accent" [mat-dialog-close]="userId" cdkFocusInitial>{{'Common.Request' | translate}}</button>
|
||||
</div>
|
@ -0,0 +1,52 @@
|
||||
import { Component, Inject, OnInit } from "@angular/core";
|
||||
import { IDenyDialogData } from "../interfaces/interfaces";
|
||||
import { MatDialogRef, MAT_DIALOG_DATA } from "@angular/material/dialog";
|
||||
import { RequestService, MessageService, IdentityService } from "../../../../services";
|
||||
import { RequestType, IRequestEngineResult, IUserDropdown } from "../../../../interfaces";
|
||||
import { FormControl } from "@angular/forms";
|
||||
import { Observable } from "rxjs";
|
||||
import { filter, map, startWith } from "rxjs/operators";
|
||||
|
||||
|
||||
|
||||
@Component({
|
||||
selector: "request-behalf",
|
||||
templateUrl: "./request-behalf.component.html",
|
||||
})
|
||||
export class RequestBehalfComponent implements OnInit {
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<RequestBehalfComponent>,
|
||||
public identity: IdentityService) { }
|
||||
|
||||
public myControl = new FormControl();
|
||||
public options: IUserDropdown[];
|
||||
public filteredOptions: Observable<IUserDropdown[]>;
|
||||
public userId: string;
|
||||
|
||||
public async ngOnInit() {
|
||||
this.options = await this.identity.getUsersDropdown().toPromise();
|
||||
this.filteredOptions = this.myControl.valueChanges
|
||||
.pipe(
|
||||
startWith(''),
|
||||
map(value => this._filter(value))
|
||||
);
|
||||
}
|
||||
|
||||
public request() {
|
||||
this.dialogRef.close(this.myControl.value);
|
||||
}
|
||||
|
||||
public onNoClick(): void {
|
||||
this.dialogRef.close();
|
||||
}
|
||||
|
||||
public displayFn(user: IUserDropdown): string {
|
||||
return user?.username ? user.username : '';
|
||||
}
|
||||
|
||||
private _filter(value: string|IUserDropdown): IUserDropdown[] {
|
||||
const filterValue = typeof value === 'string' ? value.toLowerCase() : value.username.toLowerCase();
|
||||
|
||||
return this.options.filter(option => option.username.toLowerCase().includes(filterValue));
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
<div *ngIf="tv && sonarrEnabled" class="text-center">
|
||||
<button mat-raised-button color="warn" class="text-center" (click)="openAdvancedOptions();">{{'MediaDetails.AdvancedOptions' | translate }}</button>
|
||||
</div>
|
@ -1,83 +0,0 @@
|
||||
import { Component, Input, OnInit, EventEmitter, Output } from "@angular/core";
|
||||
import { RadarrService, SonarrService } from "../../../../../services";
|
||||
import { IRadarrProfile, IRadarrRootFolder, IAdvancedData, ITvRequests, ISonarrProfile, ISonarrRootFolder } from "../../../../../interfaces";
|
||||
import { MatDialog } from "@angular/material/dialog";
|
||||
|
||||
import { RequestServiceV2 } from "../../../../../services/requestV2.service";
|
||||
import { MovieAdvancedOptionsComponent } from "../../../movie/panels/movie-advanced-options/movie-advanced-options.component";
|
||||
|
||||
@Component({
|
||||
templateUrl: "./tv-admin-panel.component.html",
|
||||
selector: "tv-admin-panel",
|
||||
})
|
||||
export class TvAdminPanelComponent implements OnInit {
|
||||
|
||||
@Input() public tv: ITvRequests;
|
||||
@Output() public advancedOptionsChanged = new EventEmitter<IAdvancedData>();
|
||||
@Output() public sonarrEnabledChange = new EventEmitter<boolean>();
|
||||
|
||||
public sonarrEnabled: boolean;
|
||||
public radarrProfiles: IRadarrProfile[];
|
||||
public selectedRadarrProfile: IRadarrProfile;
|
||||
public radarrRootFolders: IRadarrRootFolder[];
|
||||
public selectRadarrRootFolders: IRadarrRootFolder;
|
||||
|
||||
|
||||
public sonarrProfiles: ISonarrProfile[];
|
||||
public sonarrRootFolders: ISonarrRootFolder[];
|
||||
|
||||
constructor(private sonarrService: SonarrService, private requestService: RequestServiceV2, private dialog: MatDialog) { }
|
||||
|
||||
public async ngOnInit() {
|
||||
this.sonarrEnabled = await this.sonarrService.isEnabled();
|
||||
if (this.sonarrEnabled) {
|
||||
this.sonarrService.getQualityProfilesWithoutSettings()
|
||||
.subscribe(x => {
|
||||
this.sonarrProfiles = x;
|
||||
this.setQualityOverrides();
|
||||
});
|
||||
this.sonarrService.getRootFoldersWithoutSettings()
|
||||
.subscribe(x => {
|
||||
this.sonarrRootFolders = x;
|
||||
this.setRootFolderOverrides();
|
||||
});
|
||||
}
|
||||
|
||||
this.sonarrEnabledChange.emit(this.sonarrEnabled);
|
||||
}
|
||||
|
||||
public async openAdvancedOptions() {
|
||||
const dialog = this.dialog.open(MovieAdvancedOptionsComponent, { width: "700px", data: <IAdvancedData>{ profiles: this.sonarrProfiles, rootFolders: this.sonarrRootFolders }, panelClass: 'modal-panel' })
|
||||
await dialog.afterClosed().subscribe(async result => {
|
||||
if (result) {
|
||||
// get the name and ids
|
||||
result.rootFolder = result.rootFolders.filter(f => f.id === +result.rootFolderId)[0];
|
||||
result.profile = result.profiles.filter(f => f.id === +result.profileId)[0];
|
||||
await this.requestService.updateTvAdvancedOptions({ qualityOverride: result.profileId, rootPathOverride: result.rootFolderId, requestId: this.tv.id }).toPromise();
|
||||
this.advancedOptionsChanged.emit(result);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private setQualityOverrides(): void {
|
||||
if (this.sonarrProfiles) {
|
||||
const profile = this.sonarrProfiles.filter((p) => {
|
||||
return p.id === this.tv.qualityOverride;
|
||||
});
|
||||
if (profile.length > 0) {
|
||||
this.tv.qualityOverrideTitle = profile[0].name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private setRootFolderOverrides(): void {
|
||||
if (this.sonarrRootFolders) {
|
||||
const path = this.sonarrRootFolders.filter((folder) => {
|
||||
return folder.id === this.tv.rootFolder;
|
||||
});
|
||||
if (path.length > 0) {
|
||||
this.tv.rootPathOverrideTitle = path[0].path;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
<h1 mat-dialog-title>
|
||||
|
||||
Advanced Options</h1>
|
||||
<div mat-dialog-content>
|
||||
<mat-form-field>
|
||||
<mat-label>{{'MediaDetails.QualityProfilesSelect' | translate }}</mat-label>
|
||||
<mat-select [(value)]="data.profileId">
|
||||
<mat-option *ngFor="let profile of sonarrProfiles" value="{{profile.id}}">{{profile.name}}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div mat-dialog-content>
|
||||
<mat-form-field>
|
||||
<mat-label>{{'MediaDetails.RootFolderSelect' | translate }}</mat-label>
|
||||
<mat-select [(value)]="data.rootFolderId">
|
||||
<mat-option *ngFor="let profile of sonarrRootFolders" value="{{profile.id}}">{{profile.path}}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div mat-dialog-actions>
|
||||
<button mat-button [mat-dialog-close]="" cdkFocusInitial>Close</button>
|
||||
<button mat-button [mat-dialog-close]="data" cdkFocusInitial>Save</button>
|
||||
</div>
|
@ -0,0 +1,55 @@
|
||||
import { Component, Inject, OnInit } from "@angular/core";
|
||||
import { MatDialogRef, MAT_DIALOG_DATA } from "@angular/material/dialog";
|
||||
import { IAdvancedData, ISonarrProfile, ISonarrRootFolder } from "../../../../../interfaces";
|
||||
import { SonarrService } from "../../../../../services";
|
||||
|
||||
@Component({
|
||||
templateUrl: "./tv-advanced-options.component.html",
|
||||
selector: "tv-advanced-options",
|
||||
})
|
||||
export class TvAdvancedOptionsComponent implements OnInit {
|
||||
|
||||
public sonarrProfiles: ISonarrProfile[];
|
||||
public sonarrRootFolders: ISonarrRootFolder[];
|
||||
|
||||
constructor(public dialogRef: MatDialogRef<TvAdvancedOptionsComponent>, @Inject(MAT_DIALOG_DATA) public data: IAdvancedData,
|
||||
private sonarrService: SonarrService
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
public async ngOnInit() {
|
||||
this.sonarrService.getQualityProfilesWithoutSettings().subscribe(c => {
|
||||
this.sonarrProfiles = c;
|
||||
this.data.profiles = c;
|
||||
this.setQualityOverrides();
|
||||
});
|
||||
this.sonarrService.getRootFoldersWithoutSettings().subscribe(c => {
|
||||
this.sonarrRootFolders = c;
|
||||
this.data.rootFolders = c;
|
||||
this.setRootFolderOverrides();
|
||||
});
|
||||
}
|
||||
|
||||
private setQualityOverrides(): void {
|
||||
if (this.sonarrProfiles) {
|
||||
const profile = this.sonarrProfiles.filter((p) => {
|
||||
return p.id === this.data.tvRequest.qualityOverride;
|
||||
});
|
||||
if (profile.length > 0) {
|
||||
this.data.movieRequest.qualityOverrideTitle = profile[0].name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private setRootFolderOverrides(): void {
|
||||
if (this.sonarrRootFolders) {
|
||||
const path = this.sonarrRootFolders.filter((folder) => {
|
||||
return folder.id === this.data.tvRequest.rootFolder;
|
||||
});
|
||||
if (path.length > 0) {
|
||||
this.data.movieRequest.rootPathOverrideTitle = path[0].path;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in new issue