Merge branch 'dev-josh'
This commit is contained in:
commit
6114161171
|
@ -1,4 +1,4 @@
|
|||
## Cockpit Navigator 0.5.2-1
|
||||
## Cockpit Navigator 0.5.3-1
|
||||
|
||||
* Implement uploading of entire directories.
|
||||
* Add cancel option to in-progress file uploads.
|
||||
* Implement inline filename editing.
|
||||
* Add information popup button.
|
|
@ -23,12 +23,12 @@ With no command line use needed, you can:
|
|||
# Installation
|
||||
## From Github Release
|
||||
### Ubuntu
|
||||
1. `$ wget https://github.com/45Drives/cockpit-navigator/releases/download/v0.5.2/cockpit-navigator_0.5.2-1focal_all.deb`
|
||||
1. `# apt install ./cockpit-navigator_0.5.2-1focal_all.deb`
|
||||
1. `$ wget https://github.com/45Drives/cockpit-navigator/releases/download/v0.5.3/cockpit-navigator_0.5.3-1focal_all.deb`
|
||||
1. `# apt install ./cockpit-navigator_0.5.3-1focal_all.deb`
|
||||
### EL7
|
||||
1. `# yum install https://github.com/45Drives/cockpit-navigator/releases/download/v0.5.2/cockpit-navigator-0.5.2-1.el7.noarch.rpm`
|
||||
1. `# yum install https://github.com/45Drives/cockpit-navigator/releases/download/v0.5.3/cockpit-navigator-0.5.3-1.el7.noarch.rpm`
|
||||
### EL8
|
||||
1. `# dnf install https://github.com/45Drives/cockpit-navigator/releases/download/v0.5.2/cockpit-navigator-0.5.2-1.el8.noarch.rpm`
|
||||
1. `# dnf install https://github.com/45Drives/cockpit-navigator/releases/download/v0.5.3/cockpit-navigator-0.5.3-1.el8.noarch.rpm`
|
||||
## From Source
|
||||
1. Ensure dependencies are installed: `cockpit`, `python3`, `rsync`, `zip`.
|
||||
1. `$ git clone https://github.com/45Drives/cockpit-navigator.git`
|
||||
|
|
6
makefile
6
makefile
|
@ -27,6 +27,9 @@ ifeq ($(DIST),$(EL7_DIST))
|
|||
sed -i "s/pf-c-button/btn/g;s/pf-m-primary/btn-primary/g;s/pf-m-secondary/btn-default/g;s/pf-m-danger/btn-danger/g" $(DESTDIR)/usr/share/cockpit/navigator/navigator.html
|
||||
sed -i "s/pf-c-button/btn/g;s/pf-m-primary/btn-primary/g;s/pf-m-secondary/btn-default/g;s/pf-m-danger/btn-danger/g" $(DESTDIR)/usr/share/cockpit/navigator/components/ModalPrompt.js
|
||||
endif
|
||||
ifneq ($(NAV_VERS),)
|
||||
echo "export let NAVIGATOR_VERSION = \"$(NAV_VERS)\";" > $(DESTDIR)/usr/share/cockpit/navigator/version.js
|
||||
endif
|
||||
|
||||
uninstall:
|
||||
rm -rf $(DESTDIR)/usr/share/cockpit/navigator
|
||||
|
@ -35,6 +38,9 @@ install-local:
|
|||
mkdir -p $(HOME)/.local/share/cockpit
|
||||
cp -rpf navigator $(HOME)/.local/share/cockpit
|
||||
find $(HOME)/.local/share/cockpit/navigator -name '*.js' -exec sed -i "s#\"/usr/share/\(cockpit/navigator/scripts/.*\)\"#\"$(HOME)/.local/share/\1\"#g" {} \;
|
||||
ifneq ($(NAV_VERS),)
|
||||
echo "export let NAVIGATOR_VERSION = \"$(NAV_VERS)\";" > $(HOME)/.local/share/cockpit/navigator/version.js
|
||||
endif
|
||||
|
||||
uninstall-local:
|
||||
rm -rf $(HOME)/.local/share/cockpit/navigator
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"name": "cockpit-navigator",
|
||||
"title": "Cockpit Navigator",
|
||||
"prerelease": false,
|
||||
"version": "0.5.2",
|
||||
"version": "0.5.3",
|
||||
"buildVersion": "1",
|
||||
"author": "Josh Boudreau <jboudreau@45drives.com>",
|
||||
"url": "https://github.com/45Drives/cockpit-navigator",
|
||||
|
@ -54,7 +54,7 @@
|
|||
],
|
||||
"changelog": {
|
||||
"urgency": "medium",
|
||||
"version": "0.5.2",
|
||||
"version": "0.5.3",
|
||||
"buildVersion": "1",
|
||||
"ignore": [],
|
||||
"date": null,
|
||||
|
|
|
@ -96,7 +96,7 @@ export class ModalPrompt {
|
|||
*/
|
||||
set_body(message) {
|
||||
this.body.innerHTML = "";
|
||||
this.body.innerText = message;
|
||||
this.body.innerHTML = message;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -53,7 +53,7 @@ export class NavContextMenu {
|
|||
var name_list = func[0].split("_");
|
||||
name_list.forEach((word, index) => {name_list[index] = word.charAt(0).toUpperCase() + word.slice(1)});
|
||||
elem.innerHTML = func[1] + name_list.join(" ");
|
||||
elem.addEventListener("click", (e) => {this[func[0]].bind(this).apply()});
|
||||
elem.addEventListener("click", (e) => {this[func[0]].bind(this, e).apply()});
|
||||
elem.classList.add("nav-context-menu-item")
|
||||
elem.id = "nav-context-menu-" + func[0];
|
||||
this.dom_element.appendChild(elem);
|
||||
|
@ -61,58 +61,37 @@ export class NavContextMenu {
|
|||
}
|
||||
}
|
||||
|
||||
new_dir() {
|
||||
new_dir(e) {
|
||||
this.nav_window_ref.mkdir();
|
||||
}
|
||||
|
||||
new_file() {
|
||||
new_file(e) {
|
||||
this.nav_window_ref.touch();
|
||||
}
|
||||
|
||||
new_link() {
|
||||
new_link(e) {
|
||||
var default_target = "";
|
||||
if (this.nav_window_ref.selected_entries.size <= 1 && this.target !== this.nav_window_ref.pwd())
|
||||
default_target = this.target.filename();
|
||||
this.nav_window_ref.ln(default_target);
|
||||
}
|
||||
|
||||
cut() {
|
||||
cut(e) {
|
||||
this.nav_window_ref.cut();
|
||||
}
|
||||
|
||||
copy() {
|
||||
copy(e) {
|
||||
this.nav_window_ref.copy();
|
||||
}
|
||||
|
||||
paste() {
|
||||
paste(e) {
|
||||
this.nav_window_ref.paste();
|
||||
}
|
||||
|
||||
async rename() {
|
||||
async rename(e) {
|
||||
this.hide();
|
||||
let response = await this.nav_window_ref.modal_prompt.prompt("Renaming " + this.target.filename(),
|
||||
{
|
||||
new_name: {
|
||||
label: "New Name: ",
|
||||
type: "text",
|
||||
default: this.target.filename()
|
||||
}
|
||||
}
|
||||
);
|
||||
if (response === null)
|
||||
return;
|
||||
var new_name = response.new_name;
|
||||
if (new_name.includes("/")) {
|
||||
this.nav_window_ref.modal_prompt.alert("File name can't contain `/`.");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await this.target.mv(new_name);
|
||||
} catch(e) {
|
||||
this.nav_window_ref.modal_prompt.alert(e);
|
||||
return;
|
||||
}
|
||||
this.nav_window_ref.refresh();
|
||||
this.target.show_edit(this.target.dom_element.nav_item_title);
|
||||
e.stopPropagation();
|
||||
}
|
||||
|
||||
zip_for_download() {
|
||||
|
@ -134,7 +113,7 @@ export class NavContextMenu {
|
|||
});
|
||||
}
|
||||
|
||||
async download() {
|
||||
async download(e) {
|
||||
var download_target = "";
|
||||
if (this.nav_window_ref.selected_entries.size === 1 && !(this.nav_window_ref.selected_entry() instanceof NavDir)) {
|
||||
download_target = this.nav_window_ref.selected_entry();
|
||||
|
@ -155,11 +134,11 @@ export class NavContextMenu {
|
|||
download.download();
|
||||
}
|
||||
|
||||
delete() {
|
||||
delete(e) {
|
||||
this.nav_window_ref.delete_selected();
|
||||
}
|
||||
|
||||
properties() {
|
||||
properties(e) {
|
||||
this.nav_window_ref.show_edit_selected();
|
||||
}
|
||||
|
||||
|
|
|
@ -42,6 +42,20 @@ export class NavEntry {
|
|||
title.innerText = this.filename();
|
||||
this.dom_element.appendChild(icon);
|
||||
this.dom_element.appendChild(title);
|
||||
let title_edit = this.dom_element.nav_item_title.editor = document.createElement("input");
|
||||
title_edit.type = "text";
|
||||
title_edit.style.display = "none";
|
||||
title_edit.style.padding = "0";
|
||||
title_edit.style.flexBasis = "0";
|
||||
title_edit.style.flexGrow = "2";
|
||||
title_edit.classList.add("nav-item-title");
|
||||
title_edit.oninput = (e) => {
|
||||
let elem = e.target;
|
||||
elem.style.width = elem.value.length + "ch";
|
||||
}
|
||||
title_edit.addEventListener("keydown", (e) => {e.stopPropagation();});
|
||||
title_edit.addEventListener("click", (e) => {e.stopPropagation();});
|
||||
this.dom_element.appendChild(title_edit);
|
||||
this.stat = stat;
|
||||
if (stat && stat["inaccessible"]) {
|
||||
this.dom_element.style.cursor = "not-allowed";
|
||||
|
@ -80,9 +94,18 @@ export class NavEntry {
|
|||
handleEvent(e) {
|
||||
switch (e.type) {
|
||||
case "click":
|
||||
if (this.nav_window_ref.selected_entries.size === 1 && this.nav_window_ref.selected_entries.has(this)) {
|
||||
switch (e.target) {
|
||||
case this.dom_element.nav_item_title:
|
||||
this.show_edit(e.target);
|
||||
e.stopPropagation();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.nav_window_ref.set_selected(this, e.shiftKey, e.ctrlKey);
|
||||
this.context_menu_ref.hide();
|
||||
e.stopPropagation();
|
||||
break;
|
||||
case "contextmenu":
|
||||
this.context_menu_ref.show(e, this);
|
||||
|
@ -227,6 +250,72 @@ export class NavEntry {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} new_path
|
||||
*/
|
||||
async rename(new_name) {
|
||||
if (new_name === this.filename())
|
||||
return;
|
||||
if (new_name.includes("/")) {
|
||||
this.nav_window_ref.modal_prompt.alert("File name can't contain `/`.");
|
||||
return;
|
||||
} else if (new_name === "..") {
|
||||
this.nav_window_ref.modal_prompt.alert(
|
||||
"File name can't be `..`.",
|
||||
"If you want to move the file, right click > cut then right click > paste."
|
||||
);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await this.mv(new_name);
|
||||
} catch(e) {
|
||||
this.nav_window_ref.modal_prompt.alert(e);
|
||||
return;
|
||||
}
|
||||
this.nav_window_ref.refresh();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {HTMLDivElement} element
|
||||
* @returns
|
||||
*/
|
||||
show_edit(element) {
|
||||
if (!element.editor)
|
||||
return;
|
||||
element.hide_func = () => {this.hide_edit(element)};
|
||||
element.editor.onchange = element.hide_func;
|
||||
window.addEventListener("click", element.hide_func);
|
||||
switch (element) {
|
||||
case this.dom_element.nav_item_title:
|
||||
element.editor.value = this.filename();
|
||||
break;
|
||||
default:
|
||||
element.editor.value = element.innerText;
|
||||
break;
|
||||
}
|
||||
element.editor.style.width = element.editor.value.length + "ch";
|
||||
element.editor.style.display = "inline-block";
|
||||
element.style.display = "none";
|
||||
element.editor.focus();
|
||||
}
|
||||
|
||||
hide_edit(element) {
|
||||
if (!element.editor)
|
||||
return;
|
||||
switch (element) {
|
||||
case this.dom_element.nav_item_title:
|
||||
this.rename(element.editor.value);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
element.editor.style.display = "none";
|
||||
element.style.display = "inline-block";
|
||||
window.removeEventListener("click", element.hide_func);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} extra_properties
|
||||
|
|
|
@ -43,9 +43,10 @@ export class NavFile extends NavEntry {
|
|||
handleEvent(e) {
|
||||
switch(e.type){
|
||||
case "click":
|
||||
if (this.double_click)
|
||||
if (this.double_click) {
|
||||
this.open();
|
||||
else { // single click
|
||||
return;
|
||||
} else { // single click
|
||||
this.double_click = true;
|
||||
if(this.timeout)
|
||||
clearTimeout(this.timeout)
|
||||
|
|
|
@ -58,8 +58,10 @@ export class NavWindow {
|
|||
handleEvent(e) {
|
||||
switch (e.type) {
|
||||
case "click":
|
||||
if (e.target === this.window) {
|
||||
this.clear_selected();
|
||||
this.show_selected_properties();
|
||||
}
|
||||
break;
|
||||
case "contextmenu":
|
||||
this.context_menu.show(e, this.pwd());
|
||||
|
@ -129,8 +131,8 @@ export class NavWindow {
|
|||
document.getElementById("pwd").value = this.pwd().path_str();
|
||||
this.set_selected(this.pwd(), false, false);
|
||||
this.show_selected_properties();
|
||||
document.getElementById("nav-num-dirs").innerText = num_dirs.toString();
|
||||
document.getElementById("nav-num-files").innerText = num_files.toString();
|
||||
document.getElementById("nav-num-dirs").innerText = `${num_dirs} Director${(num_dirs === 1)? "y" : "ies"}`;
|
||||
document.getElementById("nav-num-files").innerText = `${num_files} File${(num_files === 1)? "" : "s"}`;
|
||||
document.getElementById("nav-num-bytes").innerText = format_bytes(bytes_sum);
|
||||
this.stop_load();
|
||||
this.set_nav_button_state();
|
||||
|
|
|
@ -162,7 +162,7 @@
|
|||
</div>
|
||||
<div class="flex-row nav-footer">
|
||||
<div>
|
||||
<span id="nav-num-dirs">-</span> Directories, <span id="nav-num-files">-</span> Files (<span id="nav-num-bytes">-</span>)
|
||||
<span id="nav-num-dirs">-</span>, <span id="nav-num-files">-</span> (<span id="nav-num-bytes">-</span>)
|
||||
</div>
|
||||
<div class="flex-grow"></div>
|
||||
<a href="https://www.45drives.com/?utm_source=Houston&utm_medium=UI&utm_campaign=OS-Link" target="_blank" title="Visit 45Drives.com">
|
||||
|
@ -194,6 +194,10 @@
|
|||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="horizontal-spacer"></div>
|
||||
<div id="nav-info-btn" class="clickable">
|
||||
<i class="far fa-question-circle" id="nav-info-icon"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
|
|
@ -17,7 +17,9 @@
|
|||
along with Cockpit Navigator. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {ModalPrompt} from "./components/ModalPrompt.js";
|
||||
import {NavWindow} from "./components/NavWindow.js";
|
||||
import {NAVIGATOR_VERSION} from "./version.js";
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -139,6 +141,16 @@ function set_up_buttons() {
|
|||
e.target.selectionStart = e.target.selectionEnd = start + 1;
|
||||
}
|
||||
});
|
||||
document.getElementById("nav-info-btn").addEventListener("click", () => {
|
||||
new ModalPrompt().alert(
|
||||
`Cockpit Navigator ${NAVIGATOR_VERSION}`,
|
||||
`<p>` +
|
||||
`Created by <a target="_blank" href=https://www.45drives.com/?utm_source=Houston&utm_medium=UI&utm_campaign=OS-Link>45Drives</a> for Houston UI (Cockpit).<br>` +
|
||||
`<a target="_blank" href=https://github.com/45Drives/cockpit-navigator/issues>Issue Tracker</a><br>` +
|
||||
`<a target="_blank" href=https://github.com/45Drives/cockpit-navigator/discussions>Feedback</a><br>` +
|
||||
`</p>`
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
async function main() {
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
export let NAVIGATOR_VERSION = "built from source";
|
|
@ -23,7 +23,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
|
|||
# empty
|
||||
|
||||
%install
|
||||
make DESTDIR=%{buildroot} DIST=%{dist} install
|
||||
make DESTDIR=%{buildroot} DIST=%{dist} NAV_VERS="%{version}-%{release}" install
|
||||
|
||||
%clean
|
||||
rm -rf %{buildroot}
|
||||
|
@ -32,6 +32,9 @@ rm -rf %{buildroot}
|
|||
/usr/share/cockpit/navigator/*
|
||||
|
||||
%changelog
|
||||
* Mon Jul 19 2021 Josh Boudreau <jboudreau@45drives.com> 0.5.3-1
|
||||
- Implement inline filename editing.
|
||||
- Add information popup button.
|
||||
* Fri Jul 16 2021 Josh Boudreau <jboudreau@45drives.com> 0.5.2-1
|
||||
- Implement uploading of entire directories.
|
||||
- Add cancel option to in-progress file uploads.
|
||||
|
@ -41,7 +44,7 @@ rm -rf %{buildroot}
|
|||
* Thu Jul 15 2021 Josh Boudreau <jboudreau@45drives.com> 0.5.0-1
|
||||
- Implement custom modal style popups to replace browser dialogs.
|
||||
* Wed Jul 07 2021 Josh Boudreau <jboudreau@45drives.com> 0.4.6-3
|
||||
- Add relase for el7
|
||||
- Add release for el7
|
||||
* Wed Jun 30 2021 Josh Boudreau <jboudreau@45drives.com> 0.4.6-2
|
||||
- First build with auto packaging
|
||||
* Fri Jun 18 2021 Josh Boudreau <jboudreau@45drives.com> 0.4.6-1
|
||||
|
|
|
@ -23,7 +23,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
|
|||
# empty
|
||||
|
||||
%install
|
||||
make DESTDIR=%{buildroot} DIST=%{dist} install
|
||||
make DESTDIR=%{buildroot} DIST=%{dist} NAV_VERS="%{version}-%{release}" install
|
||||
|
||||
%clean
|
||||
rm -rf %{buildroot}
|
||||
|
@ -32,6 +32,9 @@ rm -rf %{buildroot}
|
|||
/usr/share/cockpit/navigator/*
|
||||
|
||||
%changelog
|
||||
* Mon Jul 19 2021 Josh Boudreau <jboudreau@45drives.com> 0.5.3-1
|
||||
- Implement inline filename editing.
|
||||
- Add information popup button.
|
||||
* Fri Jul 16 2021 Josh Boudreau <jboudreau@45drives.com> 0.5.2-1
|
||||
- Implement uploading of entire directories.
|
||||
- Add cancel option to in-progress file uploads.
|
||||
|
@ -41,7 +44,7 @@ rm -rf %{buildroot}
|
|||
* Thu Jul 15 2021 Josh Boudreau <jboudreau@45drives.com> 0.5.0-1
|
||||
- Implement custom modal style popups to replace browser dialogs.
|
||||
* Wed Jul 07 2021 Josh Boudreau <jboudreau@45drives.com> 0.4.6-3
|
||||
- Add relase for el7
|
||||
- Add release for el7
|
||||
* Wed Jun 30 2021 Josh Boudreau <jboudreau@45drives.com> 0.4.6-2
|
||||
- First build with auto packaging
|
||||
* Fri Jun 18 2021 Josh Boudreau <jboudreau@45drives.com> 0.4.6-1
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
cockpit-navigator (0.5.3-1focal) focal; urgency=medium
|
||||
|
||||
* Implement inline filename editing.
|
||||
* Add information popup button.
|
||||
|
||||
-- Josh Boudreau <jboudreau@45drives.com> Mon, 19 Jul 2021 10:34:27 -0300
|
||||
|
||||
cockpit-navigator (0.5.2-1focal) focal; urgency=medium
|
||||
|
||||
* Implement uploading of entire directories.
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
# package maintainers to append LDFLAGS
|
||||
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
|
||||
|
||||
export NAV_VERS := $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ':')
|
||||
|
||||
%:
|
||||
dh $@
|
||||
|
||||
|
|
Loading…
Reference in New Issue