think i've finished the new issues work

pull/4083/head
tidusjar 4 years ago
parent f777e5d171
commit 67c7d73ca1

@ -32,7 +32,7 @@ namespace Ombi.Core.Engine.V2
public async Task<IEnumerable<IssuesSummaryModel>> GetIssues(int position, int take, IssueStatus status, CancellationToken token) public async Task<IEnumerable<IssuesSummaryModel>> GetIssues(int position, int take, IssueStatus status, CancellationToken token)
{ {
var issues = await _issues.GetAll().Where(x => x.Status == status).Skip(position).Take(take).OrderBy(x => x.Title).ToListAsync(token); var issues = await _issues.GetAll().Where(x => x.Status == status && x.ProviderId != null).Skip(position).Take(take).OrderBy(x => x.Title).ToListAsync(token);
var grouped = issues.GroupBy(x => x.Title, (key, g) => new { Title = key, Issues = g }); var grouped = issues.GroupBy(x => x.Title, (key, g) => new { Title = key, Issues = g });
var model = new List<IssuesSummaryModel>(); var model = new List<IssuesSummaryModel>();

@ -1,26 +1,27 @@
<h1 mat-dialog-title>Issues for {{data.title}}</h1> <mat-card class="issue-card" *ngIf="!deleted">
<div mat-dialog-content> <mat-card-header>
<div class="row"> <mat-card-title>{{issue.subject}}</mat-card-title>
<div class="col-6 top-spacing" *ngFor="let issue of data.issues"> <mat-card-subtitle>{{issue.userReported?.userName}} on {{issue.createdDate | date:short}}</mat-card-subtitle>
<mat-card color="accent"> </mat-card-header>
<mat-card-header> <mat-card-content>
<mat-card-title>{{issue.subject}}</mat-card-title> <p>
<mat-card-subtitle>{{issue.userReported?.userName}} on {{issue.createdDate | date:short}}</mat-card-subtitle> {{issue.description}}
</mat-card-header> </p>
<mat-card-content> </mat-card-content>
<p> <mat-card-actions>
{{issue.description}} <button mat-raised-button (click)="openChat(issue)" color="accent"><i class="far fa-comments"></i> {{'Issues.Chat' | translate }}</button>
</p> <div *ngIf="isAdmin && settings;then content else empty">here is ignored</div>
</mat-card-content> <ng-template #content>
<mat-card-actions *ngIf="isAdmin && settings"> <button mat-raised-button color="accent"
<button mat-raised-button color="accent" *ngIf="issue.status === IssueStatus.Pending && settings.enableInProgress" >{{'Issues.MarkInProgress' | translate }}</button> *ngIf="issue.status === IssueStatus.Pending && settings.enableInProgress"
<button mat-raised-button color="accent" *ngIf="issue.status === IssueStatus.Pending && !settings.enableInProgress || issue.status == IssueStatus.InProgress">{{'Issues.MarkResolved' | translate}}</button> (click)="inProgress(issue)">{{'Issues.MarkInProgress' | translate }}</button>
</mat-card-actions>
</mat-card> <button mat-raised-button color="accent"
</div> *ngIf="issue.status === IssueStatus.Pending && !settings.enableInProgress || issue.status == IssueStatus.InProgress"
</div> (click)="resolve(issue)">{{'Issues.MarkResolved' | translate}}</button>
</div>
<div mat-dialog-actions> <button mat-raised-button color="warn" (click)="delete(issue)"><i class="far fa-times-circle"></i> {{'Issues.Delete' | translate}}</button></ng-template>
<button mat-raised-button color="warn" (click)="close()">Close</button> <ng-template #empty></ng-template>
<button *ngIf="hasRequest" mat-raised-button color="accent" (click)="navToRequest()">View Media</button> </mat-card-actions>
</div> </mat-card>

@ -1,7 +1,7 @@
@import "~styles/variables.scss"; @import "~styles/variables.scss";
::ng-deep .mat-card { ::ng-deep .issue-card {
background: $ombi-background-primary-accent; border: 3px solid $ombi-background-primary-accent;
} }
.top-spacing { .top-spacing {

@ -1,48 +1,55 @@
import { Component, Inject, OnInit } from "@angular/core"; import { Component, Input } from "@angular/core";
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { MatDialog } from '@angular/material/dialog';
import { AuthService } from "../../../auth/auth.service"; import { TranslateService } from "@ngx-translate/core";
import { IIssues, IIssueSettings, IssueStatus } from "../../../interfaces"; import { IIssues, IIssueSettings, IssueStatus } from "../../../interfaces";
import { SettingsService } from "../../../services"; import { IssuesService, NotificationService } from "../../../services";
import { IssueChatComponent } from "../issue-chat/issue-chat.component";
export interface IssuesDetailsGroupData {
issues: IIssues[];
title: string;
}
@Component({ @Component({
selector: "issues-details-group", selector: "issues-details-group",
templateUrl: "details-group.component.html", templateUrl: "details-group.component.html",
styleUrls: ["details-group.component.scss"], styleUrls: ["details-group.component.scss"],
}) })
export class DetailsGroupComponent implements OnInit { export class DetailsGroupComponent {
public isAdmin: boolean; @Input() public issue: IIssues;
@Input() public isAdmin: boolean;
@Input() public settings: IIssueSettings;
public deleted: boolean;
public IssueStatus = IssueStatus; public IssueStatus = IssueStatus;
public settings: IIssueSettings;
public get hasRequest(): boolean { public get hasRequest(): boolean {
return this.data.issues.some(x => x.requestId); if (this.issue.requestId) {
return true;
}
return false;
} }
constructor(public dialogRef: MatDialogRef<DetailsGroupComponent>, constructor(
@Inject(MAT_DIALOG_DATA) public data: IssuesDetailsGroupData, private translateService: TranslateService, private issuesService: IssuesService,
private authService: AuthService, private settingsService: SettingsService) { } private notificationService: NotificationService, private dialog: MatDialog) { }
public ngOnInit() { public async delete(issue: IIssues) {
this.isAdmin = this.authService.hasRole("Admin") || this.authService.hasRole("PowerUser"); await this.issuesService.deleteIssue(issue.id);
this.settingsService.getIssueSettings().subscribe(x => this.settings = x); this.notificationService.success(this.translateService.instant("Issues.DeletedIssue"));
this.deleted = true;
} }
public close() { public openChat(issue: IIssues) {
this.dialogRef.close(); this.dialog.open(IssueChatComponent, { width: "100vh", data: { issueId: issue.id }, panelClass: 'modal-panel' })
} }
public navToRequest() {
var issue = this.data.issues.filter(x => {
return x.requestId;
})[0];
// close dialog and tell calling component to navigate public resolve(issue: IIssues) {
} this.issuesService.updateStatus({issueId: issue.id, status: IssueStatus.Resolved}).subscribe(() => {
this.notificationService.success(this.translateService.instant("Issues.MarkedAsResolved"));
issue.status = IssueStatus.Resolved;
});
}
public inProgress(issue: IIssues) {
this.issuesService.updateStatus({issueId: issue.id, status: IssueStatus.InProgress}).subscribe(() => {
this.notificationService.success(this.translateService.instant("Issues.MarkedAsInProgress"));
issue.status = IssueStatus.InProgress;
});
}
} }

@ -1,39 +1,20 @@
<div *ngIf="details"> <div class="container top-spacing" *ngIf="details">
<h1>Issues for {{details.title}}</h1> <h1>Issues for {{details.title}}</h1>
<div> <div>
<span>Has Request {{hasRequest}}</span> <span>{{'Issues.Requested' | translate}}
<i *ngIf="!hasRequest" class="far fa-times-circle"></i>
<i *ngIf="hasRequest" class="far fa-check-circle"></i>
</span>
<div>
<button mat-raised-button color="accent" (click)="navToMedia()"><i class="far fa-eye"></i> {{'Common.ViewDetails' | translate }}</button>
</div>
<div class="row"> <div class="row">
<div class="col-6 top-spacing" *ngFor="let issue of details.issues"> <div class="col-6 top-spacing" *ngFor="let issue of details.issues">
<div color="accent"> <issues-details-group [issue]="issue" [settings]="settings" [isAdmin]="isAdmin"></issues-details-group>
<div>
<div>{{issue.subject}}</div>
<span>{{issue.userReported?.userName}} on {{issue.createdDate | date:short}}</span>
</div>
<div>
<p>
{{issue.description}}
</p>
</div>
<div>
<button mat-raised-button (click)="openChat(issue)" color="accent">{{'Issues.Chat' | translate }}</button>
<span *ngIf="isAdmin && settings">
<button mat-raised-button color="accent"
*ngIf="issue.status === IssueStatus.Pending && settings.enableInProgress"
(click)="inProgress(issue)">{{'Issues.MarkInProgress' | translate }}</button>
<button mat-raised-button color="accent"
*ngIf="issue.status === IssueStatus.Pending && !settings.enableInProgress || issue.status == IssueStatus.InProgress"
(click)="resolve(issue)">{{'Issues.MarkResolved' | translate}}</button>
<button mat-raised-button color="warn" (click)="delete(issue)">{{'Issues.Delete' | translate}}</button>
</span>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<button mat-raised-button color="accent" (click)="navToMedia()">{{'Common.ViewDetails' | translate }}</button>
</div> </div>
</div> </div>

@ -70,7 +70,7 @@ export class IssuesDetailsComponent implements OnInit {
} }
public openChat(issue: IIssues) { public openChat(issue: IIssues) {
this.dialog.open(IssueChatComponent, { width: "80vh", data: { issueId: issue.id }, panelClass: 'modal-panel' }) this.dialog.open(IssueChatComponent, { width: "100vh", data: { issueId: issue.id }, panelClass: 'modal-panel' })
} }
public navToMedia() { public navToMedia() {

@ -1,6 +1,5 @@
import { IssuesV2Service } from "../../services/issuesv2.service"; import { IssuesV2Service } from "../../services/issuesv2.service";
import { IdentityService, SearchService } from "../../services"; import { IdentityService, SearchService } from "../../services";
import { DetailsGroupComponent } from "./details-group/details-group.component";
import { IssuesDetailsComponent } from "./details/details.component"; import { IssuesDetailsComponent } from "./details/details.component";
import { IssueChatComponent } from "./issue-chat/issue-chat.component"; import { IssueChatComponent } from "./issue-chat/issue-chat.component";
import { ChatBoxComponent } from "../../shared/chat-box/chat-box.component"; import { ChatBoxComponent } from "../../shared/chat-box/chat-box.component";
@ -8,7 +7,6 @@ import { ChatBoxComponent } from "../../shared/chat-box/chat-box.component";
export const components: any[] = [ export const components: any[] = [
DetailsGroupComponent,
IssuesDetailsComponent, IssuesDetailsComponent,
IssueChatComponent, IssueChatComponent,
ChatBoxComponent, ChatBoxComponent,

@ -20,7 +20,7 @@ export interface ChatData {
export class IssueChatComponent implements OnInit { export class IssueChatComponent implements OnInit {
public isAdmin: boolean; public isAdmin: boolean;
public comments: IIssuesChat[]; public comments: IIssuesChat[] = [];
public IssueStatus = IssueStatus; public IssueStatus = IssueStatus;
public settings: IIssueSettings; public settings: IIssueSettings;
public messages: ChatMessages[] = []; public messages: ChatMessages[] = [];

@ -20,6 +20,7 @@ import { IssuesPanelComponent } from "./shared/issues-panel/issues-panel.compone
import { TvAdvancedOptionsComponent } from "./tv/panels/tv-advanced-options/tv-advanced-options.component"; import { TvAdvancedOptionsComponent } from "./tv/panels/tv-advanced-options/tv-advanced-options.component";
import { RequestBehalfComponent } from "./shared/request-behalf/request-behalf.component"; import { RequestBehalfComponent } from "./shared/request-behalf/request-behalf.component";
import { TvRequestGridComponent } from "./tv/panels/tv-request-grid/tv-request-grid.component"; import { TvRequestGridComponent } from "./tv/panels/tv-request-grid/tv-request-grid.component";
import { DetailsGroupComponent } from "../../issues/components/details-group/details-group.component";
export const components: any[] = [ export const components: any[] = [
MovieDetailsComponent, MovieDetailsComponent,

@ -13,6 +13,11 @@
<!-- content start --> <!-- content start -->
<mat-accordion class="mat-elevation-z8"> <mat-accordion class="mat-elevation-z8">
<div *ngFor="let issue of issues">
<issues-details-group [issue]="issue" [settings]="settings" [isAdmin]="isAdmin"></issues-details-group>
</div>
<!--
<mat-expansion-panel *ngFor="let issue of issues"> <mat-expansion-panel *ngFor="let issue of issues">
<mat-expansion-panel-header> <mat-expansion-panel-header>
<mat-panel-title> <mat-panel-title>
@ -54,7 +59,7 @@
<button mat-raised-button color="warn" (click)="delete(issue)"> {{ 'Issues.Delete' | translate }}</button> <button mat-raised-button color="warn" (click)="delete(issue)"> {{ 'Issues.Delete' | translate }}</button>
</div> </div>
</div> </div>
</mat-expansion-panel> </mat-expansion-panel> -->
</mat-accordion> </mat-accordion>
<!-- content end --> <!-- content end -->

@ -1,4 +1,4 @@
<div class='container' *ngIf="messages.length > 0"> <div class='container'>
<div class='chatbox'> <div class='chatbox'>
<div class='chatbox__user-list'> <div class='chatbox__user-list'>
<h1>Users</h1> <h1>Users</h1>

@ -49,6 +49,7 @@ html,body {
align-items: center; align-items: center;
flex-direction: column; flex-direction: column;
height: 70vh; height: 70vh;
width: 100%;
h1 { h1 {
margin: 0.5em auto; margin: 0.5em auto;
color: #FFF; color: #FFF;
@ -58,8 +59,8 @@ html,body {
.chatbox { .chatbox {
background: rgba(255, 255, 255, 0.05); background: rgba(255, 255, 255, 0.05);
width: 600px; width: 85%;
height: 75%; height: 100%;
border-radius: 0.2em; border-radius: 0.2em;
position: relative; position: relative;
box-shadow: 1px 1px 12px rgba(0, 0, 0, 0.1); box-shadow: 1px 1px 12px rgba(0, 0, 0, 0.1);

@ -36,11 +36,13 @@ import { MatProgressSpinnerModule } from "@angular/material/progress-spinner";
import { MatSlideToggleModule } from "@angular/material/slide-toggle"; import { MatSlideToggleModule } from "@angular/material/slide-toggle";
import { MatTabsModule } from "@angular/material/tabs"; import { MatTabsModule } from "@angular/material/tabs";
import { EpisodeRequestComponent } from "./episode-request/episode-request.component"; import { EpisodeRequestComponent } from "./episode-request/episode-request.component";
import { DetailsGroupComponent } from "../issues/components/details-group/details-group.component";
@NgModule({ @NgModule({
declarations: [ declarations: [
IssuesReportComponent, IssuesReportComponent,
EpisodeRequestComponent, EpisodeRequestComponent,
DetailsGroupComponent,
], ],
imports: [ imports: [
SidebarModule, SidebarModule,
@ -76,6 +78,7 @@ import { EpisodeRequestComponent } from "./episode-request/episode-request.compo
], ],
entryComponents: [ entryComponents: [
EpisodeRequestComponent, EpisodeRequestComponent,
DetailsGroupComponent,
], ],
exports: [ exports: [
TranslateModule, TranslateModule,
@ -86,6 +89,7 @@ import { EpisodeRequestComponent } from "./episode-request/episode-request.compo
MatProgressSpinnerModule, MatProgressSpinnerModule,
IssuesReportComponent, IssuesReportComponent,
EpisodeRequestComponent, EpisodeRequestComponent,
DetailsGroupComponent,
TruncateModule, TruncateModule,
InputSwitchModule, InputSwitchModule,
MatTreeModule, MatTreeModule,

@ -216,7 +216,9 @@
"MarkedAsResolved": "This issue has now been marked as resolved!", "MarkedAsResolved": "This issue has now been marked as resolved!",
"MarkedAsInProgress": "This issue has now been marked as in progress!", "MarkedAsInProgress": "This issue has now been marked as in progress!",
"Delete": "Delete issue", "Delete": "Delete issue",
"DeletedIssue": "Issue has been deleted" "DeletedIssue": "Issue has been deleted",
"Chat":"Chat",
"Requested":"Requested"
}, },
"Filter": { "Filter": {
"ClearFilter": "Clear Filter", "ClearFilter": "Clear Filter",

Loading…
Cancel
Save