Skip to content

Commit

Permalink
Merge pull request #39 from 45Drives/dev-josh
Browse files Browse the repository at this point in the history
Add Modification and Creation Time to Columns and Sorting Methods
  • Loading branch information
joshuaboud authored Nov 29, 2021
2 parents 4d78afd + 8e70c4a commit a36d434
Show file tree
Hide file tree
Showing 12 changed files with 71 additions and 20 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
## Cockpit Navigator 0.5.6-1
## Cockpit Navigator 0.5.7-1

* Fix mangling of large files during upload.
* Fix bug where loading spinner doesn't go away after upload dialog is cancelled.
* Add modification and creation time columns and allow sorting by them.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ 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.6/cockpit-navigator_0.5.6-1focal_all.deb`
1. `# apt install ./cockpit-navigator_0.5.6-1focal_all.deb`
1. `$ wget https://github.com/45Drives/cockpit-navigator/releases/download/v0.5.7/cockpit-navigator_0.5.7-1focal_all.deb`
1. `# apt install ./cockpit-navigator_0.5.7-1focal_all.deb`
### EL7
1. `# yum install https://github.com/45Drives/cockpit-navigator/releases/download/v0.5.6/cockpit-navigator-0.5.6-1.el7.noarch.rpm`
1. `# yum install https://github.com/45Drives/cockpit-navigator/releases/download/v0.5.7/cockpit-navigator-0.5.7-1.el7.noarch.rpm`
### EL8
1. `# dnf install https://github.com/45Drives/cockpit-navigator/releases/download/v0.5.6/cockpit-navigator-0.5.6-1.el8.noarch.rpm`
1. `# dnf install https://github.com/45Drives/cockpit-navigator/releases/download/v0.5.7/cockpit-navigator-0.5.7-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`
1. `$ cd cockpit-navigator`
1. `$ git checkout <version>` (v0.5.6 is latest)
1. `$ git checkout <version>` (v0.5.7 is latest)
1. `# make install`
## From 45Drives Repositories
### Automatic Repo Setup with Script
Expand Down
4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "cockpit-navigator",
"title": "Cockpit Navigator",
"prerelease": false,
"version": "0.5.6",
"version": "0.5.7",
"buildVersion": "1",
"author": "Josh Boudreau <jboudreau@45drives.com>",
"url": "https://github.com/45Drives/cockpit-navigator",
Expand Down Expand Up @@ -54,7 +54,7 @@
],
"changelog": {
"urgency": "medium",
"version": "0.5.6",
"version": "0.5.7",
"buildVersion": "1",
"ignore": [],
"date": null,
Expand Down
8 changes: 4 additions & 4 deletions navigator/components/NavDragDrop.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@ export class NavDragDrop {
uploader.using_webkit = false;
uploads.push(uploader);
}
uploads = await this.handle_conflicts(uploads);
this.upload_manager.add(... uploads);
this.nav_window_ref.stop_load();
if (uploads.length) {
uploads = await this.handle_conflicts(uploads);
this.upload_manager.add(... uploads);
}
}
document.getElementById("nav-upload-btn").addEventListener("click", this.upload_dialog.bind(this));
}
Expand Down Expand Up @@ -213,7 +214,6 @@ export class NavDragDrop {
}

