-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
luci-app-ntpc: convert to JavaScript
Signed-off-by: Daniel Nilsson <daniel.nilsson94@outlook.com>
- Loading branch information
Showing
44 changed files
with
888 additions
and
1,018 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
applications/luci-app-ntpc/htdocs/luci-static/resources/view/ntpc.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
'use strict'; | ||
|
||
'require form'; | ||
'require rpc'; | ||
'require view'; | ||
|
||
var callSystemInfo = rpc.declare({ | ||
object: 'system', | ||
method: 'info' | ||
}); | ||
|
||
return view.extend({ | ||
load: function() { | ||
return Promise.all([ | ||
L.resolveDefault(callSystemInfo(), {}) | ||
]); | ||
}, | ||
|
||
render: function (data) { | ||
var system_info = data[0]; | ||
|
||
var m, s1, time, interval, count, freq, s2, s3, hostname, port; | ||
|
||
m = new form.Map('ntpclient', _('Time Synchronisation'), _('Synchronizes the system time.')); | ||
|
||
s1 = m.section(form.TypedSection, 'ntpclient', _('General')); | ||
s1.anonymous = true; | ||
s1.addremove = false; | ||
|
||
var datestr = null; | ||
|
||
if (system_info.localtime) { | ||
var date = new Date(system_info.localtime * 1000); | ||
|
||
datestr = '%04d-%02d-%02d %02d:%02d:%02d'.format( | ||
date.getUTCFullYear(), | ||
date.getUTCMonth() + 1, | ||
date.getUTCDate(), | ||
date.getUTCHours(), | ||
date.getUTCMinutes(), | ||
date.getUTCSeconds() | ||
); | ||
} | ||
|
||
time = s1.option(form.DummyValue, '_time', _('Current system time')); | ||
time.default = datestr; | ||
|
||
interval = s1.option(form.Value, 'interval', _('Update interval (in seconds)')); | ||
interval.datatype = 'and(uinteger,min(1))'; | ||
interval.rmempty = true; | ||
|
||
count = s1.option(form.Value, 'count', _('Count of time measurements'), _('empty = infinite')); | ||
count.datatype = 'and(uinteger,min(1))'; | ||
count.rmempty = true; | ||
|
||
s2 = m.section(form.TypedSection, 'ntpdrift', _('Clock Adjustment')); | ||
s2.anonymous = true; | ||
s2.addremove = false; | ||
|
||
freq = s2.option(form.Value, 'freq', _('Offset frequency')); | ||
freq.datatype = 'integer'; | ||
freq.rmempty = true; | ||
|
||
s3 = m.section(form.TableSection, 'ntpserver', _('Time Servers')); | ||
s3.anonymous = true; | ||
s3.addremove = true; | ||
|
||
hostname = s3.option(form.Value, 'hostname', _('Hostname')); | ||
hostname.placeholder = _('Hostname'); | ||
|
||
port = s3.option(form.Value, 'port', _('Port')); | ||
port.datatype = 'port'; | ||
port.rmempty = true; | ||
port.placeholder = _('Port'); | ||
|
||
return m.render(); | ||
} | ||
}); |
This file was deleted.
Oops, something went wrong.
28 changes: 0 additions & 28 deletions
28
applications/luci-app-ntpc/luasrc/model/cbi/ntpc/ntpcmini.lua
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.