2019-03-13 04:11:00 +00:00
|
|
|
export default function DriveLights()
|
|
|
|
{
|
|
|
|
return {
|
|
|
|
driveLight: function(drive, on) {
|
|
|
|
var disk = document.querySelector('#disk' + drive);
|
|
|
|
disk.style.backgroundImage =
|
|
|
|
on ? 'url(css/red-on-16.png)' :
|
|
|
|
'url(css/red-off-16.png)';
|
|
|
|
},
|
|
|
|
dirty: function() {
|
|
|
|
// document.querySelector('#disksave' + drive).disabled = !dirty;
|
|
|
|
},
|
|
|
|
label: function(drive, label) {
|
|
|
|
if (label) {
|
2020-04-24 02:48:52 +00:00
|
|
|
document.querySelector('#disk-label' + drive).innerText = label;
|
2019-03-13 04:11:00 +00:00
|
|
|
}
|
2020-04-24 02:48:52 +00:00
|
|
|
return document.querySelector('#disk-label' + drive).innerText;
|
2019-03-13 04:11:00 +00:00
|
|
|
},
|
|
|
|
getState: function() {
|
|
|
|
return {
|
|
|
|
disks: [
|
|
|
|
this.label(1),
|
|
|
|
this.label(2)
|
|
|
|
]
|
|
|
|
};
|
|
|
|
},
|
|
|
|
setState: function(state) {
|
|
|
|
if (state && state.disks) {
|
|
|
|
this.label(1, state.disks[0].label);
|
|
|
|
this.label(2, state.disks[1].label);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|