forked from cockpit/cockpit
Compare commits
2 Commits
update-351
...
backport-o
| Author | SHA256 | Date | |
|---|---|---|---|
|
2d699be9a0
|
|||
| 37a2d3a5ac |
63
0010-add-onExpand-prop-to-ListingTable.patch
Normal file
63
0010-add-onExpand-prop-to-ListingTable.patch
Normal file
@@ -0,0 +1,63 @@
|
||||
From a51d1777cc88f4df2e4aa37b2643bdf8862ac61c Mon Sep 17 00:00:00 2001
|
||||
From: Alice Brooks <alice.brooks@suse.com>
|
||||
Date: Wed, 26 Nov 2025 13:22:52 +0000
|
||||
Subject: [PATCH] lib: add onExpand prop to ListingTable
|
||||
|
||||
---
|
||||
pkg/lib/cockpit-components-table.tsx | 12 +++++++++++-
|
||||
1 file changed, 11 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/pkg/lib/cockpit-components-table.tsx b/pkg/lib/cockpit-components-table.tsx
|
||||
index 839b3e1c9e94..8af8a4bbc32f 100644
|
||||
--- a/pkg/lib/cockpit-components-table.tsx
|
||||
+++ b/pkg/lib/cockpit-components-table.tsx
|
||||
@@ -65,6 +65,7 @@ const _ = cockpit.gettext;
|
||||
* - sortMethod: callback function used for sorting rows. Called with 3 parameters: sortMethod(rows, activeSortDirection, activeSortIndex)
|
||||
* - style: object of additional css rules
|
||||
* - afterToggle: function to be called when content is toggled
|
||||
+ * - onExpand: function to be called when content is expanded
|
||||
* - onSelect: function to be called when a checkbox is clicked. Called with 5 parameters:
|
||||
* event, isSelected, rowIndex, rowData, extraData. rowData contains props with an id property of the clicked row.
|
||||
* - onHeaderSelect: event, isSelected.
|
||||
@@ -98,9 +99,12 @@ export interface ListingTableColumnProps {
|
||||
props?: ThProps;
|
||||
}
|
||||
|
||||
+export type RowRecord = Record<string | number, boolean>;
|
||||
+
|
||||
export interface ListingTableProps extends Omit<TableProps, 'rows' | 'onSelect'> {
|
||||
actions?: React.ReactNode[],
|
||||
afterToggle?: (expanded: boolean) => void,
|
||||
+ onExpand?: (rows: RowRecord) => void,
|
||||
caption?: string,
|
||||
className?: string,
|
||||
columns: (string | ListingTableColumnProps)[],
|
||||
@@ -121,6 +125,7 @@ export interface ListingTableProps extends Omit<TableProps, 'rows' | 'onSelect'>
|
||||
export const ListingTable = ({
|
||||
actions = [],
|
||||
afterToggle,
|
||||
+ onExpand,
|
||||
caption = '',
|
||||
className = '',
|
||||
columns: cells = [],
|
||||
@@ -139,7 +144,7 @@ export const ListingTable = ({
|
||||
...extraProps
|
||||
} : ListingTableProps) => {
|
||||
let rows = [...tableRows];
|
||||
- const [expanded, setExpanded] = useState<Record<string | number, boolean>>({});
|
||||
+ const [expanded, setExpanded] = useState<RowRecord>({});
|
||||
const [newItems, setNewItems] = useState<React.Key[]>([]);
|
||||
const [currentRowsKeys, setCurrentRowsKeys] = useState<React.Key[]>([]);
|
||||
const [activeSortIndex, setActiveSortIndex] = useState(sortBy?.index ?? 0);
|
||||
@@ -165,6 +170,11 @@ export const ListingTable = ({
|
||||
setCurrentRowsKeys(crk => [...new Set([...crk, ..._rowKeys])]);
|
||||
}, [currentRowsKeysStr, rowKeysStr]);
|
||||
|
||||
+ useEffect(() => {
|
||||
+ if (onExpand)
|
||||
+ onExpand(expanded);
|
||||
+ }, [expanded, onExpand]);
|
||||
+
|
||||
const isSortable = cells.some(col => typeof col != "string" && col.sortable);
|
||||
const isExpandable = rows.some(row => row.expandedContent);
|
||||
|
||||
@@ -1,3 +1,14 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Dec 10 12:05:51 UTC 2025 - Alice Brooks <alice.brooks@suse.com>
|
||||
|
||||
- Add 0010-add-onExpand-prop-to-ListingTable.patch to backport a feature
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Nov 19 08:05:47 UTC 2025 - Zdenek Kubala <zkubala@suse.com>
|
||||
|
||||
- Update SELinux module dir as macro to allow root path move from /var/lib/selinux
|
||||
to /etc/selinux (bsc#1221342)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Nov 13 04:36:07 UTC 2025 - Alice Brooks <alice.brooks@suse.com>
|
||||
|
||||
|
||||
@@ -91,6 +91,7 @@ Patch111: 0001-cockpit-overview-support-SUSE_SUPPORT_PRODUCT-keys.patch
|
||||
Patch112: 0002-cockpit-kdump-support-SLE-micro-6.2.patch
|
||||
Patch113: 0003-branding-use-SUSE_SUPPORT_PRODUCT-and-SUSE_SUPPORT_P.patch
|
||||
Patch114: 0009-packagekit-reboot-notification.patch
|
||||
Patch115: 0010-add-onExpand-prop-to-ListingTable.patch
|
||||
Patch201: remove_rh_links.patch
|
||||
|
||||
%define build_all 1
|
||||
@@ -239,6 +240,7 @@ BuildRequires: python3-pytest-timeout
|
||||
%patch -P 106 -p1
|
||||
%patch -P 109 -p1
|
||||
%patch -P 114 -p1
|
||||
%patch -P 115 -p1
|
||||
|
||||
# SLE Micro specific patches
|
||||
%if 0%{?is_smo}
|
||||
@@ -765,7 +767,7 @@ SELinux policy module for the cockpit-ws package.
|
||||
%{_datadir}/selinux/packages/%{selinuxtype}/%{name}.pp.bz2
|
||||
%{_mandir}/man8/%{name}_session_selinux.8cockpit.*
|
||||
%{_mandir}/man8/%{name}_ws_selinux.8cockpit.*
|
||||
%ghost %{_sharedstatedir}/selinux/%{selinuxtype}/active/modules/200/%{name}
|
||||
%ghost %{_selinux_store_path}/%{selinuxtype}/active/modules/200/%{name}
|
||||
|
||||
%posttrans ws-selinux
|
||||
%selinux_relabel_pre -s %{selinuxtype}
|
||||
|
||||
Reference in New Issue
Block a user