From 4fc09bee78f0bcdf8525c1af102a2ff492506674 Mon Sep 17 00:00:00 2001 From: Ricardo Gonzalez Garza Date: Mon, 9 Dec 2024 02:22:15 -0600 Subject: [PATCH] Show user and group information in the footer In the folder icon view you where not able to see the owner/group of the selected file or folder since the removal of the sidebar. Closes: #846 --- src/files-footer-detail.tsx | 45 +++++++++++++++++++++++++++++++++++++ test/check-application | 18 +++++++++++++++ test/reference | 2 +- 3 files changed, 64 insertions(+), 1 deletion(-) diff --git a/src/files-footer-detail.tsx b/src/files-footer-detail.tsx index f595ef08..ec5542af 100644 --- a/src/files-footer-detail.tsx +++ b/src/files-footer-detail.tsx @@ -9,6 +9,7 @@ import { Text } from "@patternfly/react-core/dist/esm/components/Text"; import { Tooltip } from "@patternfly/react-core/dist/esm/components/Tooltip"; import cockpit from "cockpit"; +import type { FileInfo } from "cockpit/fsinfo.ts"; import * as timeformat from "timeformat"; import { useFilesContext } from './app.tsx'; @@ -70,7 +71,11 @@ export const FilesFooterDetail = ({ const selectedFile = (selected.length === 1) ? selected[0] : cwdInfo; let permsPopover = null; + let userGroup = null; + if (selectedFile.mode !== undefined) { + userGroup = ; + const mode = selectedFile.mode; const popoverBody = [_("Owner"), _("Group"), _("Others")].map((permGroup, i) => { return ( @@ -119,7 +124,47 @@ export const FilesFooterDetail = ({ {timeformat.distanceToNow(selectedFile.mtime * 1000)} } + {userGroup} {permsPopover} ); }; + +const UserGroupPopover = ({ file }: { file: FileInfo }) => ( + + + + {_("User")} + + + {file.user} + + + + + {_("Group")} + + + {file.group} + + + + } + > + + +); diff --git a/test/check-application b/test/check-application index 0ba59b6a..e6f90c86 100755 --- a/test/check-application +++ b/test/check-application @@ -333,6 +333,7 @@ class TestFiles(testlib.MachineCase): b.wait_in_text("#files-footer-permissions", "rwx r-x r-x") m.execute("chmod 700 /home/admin/newdir") b.wait_in_text("#files-footer-permissions", "rwx --- ---") + b.wait_text("#files-footer-owner", "root") # Also check popover b.click("#files-footer-permissions") @@ -342,6 +343,22 @@ class TestFiles(testlib.MachineCase): b.click(".pf-v5-c-popover__close > button") b.wait_not_present(".pf-v5-c-popover") + b.click("#files-footer-owner") + b.wait_in_text(".pf-v5-c-popover dl div:nth-child(1) > dd", "root") + b.wait_in_text(".pf-v5-c-popover dl div:nth-child(2) > dd", "root") + b.click(".pf-v5-c-popover__close > button") + b.wait_not_present(".pf-v5-c-popover") + + # Change group is shown in popover + m.execute("chown root:admin /home/admin/newdir") + b.wait_text("#files-footer-owner", "root:admin") + + b.click("#files-footer-owner") + b.wait_in_text(".pf-v5-c-popover dl div:nth-child(1) > dd", "root") + b.wait_in_text(".pf-v5-c-popover dl div:nth-child(2) > dd", "admin") + b.click(".pf-v5-c-popover__close > button") + b.wait_not_present(".pf-v5-c-popover") + # Change last edit time on cwd m.execute("touch -d '2 hours ago' /home/admin/newdir") b.wait_in_text(".files-footer-mtime", "2 hours ago") @@ -380,6 +397,7 @@ class TestFiles(testlib.MachineCase): b.click("[data-item='newdir']") b.wait_in_text(".files-footer-info", "newdir") b.wait_in_text("#files-footer-permissions", "rwx --- ---") + b.wait_in_text("#files-footer-owner", "root") # Select multiple files m.execute("touch /home/admin/newfile.txt") diff --git a/test/reference b/test/reference index a694ed97..8f24e9a2 160000 --- a/test/reference +++ b/test/reference @@ -1 +1 @@ -Subproject commit a694ed97d64166a81373cad3cc19be661600abbc +Subproject commit 8f24e9a281134a71dc5277094fda1d564d39e435