mirror of https://github.com/Ombi-app/Ombi
parent
c787e58f3b
commit
cdfe91e3a4
@ -0,0 +1,63 @@
|
||||
<mat-accordion *ngIf="issuesCount > 0">
|
||||
<mat-expansion-panel>
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>
|
||||
{{'Issues.Title' | translate}}
|
||||
</mat-panel-title>
|
||||
<mat-panel-description>
|
||||
<span *ngIf="isOutstanding">{{issuesCount}} </span><span><mat-icon *ngIf="isOutstanding" matTooltip="{{'Issues.Outstanding' | translate}}">error_outline</mat-icon></span>
|
||||
<span *ngIf="!isOutstanding">{{issuesCount}}</span>
|
||||
</mat-panel-description>
|
||||
</mat-expansion-panel-header>
|
||||
|
||||
<!-- content start -->
|
||||
|
||||
<mat-accordion class="mat-elevation-z8">
|
||||
<mat-expansion-panel *ngFor="let issue of issues">
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>
|
||||
{{ 'Issues.Subject' | translate}}: {{issue.subject}}
|
||||
</mat-panel-title>
|
||||
<mat-panel-description>
|
||||
{{ 'Issues.ReportedBy' | translate}}: {{issue.userReported.userAlias}}
|
||||
</mat-panel-description>
|
||||
<mat-panel-description>
|
||||
{{'Issues.Category' | translate}}: {{issue.issueCategory.value}}
|
||||
</mat-panel-description>
|
||||
</mat-expansion-panel-header>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col">
|
||||
{{'Issues.Description' | translate}}: {{issue.description}}
|
||||
</div>
|
||||
<div class="col">
|
||||
{{'Issues.Status' | translate}}: {{IssueStatus[issue.status] | humanize}}
|
||||
</div>
|
||||
<div class="col" *ngIf="issue.resolvedDate">
|
||||
{{'Issues.ResolvedDate' | translate}}: {{issue.resolvedDate}}
|
||||
</div>
|
||||
<div class="col" *ngIf="issue.createdDate">
|
||||
{{'Issues.CreatedDate' | translate}}: {{issue.createdDate}}
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div *ngIf="isAdmin" class="row action-buttons">
|
||||
<div class="button-padding">
|
||||
<button *ngIf="issue.status === IssueStatus.Pending && !settings.enableInProgress || issue.status == IssueStatus.InProgress" mat-raised-button color="accent" (click)="resolve(issue)"> {{ 'Issues.MarkResolved' | translate }}</button>
|
||||
</div>
|
||||
<div class="button-padding">
|
||||
<button *ngIf="issue.status === IssueStatus.Pending && settings.enableInProgress" mat-raised-button color="accent" (click)="inProgress(issue)"> {{ 'Issues.MarkInProgress' | translate }}</button>
|
||||
</div>
|
||||
<div class="button-padding">
|
||||
<button mat-raised-button color="warn" (click)="delete(issue)"> {{ 'Issues.Delete' | translate }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</mat-expansion-panel>
|
||||
</mat-accordion>
|
||||
|
||||
<!-- content end -->
|
||||
</mat-expansion-panel>
|
||||
|
||||
</mat-accordion>
|
@ -0,0 +1,7 @@
|
||||
.action-buttons {
|
||||
padding-top: 1%;
|
||||
}
|
||||
|
||||
.button-padding {
|
||||
padding: 1%;
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
import { Component, Input, OnInit } from "@angular/core";
|
||||
import { IssuesService, NotificationService, SettingsService } from "../../../../services";
|
||||
import { RequestType, IIssues, IssueStatus, IIssueSettings } from "../../../../interfaces";
|
||||
import { TranslateService } from "@ngx-translate/core";
|
||||
|
||||
@Component({
|
||||
selector: "issues-panel",
|
||||
templateUrl: "./issues-panel.component.html",
|
||||
styleUrls: ["./issues-panel.component.scss"]
|
||||
})
|
||||
export class IssuesPanelComponent implements OnInit {
|
||||
|
||||
@Input() public requestId: number;
|
||||
@Input() public isAdmin: boolean;
|
||||
|
||||
public issuesCount: number;
|
||||
public issues: IIssues[];
|
||||
public IssueStatus = IssueStatus;
|
||||
public isOutstanding: boolean;
|
||||
public loadingFlag: boolean;
|
||||
public settings: IIssueSettings;
|
||||
|
||||
constructor(private issuesService: IssuesService, private notificationService: NotificationService,
|
||||
private translateService: TranslateService, private settingsService: SettingsService) {
|
||||
|
||||
}
|
||||
|
||||
public async ngOnInit() {
|
||||
this.issues = await this.issuesService.getIssuesByRequestId(this.requestId);
|
||||
this.issuesCount = this.issues.length;
|
||||
this.calculateOutstanding();
|
||||
this.settings = await this.settingsService.getIssueSettings().toPromise();
|
||||
}
|
||||
|
||||
public resolve(issue: IIssues) {
|
||||
this.issuesService.updateStatus({issueId: issue.id, status: IssueStatus.Resolved}).subscribe(x => {
|
||||
this.notificationService.success(this.translateService.instant("Issues.MarkedAsResolved"));
|
||||
issue.status = IssueStatus.Resolved;
|
||||
this.calculateOutstanding();
|
||||
});
|
||||
}
|
||||
|
||||
public inProgress(issue: IIssues) {
|
||||
this.issuesService.updateStatus({issueId: issue.id, status: IssueStatus.InProgress}).subscribe(x => {
|
||||
this.notificationService.success(this.translateService.instant("Issues.MarkedAsInProgress"));
|
||||
issue.status = IssueStatus.InProgress;
|
||||
});
|
||||
}
|
||||
|
||||
public async delete(issue: IIssues) {
|
||||
await this.issuesService.deleteIssue(issue.id);
|
||||
this.notificationService.success(this.translateService.instant("Issues.DeletedIssue"));
|
||||
this.issues = this.issues.filter((el) => { return el.id !== issue.id; });
|
||||
this.issuesCount = this.issues.length;
|
||||
this.calculateOutstanding();
|
||||
}
|
||||
|
||||
private calculateOutstanding() {
|
||||
this.isOutstanding = this.issues.some((i) => {
|
||||
return i.status !== IssueStatus.Resolved;
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Reference in new issue