Changes for v0.4.4

This commit is contained in:
joshuaboud 2021-06-10 12:18:04 -03:00
commit fbdac5bf92
4 changed files with 34 additions and 16 deletions

View File

@ -23,12 +23,12 @@ With no command line use needed, you can:
# Installation # Installation
## From Github Release ## From Github Release
### Ubuntu ### Ubuntu
1. `$ wget https://github.com/45Drives/cockpit-navigator/releases/download/v0.4/cockpit-navigator_0.4.3-1focal_all.deb` 1. `$ wget https://github.com/45Drives/cockpit-navigator/releases/download/v0.4/cockpit-navigator_0.4.4-1focal_all.deb`
1. `# apt install ./cockpit-navigator_0.4.3-1focal_all.deb` 1. `# apt install ./cockpit-navigator_0.4.4-1focal_all.deb`
### EL7 ### EL7
1. `# yum install https://github.com/45Drives/cockpit-navigator/releases/download/v0.4/cockpit-navigator-0.4.3-1.el7.noarch.rpm` 1. `# yum install https://github.com/45Drives/cockpit-navigator/releases/download/v0.4/cockpit-navigator-0.4.4-1.el7.noarch.rpm`
### EL8 ### EL8
1. `# dnf install https://github.com/45Drives/cockpit-navigator/releases/download/v0.4/cockpit-navigator-0.4.3-1.el8.noarch.rpm` 1. `# dnf install https://github.com/45Drives/cockpit-navigator/releases/download/v0.4/cockpit-navigator-0.4.4-1.el8.noarch.rpm`
## From Source ## From Source
1. Ensure dependencies are installed: `cockpit`, `python3`, `rsync`, `zip`. 1. Ensure dependencies are installed: `cockpit`, `python3`, `rsync`, `zip`.
1. `$ git clone https://github.com/45Drives/cockpit-navigator.git` 1. `$ git clone https://github.com/45Drives/cockpit-navigator.git`

7
debian/changelog vendored
View File

@ -1,3 +1,10 @@
cockpit-navigator (0.4.4-1focal) focal; urgency=medium
* Hide download option in right click context menu when no items
are explicitly selected.
-- Josh Boudreau <jboudreau@45drives.com> Thu, 10 Jun 2021 12:09:00 -0300
cockpit-navigator (0.4.3-1focal) focal; urgency=medium cockpit-navigator (0.4.3-1focal) focal; urgency=medium
* Add sort options for list view. * Add sort options for list view.

View File

