mirror of https://github.com/Ombi-app/Ombi
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
133 lines
4.5 KiB
133 lines
4.5 KiB
8 years ago
|
@using Ombi.UI.Helpers
|
||
|
@inherits Nancy.ViewEngines.Razor.NancyRazorViewBase<Ombi.Core.SettingModels.WatcherSettings>
|
||
|
@Html.Partial("Shared/Partial/_Sidebar")
|
||
|
@{
|
||
|
int port;
|
||
|
if (Model.Port == 0)
|
||
|
{
|
||
|
port = 9090;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
port = Model.Port;
|
||
|
}
|
||
|
}
|
||
|
<div class="col-sm-8 col-sm-push-1">
|
||
|
<form class="form-horizontal" method="POST" id="mainForm">
|
||
|
<fieldset>
|
||
|
<legend>Watcher Settings</legend>
|
||
8 years ago
|
<small>Please note, this is still in beta and may stop working at anytime as Watcher is still very much in development and is constantly changing.</small>
|
||
8 years ago
|
@Html.Checkbox(Model.Enabled, "Enabled", "Enabled")
|
||
|
|
||
|
<div class="form-group">
|
||
|
<label for="Ip" class="control-label">Watcher Hostname or IP</label>
|
||
|
<div class="">
|
||
|
<input type="text" class="form-control form-control-custom " id="Ip" name="Ip" placeholder="localhost" value="@Model.Ip">
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div class="form-group">
|
||
|
<label for="portNumber" class="control-label">Port</label>
|
||
|
|
||
|
<div class="">
|
||
|
<input type="text" class="form-control form-control-custom " id="portNumber" name="Port" placeholder="Port Number" value="@port">
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
<div class="form-group">
|
||
|
<label for="ApiKey" class="control-label">Watcher API Key</label>
|
||
|
<div>
|
||
|
<input type="text" class="form-control form-control-custom " id="ApiKey" name="ApiKey" value="@Model.ApiKey">
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
@Html.Checkbox(Model.Ssl, "Ssl", "SSL")
|
||
|
|
||
|
<div class="form-group">
|
||
|
<label for="SubDir" class="control-label">Watcher Base Url</label>
|
||
|
<div>
|
||
|
<input type="text" class="form-control form-control-custom " id="SubDir" name="SubDir" value="@Model.SubDir">
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<br />
|
||
|
|
||
|
<div class="form-group">
|
||
|
<div>
|
||
|
<button id="testWatcher" type="submit" class="btn btn-primary-outline">Test Connectivity <div id="spinner"> </div></button>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div class="form-group">
|
||
|
<div>
|
||
|
<button id="save" type="submit" class="btn btn-primary-outline">Submit</button>
|
||
|
</div>
|
||
|
</div>
|
||
|
</fieldset>
|
||
|
</form>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
<script>
|
||
|
$(function () {
|
||
|
|
||
|
var baseUrl = '@Html.GetBaseUrl()';
|
||
|
|
||
|
|
||
|
$('#testWatcher').click(function (e) {
|
||
|
e.preventDefault();
|
||
|
var $form = $("#mainForm");
|
||
|
var url = createBaseUrl(baseUrl, "/test/watcher");
|
||
|
$('#spinner').attr("class", "fa fa-spinner fa-spin");
|
||
|
|
||
|
$.ajax({
|
||
|
type: $form.prop("method"),
|
||
|
url: url,
|
||
|
data: $form.serialize(),
|
||
|
dataType: "json",
|
||
|
success: function (response) {
|
||
|
console.log(response);
|
||
|
if (response.result === true) {
|
||
|
$('#spinner').attr("class", "fa fa-check");
|
||
|
generateNotify(response.message, "success");
|
||
|
} else {
|
||
|
generateNotify(response.message, "warning");
|
||
|
$('#spinner').attr("class", "fa fa-times");
|
||
|
}
|
||
|
},
|
||
|
error: function (e) {
|
||
|
console.log(e);
|
||
|
generateNotify("Something went wrong!", "danger");
|
||
|
$('#spinner').attr("class", "fa fa-times");
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
|
||
|
$('#save').click(function (e) {
|
||
|
e.preventDefault();
|
||
|
var $form = $("#mainForm");
|
||
|
var data = $form.serialize();
|
||
|
|
||
|
$.ajax({
|
||
|
type: $form.prop("method"),
|
||
|
data: data,
|
||
|
url: $form.prop("action"),
|
||
|
dataType: "json",
|
||
|
success: function (response) {
|
||
|
if (response.result === true) {
|
||
|
generateNotify(response.message, "success");
|
||
|
} else {
|
||
|
generateNotify(response.message, "warning");
|
||
|
}
|
||
|
},
|
||
|
error: function (e) {
|
||
|
console.log(e);
|
||
|
generateNotify("Something went wrong!", "danger");
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
|
||
|
});
|
||
|
</script>
|