mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-14 02:26:55 -07:00
fix(Hide music from navbar and request list when not enabled): 🐛
This commit is contained in:
parent
8eda250367
commit
5123a76954
10 changed files with 35 additions and 10 deletions
|
@ -1,5 +1,5 @@
|
|||
import { APP_BASE_HREF, CommonModule, PlatformLocation } from "@angular/common";
|
||||
import { CustomPageService, ImageService, RequestService, SettingsService, SonarrService } from "./services";
|
||||
import { CustomPageService, ImageService, LidarrService, RequestService, SettingsService, SonarrService } from "./services";
|
||||
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
|
||||
import { HTTP_INTERCEPTORS, HttpClient, HttpClientModule } from "@angular/common/http";
|
||||
import { IdentityService, IssuesService, JobService, MessageService, PlexTvService, SearchService, StatusService } from "./services";
|
||||
|
@ -209,6 +209,7 @@ export function JwtTokenGetter() {
|
|||
StorageService,
|
||||
RequestService,
|
||||
SonarrService,
|
||||
LidarrService,
|
||||
SignalRNotificationService,
|
||||
FEATURES_INITIALIZER,
|
||||
SONARR_INITIALIZER,
|
||||
|
|
|
@ -45,7 +45,7 @@ export class CarouselListComponent implements OnInit {
|
|||
};
|
||||
private amountToLoad = 17;
|
||||
private currentlyLoaded = 0;
|
||||
private baseUrl: string;
|
||||
private baseUrl: string = "";
|
||||
|
||||
|
||||
constructor(private searchService: SearchV2Service,
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
<mat-slide-toggle id="filterTv" class="mat-menu-item slide-menu" [checked]="searchFilter.tvShows"
|
||||
(click)="$event.stopPropagation()" (change)="changeFilter($event,SearchFilterType.TvShow)">
|
||||
{{ 'NavigationBar.Filter.TvShows' | translate}}</mat-slide-toggle>
|
||||
<mat-slide-toggle id="filterMusic" class="mat-menu-item slide-menu" [checked]="searchFilter.music"
|
||||
<mat-slide-toggle *ngIf="musicEnabled$ | async" id="filterMusic" class="mat-menu-item slide-menu" [checked]="searchFilter.music"
|
||||
(click)="$event.stopPropagation()" (change)="changeFilter($event,SearchFilterType.Music)">
|
||||
{{ 'NavigationBar.Filter.Music' | translate}}</mat-slide-toggle>
|
||||
<!-- <mat-slide-toggle class="mat-menu-item slide-menu" [checked]="searchFilter.people"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
|
||||
import { Component, EventEmitter, Input, OnInit, Output, SimpleChanges } from '@angular/core';
|
||||
import { ICustomizationSettings, IUser, RequestType, UserType } from '../interfaces';
|
||||
import { SettingsService, SettingsStateService } from '../services';
|
||||
import { LidarrService, SettingsService, SettingsStateService } from '../services';
|
||||
|
||||
import { AdvancedSearchDialogComponent } from '../shared/advanced-search-dialog/advanced-search-dialog.component';
|
||||
import { CustomizationFacade } from '../state/customization';
|
||||
|
@ -15,7 +15,7 @@ import { Observable } from 'rxjs';
|
|||
import { Router } from '@angular/router';
|
||||
import { SearchFilter } from './SearchFilter';
|
||||
import { StorageService } from '../shared/storage/storage-service';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { map, take } from 'rxjs/operators';
|
||||
|
||||
export enum SearchFilterType {
|
||||
Movie = 1,
|
||||
|
@ -56,9 +56,12 @@ export class MyNavComponent implements OnInit {
|
|||
|
||||
private customizationSettings: ICustomizationSettings;
|
||||
|
||||
public readonly musicEnabled$ = this.lidarrService.enabled().pipe(take(1));
|
||||
|
||||
constructor(private breakpointObserver: BreakpointObserver,
|
||||
private settingsService: SettingsService,
|
||||
private customizationFacade: CustomizationFacade,
|
||||
private lidarrService: LidarrService,
|
||||
private store: StorageService,
|
||||
private filterService: FilterService,
|
||||
private dialogService: MatDialog,
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import { MoviesGridComponent } from "./movies-grid/movies-grid.component";
|
||||
|
||||
import { RequestServiceV2 } from "../../services/requestV2.service";
|
||||
import { RequestService } from "../../services";
|
||||
import { LidarrService, RequestService } from "../../services";
|
||||
import { TvGridComponent } from "./tv-grid/tv-grid.component";
|
||||
import { GridSpinnerComponent } from "./grid-spinner/grid-spinner.component";
|
||||
import { RequestOptionsComponent } from "./options/request-options.component";
|
||||
|
@ -20,4 +20,5 @@ export const components: any[] = [
|
|||
export const providers: any[] = [
|
||||
RequestService,
|
||||
RequestServiceV2,
|
||||
LidarrService,
|
||||
];
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<tv-grid (onOpenOptions)="onOpenOptions($event)"></tv-grid>
|
||||
</ng-template>
|
||||
</mat-tab>
|
||||
<mat-tab label="{{ 'NavigationBar.Filter.Music' | translate }}">
|
||||
<mat-tab *ngIf="musicEnabled$ | async" label="{{ 'NavigationBar.Filter.Music' | translate }}">
|
||||
<ng-template matTabContent>
|
||||
<albums-grid (onOpenOptions)="onOpenOptions($event)"></albums-grid>
|
||||
</ng-template>
|
||||
|
|
|
@ -3,6 +3,8 @@ import { Component, ViewChild } from "@angular/core";
|
|||
import { MatBottomSheet } from "@angular/material/bottom-sheet";
|
||||
import { RequestOptionsComponent } from "./options/request-options.component";
|
||||
import { UpdateType } from "../models/UpdateType";
|
||||
import { LidarrService } from "app/services";
|
||||
import { take } from "rxjs";
|
||||
|
||||
@Component({
|
||||
templateUrl: "./requests-list.component.html",
|
||||
|
@ -10,7 +12,9 @@ import { UpdateType } from "../models/UpdateType";
|
|||
})
|
||||
export class RequestsListComponent {
|
||||
|
||||
constructor(private bottomSheet: MatBottomSheet) { }
|
||||
constructor(private bottomSheet: MatBottomSheet, private lidarrService: LidarrService) { }
|
||||
|
||||
public readonly musicEnabled$ = this.lidarrService.enabled().pipe(take(1));
|
||||
|
||||
public onOpenOptions(event: { request: any, filter: any, onChange: any, manageOwnRequests: boolean, isAdmin: boolean, has4kRequest: boolean, hasRegularRequest: boolean }) {
|
||||
const ref = this.bottomSheet.open(RequestOptionsComponent, { data: { id: event.request.id, type: event.request.requestType, canApprove: event.request.canApprove, manageOwnRequests: event.manageOwnRequests, isAdmin: event.isAdmin, has4kRequest: event.has4kRequest, hasRegularRequest: event.hasRegularRequest } });
|
||||
|
|
|
@ -13,9 +13,14 @@ export class LidarrService extends ServiceHelpers {
|
|||
super(http, "/api/v1/Lidarr", href);
|
||||
}
|
||||
|
||||
public enabled(): Observable<boolean> {
|
||||
return this.http.get<boolean>(`${this.url}/enabled/`, {headers: this.headers});
|
||||
}
|
||||
|
||||
public getRootFolders(settings: ILidarrSettings): Observable<ILidarrRootFolder[]> {
|
||||
return this.http.post<ILidarrRootFolder[]>(`${this.url}/RootFolders/`, JSON.stringify(settings), {headers: this.headers});
|
||||
}
|
||||
|
||||
public getQualityProfiles(settings: ILidarrSettings): Observable<ILidarrProfile[]> {
|
||||
return this.http.post<ILidarrProfile[]>(`${this.url}/Profiles/`, JSON.stringify(settings), {headers: this.headers});
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ export class AdvancedSearchDialogDataService {
|
|||
getOptions(): any {
|
||||
return this._options;
|
||||
}
|
||||
|
||||
|
||||
getLoaded(): number {
|
||||
return this._options.loaded;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ using Ombi.Settings.Settings.Models.External;
|
|||
|
||||
namespace Ombi.Controllers.V1.External
|
||||
{
|
||||
[PowerUser]
|
||||
[ApiV1]
|
||||
[Produces("application/json")]
|
||||
public class LidarrController : Controller
|
||||
|
@ -28,11 +27,19 @@ namespace Ombi.Controllers.V1.External
|
|||
private readonly ISettingsService<LidarrSettings> _lidarrSettings;
|
||||
private ICacheService Cache { get; }
|
||||
|
||||
[HttpGet("enabled")]
|
||||
public async Task<bool> Enabled()
|
||||
{
|
||||
var settings = await _lidarrSettings.GetSettingsAsync();
|
||||
return settings.Enabled;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Lidarr profiles.
|
||||
/// </summary>
|
||||
/// <param name="settings">The settings.</param>
|
||||
/// <returns></returns>
|
||||
[PowerUser]
|
||||
[HttpPost("Profiles")]
|
||||
public async Task<IEnumerable<LidarrProfile>> GetProfiles([FromBody] LidarrSettings settings)
|
||||
{
|
||||
|
@ -44,6 +51,7 @@ namespace Ombi.Controllers.V1.External
|
|||
/// </summary>
|
||||
/// <param name="settings">The settings.</param>
|
||||
/// <returns></returns>
|
||||
[PowerUser]
|
||||
[HttpPost("RootFolders")]
|
||||
public async Task<IEnumerable<LidarrRootFolder>> GetRootFolders([FromBody] LidarrSettings settings)
|
||||
{
|
||||
|
@ -55,6 +63,7 @@ namespace Ombi.Controllers.V1.External
|
|||
/// </summary>
|
||||
/// <param name="settings">The settings.</param>
|
||||
/// <returns></returns>
|
||||
[PowerUser]
|
||||
[HttpPost("Metadata")]
|
||||
public async Task<IEnumerable<MetadataProfile>> GetMetadataProfiles([FromBody] LidarrSettings settings)
|
||||
{
|
||||
|
@ -66,6 +75,7 @@ namespace Ombi.Controllers.V1.External
|
|||
/// <remarks>The data is cached for an hour</remarks>
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[PowerUser]
|
||||
[HttpGet("Profiles")]
|
||||
public async Task<IEnumerable<LidarrProfile>> GetProfiles()
|
||||
{
|
||||
|
@ -85,6 +95,7 @@ namespace Ombi.Controllers.V1.External
|
|||
/// <remarks>The data is cached for an hour</remarks>
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[PowerUser]
|
||||
[HttpGet("RootFolders")]
|
||||
public async Task<IEnumerable<LidarrRootFolder>> GetRootFolders()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue