mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-11 07:46:05 -07:00
Added the functionality for the admin to clear the issues.
This commit is contained in:
parent
0556e4d32b
commit
9ef618af4b
5 changed files with 77 additions and 18 deletions
|
@ -33,10 +33,11 @@ namespace PlexRequests.Store
|
||||||
|
|
||||||
public enum IssueState
|
public enum IssueState
|
||||||
{
|
{
|
||||||
WrongAudio,
|
None = 99,
|
||||||
NoSubtitles,
|
WrongAudio = 0,
|
||||||
WrongContent,
|
NoSubtitles = 1,
|
||||||
PlaybackIssues,
|
WrongContent = 2,
|
||||||
Other
|
PlaybackIssues = 3,
|
||||||
|
Other = 4 // Provide a message
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ $('#approveAll').click(function () {
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (response) {
|
success: function (response) {
|
||||||
if (checkJsonResponse(response)) {
|
if (checkJsonResponse(response)) {
|
||||||
generateNotify("Success!", "success");
|
generateNotify("Success! All requests approved!", "success");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function (e) {
|
error: function (e) {
|
||||||
|
@ -52,7 +52,7 @@ $(document).on("click", ".dropdownIssue", function (e) {
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (response) {
|
success: function (response) {
|
||||||
if (checkJsonResponse(response)) {
|
if (checkJsonResponse(response)) {
|
||||||
generateNotify("Success!", "success");
|
generateNotify("Success! Added Issue.", "success");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function (e) {
|
error: function (e) {
|
||||||
|
@ -66,7 +66,7 @@ $(document).on("click", ".dropdownIssue", function (e) {
|
||||||
$(".theSaveButton").click(function (e) {
|
$(".theSaveButton").click(function (e) {
|
||||||
var comment = $("#commentArea").val();
|
var comment = $("#commentArea").val();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var id = e.target.value;
|
|
||||||
var $form = $("#commentForm");
|
var $form = $("#commentForm");
|
||||||
var data = $form.serialize();
|
var data = $form.serialize();
|
||||||
data = data + "&issue=" + 4 + "&comment=" + comment;
|
data = data + "&issue=" + 4 + "&comment=" + comment;
|
||||||
|
@ -78,7 +78,7 @@ $(".theSaveButton").click(function (e) {
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (response) {
|
success: function (response) {
|
||||||
if (checkJsonResponse(response)) {
|
if (checkJsonResponse(response)) {
|
||||||
generateNotify("Success!", "success");
|
generateNotify("Success! Added Issue.", "success");
|
||||||
$("#myModal").modal("hide");
|
$("#myModal").modal("hide");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -100,6 +100,7 @@ $('#myModal').on('show.bs.modal', function (event) {
|
||||||
requestField.val(id); // Add ID to the hidden field
|
requestField.val(id); // Add ID to the hidden field
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Delete
|
||||||
$(document).on("click", ".delete", function (e) {
|
$(document).on("click", ".delete", function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var buttonId = e.target.id;
|
var buttonId = e.target.id;
|
||||||
|
@ -113,7 +114,7 @@ $(document).on("click", ".delete", function (e) {
|
||||||
success: function (response) {
|
success: function (response) {
|
||||||
|
|
||||||
if (checkJsonResponse(response)) {
|
if (checkJsonResponse(response)) {
|
||||||
generateNotify("Success!", "success");
|
generateNotify("Success! Request Deleted.", "success");
|
||||||
|
|
||||||
$("#" + buttonId + "Template").slideUp();
|
$("#" + buttonId + "Template").slideUp();
|
||||||
}
|
}
|
||||||
|
@ -126,6 +127,32 @@ $(document).on("click", ".delete", function (e) {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Clear issues
|
||||||
|
$(document).on("click", ".clear", function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
var buttonId = e.target.id;
|
||||||
|
var $form = $('#clear' + buttonId);
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: $form.prop('method'),
|
||||||
|
url: $form.prop('action'),
|
||||||
|
data: $form.serialize(),
|
||||||
|
dataType: "json",
|
||||||
|
success: function (response) {
|
||||||
|
|
||||||
|
if (checkJsonResponse(response)) {
|
||||||
|
generateNotify("Success! Issues Cleared.", "info");
|
||||||
|
$('#issueArea').html("<p>Issue: None</p>");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function (e) {
|
||||||
|
console.log(e);
|
||||||
|
generateNotify("Something went wrong!", "danger");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
function movieLoad() {
|
function movieLoad() {
|
||||||
$("#movieList").html("");
|
$("#movieList").html("");
|
||||||
|
|
|
@ -59,6 +59,8 @@ namespace PlexRequests.UI.Modules
|
||||||
Post["/reportissue"] = _ => ReportIssue((int)Request.Form.requestId, (IssueState)(int)Request.Form.issue, null);
|
Post["/reportissue"] = _ => ReportIssue((int)Request.Form.requestId, (IssueState)(int)Request.Form.issue, null);
|
||||||
Post["/reportissuecomment"] = _ => ReportIssue((int)Request.Form.requestId, IssueState.Other, (string)Request.Form.commentArea);
|
Post["/reportissuecomment"] = _ => ReportIssue((int)Request.Form.requestId, IssueState.Other, (string)Request.Form.commentArea);
|
||||||
|
|
||||||
|
Post["/clearissues"] = _ => ClearIssue((int)Request.Form.requestId);
|
||||||
|
|
||||||
}
|
}
|
||||||
private IRepository<RequestedModel> Service { get; }
|
private IRepository<RequestedModel> Service { get; }
|
||||||
private ISettingsService<PlexRequestSettings> PrSettings { get; }
|
private ISettingsService<PlexRequestSettings> PrSettings { get; }
|
||||||
|
@ -163,5 +165,26 @@ namespace PlexRequests.UI.Modules
|
||||||
}
|
}
|
||||||
return Response.AsJson(new JsonResponseModel { Result = false, Message = "Could not add issue, please try again or contact the administrator!" });
|
return Response.AsJson(new JsonResponseModel { Result = false, Message = "Could not add issue, please try again or contact the administrator!" });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Response ClearIssue(int requestId)
|
||||||
|
{
|
||||||
|
if (!Context.CurrentUser.IsAuthenticated())
|
||||||
|
{
|
||||||
|
return Response.AsJson(new JsonResponseModel { Result = false, Message = "You are not an Admin, so you cannot clear any issues." });
|
||||||
|
}
|
||||||
|
|
||||||
|
var originalRequest = Service.Get(requestId);
|
||||||
|
if (originalRequest == null)
|
||||||
|
{
|
||||||
|
return Response.AsJson(new JsonResponseModel { Result = false, Message = "Request does not exist to clear it!" });
|
||||||
|
}
|
||||||
|
originalRequest.Issues = IssueState.None;
|
||||||
|
originalRequest.OtherMessage = string.Empty;
|
||||||
|
|
||||||
|
var result = Service.Update(originalRequest);
|
||||||
|
return Response.AsJson(result
|
||||||
|
? new JsonResponseModel { Result = true }
|
||||||
|
: new JsonResponseModel { Result = false, Message = "Could not clear issue, please try again or check the logs" });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -184,7 +184,8 @@ namespace PlexRequests.UI.Modules
|
||||||
Status = movieInfo.Status,
|
Status = movieInfo.Status,
|
||||||
RequestedDate = DateTime.Now,
|
RequestedDate = DateTime.Now,
|
||||||
Approved = false,
|
Approved = false,
|
||||||
RequestedBy = Session[SessionKeys.UsernameKey].ToString()
|
RequestedBy = Session[SessionKeys.UsernameKey].ToString(),
|
||||||
|
Issues = IssueState.None,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -255,7 +256,8 @@ namespace PlexRequests.UI.Modules
|
||||||
Status = showInfo.status,
|
Status = showInfo.status,
|
||||||
RequestedDate = DateTime.Now,
|
RequestedDate = DateTime.Now,
|
||||||
Approved = false,
|
Approved = false,
|
||||||
RequestedBy = Session[SessionKeys.UsernameKey].ToString()
|
RequestedBy = Session[SessionKeys.UsernameKey].ToString(),
|
||||||
|
Issues = IssueState.None
|
||||||
};
|
};
|
||||||
|
|
||||||
RequestService.AddRequest(showId, model);
|
RequestService.AddRequest(showId, model);
|
||||||
|
|
|
@ -93,12 +93,13 @@
|
||||||
</p>
|
</p>
|
||||||
<p>Requested By: {{requestedBy}}</p>
|
<p>Requested By: {{requestedBy}}</p>
|
||||||
<p>Requested Date: {{requestedDate}}</p>
|
<p>Requested Date: {{requestedDate}}</p>
|
||||||
|
<div id="issueArea">
|
||||||
{{#if otherMessage}}
|
{{#if otherMessage}}
|
||||||
<p>Message: {{otherMessage}}</p>
|
<p>Message: {{otherMessage}}</p>
|
||||||
{{else}}
|
{{else}}
|
||||||
<p>Issue: {{issues}}</p>
|
<p>Issue: {{issues}}</p>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-2 col-sm-push-3">
|
<div class="col-sm-2 col-sm-push-3">
|
||||||
<br />
|
<br />
|
||||||
|
@ -108,6 +109,11 @@
|
||||||
<input name="Id" type="text" value="{{requestId}}" hidden="hidden" />
|
<input name="Id" type="text" value="{{requestId}}" hidden="hidden" />
|
||||||
<button id="{{requestId}}" style="text-align: right" class="btn btn-danger delete" type="submit"><i class="fa fa-plus"></i> Remove</button>
|
<button id="{{requestId}}" style="text-align: right" class="btn btn-danger delete" type="submit"><i class="fa fa-plus"></i> Remove</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<form method="POST" action="/requests/clearissues" id="clear{{requestId}}">
|
||||||
|
<input name="Id" type="text" value="{{requestId}}" hidden="hidden" />
|
||||||
|
<button id="{{requestId}}" style="text-align: right" class="btn btn-info clear" type="submit"><i class="fa fa-check"></i> Clear Issues</button>
|
||||||
|
</form>
|
||||||
{{/if_eq}}
|
{{/if_eq}}
|
||||||
|
|
||||||
<form method="POST" action="/requests/reportissue/" id="report{{requestId}}">
|
<form method="POST" action="/requests/reportissue/" id="report{{requestId}}">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue