moved images info to comment elements

This commit is contained in:
Devaev Maxim
2019-11-10 06:05:55 +03:00
parent 31a213385d
commit 151463447e
2 changed files with 21 additions and 8 deletions

View File

@@ -154,6 +154,10 @@ select option {
color: var(--cs-control-default-fg); color: var(--cs-control-default-fg);
background-color: var(--cs-control-default-bg); background-color: var(--cs-control-default-bg);
} }
select option.comment {
color: var(--cs-control-disabled-fg);
font-style: italic;
}
input[type=text], input[type=password] { input[type=text], input[type=password] {
overflow-x: auto; overflow-x: auto;

View File

@@ -320,27 +320,36 @@ export function Msd() {
var __refreshImageSelector = function() { var __refreshImageSelector = function() {
let el = $("msd-image-selector"); let el = $("msd-image-selector");
let precom = "\xA0\xA0\xA0\xA0\xA0\u21b3";
let select_index = 0; let select_index = 0;
let index = 1; let index = 1;
el.options.length = 1; el.options.length = 1; // Cleanup
if (__state.online) { if (__state.online) {
let names = Object.keys(__state.storage.images).sort();
for (let name of Object.keys(__state.storage.images).sort()) { for (let name of Object.keys(__state.storage.images).sort()) {
let image = __state.storage.images[name]; let image = __state.storage.images[name];
let title = `${name} (${tools.formatSize(image.size)}${image.complete ? "" : ", broken"})`;
let option = new Option(title, name, false, false); let option = new Option(name, name, false, false);
el.options[index] = option; el.options[index] = option;
if (__state.drive.image && __state.drive.image.name == name && __state.drive.image.in_storage) { if (__state.drive.image && __state.drive.image.name == name && __state.drive.image.in_storage) {
select_index = index; select_index = index;
} }
++index;
let comment = new Option(`${precom} ${tools.formatSize(image.size)}${image.complete ? "" : ", broken"}`, "", false, false);
comment.disabled = true;
comment.className = "comment";
el.options[index + 1] = comment;
index += 2;
} }
if (__state.drive.image && !__state.drive.image.in_storage) { if (__state.drive.image && !__state.drive.image.in_storage) {
let title = `${__state.drive.image.name} (${tools.formatSize(__state.drive.image.size)}, out of storage)`; el.options[index] = new Option(__state.drive.image.name, "", false, false);
el.options[index] = new Option(title, "", false, false); el.options[index + 1] = new Option(`${precom} ${tools.formatSize(__state.drive.image.size)}, out of storage`, "", false, false);
select_index = el.options.length - 1; select_index = el.options.length - 2;
} }
el.selectedIndex = select_index; el.selectedIndex = select_index;
} }
}; };