mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-14 10:36:54 -07:00
Added root folder and approving quality profiles in radarr #1065
This commit is contained in:
parent
10ef372cfd
commit
a93c18bc04
14 changed files with 395 additions and 32 deletions
|
@ -11,6 +11,13 @@
|
|||
{
|
||||
port = Model.Port;
|
||||
}
|
||||
|
||||
var rootFolder = string.Empty;
|
||||
if (!string.IsNullOrEmpty(Model.RootPath))
|
||||
|
||||
{
|
||||
rootFolder = Model.RootPath.Replace("/", "//");
|
||||
}
|
||||
}
|
||||
<div class="col-sm-8 col-sm-push-1">
|
||||
<form class="form-horizontal" method="POST" id="mainForm">
|
||||
|
@ -64,10 +71,17 @@
|
|||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="RootPath" class="control-label">Root save directory for Movies</label>
|
||||
<div>
|
||||
<input type="text" class="form-control form-control-custom " placeholder="C:\Media\Movies" id="RootPath" name="RootPath" value="@Model.RootPath">
|
||||
<label>Enter the root folder where movies are saved. For example <strong>C:\Media\Movies</strong>.</label>
|
||||
<button type="submit" id="getRootFolders" class="btn btn-primary-outline">Get Root Folders <div id="getRootFolderSpinner" /></button>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="selectRootFolder" class="control-label">Default Root Folders</label>
|
||||
<div id="rootFolders">
|
||||
<select class="form-control form-control-custom" id="selectRootFolder"></select>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -128,6 +142,39 @@
|
|||
}
|
||||
</text>
|
||||
}
|
||||
@if (!string.IsNullOrEmpty(Model.RootPath))
|
||||
{
|
||||
<text>
|
||||
|
||||
console.log('Hit root folders..');
|
||||
|
||||
var rootFolderSelected = '@rootFolder';
|
||||
if (!rootFolderSelected) {
|
||||
return;
|
||||
}
|
||||
var $form = $("#mainForm");
|
||||
$.ajax({
|
||||
type: $form.prop("method"),
|
||||
data: $form.serialize(),
|
||||
url: "sonarrrootfolders",
|
||||
dataType: "json",
|
||||
success: function(response) {
|
||||
response.forEach(function(result) {
|
||||
$('#selectedRootFolder').html("");
|
||||
if (result.id == rootFolderSelected) {
|
||||
$("#selectRootFolder").append("<option selected='selected' value='" + result.id + "'>" + result.path + "</option>");
|
||||
} else {
|
||||
$("#selectRootFolder").append("<option value='" + result.id + "'>" + result.path + "</option>");
|
||||
}
|
||||
});
|
||||
},
|
||||
error: function(e) {
|
||||
console.log(e);
|
||||
generateNotify("Something went wrong!", "danger");
|
||||
}
|
||||
});
|
||||
</text>
|
||||
}
|
||||
|
||||
|
||||
$('#save').click(function(e) {
|
||||
|
@ -138,11 +185,14 @@
|
|||
return;
|
||||
}
|
||||
var qualityProfile = $("#profiles option:selected").val();
|
||||
var rootFolder = $("#rootFolders option:selected").val();
|
||||
var rootFolderPath = $('#rootFolders option:selected').text();
|
||||
$('#fullRootPath').val(rootFolderPath);
|
||||
|
||||
var $form = $("#mainForm");
|
||||
|
||||
var data = $form.serialize();
|
||||
data = data + "&qualityProfile=" + qualityProfile;
|
||||
data = data + "&qualityProfile=" + qualityProfile + "&rootPath=" + rootFolder;
|
||||
|
||||
$.ajax({
|
||||
type: $form.prop("method"),
|
||||
|
@ -202,6 +252,45 @@
|
|||
});
|
||||
});
|
||||
|
||||
$('#getRootFolders').click(function (e) {
|
||||
|
||||
$('#getRootFolderSpinner').attr("class", "fa fa-spinner fa-spin");
|
||||
e.preventDefault();
|
||||
if (!$('#Ip').val()) {
|
||||
generateNotify("Please enter a valid IP/Hostname.", "warning");
|
||||
$('#getRootFolderSpinner').attr("class", "fa fa-times");
|
||||
return;
|
||||
}
|
||||
if (!$('#portNumber').val()) {
|
||||
generateNotify("Please enter a valid Port Number.", "warning");
|
||||
$('#getRootFolderSpinner').attr("class", "fa fa-times");
|
||||
return;
|
||||
}
|
||||
if (!$('#ApiKey').val()) {
|
||||
generateNotify("Please enter a valid ApiKey.", "warning");
|
||||
$('#getRootFolderSpinner').attr("class", "fa fa-times");
|
||||
return;
|
||||
}
|
||||
var $form = $("#mainForm");
|
||||
$.ajax({
|
||||
type: $form.prop("method"),
|
||||
data: $form.serialize(),
|
||||
url: "radarrrootfolders",
|
||||
dataType: "json",
|
||||
success: function (response) {
|
||||
response.forEach(function (result) {
|
||||
$('#getRootFolderSpinner').attr("class", "fa fa-check");
|
||||
$("#selectRootFolder").append("<option value='" + result.id + "'>" + result.path + "</option>");
|
||||
});
|
||||
},
|
||||
error: function (e) {
|
||||
console.log(e);
|
||||
$('#getRootFolderSpinner').attr("class", "fa fa-times");
|
||||
generateNotify("Something went wrong!", "danger");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var base = '@Html.GetBaseUrl()';
|
||||
$('#testRadarr').click(function (e) {
|
||||
|
||||
|
@ -213,7 +302,7 @@
|
|||
|
||||
var data = $form.serialize();
|
||||
data = data + "&qualityProfile=" + qualityProfile;
|
||||
|
||||
|
||||
var url = createBaseUrl(base, '/test/radarr');
|
||||
$.ajax({
|
||||
type: $form.prop("method"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue