forked from j62/ctbrec
Change look of the model table in the web interface
This commit is contained in:
parent
e55daa0772
commit
caf329eb23
|
@ -679,7 +679,7 @@ public class RecordedModelsTab extends Tab implements TabSelectionListener {
|
||||||
HBox.setMargin(pauseButton, new Insets(5));
|
HBox.setMargin(pauseButton, new Insets(5));
|
||||||
HBox.setMargin(removeButton, new Insets(5));
|
HBox.setMargin(removeButton, new Insets(5));
|
||||||
grid.add(row, 1, 1);
|
grid.add(row, 1, 1);
|
||||||
if (model.getRecordUntil().toEpochMilli() != Long.MAX_VALUE) {
|
if (model.getRecordUntil().toEpochMilli() != Model.RECORD_INDEFINITELY) {
|
||||||
LocalDate localDate = LocalDate.ofInstant(model.getRecordUntil(), ZoneId.systemDefault());
|
LocalDate localDate = LocalDate.ofInstant(model.getRecordUntil(), ZoneId.systemDefault());
|
||||||
datePicker.setValue(localDate);
|
datePicker.setValue(localDate);
|
||||||
}
|
}
|
||||||
|
|
|
@ -235,7 +235,7 @@ public abstract class AbstractModel implements Model {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Instant getRecordUntil() {
|
public Instant getRecordUntil() {
|
||||||
return Optional.ofNullable(recordUntil).orElse(Instant.ofEpochMilli(Long.MAX_VALUE));
|
return Optional.ofNullable(recordUntil).orElse(Instant.ofEpochMilli(RECORD_INDEFINITELY));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -20,6 +20,8 @@ import ctbrec.sites.Site;
|
||||||
|
|
||||||
public interface Model extends Comparable<Model>, Serializable {
|
public interface Model extends Comparable<Model>, Serializable {
|
||||||
|
|
||||||
|
public static final long RECORD_INDEFINITELY = 9000000000000000000l;
|
||||||
|
|
||||||
public enum State {
|
public enum State {
|
||||||
ONLINE("online"),
|
ONLINE("online"),
|
||||||
OFFLINE("offline"),
|
OFFLINE("offline"),
|
||||||
|
|
|
@ -58,6 +58,10 @@ th a:hover {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.checkmark-green {
|
||||||
|
color: #28a745;
|
||||||
|
}
|
||||||
|
|
||||||
|
.red {
|
||||||
|
color: #dc4444;
|
||||||
|
}
|
|
@ -96,19 +96,22 @@
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th><a href="#" data-bind="orderable: {collection: 'models', field: 'ko_name'}">Model</a></th>
|
<th><a href="#" data-bind="orderable: {collection: 'models', field: 'ko_name'}">Model</a></th>
|
||||||
<th><a href="#" data-bind="orderable: {collection: 'models', field: 'ko_suspended'}">Paused</a></th>
|
|
||||||
<th><a href="#" data-bind="orderable: {collection: 'models', field: 'ko_online'}">Online</a></th>
|
<th><a href="#" data-bind="orderable: {collection: 'models', field: 'ko_online'}">Online</a></th>
|
||||||
<th><a href="#" data-bind="orderable: {collection: 'models', field: 'ko_recording'}">Recording</a></th>
|
<th><a href="#" data-bind="orderable: {collection: 'models', field: 'ko_recording'}">Recording</a></th>
|
||||||
<th>Actions</th>
|
<th></th>
|
||||||
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody data-bind="foreach: models">
|
<tbody data-bind="foreach: models">
|
||||||
<tr>
|
<tr>
|
||||||
<td><a data-bind="attr: { href: ko_url, title: ko_name }, text: ko_name"></a></td>
|
<td><a data-bind="attr: { href: ko_url, title: ko_name }, text: ko_name"></a></td>
|
||||||
<td><input type="checkbox" data-bind="checked: ko_suspended" /></td>
|
<td><span data-bind="checked: ko_online, class: ko_online() ? `fa fa-check-square checkmark-green` : ``" style="font-size: 2em"></span></td>
|
||||||
<td><input type="checkbox" disabled data-bind="checked: ko_online" /></td>
|
<td><span data-bind="checked: ko_recording, class: ko_recording() ? `fa fa-circle red` : ``" style="font-size: 2em"></span></td>
|
||||||
<td><input type="checkbox" disabled data-bind="checked: ko_recording" /></td>
|
<td>
|
||||||
<td><button class="btn btn-secondary fa fa-minus-circle" title="Stop recording" data-bind="click: ctbrec.stop"></button></td>
|
<button class="btn btn-secondary fa fa-play" title="Resume recording" data-bind="click: ctbrec.resume, visible: ko_suspended"></button>
|
||||||
|
<button class="btn btn-secondary fa fa-pause" title="Pause recording" data-bind="click: ctbrec.suspend, hidden: ko_suspended"></button>
|
||||||
|
</td>
|
||||||
|
<td><button class="btn btn-secondary fa fa-trash" title="Remove model" data-bind="click: ctbrec.stop"></button></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -69,6 +69,7 @@ function syncModels(models) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
model.ko_recording = ko.observable(model.online && !model.suspended);
|
model.ko_recording = ko.observable(model.online && !model.suspended);
|
||||||
|
//model.ko_recording_class = ko.observable( (model.online && !model.suspended) ? 'fa fa-circle red' : '' );
|
||||||
model.ko_suspended = ko.observable(model.suspended);
|
model.ko_suspended = ko.observable(model.suspended);
|
||||||
model.swallowEvents = false;
|
model.swallowEvents = false;
|
||||||
model.ko_suspended.subscribe(function(checked) {
|
model.ko_suspended.subscribe(function(checked) {
|
||||||
|
@ -102,6 +103,7 @@ function syncModels(models) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m.ko_online(onlineState);
|
m.ko_online(onlineState);
|
||||||
|
//m.ko_recording_class( (model.online && !model.suspended) ? 'fa fa-circle red' : '');
|
||||||
m.swallowEvents = true;
|
m.swallowEvents = true;
|
||||||
m.ko_suspended(model.suspended);
|
m.ko_suspended(model.suspended);
|
||||||
m.swallowEvents = false;
|
m.swallowEvents = false;
|
||||||
|
|
|
@ -195,7 +195,6 @@ function updateDiskSpace() {
|
||||||
throughput.bytes(data.throughput);
|
throughput.bytes(data.throughput);
|
||||||
throughput.timeframe(data.throughputTimeframe);
|
throughput.timeframe(data.throughputTimeframe);
|
||||||
let bytesPerSecond = data.throughput / data.throughputTimeframe;
|
let bytesPerSecond = data.throughput / data.throughputTimeframe;
|
||||||
console.log(data.throughput, data.throughputTimeframe, bytesPerSecond, calculateSize(bytesPerSecond) + '/s');
|
|
||||||
throughput.text(calculateSize(bytesPerSecond) + '/s');
|
throughput.text(calculateSize(bytesPerSecond) + '/s');
|
||||||
} else {
|
} else {
|
||||||
if (console)
|
if (console)
|
||||||
|
|
Loading…
Reference in New Issue