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.

125 lines
4.6 KiB

<html>
<head>
<link rel="stylesheet" type="text/css" href="../../lib/css/themes/jquery-ui/redmond/jquery-ui.min.css"/>
<script type="text/javascript" src="../../lib/js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="../../socket.io/socket.io.js"></script>
<script type="text/javascript" src="../../lib/js/jquery-ui-1.10.3.full.min.js"></script>
<link rel="stylesheet" type="text/css" href="../../css/adapter.css"/>
<script type="text/javascript" src="../../js/translate.js"></script>
<script type="text/javascript" src="../../js/adapter-settings.js"></script>
<script type="text/javascript" src="words.js"></script>
<style>
.number {
width: 70px
}
.table-values th {
background: #686868;
color: #FFF;
font-weight: bold;
}
.table-values tr:nth-child(even) {
background: #d0d0d0;
}
</style>
<script type="text/javascript">
function load(settings, onChange) {
if (!settings) return;
if (!settings.route) settings.route = 'proxy.' + instance + '/';
if (!settings.errorTimeout) settings.errorTimeout = 10000;
$('.value').each(function () {
var key = $(this).attr('id');
var $key = $('#' + key + '.value');
if ($key.attr('type') === 'checkbox') {
$key.prop('checked', settings[key]).change(function() {
onChange();
});
} else {
$key.val(settings[key]).change(function() {
onChange();
}).keyup(function() {
onChange();
});
}
});
getExtendableInstances(function (result) {
if (result) {
var text = '';
for (var r = 0; r < result.length; r++) {
var name = result[r]._id.substring('system.adapter.'.length);
text += '<option value="' + name + '" ' + (settings.webInstance === name ? 'selected' : '') + '>' + name + '</option>';
}
$('#webInstance').append(text);
}
});
onChange(false);
values2table('values', settings.rules, onChange);
}
function save(callback) {
var obj = {};
$('.value').each(function () {
var $this = $(this);
if ($this.attr('type') === 'checkbox') {
obj[$this.attr('id')] = $this.prop('checked');
} else {
obj[$this.attr('id')] = $this.val();
}
});
if (obj.route === 'proxy.' + instance + '/') obj.route = '';
obj.rules = table2values();
callback(obj);
}
</script>
</head>
<body>
<div id="adapter-container">
<table><tr><td><img src="proxy.png"></td><td><h3 class="translate">Proxy adapter settings</h3></td></tr></table>
<table style="width: 100%;">
<tr>
<td style="width: 200px;"><label for="webInstance" class="translate">Extend WEB adapter:</label></td>
<td><select class="value" id="webInstance">
<option value="*" class="translate">all</option>
</select>
</td>
</tr>
<tr>
<td style="width: 200px;"><label for="route" class="translate">Route path:</label></td>
<td><input class="value" id="route"/></td>
</tr>
<tr>
<td style="width: 200px;"><label for="errorTimeout" class="translate">Error timeout(ms):</label></td>
<td><input class="value" id="errorTimeout" type="number" min="1000"/></td>
</tr>
<tr>
<td colspan="2">&nbsp;
</td>
</tr>
</table>
<div id="values" style="width: 100%; height: calc(100% - 245px)">
<button class="table-button-add" style="margin-left: 10px; width: 1.5em; height: 1.5em"></button>
<div style="width: 100%; height: calc(100% - 30px); overflow: auto;">
<table class="table-values" style="width: 100%;">
<thead>
<tr>
<th data-name="regex" style="width: 30%" class="translate">Context</th>
<th data-name="url" class="translate">URL</th>
<th data-name="timeout" style="width: 70px" data-style="width: 70px" data-type="number" class="translate">Timeout</th>
<th data-buttons="delete up down" style="width: 70px"></th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</body>
</html>