Initial commit
This commit is contained in:
276
admin/index.html
Normal file
276
admin/index.html
Normal file
@@ -0,0 +1,276 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title></title>
|
||||
<!-- these 4 files always have to be included -->
|
||||
<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>
|
||||
|
||||
<!-- these three files have to be always included -->
|
||||
<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>
|
||||
|
||||
<!-- you have to define 2 functions in the global scope: -->
|
||||
<script type="text/javascript">
|
||||
var convertComma = null;
|
||||
function setValue(id, value, onChange) {
|
||||
var $value = $('#' + id + '.value');
|
||||
if ($value.attr('type') === 'checkbox') {
|
||||
$value.prop('checked', value).change(function () {
|
||||
onChange();
|
||||
});
|
||||
} else {
|
||||
$value.val(value).change(function() {
|
||||
onChange();
|
||||
}).keyup(function() {
|
||||
// Check that only numbers entered
|
||||
if ($(this).hasClass('number')) {
|
||||
var val = $(this).val();
|
||||
if (val) {
|
||||
var newVal = '';
|
||||
for (var i = 0; i < val.length; i++) {
|
||||
if ((val[i] >= '0' && val[i] <= '9') || val[i] === '-' || val[i] === '+' || val[i] === '.' || val[i] === ',') {
|
||||
if (val[i] === '.' && convertComma === true) val[i] = ',';
|
||||
if (val[i] === ',' && convertComma === false) val[i] = '.';
|
||||
newVal += val[i];
|
||||
}
|
||||
}
|
||||
|
||||
if (val != newVal) {
|
||||
$(this).val(newVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
$(this).trigger('change');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function load(settings, onChange) {
|
||||
$('#tabs').tabs();
|
||||
|
||||
// works only with newest admin adapter
|
||||
if (typeof systemConfig !== 'undefined') {
|
||||
convertComma = systemConfig.common.isFloatComma;
|
||||
}
|
||||
|
||||
if (settings.writeNulls === undefined) settings.writeNulls = true;
|
||||
for (var key in settings) {
|
||||
if (settings.hasOwnProperty(key)) {
|
||||
setValue(key, settings[key], onChange);
|
||||
}
|
||||
}
|
||||
$('#passwordConfirm').val(settings.password);
|
||||
|
||||
$('#test').button().click(function () {
|
||||
getIsAdapterAlive(function (isAlive) {
|
||||
if (!isAlive) {
|
||||
showMessage(_('Start or enable adapter first'));
|
||||
} else {
|
||||
$('#test').button('option', 'disabled', true);
|
||||
sendTo(null, 'test', {
|
||||
config: {
|
||||
dbtype: $('#dbtype').val(),
|
||||
port: $('#port').val(),
|
||||
host: $('#host').val(),
|
||||
user: $('#user').val(),
|
||||
fileName: $('#fileName').val(),
|
||||
password: $('#password').val()
|
||||
}
|
||||
}, function (response) {
|
||||
$('#test').button('option', 'disabled', false);
|
||||
showMessage(response.error || 'OK');
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#reset').button().click(function () {
|
||||
getIsAdapterAlive(function (isAlive) {
|
||||
if (!isAlive) {
|
||||
showMessage(_('Start or enable adapter first'));
|
||||
} else {
|
||||
if (confirm(_('Are you sure? All data will be dropped.'))) {
|
||||
$('#reset').button('option', 'disabled', true);
|
||||
sendTo(null, 'destroy', null, function (response) {
|
||||
$('#reset').button('option', 'disabled', false);
|
||||
showMessage(response.error || _('Adapter will be restarted'));
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
$('#dbtype').change(function () {
|
||||
if ($(this).val() === 'sqlite') {
|
||||
$('.baby-sql').show();
|
||||
$('.real-sql').hide();
|
||||
$('.ms-sql').hide();
|
||||
} else if ($(this).val() === 'mssql') {
|
||||
$('.baby-sql').hide();
|
||||
$('.real-sql').show();
|
||||
$('.ms-sql').show();
|
||||
} else {
|
||||
$('.baby-sql').hide();
|
||||
$('.ms-sql').hide();
|
||||
$('.real-sql').show();
|
||||
}
|
||||
}).trigger('change');
|
||||
|
||||
onChange(false);
|
||||
}
|
||||
|
||||
function save(callback) {
|
||||
var settings = {};
|
||||
$('.value').each(function () {
|
||||
var $this = $(this);
|
||||
var id = $this.attr('id');
|
||||
|
||||
if ($this.attr('type') === 'checkbox') {
|
||||
settings[id] = $this.prop('checked');
|
||||
} else {
|
||||
settings[id] = $this.val();
|
||||
}
|
||||
});
|
||||
|
||||
if (($('#dbtype').val() !== 'sqlite') && ($('#passwordConfirm').val() !== $('#password').val())) {
|
||||
showMessage(_('Password confirmation is not equal with password!'));
|
||||
return;
|
||||
}
|
||||
|
||||
callback(settings);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="adapter-container">
|
||||
<table><tr>
|
||||
<td><img src="sql.png"></td>
|
||||
<td style="padding-top: 20px;padding-left: 10px"><h3 class="translate">SQL history adapter settings</h3></td>
|
||||
</tr></table>
|
||||
<div id="tabs">
|
||||
<ul>
|
||||
<li><a href="#tabs-1" class="translate">DB settings</a></li>
|
||||
<li><a href="#tabs-2" class="translate">Default settings</a></li>
|
||||
</ul>
|
||||
<div id="tabs-1">
|
||||
<table>
|
||||
<tr>
|
||||
<td><label class="translate" for="dbtype">DB Type</label></td>
|
||||
<td><select id="dbtype" class="value">
|
||||
<option value="mysql">MySQL</option>
|
||||
<option value="postgresql">PostgreSQL</option>
|
||||
<option value="sqlite">SQLite3</option>
|
||||
<option value="mssql">MS-SQL</option>
|
||||
</select></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="real-sql">
|
||||
<td><label class="translate" for="host">Host</label></td>
|
||||
<td><input id="host" class="value"/></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="real-sql">
|
||||
<td><label class="translate" for="port">Port</label></td>
|
||||
<td><input id="port" class="value"/></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="ms-sql real-sql">
|
||||
<td><label class="translate" for="dbname">DB Name</label></td>
|
||||
<td><input id="dbname" class="value"/></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="real-sql">
|
||||
<td><label class="translate" for="user">User</label></td>
|
||||
<td><input id="user" class="value"/></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="real-sql">
|
||||
<td><label class="translate" for="password">Password</label></td>
|
||||
<td><input id="password" type="password" class="value"/></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="real-sql">
|
||||
<td><label class="translate" for="passwordConfirm">Password confirm</label></td>
|
||||
<td><input id="passwordConfirm" type="password"/></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="baby-sql">
|
||||
<td><label class="translate" for="fileName">File for sqlite:</label></td>
|
||||
<td><input id="fileName" class="value"/></td>
|
||||
<td class="translate">Input path with the file name.</td>
|
||||
</tr>
|
||||
<tr class="baby-sql">
|
||||
<td><label class="translate" for="requestInterval">requestInterval</label></td>
|
||||
<td><input id="requestInterval" class="value"/></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="ms-sql real-sql">
|
||||
<td><label class="translate" for="encrypt">Encrypt:</label></td>
|
||||
<td><input id="encrypt" type="checkbox" class="value"/></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="ms-sql real-sql">
|
||||
<td><label class="translate" for="round">Round real to:</label></td>
|
||||
<td><input id="round" class="value"/></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="ms-sql real-sql">
|
||||
<td><label class="translate" for="multiRequests">Allow parallel requests:</label></td>
|
||||
<td><input id="multiRequests" type="checkbox" class="value"/></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label class="translate" for="writeNulls">Write NULL values on start/stop boundaries:</label></td>
|
||||
<td><input id="writeNulls" type="checkbox" class="value"/></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<button id="test" class="translate">Test connection</button>
|
||||
<button id="reset" class="translate">Reset DB</button>
|
||||
</div>
|
||||
<div id="tabs-2">
|
||||
<table>
|
||||
<tr><td colspan="3"><h4 class="translate">Default settings:</h4></td></tr>
|
||||
<tr>
|
||||
<td><label class="translate" for="debounce">debounce</label></td>
|
||||
<td><input id="debounce" size="5" class="value number"/></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label class="translate" for="changesRelogInterval">log changes interval(s)</label></td>
|
||||
<td><input id="changesRelogInterval" size="5" class="value number"/></td>
|
||||
<td class="translate">0 = disable</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label class="translate" for="changesMinDelta">log changes minimal delta</label></td>
|
||||
<td><input id="changesMinDelta" size="5" class="value number"/></td>
|
||||
<td class="translate">0 = disable delta check</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label class="translate" for="retention">retention</label></td>
|
||||
<td><select id="retention" class="value">
|
||||
<option value="0" class="translate">keep forever</option>
|
||||
<option value="63072000" class="translate">2 years</option>
|
||||
<option value="31536000" class="translate">1 year</option>
|
||||
<option value="15811200" class="translate">6 months</option>
|
||||
<option value="7948800" class="translate">3 months</option>
|
||||
<option value="2678400" class="translate">1 months</option>
|
||||
<option value="1209600" class="translate">2 weeks</option>
|
||||
<option value="604800" class="translate">1 week</option>
|
||||
<option value="432000" class="translate">5 days</option>
|
||||
<option value="259200" class="translate">3 days</option>
|
||||
<option value="86400" class="translate">1 day</option>
|
||||
</select></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user