This commit is contained in:
tidusjar 2017-01-23 22:50:54 +00:00
commit 7fc26df599
19 changed files with 262 additions and 128 deletions

View file

@ -81,13 +81,13 @@
<div class="form-group">
<div>
<button type="submit" id="getRootFolders" class="btn btn-primary-outline">Get RootFolders <div id="getRootFolderSpinner" /></button>
<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">Root Folders</label>
<label for="selectRootFolder" class="control-label">Default Root Folders</label>
<div id="rootFolders">
<select class="form-control form-control-custom" id="selectRootFolder"></select>
@ -176,37 +176,38 @@
</text>
}
@if (!string.IsNullOrEmpty(Model.RootFolder))
@if (!string.IsNullOrEmpty(Model.RootPath))
{
<text>
console.log('Hit root folders..');
console.log('Hit root folders..');
var rootFolderSelected = @Model.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) {
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>
var rootFolderSelected = @Model.RootPath;
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>
}
@ -218,11 +219,12 @@
return;
}
var qualityProfile = $("#profiles option:selected").val();
var rootFolder = $("#rootFolders option:selected").val();
var $form = $("#mainForm");
var data = $form.serialize();
data = data + "&qualityProfile=" + qualityProfile;
data = data + "&qualityProfile=" + qualityProfile + "&rootPath=" + rootFolder;
$.ajax({
type: $form.prop("method"),