Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for issue #1907 #2093

Merged
merged 8 commits into from
Mar 26, 2018
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions src/Ombi/ClientApp/app/issues/issueDetails.component.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
<div *ngIf="issue">
<div class="myBg backdrop" [style.background-image]="backgroundPath"></div>
<div class="tint" style="background-image: linear-gradient(to bottom, rgba(0,0,0,0.6) 0%,rgba(0,0,0,0.6) 100%);"></div>
<h1>{{issue.title}} </h1>
<div class="col-md-6">
<span class="label label-info">{{IssueStatus[issue.status]}}</span>
<span class="label label-success">{{issue.issueCategory.value}}</span>

<h3 *ngIf="issue.userReported?.alias">{{'Issues.ReportedBy' | translate}}: {{issue.userReported.alias}}</h3>
<h3 *ngIf="!issue.userReported?.alias">{{'Issues.ReportedBy' | translate}}: {{issue.userReported.userName}}</h3>
<img class="img-responsive poster" src="{{posterPath}}" alt="poster">
<span class="label label-info">{{IssueStatus[issue.status]}}</span>
<span class="label label-success">{{issue.issueCategory.value}}</span>

<h3 *ngIf="issue.userReported?.alias">{{'Issues.ReportedBy' | translate}}: {{issue.userReported.alias}}</h3>
<h3 *ngIf="!issue.userReported?.alias">{{'Issues.ReportedBy' | translate}}: {{issue.userReported.userName}}</h3>
<h3 *ngIf="issue.subject">{{'Issues.Subject' | translate}}: {{issue.subject}}</h3>
<br>
<br>
<div class="form-group">
<label for="description" class="control-label" [translate]="'Issues.Description'"></label>
<div>
Expand All @@ -26,7 +29,8 @@ <h3 *ngIf="issue.subject">{{'Issues.Subject' | translate}}: {{issue.subject}}</h
<div class="panel-heading top-bar">
<div class="col-md-8 col-xs-8">
<h3 class="panel-title">
<span class="glyphicon glyphicon-comment"></span> {{'Issues.Comments' | translate}}</h3>
<span class="glyphicon glyphicon-comment"></span> {{'Issues.Comments' | translate}}
</h3>
</div>
</div>

