@skyhook-io/k8s-ui 1.7.3 → 1.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/components/audit/AuditFindingsTable.tsx +7 -0
- package/src/components/checks/ChecksView.tsx +899 -0
- package/src/components/checks/checks.test.ts +40 -0
- package/src/components/checks/index.ts +3 -0
- package/src/components/checks/severity.ts +63 -0
- package/src/components/checks/types.ts +138 -0
- package/src/components/gitops/GitOpsTableView.tsx +246 -28
- package/src/components/resources/ResourcesView.tsx +61 -0
- package/src/index.ts +5 -0
|
@@ -1776,6 +1776,13 @@ interface ResourcesViewProps {
|
|
|
1776
1776
|
* namespace+name only.
|
|
1777
1777
|
*/
|
|
1778
1778
|
resolveRowCluster?: (resource: any) => { id: string; name: string } | undefined
|
|
1779
|
+
/**
|
|
1780
|
+
* Clears the global namespace selection (the header NamespaceSwitcher state).
|
|
1781
|
+
* When wired, the "Clear filters" button also drops the active namespaces;
|
|
1782
|
+
* otherwise it only resets the view-local filter state. Host-owned because
|
|
1783
|
+
* the switcher lives outside this component and may persist server-side.
|
|
1784
|
+
*/
|
|
1785
|
+
onClearNamespaces?: () => void
|
|
1779
1786
|
}
|
|
1780
1787
|
|
|
1781
1788
|
// Default selected kind
|
|
@@ -1922,6 +1929,7 @@ export function ResourcesView({
|
|
|
1922
1929
|
onRowSelect,
|
|
1923
1930
|
onCompareSubmit,
|
|
1924
1931
|
resolveRowCluster,
|
|
1932
|
+
onClearNamespaces,
|
|
1925
1933
|
}: ResourcesViewProps) {
|
|
1926
1934
|
const initialFilters = getInitialFiltersFromURL()
|
|
1927
1935
|
const [selectedKind, setSelectedKind] = useState<SelectedKindInfo>(() => getInitialKindFromURL(basePath, defaultKind, locationPathname, locationSearch))
|
|
@@ -2684,6 +2692,25 @@ export function ResourcesView({
|
|
|
2684
2692
|
navigate({ pathname: newPath, search: queryStr }, { replace: !pushHistory })
|
|
2685
2693
|
}, [navigate, basePath])
|
|
2686
2694
|
|
|
2695
|
+
const clearAllFilters = useCallback(() => {
|
|
2696
|
+
setSearchTerm('')
|
|
2697
|
+
setColumnFilters({})
|
|
2698
|
+
setProblemFilters([])
|
|
2699
|
+
setLabelSelector('')
|
|
2700
|
+
setOwnerKind('')
|
|
2701
|
+
setOwnerName('')
|
|
2702
|
+
setShowInactiveReplicaSets(false)
|
|
2703
|
+
// Filter-only URL params. Path + kind + namespace + other cross-view
|
|
2704
|
+
// params are out of scope here; the host's onClearNamespaces (and its
|
|
2705
|
+
// own state→URL sync) owns namespace cleanup.
|
|
2706
|
+
const params = new URLSearchParams(window.location.search)
|
|
2707
|
+
for (const key of ['search', 'filters', 'problems', 'labels', 'ownerKind', 'ownerName', 'showInactive']) {
|
|
2708
|
+
params.delete(key)
|
|
2709
|
+
}
|
|
2710
|
+
navigate({ pathname: window.location.pathname, search: params.toString() }, { replace: true })
|
|
2711
|
+
onClearNamespaces?.()
|
|
2712
|
+
}, [navigate, onClearNamespaces])
|
|
2713
|
+
|
|
2687
2714
|
// Update URL when any filter changes
|
|
2688
2715
|
useEffect(() => {
|
|
2689
2716
|
// Skip URL update if we're syncing FROM the URL (e.g., browser back button)
|
|
@@ -3505,6 +3532,17 @@ export function ResourcesView({
|
|
|
3505
3532
|
|
|
3506
3533
|
// Check if any filters are active
|
|
3507
3534
|
const hasOwnerFilter = ownerKind !== '' && ownerName !== ''
|
|
3535
|
+
// Namespace contribution gated on a host-wired clearer: without it the
|
|
3536
|
+
// Clear filters button can't drop the namespace, so showing it would be
|
|
3537
|
+
// a no-op for that case.
|
|
3538
|
+
const hasAnyFilter =
|
|
3539
|
+
!!searchTerm ||
|
|
3540
|
+
!!labelSelector ||
|
|
3541
|
+
hasOwnerFilter ||
|
|
3542
|
+
problemFilters.length > 0 ||
|
|
3543
|
+
Object.values(columnFilters).some((vals) => vals.length > 0) ||
|
|
3544
|
+
showInactiveReplicaSets ||
|
|
3545
|
+
(!!onClearNamespaces && namespaces.length > 0)
|
|
3508
3546
|
|
|
3509
3547
|
|
|
3510
3548
|
// Toggle problem filter
|
|
@@ -3799,6 +3837,19 @@ export function ResourcesView({
|
|
|
3799
3837
|
</span>
|
|
3800
3838
|
)}
|
|
3801
3839
|
|
|
3840
|
+
{hasAnyFilter && (
|
|
3841
|
+
<Tooltip content={!!onClearNamespaces && namespaces.length > 0 ? 'Reset all filters and the active namespace' : 'Reset all filters'}>
|
|
3842
|
+
<button
|
|
3843
|
+
type="button"
|
|
3844
|
+
onClick={clearAllFilters}
|
|
3845
|
+
className="flex items-center gap-1.5 px-2.5 py-1 rounded-lg text-xs text-theme-text-secondary hover:text-theme-text-primary hover:bg-theme-elevated transition-colors"
|
|
3846
|
+
>
|
|
3847
|
+
<RotateCcw className="w-3.5 h-3.5" />
|
|
3848
|
+
<span>Clear filters</span>
|
|
3849
|
+
</button>
|
|
3850
|
+
</Tooltip>
|
|
3851
|
+
)}
|
|
3852
|
+
|
|
3802
3853
|
{lastUpdated && <LastUpdatedLabel lastUpdated={lastUpdated} />}
|
|
3803
3854
|
{/* Column picker */}
|
|
3804
3855
|
<div className="relative" ref={columnPickerRef}>
|
|
@@ -3978,6 +4029,16 @@ export function ResourcesView({
|
|
|
3978
4029
|
</div>
|
|
3979
4030
|
)
|
|
3980
4031
|
})()}
|
|
4032
|
+
{hasAnyFilter && (
|
|
4033
|
+
<button
|
|
4034
|
+
type="button"
|
|
4035
|
+
onClick={clearAllFilters}
|
|
4036
|
+
className="flex items-center gap-1.5 mt-3 px-3 py-1.5 text-sm rounded-md bg-theme-elevated hover:bg-theme-border text-theme-text-secondary hover:text-theme-text-primary transition-colors"
|
|
4037
|
+
>
|
|
4038
|
+
<RotateCcw className="w-3.5 h-3.5" />
|
|
4039
|
+
Clear filters
|
|
4040
|
+
</button>
|
|
4041
|
+
)}
|
|
3981
4042
|
</div>
|
|
3982
4043
|
) : (
|
|
3983
4044
|
<MetricsContext.Provider value={metricsLookup}>
|
package/src/index.ts
CHANGED
|
@@ -40,6 +40,11 @@ export * from './components/topology'
|
|
|
40
40
|
// Cluster audit (AuditCard, AuditAlerts, AuditFindingsTable)
|
|
41
41
|
export * from './components/audit'
|
|
42
42
|
|
|
43
|
+
// Checks remediation queue (ChecksView, shared types + severity vocabulary).
|
|
44
|
+
// Host-agnostic: Hub feeds fleet-resolved data, OSS can feed a single-cluster
|
|
45
|
+
// resolve.
|
|
46
|
+
export * from './components/checks'
|
|
47
|
+
|
|
43
48
|
// Cluster switcher (shared trigger+dropdown for OSS Radar and Radar Hub)
|
|
44
49
|
export * from './components/cluster-switcher'
|
|
45
50
|
|