mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 04:49:33 -07:00
Added some feedback on the request buttons for movies #1536
This commit is contained in:
parent
462bbcc4a6
commit
e1ea188109
4 changed files with 39 additions and 14 deletions
|
@ -22,4 +22,8 @@
|
||||||
available: boolean;
|
available: boolean;
|
||||||
plexUrl: string;
|
plexUrl: string;
|
||||||
quality: string;
|
quality: string;
|
||||||
|
|
||||||
|
// for the UI
|
||||||
|
requestProcessing: boolean;
|
||||||
|
processed: boolean;
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,9 @@
|
||||||
<button style="text-align: right" class="btn btn-primary-outline disabled" [disabled]><i class="fa fa-check"></i> Requested</button>
|
<button style="text-align: right" class="btn btn-primary-outline disabled" [disabled]><i class="fa fa-check"></i> Requested</button>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
<ng-template #notRequestedBtn>
|
<ng-template #notRequestedBtn>
|
||||||
<button id="{{result.id}}" style="text-align: right" class="btn btn-primary-outline" (click)="request(result)"><i class="fa fa-plus"></i> Request</button>
|
<button id="{{result.id}}" style="text-align: right" class="btn btn-primary-outline" (click)="request(result)">
|
||||||
|
<i *ngIf="result.requestProcessing" class="fa fa-circle-o-notch fa-spin fa-fw"></i> <i *ngIf="!result.requestProcessing && !result.processed" class="fa fa-plus"></i>
|
||||||
|
<i *ngIf="result.processed && !result.requestProcessing" class="fa fa-check"></i>Request</button>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -60,23 +60,38 @@ export class MovieSearchComponent implements OnInit {
|
||||||
|
|
||||||
public request(searchResult: ISearchMovieResult) {
|
public request(searchResult: ISearchMovieResult) {
|
||||||
searchResult.requested = true;
|
searchResult.requested = true;
|
||||||
|
searchResult.requestProcessing = true;
|
||||||
if (this.authService.hasRole("admin") || this.authService.hasRole("AutoApproveMovie")) {
|
if (this.authService.hasRole("admin") || this.authService.hasRole("AutoApproveMovie")) {
|
||||||
searchResult.approved = true;
|
searchResult.approved = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.requestService.requestMovie(searchResult)
|
try {
|
||||||
.subscribe(x => {
|
this.requestService.requestMovie(searchResult)
|
||||||
this.result = x;
|
.subscribe(x => {
|
||||||
|
this.result = x;
|
||||||
|
|
||||||
if (this.result.requestAdded) {
|
if (this.result.requestAdded) {
|
||||||
this.notificationService.success("Request Added",
|
this.notificationService.success("Request Added",
|
||||||
`Request for ${searchResult.title} has been added successfully`);
|
`Request for ${searchResult.title} has been added successfully`);
|
||||||
} else {
|
searchResult.processed = true;
|
||||||
this.notificationService.warning("Request Added", this.result.message ? this.result.message : this.result.errorMessage);
|
} else {
|
||||||
searchResult.requested = false;
|
if (this.result.errorMessage && this.result.message) {
|
||||||
searchResult.approved = false;
|
this.notificationService.warning("Request Added", `${this.result.message} - ${this.result.errorMessage}`);
|
||||||
}
|
} else {
|
||||||
});
|
this.notificationService.warning("Request Added", this.result.message ? this.result.message : this.result.errorMessage);
|
||||||
|
}
|
||||||
|
searchResult.requested = false;
|
||||||
|
searchResult.approved = false;
|
||||||
|
searchResult.processed = false;
|
||||||
|
searchResult.requestProcessing = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
|
||||||
|
searchResult.processed = false;
|
||||||
|
searchResult.requestProcessing = false;
|
||||||
|
this.notificationService.error("Something went wrong", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public popularMovies() {
|
public popularMovies() {
|
||||||
|
|
|
@ -158,7 +158,11 @@ export class TvSearchComponent implements OnInit, OnDestroy {
|
||||||
this.notificationService.success("Request Added",
|
this.notificationService.success("Request Added",
|
||||||
`Request for ${searchResult.title} has been added successfully`);
|
`Request for ${searchResult.title} has been added successfully`);
|
||||||
} else {
|
} else {
|
||||||
this.notificationService.warning("Request Added", this.result.message ? this.result.message : this.result.errorMessage);
|
if (this.result.errorMessage && this.result.message) {
|
||||||
|
this.notificationService.warning("Request Added", `${this.result.message} - ${this.result.errorMessage}`);
|
||||||
|
} else {
|
||||||
|
this.notificationService.warning("Request Added", this.result.message ? this.result.message : this.result.errorMessage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue