Allow user to add a comment to a request for movies/tv shows then display this in requests table.

This commit is contained in:
Ryan Castles 2023-04-23 16:40:39 +10:00
commit 165920291f
22 changed files with 133 additions and 92 deletions

View file

@ -145,7 +145,8 @@ namespace Ombi.Core.Engine
QualityOverride = model.QualityPathOverride.GetValueOrDefault(),
RequestedDate4k = model.Is4kRequest ? DateTime.UtcNow : DateTime.MinValue,
Is4kRequest = model.Is4kRequest,
Source = model.Source
Source = model.Source,
Comment = model.Comment
};
}

View file

@ -35,5 +35,7 @@ namespace Ombi.Core.Models.Requests
public string RequestOnBehalf { get; set; }
public int? RootFolderOverride { get; set; }
public int? QualityPathOverride { get; set; }
public string Comment { get; set; }
}
}

View file

@ -23,6 +23,7 @@ namespace Ombi.Store.Entities.Requests
public OmbiUser RequestedUser { get; set; }
public RequestSource Source { get; set; } = RequestSource.Ombi;
public string Comment { get; set; }
[NotMapped]

View file

@ -27,5 +27,7 @@ namespace Ombi.Store.Entities.Requests
public int TotalSeasons { get; set; }
public List<ChildRequests> ChildRequests { get; set; }
public string Comment { get; set; }
}
}

View file

@ -126,7 +126,7 @@ export class DiscoverCardComponent implements OnInit {
return "";
}
public request(event: any, is4k: boolean) {
public request(event: any, is4k: boolean, comment: string) {
event.preventDefault();
this.loading = true;
switch (this.result.type) {
@ -146,6 +146,7 @@ export class DiscoverCardComponent implements OnInit {
qualityPathOverride: null,
rootFolderOverride: null,
is4KRequest: is4k,
comment: comment
};
if (!this.isAdmin) {
@ -157,7 +158,7 @@ export class DiscoverCardComponent implements OnInit {
AdminRequestDialogComponent,
{
width: "700px",
data: { type: RequestType.movie, id: this.result.id, is4k: is4k },
data: { type: RequestType.movie, id: this.result.id, is4k: is4k, comment: comment },
panelClass: "modal-panel",
}
);
@ -170,6 +171,8 @@ export class DiscoverCardComponent implements OnInit {
movieRequest.requestOnBehalf = result.username?.id;
movieRequest.qualityPathOverride = result.radarrPathId;
movieRequest.rootFolderOverride = result.radarrFolderId;
movieRequest.comment = result.comment;
this.requestMovie(movieRequest);
});
break;

View file

@ -212,4 +212,5 @@ export class BaseRequestOptions {
requestOnBehalf: string | undefined;
rootFolderOverride: number | undefined;
qualityPathOverride: number | undefined;
comment: string | undefined;
}

View file

@ -106,7 +106,7 @@ export class MovieDetailsComponent implements OnInit{
}
}
public async request(is4K: boolean, userId?: string) {
public async request(is4K: boolean, userId?: string, comment?: string) {
if (!this.is4KEnabled) {
is4K = false;
}
@ -119,7 +119,8 @@ export class MovieDetailsComponent implements OnInit{
qualityPathOverride: result.radarrPathId,
requestOnBehalf: result.username?.id,
rootFolderOverride: result.radarrFolderId,
is4KRequest: is4K }));
is4KRequest: is4K,
comment: result.comment }));
if (requestResult.result) {
if (is4K) {
this.movie.has4KRequest = true;
@ -135,7 +136,7 @@ export class MovieDetailsComponent implements OnInit{
}
});
} else {
const result = await firstValueFrom(this.requestService.requestMovie({ theMovieDbId: this.theMovidDbId, languageCode: this.translate.currentLang, requestOnBehalf: userId, qualityPathOverride: undefined, rootFolderOverride: undefined, is4KRequest: is4K }));
const result = await firstValueFrom(this.requestService.requestMovie({ theMovieDbId: this.theMovidDbId, languageCode: this.translate.currentLang, requestOnBehalf: userId, qualityPathOverride: undefined, rootFolderOverride: undefined, is4KRequest: is4K, comment: comment }));
if (result.result) {
if (is4K) {
this.movie.has4KRequest = true;

View file

@ -69,6 +69,7 @@ export class TvRequestGridComponent {
viewModel.qualityPathOverride = result?.sonarrPathId;
viewModel.rootFolderOverride = result?.sonarrFolderId;
viewModel.languageProfile = result?.sonarrLanguageId;
//viewModel.comment = result?.comment;
const requestResult = await this.requestServiceV2.requestTv(viewModel).toPromise();
this.postRequest(requestResult);

View file

@ -66,6 +66,11 @@
<td mat-cell id="status{{element.id}}" *matCellDef="let element"> {{element.status |translateStatus }} </td>
</ng-container>
<ng-container matColumnDef="comment">
<th mat-header-cell *matHeaderCellDef> {{'Requests.Comment' | translate}} </th>
<td mat-cell id="requestedBy{{element.id}}" *matCellDef="let element"> {{element.comment}} </td>
</ng-container>
<ng-container matColumnDef="has4kRequest">
<th mat-header-cell *matHeaderCellDef mat-sort-header disableClear> {{ 'Requests.Has4KRequest' | translate}} </th>
<td mat-cell id="has4kRequest{{element.id}}" *matCellDef="let element">

View file

@ -24,7 +24,7 @@ export class MoviesGridComponent implements OnInit, AfterViewInit {
public dataSource: MatTableDataSource<IMovieRequests>;
public resultsLength: number;
public isLoadingResults = true;
public displayedColumns: string[] = ['title', 'requestedUser.requestedBy', 'status', 'requestStatus','requestedDate', 'actions'];
public displayedColumns: string[] = ['title', 'requestedUser.requestedBy', 'status', 'requestStatus','requestedDate', 'comment', 'actions' ];
public gridCount: string = "15";
public isAdmin: boolean;
public is4kEnabled = false;

View file

@ -60,6 +60,11 @@
</td>
</ng-container>
<ng-container matColumnDef="comment">
<th mat-header-cell *matHeaderCellDef> {{'Requests.Comment' | translate}} </th>
<td mat-cell id="requestedBy{{element.id}}" *matCellDef="let element"> {{element.parentRequest.comment}} </td>
</ng-container>
<ng-container matColumnDef="actions">
<th mat-header-cell *matHeaderCellDef> </th>
<td mat-cell *matCellDef="let element">

View file

@ -19,7 +19,7 @@ export class TvGridComponent implements OnInit, AfterViewInit {
public dataSource: IChildRequests[] = [];
public resultsLength: number;
public isLoadingResults = true;
public displayedColumns: string[] = ['series', 'requestedBy', 'status', 'requestStatus', 'requestedDate','actions'];
public displayedColumns: string[] = ['series', 'requestedBy', 'status', 'requestStatus', 'requestedDate', 'comment','actions'];
public gridCount: string = "15";
public isAdmin: boolean;
public defaultSort: string = "requestedDate";

View file

@ -28,6 +28,10 @@
</mat-option>
</mat-autocomplete>
</mat-form-field>
<mat-form-field appearance="outline">
<mat-label>{{ 'MediaDetails.AddComment' | translate}}</mat-label>
<textarea matInput class="comment-box" formControlName="comment"></textarea>
</mat-form-field>
<!-- End User area -->

View file

@ -6,3 +6,7 @@
border-color: $ombi-background-primary;
color:white;
}
.comment-box {
resize: none;
}

View file

@ -20,6 +20,7 @@ export interface IAdminRequestDialogData {
type: RequestType;
id: number;
is4k: boolean | null;
comment: string | null;
}
@Component({
@ -59,6 +60,7 @@ export class AdminRequestDialogComponent implements OnInit {
public async ngOnInit() {
this.form = this.fb.group({
username: [null],
comment: [null],
sonarrPathId: [null],
sonarrFolderId: [null],
sonarrLanguageId: [null],

View file

@ -12,6 +12,7 @@ export interface EpisodeRequestData {
series: ISearchTvResultV2;
isAdmin: boolean;
requestOnBehalf: string | undefined;
comment: string | undefined;
}
@Component({
selector: "episode-request",
@ -69,6 +70,7 @@ export class EpisodeRequestComponent {
viewModel.qualityPathOverride = result?.sonarrPathId;
viewModel.rootFolderOverride = result?.sonarrFolderId;
viewModel.languageProfile = result?.sonarrLanguageId;
viewModel.comment = result?.comment;
const requestResult = await this.requestService.requestTv(viewModel).toPromise();
this.postRequest(requestResult);

View file

@ -378,6 +378,7 @@
"RadarrConfiguration": "Конфигурация на Radarr",
"RequestOnBehalf": "Заявете от името на",
"PleaseSelectUser": "Моля, изберете потребител",
"AddComment": "Добавить комментарий",
"StreamingOn": "Поточното изпълнение е включено:",
"RequestedBy": "Заявено от:",
"OnDate": "On:",

View file

@ -378,6 +378,7 @@
"RadarrConfiguration": "Radarr Configuration",
"RequestOnBehalf": "Request on behalf of",
"PleaseSelectUser": "Please select a user",
"AddComment": "Add a comment",
"StreamingOn": "Streamuje na:",
"RequestedBy": "Požadováno od:",
"OnDate": "On:",

View file

@ -165,6 +165,7 @@
"TheatricalReleaseSort": "Theatrical Release",
"DigitalRelease": "Digital Release: {{date}}",
"RequestDate": "Request Date",
"Comment": "Comment",
"QualityOverride": "Quality Override:",
"RootFolderOverride": "Root Folder Override:",
"ChangeRootFolder": "Root Folder",
@ -379,6 +380,7 @@
"RadarrConfiguration": "Radarr Configuration",
"RequestOnBehalf": "Request on behalf of",
"PleaseSelectUser": "Please select a user",
"AddComment": "Add a comment",
"StreamingOn": "Streaming On:",
"RequestedBy": "Requested By:",
"OnDate": "On:",

View file

@ -378,6 +378,7 @@
"RadarrConfiguration": "Radarr Configuration",
"RequestOnBehalf": "Request on behalf of",
"PleaseSelectUser": "Please select a user",
"AddComment": "Add a comment",
"StreamingOn": "Streaming On:",
"RequestedBy": "Etterspurt av:",
"OnDate": "On:",

View file

@ -378,6 +378,7 @@
"RadarrConfiguration": "Radarr Configuration",
"RequestOnBehalf": "Request on behalf of",
"PleaseSelectUser": "Please select a user",
"AddComment": "Add a comment",
"StreamingOn": "Streaming On:",
"RequestedBy": "Requested By:",
"OnDate": "On:",

View file

@ -378,6 +378,7 @@
"RadarrConfiguration": "Radarr Configuration",
"RequestOnBehalf": "Request on behalf of",
"PleaseSelectUser": "Please select a user",
"AddComment": "Add a comment",
"StreamingOn": "Streaming On:",
"RequestedBy": "Автор запроса:",
"OnDate": "On:",