Skip to content
Open
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
4 changes: 2 additions & 2 deletions flux/src/helm-releases/HelmReleaseList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import React from 'react';
import { NotSupported } from '../checkflux';
import { HelmRelease } from '../common/Resources';
import Table from '../common/Table';
import { NameLink } from '../helpers';
import { NameLink, useNamespaces } from '../helpers';

export function HelmReleases() {
const filterFunction = useFilterFunc();
const [resources, error] = HelmRelease.useList();
const [resources, error] = HelmRelease.useList({ namespace: useNamespaces() });

if (error?.status === 404) {
return <NotSupported typeName="Helm Releases" />;
Expand Down
12 changes: 11 additions & 1 deletion flux/src/helpers/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import K8s from '@kinvolk/headlamp-plugin/lib/k8s';
import Event from '@kinvolk/headlamp-plugin/lib/K8s/event';
import { KubeObject, KubeObjectClass } from '@kinvolk/headlamp-plugin/lib/lib/k8s/cluster';
import { localeDate, timeAgo } from '@kinvolk/headlamp-plugin/lib/Utils';
import React, { useEffect } from 'react';
import React, { useEffect, useMemo } from 'react';
import { useSelector } from 'react-redux';
import Table from '../common/Table';
import { PluralName } from './pluralName';

Expand Down Expand Up @@ -243,3 +244,12 @@ export function useFluxCheck() {
allCrdsSuccessful,
};
}

export const useNamespaces = () => {
interface FilterState {
namespaces: Set<string>;
}

const namespacesSet = useSelector(({ filter }: { filter: FilterState }) => filter.namespaces);
return useMemo(() => [...namespacesSet], [namespacesSet]);
};
8 changes: 4 additions & 4 deletions flux/src/image-automation/ImageAutomationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { NotSupported } from '../checkflux';
import SourceLink from '../common/Link';
import { ImagePolicy, ImageRepository, ImageUpdateAutomation } from '../common/Resources';
import Table from '../common/Table';
import { NameLink } from '../helpers';
import { NameLink, useNamespaces } from '../helpers';

export function ImageAutomation() {
return (
Expand All @@ -25,7 +25,7 @@ export function ImageAutomation() {

function ImageUpdateAutomationList() {
const filterFunction = useFilterFunc();
const [resources, error] = ImageUpdateAutomation.useList();
const [resources, error] = ImageUpdateAutomation.useList({ namespace: useNamespaces() });

if (error?.status === 404) {
return <NotSupported typeName="Image Update Automations" />;
Expand Down Expand Up @@ -74,7 +74,7 @@ function ImageUpdateAutomationList() {

function ImagePolicyList() {
const filterFunction = useFilterFunc();
const [resources, error] = ImagePolicy.useList();
const [resources, error] = ImagePolicy.useList({ namespace: useNamespaces() });

if (error?.status === 404) {
return <NotSupported typeName="Image Update Policies" />;
Expand Down Expand Up @@ -107,7 +107,7 @@ function ImagePolicyList() {

function ImageRepositoryList() {
const filterFunction = useFilterFunc();
const [resources, error] = ImageRepository.useList();
const [resources, error] = ImageRepository.useList({ namespace: useNamespaces() });

if (error?.status === 404) {
return <NotSupported typeName="Image Repositories" />;
Expand Down
4 changes: 2 additions & 2 deletions flux/src/kustomizations/KustomizationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import React from 'react';
import { NotSupported } from '../checkflux';
import { Kustomization } from '../common/Resources';
import Table from '../common/Table';
import { NameLink } from '../helpers';
import { NameLink, useNamespaces } from '../helpers';

export function Kustomizations() {
const filterFunction = useFilterFunc();
const [resources, error] = Kustomization.useList();
const [resources, error] = Kustomization.useList({ namespace: useNamespaces() });

if (error?.status === 404) {
return <NotSupported typeName="Kustomizations" />;
Expand Down
7 changes: 4 additions & 3 deletions flux/src/notifications/NotificationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import React from 'react';
import { NotSupported } from '../checkflux';
import { AlertNotification, ProviderNotification, ReceiverNotification } from '../common/Resources';
import Table from '../common/Table';
import { useNamespaces } from '../helpers';

export function Notifications() {
return (
Expand All @@ -22,7 +23,7 @@ export function Notifications() {

function Alerts() {
const filterFunction = useFilterFunc();
const [resources, error] = AlertNotification.useList();
const [resources, error] = AlertNotification.useList({ namespace: useNamespaces() });

if (error?.status === 404) {
return <NotSupported typeName="Alerts" />;
Expand Down Expand Up @@ -90,7 +91,7 @@ function Alerts() {

function Providers() {
const filterFunction = useFilterFunc();
const [resources, error] = ProviderNotification.useList();
const [resources, error] = ProviderNotification.useList({ namespace: useNamespaces() });

if (error?.status === 404) {
return <NotSupported typeName="Providers" />;
Expand Down Expand Up @@ -174,7 +175,7 @@ function Providers() {

function Receivers() {
const filterFunction = useFilterFunc();
const [resources, error] = ReceiverNotification.useList();
const [resources, error] = ReceiverNotification.useList({ namespace: useNamespaces() });

if (error?.status === 404) {
return <NotSupported typeName="Receivers" />;
Expand Down
3 changes: 2 additions & 1 deletion flux/src/sources/SourceList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
OCIRepository,
} from '../common/Resources';
import Table, { TableProps } from '../common/Table';
import { useNamespaces } from '../helpers';

export function FluxSources() {
return (
Expand Down Expand Up @@ -52,7 +53,7 @@ interface FluxSourceCustomResourceRendererProps {
function FluxSource(props: FluxSourceCustomResourceRendererProps) {
const filterFunction = useFilterFunc();
const { resourceClass, title, pluralName } = props;
const [resources, error] = resourceClass.useList();
const [resources, error] = resourceClass.useList({ namespace: useNamespaces() });

function prepareColumns() {
const columns: TableProps['columns'] = [
Expand Down
Loading