mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-15 01:32:55 -07:00
Done #1012
This commit is contained in:
parent
beed3e858b
commit
635366261c
3 changed files with 69 additions and 40 deletions
|
@ -25,7 +25,10 @@
|
||||||
// ************************************************************************/
|
// ************************************************************************/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Nancy;
|
||||||
using Nancy.Responses.Negotiation;
|
using Nancy.Responses.Negotiation;
|
||||||
using Ombi.Core;
|
using Ombi.Core;
|
||||||
using Ombi.Core.SettingModels;
|
using Ombi.Core.SettingModels;
|
||||||
|
@ -48,6 +51,7 @@ namespace Ombi.UI.Modules.Admin
|
||||||
Before += (ctx) => Security.AdminLoginRedirect(Permissions.Administrator, ctx);
|
Before += (ctx) => Security.AdminLoginRedirect(Permissions.Administrator, ctx);
|
||||||
|
|
||||||
Get["Index", "/faultqueue"] = x => Index();
|
Get["Index", "/faultqueue"] = x => Index();
|
||||||
|
Get["DeleteFault", "/deleteFault", true] = async (x,ct) => await DeleteFault(Convert.ToInt32(Request.Form.id));
|
||||||
}
|
}
|
||||||
|
|
||||||
private IRepository<RequestQueue> RequestQueue { get; }
|
private IRepository<RequestQueue> RequestQueue { get; }
|
||||||
|
@ -69,5 +73,35 @@ namespace Ombi.UI.Modules.Admin
|
||||||
|
|
||||||
return View["RequestFaultQueue", model];
|
return View["RequestFaultQueue", model];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<Response> DeleteFault(int faultId)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (faultId == 0)
|
||||||
|
{
|
||||||
|
return Response.AsJson(new JsonResponseModel
|
||||||
|
{
|
||||||
|
Result = true,
|
||||||
|
Message = "Fault does not exist"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var fault = await RequestQueue.GetAsync(faultId);
|
||||||
|
if (fault == null)
|
||||||
|
{
|
||||||
|
return Response.AsJson(new JsonResponseModel
|
||||||
|
{
|
||||||
|
Result = true,
|
||||||
|
Message = "Fault does not exist"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
await RequestQueue.DeleteAsync(fault);
|
||||||
|
|
||||||
|
return Response.AsJson(new JsonResponseModel
|
||||||
|
{
|
||||||
|
Result = true
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -175,13 +175,19 @@
|
||||||
success: function (response) {
|
success: function (response) {
|
||||||
if (response.result === true) {
|
if (response.result === true) {
|
||||||
generateNotify("Success!", "success");
|
generateNotify("Success!", "success");
|
||||||
|
ev.removeClass("fa-spin");
|
||||||
|
ev.addClass("fa-check");
|
||||||
} else {
|
} else {
|
||||||
generateNotify(response.message, "warning");
|
generateNotify(response.message, "warning");
|
||||||
|
ev.removeClass("fa-spin");
|
||||||
|
ev.addClass("fa-times");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function (e) {
|
error: function (e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
generateNotify("Something went wrong!", "danger");
|
generateNotify("Something went wrong!", "danger");
|
||||||
|
ev.removeClass("fa-spin");
|
||||||
|
ev.addClass("fa-times");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,9 @@
|
||||||
<th>
|
<th>
|
||||||
Error Description
|
Error Description
|
||||||
</th>
|
</th>
|
||||||
|
<th>
|
||||||
|
Delete
|
||||||
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@ -44,6 +47,7 @@
|
||||||
<td>
|
<td>
|
||||||
@m.Message
|
@m.Message
|
||||||
</td>
|
</td>
|
||||||
|
<td class="delete" id="@m.Id"><i class="fa fa-times"></i></td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -52,57 +56,42 @@
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@*<script>
|
<script>
|
||||||
|
|
||||||
var base = '@Html.GetBaseUrl()';
|
$(function () {
|
||||||
$('#autoUpdate')
|
|
||||||
.click(function (e) {
|
|
||||||
e.preventDefault();
|
|
||||||
$('body').append("<i class=\"fa fa-spinner fa-spin fa-5x fa-fw\" style=\"position: absolute; top: 20%; left: 50%;\"></i>");
|
|
||||||
$('#autoUpdate').prop("disabled", "disabled");
|
|
||||||
document.getElementById("lightbox").style.display = "";
|
|
||||||
var count = 0;
|
|
||||||
setInterval(function () {
|
|
||||||
count++;
|
|
||||||
var dots = new Array(count % 10).join('.');
|
|
||||||
document.getElementById('autoUpdate').innerHTML = "Updating" + dots;
|
|
||||||
}, 1000);
|
|
||||||
|
|
||||||
|
$('.refresh').click(function (e) {
|
||||||
|
var id = e.currentTarget.id;
|
||||||
|
|
||||||
|
var ev = $(e.currentTarget.children[0]);
|
||||||
|
ev.addClass("fa-spin");
|
||||||
|
|
||||||
|
var url = createLocalUrl("/admin/deleteFault");
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "Post",
|
type: 'POST',
|
||||||
url: "autoupdate",
|
data: { key: id },
|
||||||
data: { url: "@Model.Status.DownloadUri" },
|
url: url,
|
||||||
dataType: "json",
|
|
||||||
error: function () {
|
|
||||||
setTimeout(
|
|
||||||
function () {
|
|
||||||
location.reload();
|
|
||||||
}, 30000);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#saveSettings').click(function (e) {
|
|
||||||
e.preventDefault();
|
|
||||||
var $form = $("#mainForm");
|
|
||||||
|
|
||||||
var branches = $("#branches option:selected").val();
|
|
||||||
|
|
||||||
var data = $form.serialize();
|
|
||||||
data = data + "&branch=" + branches;
|
|
||||||
$.ajax({
|
|
||||||
type: $form.prop("method"),
|
|
||||||
url: $form.prop("action"),
|
|
||||||
data: data,
|
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (response) {
|
success: function (response) {
|
||||||
if (response.result === true) {
|
if (response.result === true) {
|
||||||
generateNotify(response.message, "success");
|
generateNotify("Success!", "success");
|
||||||
|
ev.removeClass("fa-spin");
|
||||||
|
ev.addClass("fa-check");
|
||||||
} else {
|
} else {
|
||||||
generateNotify(response.message, "warning");
|
generateNotify(response.message, "warning");
|
||||||
|
ev.removeClass("fa-spin");
|
||||||
|
ev.addClass("fa-exclamation");
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
error: function (e) {
|
||||||
|
console.log(e);
|
||||||
|
generateNotify("Something went wrong!", "danger");
|
||||||
|
ev.removeClass("fa-spin");
|
||||||
|
ev.addClass("fa-exclamation");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>*@
|
|
||||||
|
});
|
||||||
|
</script>
|
Loading…
Add table
Add a link
Reference in a new issue