mirror of https://github.com/Ombi-app/Ombi
parent
957f7db195
commit
8f3dd86c52
@ -0,0 +1,3 @@
|
||||
<div *ngIf="movie">
|
||||
<button mat-raised-button color="warn" class="text-center" (click)="openAdvancedOptions();">Advanced Options</button>
|
||||
</div>
|
@ -0,0 +1,63 @@
|
||||
import { Component, Input, OnInit } from "@angular/core";
|
||||
import { RadarrService } from "../../../../../services";
|
||||
import { IRadarrProfile, IRadarrRootFolder, IMovieRequests, IAdvancedData } from "../../../../../interfaces";
|
||||
import { MatDialog } from "@angular/material";
|
||||
import { MovieAdvancedOptionsComponent } from "../movie-advanced-options/movie-advanced-options.component";
|
||||
|
||||
@Component({
|
||||
templateUrl: "./movie-admin-panel.component.html",
|
||||
selector: "movie-admin-panel",
|
||||
})
|
||||
export class MovieAdminPanelComponent implements OnInit {
|
||||
|
||||
@Input() public movie: IMovieRequests;
|
||||
|
||||
public radarrProfiles: IRadarrProfile[];
|
||||
public selectedRadarrProfile: IRadarrProfile;
|
||||
public radarrRootFolders: IRadarrRootFolder[];
|
||||
public selectRadarrRootFolders: IRadarrRootFolder;
|
||||
|
||||
constructor(private radarrService: RadarrService, private dialog: MatDialog) { }
|
||||
|
||||
public async ngOnInit() {
|
||||
if (await this.radarrService.isRadarrEnabled()) {
|
||||
this.radarrService.getQualityProfilesFromSettings().subscribe(c => {
|
||||
this.radarrProfiles = c;
|
||||
this.setQualityOverrides();
|
||||
});
|
||||
this.radarrService.getRootFoldersFromSettings().subscribe(c => {
|
||||
this.radarrRootFolders = c;
|
||||
this.setRootFolderOverrides();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public openAdvancedOptions() {
|
||||
const dialog = this.dialog.open(MovieAdvancedOptionsComponent, { width: "700px", data: <IAdvancedData>{ profiles: this.radarrProfiles, rootFolders: this.radarrRootFolders }, panelClass: 'modal-panel' })
|
||||
dialog.afterClosed().subscribe(result => {
|
||||
console.log(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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
|
||||
|
||||
<h1 mat-dialog-title>Advanced Options</h1>
|
||||
<div mat-dialog-content>
|
||||
<mat-form-field>
|
||||
<mat-label>Radarr Quality Profile</mat-label>
|
||||
<mat-select [(value)]="options.profile">
|
||||
<mat-option *ngFor="let profile of data.profiles" value="{{profile.id}}">{{profile.name}}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Radarr Root Folders</mat-label>
|
||||
<mat-select [(value)]="options.rootFolder">
|
||||
<mat-option *ngFor="let profile of data.rootFolders" value="{{profile.id}}">{{profile.path}}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div mat-dialog-actions>
|
||||
<button mat-button [mat-dialog-close]="selectedRadarrProfile" cdkFocusInitial>Ok</button>
|
||||
</div>
|
@ -0,0 +1,14 @@
|
||||
import { Component, Inject } from "@angular/core";
|
||||
import { MatDialogRef, MAT_DIALOG_DATA } from "@angular/material";
|
||||
import { IAdvancedModel, IAdvancedData } from "../../../../../interfaces";
|
||||
|
||||
@Component({
|
||||
templateUrl: "./movie-advanced-options.component.html",
|
||||
selector: "movie-advanced-options",
|
||||
})
|
||||
export class MovieAdvancedOptionsComponent {
|
||||
|
||||
public options: IAdvancedModel;
|
||||
|
||||
constructor(public dialogRef: MatDialogRef<MovieAdvancedOptionsComponent>, @Inject(MAT_DIALOG_DATA) public data: IAdvancedData) { }
|
||||
}
|
Loading…
Reference in new issue