upload_dialog() {
this.nav_window_ref.start_load();
this.upload_element.click();
}
}
12 changes: 12 additions & 0 deletions navigator/components/NavEntry.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,30 @@ export class NavEntry {
let owner = document.createElement("div");
let group = document.createElement("div");
let size = document.createElement("div");
let modified = document.createElement("div");
let created = document.createElement("div");
mode.title = mode.innerText = this.stat["mode-str"];
owner.title = owner.innerText = this.stat["owner"];
group.title = group.innerText = this.stat["group"];
size.title = size.innerText = format_bytes(this.stat["size"]);
modified.title = modified.innerText = format_time(this.stat["mtime"]);
created.title = created.innerText = format_time(this.stat["ctime"]);
mode.classList.add("nav-item-title", "no-select", "monospace-sm");
owner.classList.add("nav-item-title", "no-select");
group.classList.add("nav-item-title", "no-select");
size.classList.add("nav-item-title", "no-select");
modified.classList.add("nav-item-title", "no-select");
created.classList.add("nav-item-title", "no-select");
modified.style.flexGrow = 2;
modified.style.flexBasis = 0;
created.style.flexGrow = 2;
created.style.flexBasis = 0;
this.dom_element.appendChild(mode);
this.dom_element.appendChild(owner);
this.dom_element.appendChild(group);
this.dom_element.appendChild(size);
this.dom_element.appendChild(modified);
this.dom_element.appendChild(created);
}
this.visible = true;
}
Expand Down
20 changes: 19 additions & 1 deletion navigator/components/SortFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ export class SortFunctions {
owner: "asc",
group: "asc",
size: "asc",
modified: "asc",
created: "asc",
}
this.icons = {};
for (let option of ["name", "owner", "group", "size"]) {
for (let option of ["name", "owner", "group", "size", "modified", "created"]) {
this.icons[option] = document.getElementById(`sort-${option}-icon`);
}
this.current_choice = "name";
Expand Down Expand Up @@ -90,4 +92,20 @@ export class SortFunctions {
size_desc(first, second) {
return second.stat["size"] - first.stat["size"];
}

modified_asc(first, second) {
return first.stat["mtime"] - second.stat["mtime"];
}

modified_desc(first, second) {
return second.stat["mtime"] - first.stat["mtime"];
}

created_asc(first, second) {
return first.stat["ctime"] - second.stat["ctime"];
}

created_desc(first, second) {
return second.stat["ctime"] - first.stat["ctime"];
}
}
10 changes: 6 additions & 4 deletions navigator/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,12 @@
<div class="contents-view-list-header nav-item">
<i class="nav-item-icon"></i>
<div class="nav-item-title" id="sort-name-btn">Name<i class="sort-arrow fas fa-chevron-up" id="sort-name-icon"></i></div>
<div id="sort-mode-btn">Mode</div>
<div id="sort-owner-btn">Owner<i class="sort-arrow fas" id="sort-owner-icon"></i></div>
<div id="sort-group-btn">Group<i class="sort-arrow fas" id="sort-group-icon"></i></div>
<div id="sort-size-btn">Size<i class="sort-arrow fas" id="sort-size-icon"></i></div>
<div class="nav-item-title" id="sort-mode-btn">Mode</div>
<div class="nav-item-title" id="sort-owner-btn">Owner<i class="sort-arrow fas" id="sort-owner-icon"></i></div>
<div class="nav-item-title" id="sort-group-btn">Group<i class="sort-arrow fas" id="sort-group-icon"></i></div>
<div class="nav-item-title" id="sort-size-btn">Size<i class="sort-arrow fas" id="sort-size-icon"></i></div>
<div class="nav-item-title" id="sort-modified-btn">Modified<i class="sort-arrow fas" id="sort-modified-icon"></i></div>
<div class="nav-item-title" id="sort-created-btn">Created<i class="sort-arrow fas" id="sort-created-icon"></i></div>
</div>
</div>
<div class="nav-notifications" id="nav-notifications">
Expand Down
2 changes: 1 addition & 1 deletion navigator/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function set_up_buttons() {
document.getElementById("toggle-theme").addEventListener("change", switch_theme, false);
document.getElementById("nav-show-hidden").addEventListener("change", nav_window.toggle_show_hidden.bind(nav_window));
document.getElementById("nav-item-display-btn").addEventListener("click", nav_window.switch_item_display.bind(nav_window));
for (let option of ["name", "owner", "group", "size"]) {
for (let option of ["name", "owner", "group", "size", "modified", "created"]) {
var elem = document.getElementById("sort-" + option + "-btn");
elem.addEventListener("click", (event) => {
nav_window.sort_function.set_func(option);
Expand Down
7 changes: 6 additions & 1 deletion navigator/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,11 @@ input[type="text"] {
flex-grow: 2;
}

.contents-view-list > .nav-item > #sort-modified-btn, #sort-created-btn {
flex-basis: 0;
flex-grow: 2;
}

.nav-info-column {
background-color: var(--container);
flex-basis: 0;
Expand Down Expand Up @@ -692,4 +697,4 @@ input:checked + .slider:before {

.no-border {
border: none;
}
}
3 changes: 3 additions & 0 deletions packaging/el7/main.spec
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ rm -rf %{buildroot}
/usr/share/cockpit/navigator/*

%changelog
* Mon Nov 29 2021 Joshua Boudreau <jboudreau@45drives.com> 0.5.7-1
- Fix bug where loading spinner doesn't go away after upload dialog is cancelled.
- Add modification and creation time columns and allow sorting by them.
* Fri Nov 12 2021 Joshua Boudreau <jboudreau@45drives.com> 0.5.6-1
- Fix mangling of large files during upload.
* Mon Oct 04 2021 Joshua Boudreau <jboudreau@45drives.com> 0.5.5-2
Expand Down
3 changes: 3 additions & 0 deletions packaging/el8/main.spec
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ rm -rf %{buildroot}
/usr/share/cockpit/navigator/*

%changelog
* Mon Nov 29 2021 Joshua Boudreau <jboudreau@45drives.com> 0.5.7-1
- Fix bug where loading spinner doesn't go away after upload dialog is cancelled.
- Add modification and creation time columns and allow sorting by them.
* Fri Nov 12 2021 Joshua Boudreau <jboudreau@45drives.com> 0.5.6-1
- Fix mangling of large files during upload.
* Mon Oct 04 2021 Joshua Boudreau <jboudreau@45drives.com> 0.5.5-2
Expand Down
7 changes: 7 additions & 0 deletions packaging/focal/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
cockpit-navigator (0.5.7-1focal) focal; urgency=medium

* Fix bug where loading spinner doesn't go away after upload dialog is cancelled.
* Add modification and creation time columns and allow sorting by them.

-- Joshua Boudreau <jboudreau@45drives.com> Mon, 29 Nov 2021 08:52:51 -0400

cockpit-navigator (0.5.6-1focal) focal; urgency=medium

* Fix mangling of large files during upload.
Expand Down

0 comments on commit a36d434

Please sign in to comment.