mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-20 13:23:20 -07:00
Fixed it
This commit is contained in:
parent
6fc9db003e
commit
9f5c19ecf6
5 changed files with 46 additions and 28 deletions
|
@ -58,10 +58,9 @@ namespace Ombi.Api.TheMovieDb
|
||||||
public async Task<Collections> GetCollection(string langCode, int collectionId)
|
public async Task<Collections> GetCollection(string langCode, int collectionId)
|
||||||
{
|
{
|
||||||
// https://developers.themoviedb.org/3/discover/movie-discover
|
// https://developers.themoviedb.org/3/discover/movie-discover
|
||||||
var request = new Request("discover/movie", BaseUri, HttpMethod.Get);
|
var request = new Request($"collection/{collectionId}", BaseUri, HttpMethod.Get);
|
||||||
request.FullUri = request.FullUri.AddQueryParameter("api_key", ApiToken);
|
request.FullUri = request.FullUri.AddQueryParameter("api_key", ApiToken);
|
||||||
request.FullUri = request.FullUri.AddQueryParameter("language", langCode);
|
request.FullUri = request.FullUri.AddQueryParameter("language", langCode);
|
||||||
request.FullUri = request.FullUri.AddQueryParameter("collection_id", collectionId.ToString());
|
|
||||||
|
|
||||||
return await Api.Request<Collections> (request);
|
return await Api.Request<Collections> (request);
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,8 +61,6 @@ export class AppComponent implements OnInit {
|
||||||
public ngOnInit() {
|
public ngOnInit() {
|
||||||
const theme = localStorage.getItem("theme");
|
const theme = localStorage.getItem("theme");
|
||||||
this.onSetTheme(theme);
|
this.onSetTheme(theme);
|
||||||
this.user = this.authService.claims();
|
|
||||||
this.isAdmin = this.authService.hasRole("admin");
|
|
||||||
|
|
||||||
this.settingsService.getCustomization().subscribe(x => {
|
this.settingsService.getCustomization().subscribe(x => {
|
||||||
this.customizationSettings = x;
|
this.customizationSettings = x;
|
||||||
|
@ -88,10 +86,11 @@ export class AppComponent implements OnInit {
|
||||||
this.currentUrl = event.url;
|
this.currentUrl = event.url;
|
||||||
if (event instanceof NavigationStart) {
|
if (event instanceof NavigationStart) {
|
||||||
this.user = this.authService.claims();
|
this.user = this.authService.claims();
|
||||||
|
this.isAdmin = this.authService.hasRole("admin");
|
||||||
this.showNav = this.authService.loggedIn();
|
this.showNav = this.authService.loggedIn();
|
||||||
|
|
||||||
// tslint:disable-next-line:no-string-literal
|
// tslint:disable-next-line:no-string-literal
|
||||||
if (this.user !== null && this.user.name && !this.checkedForUpdate && this.user.roles["Admin"]) {
|
if (this.user !== null && this.user.name && !this.checkedForUpdate && this.isAdmin) {
|
||||||
this.checkedForUpdate = true;
|
this.checkedForUpdate = true;
|
||||||
this.jobService.getCachedUpdate().subscribe(x => {
|
this.jobService.getCachedUpdate().subscribe(x => {
|
||||||
this.updateAvailable = x;
|
this.updateAvailable = x;
|
||||||
|
@ -103,18 +102,16 @@ export class AppComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
public roleClass() {
|
public roleClass() {
|
||||||
if (this.user.roles.some(r => r === "Admin")) {
|
if (this.user) {
|
||||||
return "adminUser";
|
if (this.user.roles.some(r => r === "Admin")) {
|
||||||
} else if (this.user.roles.some(r => r === "PowerUser")) {
|
return "adminUser";
|
||||||
return "powerUser";
|
} else if (this.user.roles.some(r => r === "PowerUser")) {
|
||||||
|
return "powerUser";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return "user";
|
return "user";
|
||||||
}
|
}
|
||||||
|
|
||||||
public hasRole(role: string): boolean {
|
|
||||||
return this.user.roles.some(r => r === role);
|
|
||||||
}
|
|
||||||
|
|
||||||
public openMobileApp(event: any) {
|
public openMobileApp(event: any) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
if (!this.customizationSettings.applicationUrl) {
|
if (!this.customizationSettings.applicationUrl) {
|
||||||
|
|
|
@ -1,19 +1,9 @@
|
||||||
<div class="small-middle-container">
|
<div class="small-middle-container">
|
||||||
|
|
||||||
<div class="row justify-content-md-center top-spacing">
|
<div class="row justify-content-md-center top-spacing">
|
||||||
<div class="btn-group" role="group" aria-label="Basic example">
|
<h2>{{collection.title}}</h2>
|
||||||
<button type="button" (click)="popular()" [attr.color]="popularActive ? 'accent' : 'primary'"
|
<p>{{collection.overview}}</p>
|
||||||
[ngClass]="popularActive ? 'mat-accent' : 'mat-primary'" mat-raised-button
|
|
||||||
class="btn grow" >{{'Discovery.PopularTab' | translate}}</button>
|
|
||||||
<button type="button" (click)="trending()"
|
|
||||||
[attr.color]="trendingActive ? 'accent' : 'primary'"
|
|
||||||
[ngClass]="trendingActive ? 'mat-accent' : 'mat-primary'"
|
|
||||||
mat-raised-button class="btn grow" color="primary">{{'Discovery.TrendingTab' | translate}}</button>
|
|
||||||
<button type="button" (click)="upcoming()"
|
|
||||||
[attr.color]="upcomingActive ? 'accent' : 'primary'"
|
|
||||||
[ngClass]="upcomingActive ? 'mat-accent' : 'mat-primary'"
|
|
||||||
mat-raised-button class="btn grow" color="primary">{{'Discovery.UpcomingTab' | translate}}</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="loadingFlag" class="row justify-content-md-center top-spacing loading-spinner">
|
<div *ngIf="loadingFlag" class="row justify-content-md-center top-spacing loading-spinner">
|
||||||
<mat-spinner [color]="'accent'"></mat-spinner>
|
<mat-spinner [color]="'accent'"></mat-spinner>
|
||||||
|
|
|
@ -2,6 +2,8 @@ import { Component, OnInit } from "@angular/core";
|
||||||
import { ActivatedRoute } from "@angular/router";
|
import { ActivatedRoute } from "@angular/router";
|
||||||
import { SearchV2Service } from "../../services";
|
import { SearchV2Service } from "../../services";
|
||||||
import { IMovieCollectionsViewModel } from "../../interfaces/ISearchTvResultV2";
|
import { IMovieCollectionsViewModel } from "../../interfaces/ISearchTvResultV2";
|
||||||
|
import { IDiscoverCardResult } from "../interfaces";
|
||||||
|
import { RequestType } from "../../interfaces";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: "./discover-collections.component.html",
|
templateUrl: "./discover-collections.component.html",
|
||||||
|
@ -11,6 +13,9 @@ export class DiscoverCollectionsComponent implements OnInit {
|
||||||
|
|
||||||
public collectionId: number;
|
public collectionId: number;
|
||||||
public collection: IMovieCollectionsViewModel;
|
public collection: IMovieCollectionsViewModel;
|
||||||
|
public loadingFlag: boolean;
|
||||||
|
|
||||||
|
public discoverResults: IDiscoverCardResult[] = [];
|
||||||
|
|
||||||
constructor(private searchService: SearchV2Service, private route: ActivatedRoute) {
|
constructor(private searchService: SearchV2Service, private route: ActivatedRoute) {
|
||||||
this.route.params.subscribe((params: any) => {
|
this.route.params.subscribe((params: any) => {
|
||||||
|
@ -20,5 +25,32 @@ export class DiscoverCollectionsComponent implements OnInit {
|
||||||
|
|
||||||
public async ngOnInit() {
|
public async ngOnInit() {
|
||||||
this.collection = await this.searchService.getMovieCollections(this.collectionId);
|
this.collection = await this.searchService.getMovieCollections(this.collectionId);
|
||||||
|
this.createModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
private createModel() {
|
||||||
|
this.finishLoading();
|
||||||
|
this.collection.collection.forEach(m => {
|
||||||
|
this.discoverResults.push({
|
||||||
|
available: m.available,
|
||||||
|
posterPath: `https://image.tmdb.org/t/p/w300/${m.posterPath}`,
|
||||||
|
requested: m.requested,
|
||||||
|
title: m.title,
|
||||||
|
type: RequestType.movie,
|
||||||
|
id: m.id,
|
||||||
|
url: `http://www.imdb.com/title/${m.imdbId}/`,
|
||||||
|
rating: null,
|
||||||
|
overview: m.overview,
|
||||||
|
approved: m.approved
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private loading() {
|
||||||
|
this.loadingFlag = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private finishLoading() {
|
||||||
|
this.loadingFlag = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
||||||
<div class="col-12 col-md-2">
|
<div class="col-12 col-md-2">
|
||||||
<button *ngIf="movie.belongsToCollection" [routerLink]="/discover/{{movie.belongsToCollection.id}" mat-raised-button class="spacing-below full-width mat-elevation-z8">{{movie.belongsToCollection.name}}</button>
|
<button *ngIf="movie.belongsToCollection" [routerLink]="'/discover/collection/' + movie.belongsToCollection.id" mat-raised-button class="spacing-below full-width mat-elevation-z8">{{movie.belongsToCollection.name}}</button>
|
||||||
|
|
||||||
<mat-card class="mat-elevation-z8">
|
<mat-card class="mat-elevation-z8">
|
||||||
<mat-card-content class="medium-font">
|
<mat-card-content class="medium-font">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue