Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Component: UI
Issues: 14807
Description: Add label query parameter sync with URL in WorkflowTemplates UI to match Workflows list behavior for consistent filtering.
Author: [puretension](https://github.com/puretension)

- WorkflowTemplates UI now properly handles label query parameters (e.g., ?label=key%3Dvalue)
- Combined URL updates and localStorage persistence in single useEffect
- Enables custom UI links for filtered template views
- Verified that URL updates when changing filters and filters persist on page refresh
19 changes: 15 additions & 4 deletions ui/src/workflow-templates/workflow-template-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,13 @@ export function WorkflowTemplateList({match, location, history}: RouteComponentP
const [namespace, setNamespace] = useState(nsUtils.getNamespace(match.params.namespace) || '');
const [sidePanel, setSidePanel] = useState(queryParams.get('sidePanel') === 'true');
const [namePattern, setNamePattern] = useState('');
const [labels, setLabels] = useState([]);
const [labels, setLabels] = useState<string[]>(() => {
const savedOptions = storage.getItem('options', {});
const savedLabels = savedOptions.labels || [];
const labelQueryParam = queryParams.getAll('label');
return labelQueryParam.length > 0 ? labelQueryParam : savedLabels;
});

const [pagination, setPagination] = useState<Pagination>({
offset: queryParams.get('offset'),
limit: parseLimit(queryParams.get('limit')) || savedOptions.paginationLimit || 500
Expand All @@ -62,14 +68,19 @@ export function WorkflowTemplateList({match, location, history}: RouteComponentP
isFirstRender.current = false;
return;
}
storage.setItem('options', {labels}, {});
const params = new URLSearchParams();
labels?.forEach(label => params.append('label', label));
if (sidePanel) {
params.append('sidePanel', 'true');
}
history.push(
historyUrl('workflow-templates' + (nsUtils.getManagedNamespace() ? '' : '/{namespace}'), {
namespace,
sidePanel
extraSearchParams: params
})
);
}, [namespace, sidePanel]);

}, [namespace, sidePanel, labels.toString()]);
// internal state
const [error, setError] = useState<Error>();
const [templates, setTemplates] = useState<WorkflowTemplate[]>();
Expand Down
Loading