mirror of
https://github.com/45Drives/cockpit-navigator.git
synced 2025-07-30 00:55:30 +02:00
merge changes from dev-josh
This commit is contained in:
parent
0f487a15f4
commit
8e626ea080
@ -232,8 +232,12 @@ class NavEntry {
|
|||||||
this.dom_element.appendChild(icon);
|
this.dom_element.appendChild(icon);
|
||||||
this.dom_element.appendChild(title);
|
this.dom_element.appendChild(title);
|
||||||
this.stat = stat;
|
this.stat = stat;
|
||||||
this.dom_element.addEventListener("click", this);
|
if (stat && stat["inaccessible"]) {
|
||||||
this.dom_element.addEventListener("contextmenu", this);
|
this.dom_element.style.cursor = "not-allowed";
|
||||||
|
} else {
|
||||||
|
this.dom_element.addEventListener("click", this);
|
||||||
|
this.dom_element.addEventListener("contextmenu", this);
|
||||||
|
}
|
||||||
this.is_hidden_file = this.filename().startsWith('.');
|
this.is_hidden_file = this.filename().startsWith('.');
|
||||||
if (this.is_hidden_file)
|
if (this.is_hidden_file)
|
||||||
icon.style.opacity = 0.5;
|
icon.style.opacity = 0.5;
|
||||||
@ -1484,8 +1488,15 @@ class NavWindow {
|
|||||||
this.show_selected_properties();
|
this.show_selected_properties();
|
||||||
document.getElementById("nav-num-dirs").innerText = num_dirs.toString();
|
document.getElementById("nav-num-dirs").innerText = num_dirs.toString();
|
||||||
document.getElementById("nav-num-files").innerText = num_files.toString();
|
document.getElementById("nav-num-files").innerText = num_files.toString();
|
||||||
document.getElementById("nav-num-bytes"). innerText = format_bytes(bytes_sum);
|
document.getElementById("nav-num-bytes").innerText = format_bytes(bytes_sum);
|
||||||
this.stop_load();
|
this.stop_load();
|
||||||
|
this.set_nav_button_state();
|
||||||
|
}
|
||||||
|
|
||||||
|
set_nav_button_state() {
|
||||||
|
document.getElementById("nav-back-btn").disabled = (this.path_stack_index === 1);
|
||||||
|
document.getElementById("nav-forward-btn").disabled = (this.path_stack_index === this.path_stack.length - 1);
|
||||||
|
document.getElementById("nav-up-dir-btn").disabled = (this.pwd().path_str() === "/");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1550,7 +1561,7 @@ class NavWindow {
|
|||||||
[start, end] = [end, start];
|
[start, end] = [end, start];
|
||||||
if (end === -1)
|
if (end === -1)
|
||||||
return;
|
return;
|
||||||
to_be_selected = this.entries.slice(start, end + 1);
|
to_be_selected = this.entries.slice(start, end + 1).filter(entry => !entry.stat["inaccessible"]);
|
||||||
} else {
|
} else {
|
||||||
if (!append)
|
if (!append)
|
||||||
this.selected_entries.clear();
|
this.selected_entries.clear();
|
||||||
@ -2065,6 +2076,7 @@ class NavWindow {
|
|||||||
button.disabled = false;
|
button.disabled = false;
|
||||||
}
|
}
|
||||||
document.getElementById("pwd").disabled = false;
|
document.getElementById("pwd").disabled = false;
|
||||||
|
this.set_nav_button_state();
|
||||||
}
|
}
|
||||||
|
|
||||||
select_all() {
|
select_all() {
|
||||||
|
@ -25,7 +25,27 @@ from pwd import getpwuid
|
|||||||
from grp import getgrgid
|
from grp import getgrgid
|
||||||
|
|
||||||
def get_stat(full_path, filename = '/'):
|
def get_stat(full_path, filename = '/'):
|
||||||
stats = os.lstat(full_path)
|
try:
|
||||||
|
stats = os.lstat(full_path)
|
||||||
|
except OSError:
|
||||||
|
return {
|
||||||
|
"filename": filename,
|
||||||
|
"isdir": False,
|
||||||
|
"link-target": "",
|
||||||
|
"stat": {
|
||||||
|
"inaccessible": True,
|
||||||
|
"mode": 0,
|
||||||
|
"mode-str": "?",
|
||||||
|
"uid": 0,
|
||||||
|
"owner": "?",
|
||||||
|
"gid": 0,
|
||||||
|
"group": "?",
|
||||||
|
"size": 0,
|
||||||
|
"atime": 0,
|
||||||
|
"mtime": 0,
|
||||||
|
"ctime": 0
|
||||||
|
}
|
||||||
|
}
|
||||||
isdir = False
|
isdir = False
|
||||||
try:
|
try:
|
||||||
isdir = S_ISDIR(os.stat(full_path).st_mode)
|
isdir = S_ISDIR(os.stat(full_path).st_mode)
|
||||||
@ -45,6 +65,7 @@ def get_stat(full_path, filename = '/'):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
response = {
|
response = {
|
||||||
|
"inaccessible": False,
|
||||||
"filename": filename,
|
"filename": filename,
|
||||||
"isdir": isdir,
|
"isdir": isdir,
|
||||||
"link-target": link_target,
|
"link-target": link_target,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user