@ -1,5 +1,5 @@
Name: cockpit-navigator Name: cockpit-navigator
Version: 0.4.3 Version: 0.4.4
Release: 1%{?dist} Release: 1%{?dist}
Summary: A File System Browser for Cockpit. Summary: A File System Browser for Cockpit.
License: GPL-3.0+ License: GPL-3.0+
@ -32,6 +32,9 @@ rm -rf %{buildroot}
/usr/share/cockpit/navigator/* /usr/share/cockpit/navigator/*
%changelog %changelog
* Thu Jun 10 2021 Josh Boudreau <jboudreau@45drives.com> 0.4.4-1
- Hide download option in right click context menu when no items
are explicitly selected.
* Tue Jun 08 2021 Josh Boudreau <jboudreau@45drives.com> 0.4.3-1 * Tue Jun 08 2021 Josh Boudreau <jboudreau@45drives.com> 0.4.3-1
- Add sort options for list view. - Add sort options for list view.
- Add search bar to filter items. - Add search bar to filter items.

View File

@ -247,6 +247,10 @@ class NavEntry {
owner.title = owner.innerText = this.stat["owner"]; owner.title = owner.innerText = this.stat["owner"];
group.title = group.innerText = this.stat["group"]; group.title = group.innerText = this.stat["group"];
size.title = size.innerText = format_bytes(this.stat["size"]); size.title = size.innerText = format_bytes(this.stat["size"]);
mode.classList.add("nav-item-title", "no-select");
owner.classList.add("nav-item-title", "no-select");
group.classList.add("nav-item-title", "no-select");
size.classList.add("nav-item-title", "no-select");
this.dom_element.appendChild(mode); this.dom_element.appendChild(mode);
this.dom_element.appendChild(owner); this.dom_element.appendChild(owner);
this.dom_element.appendChild(group); this.dom_element.appendChild(group);
@ -934,7 +938,6 @@ class NavContextMenu {
this.dom_element.appendChild(elem); this.dom_element.appendChild(elem);
this.menu_options[func[0]] = elem; this.menu_options[func[0]] = elem;
} }
this.menu_options["paste"].style.display = "none";
} }
new_dir() { new_dir() {
@ -1036,29 +1039,30 @@ class NavContextMenu {
* @param {NavEntry} target * @param {NavEntry} target
*/ */
show(event, target) { show(event, target) {
if (this.nav_window_ref.selected_entries.size > 1) { if (!this.nav_window_ref.none_selected()) {
if (event.shiftKey || event.ctrlKey) if (event.shiftKey || event.ctrlKey)
this.nav_window_ref.set_selected(target, event.shiftKey, event.ctrlKey); this.nav_window_ref.set_selected(target, event.shiftKey, event.ctrlKey);
} else { } else {
this.nav_window_ref.set_selected(target, false, false); this.nav_window_ref.set_selected(target, false, false);
} }
this.menu_options["download"].style.display = "flex"; for (let option of Object.keys(this.menu_options)) {
if (target === this.nav_window_ref.pwd()) { this.menu_options[option].style.display = "flex"; // show all
}
// selectively hide options based on context
if (this.nav_window_ref.none_selected()) {
this.menu_options["copy"].style.display = "none"; this.menu_options["copy"].style.display = "none";
this.menu_options["cut"].style.display = "none"; this.menu_options["cut"].style.display = "none";
this.menu_options["delete"].style.display = "none"; this.menu_options["delete"].style.display = "none";
} else { this.menu_options["download"].style.display = "none";
this.menu_options["copy"].style.display = "flex";
this.menu_options["cut"].style.display = "flex";
this.menu_options["delete"].style.display = "flex";
} }
if (this.nav_window_ref.selected_entries.size > 1) { if (this.nav_window_ref.selected_entries.size > 1) {
this.menu_options["rename"].style.display = "none"; this.menu_options["rename"].style.display = "none";
} else { } else {
this.menu_options["rename"].style.display = "flex"; if (target instanceof NavDirLink || target instanceof NavFileLink)
if (target instanceof NavFileLink)
this.menu_options["download"].style.display = "none"; this.menu_options["download"].style.display = "none";
} }
if (!this.nav_window_ref.clip_board.length)
this.menu_options["paste"].style.display = "none";
this.target = target; this.target = target;
this.dom_element.style.display = "inline"; this.dom_element.style.display = "inline";
this.dom_element.style.left = event.clientX + "px"; this.dom_element.style.left = event.clientX + "px";
@ -1582,6 +1586,10 @@ class NavWindow {
selected_entry() { selected_entry() {
return [...this.selected_entries][this.selected_entries.size - 1]; return [...this.selected_entries][this.selected_entries.size - 1];
} }
none_selected() {
return this.selected_entries.size === 1 && this.selected_entry() === this.pwd();
}
show_selected_properties() { show_selected_properties() {
this.selected_entry().show_properties(); this.selected_entry().show_properties();
@ -1855,7 +1863,6 @@ class NavWindow {
async paste_clipboard() { async paste_clipboard() {
this.start_load(); this.start_load();
this.context_menu.hide_paste();
var cmd = ["/usr/share/cockpit/navigator/scripts/paste.py"]; var cmd = ["/usr/share/cockpit/navigator/scripts/paste.py"];
var dest = this.pwd().path_str(); var dest = this.pwd().path_str();
if (this.copy_or_move === "move") { if (this.copy_or_move === "move") {
@ -1866,6 +1873,7 @@ class NavWindow {
cmd.push(item.path_str()); cmd.push(item.path_str());
} }
cmd.push(dest); cmd.push(dest);
this.clip_board.length = 0; // clear clipboard
var promise = new Promise((resolve, reject) => { var promise = new Promise((resolve, reject) => {
var proc = cockpit.spawn( var proc = cockpit.spawn(
cmd, cmd,