mirror of https://github.com/Ombi-app/Ombi
parent
f777e5d171
commit
67c7d73ca1
@ -1,26 +1,27 @@
|
||||
<h1 mat-dialog-title>Issues for {{data.title}}</h1>
|
||||
<div mat-dialog-content>
|
||||
<div class="row">
|
||||
<div class="col-6 top-spacing" *ngFor="let issue of data.issues">
|
||||
<mat-card color="accent">
|
||||
<mat-card-header>
|
||||
<mat-card-title>{{issue.subject}}</mat-card-title>
|
||||
<mat-card-subtitle>{{issue.userReported?.userName}} on {{issue.createdDate | date:short}}</mat-card-subtitle>
|
||||
</mat-card-header>
|
||||
<mat-card-content>
|
||||
<p>
|
||||
{{issue.description}}
|
||||
</p>
|
||||
</mat-card-content>
|
||||
<mat-card-actions *ngIf="isAdmin && settings">
|
||||
<button mat-raised-button color="accent" *ngIf="issue.status === IssueStatus.Pending && settings.enableInProgress" >{{'Issues.MarkInProgress' | translate }}</button>
|
||||
<button mat-raised-button color="accent" *ngIf="issue.status === IssueStatus.Pending && !settings.enableInProgress || issue.status == IssueStatus.InProgress">{{'Issues.MarkResolved' | translate}}</button>
|
||||
</mat-card-actions>
|
||||
</mat-card>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div mat-dialog-actions>
|
||||
<button mat-raised-button color="warn" (click)="close()">Close</button>
|
||||
<button *ngIf="hasRequest" mat-raised-button color="accent" (click)="navToRequest()">View Media</button>
|
||||
</div>
|
||||
<mat-card class="issue-card" *ngIf="!deleted">
|
||||
<mat-card-header>
|
||||
<mat-card-title>{{issue.subject}}</mat-card-title>
|
||||
<mat-card-subtitle>{{issue.userReported?.userName}} on {{issue.createdDate | date:short}}</mat-card-subtitle>
|
||||
</mat-card-header>
|
||||
<mat-card-content>
|
||||
<p>
|
||||
{{issue.description}}
|
||||
</p>
|
||||
</mat-card-content>
|
||||
<mat-card-actions>
|
||||
<button mat-raised-button (click)="openChat(issue)" color="accent"><i class="far fa-comments"></i> {{'Issues.Chat' | translate }}</button>
|
||||
<div *ngIf="isAdmin && settings;then content else empty">here is ignored</div>
|
||||
<ng-template #content>
|
||||
<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)"><i class="far fa-times-circle"></i> {{'Issues.Delete' | translate}}</button></ng-template>
|
||||
<ng-template #empty></ng-template>
|
||||
</mat-card-actions>
|
||||
</mat-card>
|
||||
|
||||
|
@ -1,48 +1,55 @@
|
||||
import { Component, Inject, OnInit } from "@angular/core";
|
||||
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
import { AuthService } from "../../../auth/auth.service";
|
||||
import { Component, Input } from "@angular/core";
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { TranslateService } from "@ngx-translate/core";
|
||||
import { IIssues, IIssueSettings, IssueStatus } from "../../../interfaces";
|
||||
import { SettingsService } from "../../../services";
|
||||
|
||||
|
||||
export interface IssuesDetailsGroupData {
|
||||
issues: IIssues[];
|
||||
title: string;
|
||||
}
|
||||
import { IssuesService, NotificationService } from "../../../services";
|
||||
import { IssueChatComponent } from "../issue-chat/issue-chat.component";
|
||||
|
||||
@Component({
|
||||
selector: "issues-details-group",
|
||||
templateUrl: "details-group.component.html",
|
||||
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 settings: IIssueSettings;
|
||||
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>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: IssuesDetailsGroupData,
|
||||
private authService: AuthService, private settingsService: SettingsService) { }
|
||||
constructor(
|
||||
private translateService: TranslateService, private issuesService: IssuesService,
|
||||
private notificationService: NotificationService, private dialog: MatDialog) { }
|
||||
|
||||
public ngOnInit() {
|
||||
this.isAdmin = this.authService.hasRole("Admin") || this.authService.hasRole("PowerUser");
|
||||
this.settingsService.getIssueSettings().subscribe(x => this.settings = x);
|
||||
public async delete(issue: IIssues) {
|
||||
await this.issuesService.deleteIssue(issue.id);
|
||||
this.notificationService.success(this.translateService.instant("Issues.DeletedIssue"));
|
||||
this.deleted = true;
|
||||
}
|
||||
|
||||
public close() {
|
||||
this.dialogRef.close();
|
||||
}
|
||||
|
||||
public navToRequest() {
|
||||
var issue = this.data.issues.filter(x => {
|
||||
return x.requestId;
|
||||
})[0];
|
||||
public openChat(issue: IIssues) {
|
||||
this.dialog.open(IssueChatComponent, { width: "100vh", data: { issueId: issue.id }, panelClass: 'modal-panel' })
|
||||
}
|
||||
|
||||
// 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>
|
||||
<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="col-6 top-spacing" *ngFor="let issue of details.issues">
|
||||
<div color="accent">
|
||||
<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>
|
||||
<issues-details-group [issue]="issue" [settings]="settings" [isAdmin]="isAdmin"></issues-details-group>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<button mat-raised-button color="accent" (click)="navToMedia()">{{'Common.ViewDetails' | translate }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in new issue