Expand All @@ -51,8 +55,7 @@ <h3 class="panel-title">
</div>
<div class="panel-footer">
<div class="input-group">
<input id="btn-input" type="text" class="form-control input-sm chat_input" [(ngModel)]="newComment.comment" [attr.placeholder]="'Issues.WriteMessagePlaceholder' | translate"
/>
<input id="btn-input" type="text" class="form-control input-sm chat_input" [(ngModel)]="newComment.comment" [attr.placeholder]="'Issues.WriteMessagePlaceholder' | translate" />
<span class="input-group-btn">
<button class="btn btn-primary btn-sm" id="btn-chat" (click)="addComment()" [translate]="'Issues.SendMessageButton'"></button>
</span>
Expand Down
9 changes: 9 additions & 0 deletions src/Ombi/ClientApp/app/issues/issueDetails.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,15 @@ body{
overflow: hidden;
display: flex;
}
.myBg {
z-index: -1;
}
.tint {
z-index: -1;
}
img-responsive poster {
display:block;
}
img {
display: block;
width: 100%;
Expand Down
32 changes: 29 additions & 3 deletions src/Ombi/ClientApp/app/issues/issueDetails.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import { Component, OnInit } from "@angular/core";
import { ActivatedRoute } from "@angular/router";

import { AuthService } from "../auth/auth.service";
import { IssuesService, NotificationService, SettingsService } from "../services";
import { ImageService, IssuesService, NotificationService, SearchService, SettingsService } from "../services";

import { DomSanitizer } from "@angular/platform-browser";
import { IIssues, IIssuesChat, IIssueSettings, INewIssueComments, IssueStatus } from "../interfaces";

@Component({
Expand All @@ -22,14 +23,19 @@ export class IssueDetailsComponent implements OnInit {
public IssueStatus = IssueStatus;
public isAdmin: boolean;
public settings: IIssueSettings;
public backgroundPath: any;
public posterPath: any;

private issueId: number;

constructor(private issueService: IssuesService,
private route: ActivatedRoute,
private authService: AuthService,
private settingsService: SettingsService,
private notificationService: NotificationService) {
private notificationService: NotificationService,
private imageService: ImageService,
private searchService: SearchService,
private sanitizer: DomSanitizer) {
this.route.params
.subscribe((params: any) => {
this.issueId = parseInt(params.id);
Expand All @@ -56,8 +62,8 @@ export class IssueDetailsComponent implements OnInit {
providerId: x.providerId,
userReported: x.userReported,
};
this.setBackground(x);
});

this.loadComments();
}

Expand Down Expand Up @@ -85,4 +91,24 @@ export class IssueDetailsComponent implements OnInit {
private loadComments() {
this.issueService.getComments(this.issueId).subscribe(x => this.comments = x);
}

private setBackground(issue: any) {
if (issue.requestType === 1) {
this.searchService.getMovieInformation(Number(issue.providerId)).subscribe(x => {
this.backgroundPath = this.sanitizer.bypassSecurityTrustStyle
("url(" + "https://image.tmdb.org/t/p/w1280" + x.backdropPath + ")");
this.posterPath = "https://image.tmdb.org/t/p/w300/" + x.posterPath;
});

} else {
this.imageService.getTvBanner(Number(issue.providerId)).subscribe(x => {
this.backgroundPath = this.sanitizer.bypassSecurityTrustStyle
("url(" + x + ")");
});
this.searchService.getShowInformationTreeNode(Number(issue.providerId)).subscribe(x => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably shouldn't be doing this just to get the banner.
This will pull back ALL the information about the request, and we need to keep in mind that there might not be a request associated with the issue.

We can raise issues on content that do not have requests.

Copy link
Contributor Author

@anojht anojht Mar 23, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tidusjar Good point, I did not think of that. Would writing a few API calls that just returns image paths be the best solution here instead?

For example, I wrote API calls inside image.service.ts but the FanArt banner and poster images were inconsistent with the request or search images. So maybe just writing new API calls for TheMovieDBApi.cs and TvMazeApi.cs to return just the images would work?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we have the provider id so we can just use the Image service (check the Image Controller to see what we currently support)

If you are writing a new api then I suggest it should be on the ImageController.

this.posterPath = x.data.banner;
});
}

}
}
3 changes: 2 additions & 1 deletion src/Ombi/ClientApp/app/issues/issues.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { NgbModule } from "@ng-bootstrap/ng-bootstrap";
import { OrderModule } from "ngx-order-pipe";
import { PaginatorModule, SharedModule, TabViewModule } from "primeng/primeng";

import { IdentityService } from "../services";
import { IdentityService, SearchService } from "../services";

import { AuthGuard } from "../auth/auth.guard";

Expand Down Expand Up @@ -43,6 +43,7 @@ const routes: Routes = [
],
providers: [
IdentityService,
SearchService,
],

})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ <h4 class="request-title">{{request.title}} ({{request.releaseDate | date: 'yyyy


<issue-report [movie]="true" [visible]="issuesBarVisible" (visibleChange)="issuesBarVisible = $event;" [title]="issueRequest?.title"
[issueCategory]="issueCategorySelected" [id]="issueRequest?.id" [providerId]=""></issue-report>
[issueCategory]="issueCategorySelected" [id]="issueRequest?.id" [providerId]="issueProviderId"></issue-report>


<p-sidebar [(visible)]="filterDisplay" styleClass="ui-sidebar-md side-back side-small">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,4 @@ <h2>{{ 'Requests.Season' | translate }} {{season.seasonNumber}}</h2>


<issue-report [movie]="false" [visible]="issuesBarVisible" [title]="issueRequest?.title"
[issueCategory]="issueCategorySelected" [id]="issueRequest?.id" (visibleChange)="issuesBarVisible = $event;"></issue-report>
[issueCategory]="issueCategorySelected" [id]="issueRequest?.id" [providerId]="issueProviderId" (visibleChange)="issuesBarVisible = $event;"></issue-report>
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export class TvRequestChildrenComponent {
this.issueRequest = req;
this.issueCategorySelected = catId;
this.issuesBarVisible = true;
this.issueProviderId = req.id.toString();
}

private removeRequestFromUi(key: IChildRequests) {
Expand Down
2 changes: 2 additions & 0 deletions src/Ombi/ClientApp/app/shared/issues-report.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export class IssuesReportComponent {
@Input() public issueCategory: IIssueCategory;
@Input() public movie: boolean;
@Input() public providerId: string;
@Input() public background: string;
@Input() public posterPath: string;

@Output() public visibleChange = new EventEmitter<boolean>();

Expand Down