Skip to content

Commit

Permalink
prettified
Browse files Browse the repository at this point in the history
Signed-off-by: Eneko Fernandez <eneko@weave.works>
  • Loading branch information
enekofb committed Dec 18, 2023
1 parent ae61afe commit 6e4cdbe
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 38 deletions.
24 changes: 12 additions & 12 deletions ui/components/FluxRuntime.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,18 @@ function FluxRuntime({ className, deployments, crds }: Props) {
];
const fluxVersions: { [key: string]: FluxVersion } = {};
deployments
.filter((d) => d.labels[partOfLabel] == fluxLabel)
.forEach((d) => {
const fv = d.labels[fluxVersionLabel];
const k = `${fv}${d.clusterName}${d.namespace}`;
if (!fluxVersions[k]) {
fluxVersions[k] = {
version: fv,
clusterName: d.clusterName,
namespace: d.namespace,
};
}
});
.filter((d) => d.labels[partOfLabel] == fluxLabel)
.forEach((d) => {
const fv = d.labels[fluxVersionLabel];
const k = `${fv}${d.clusterName}${d.namespace}`;
if (!fluxVersions[k]) {
fluxVersions[k] = {
version: fv,
clusterName: d.clusterName,
namespace: d.namespace,
};
}
});

const supportMultipleFlux = true;

Expand Down
46 changes: 23 additions & 23 deletions ui/hooks/flux.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { useContext } from "react";
import { useMutation, useQuery, useQueryClient } from "react-query";
import { CoreClientContext } from "../contexts/CoreClientContext";
import {
ListFluxCrdsResponse,
ListFluxRuntimeObjectsResponse,
ListRuntimeObjectsResponse,
ToggleSuspendResourceRequest,
ToggleSuspendResourceResponse,
ListFluxCrdsResponse,
ListFluxRuntimeObjectsResponse,
ListRuntimeObjectsResponse,
ToggleSuspendResourceRequest,
ToggleSuspendResourceResponse,
} from "../lib/api/core/core.pb";
import { GroupVersionKind, Kind } from "../lib/api/core/types.pb";
import { getChildren } from "../lib/graph";
Expand Down Expand Up @@ -46,30 +46,30 @@ export function useListFluxCrds(clusterName = DefaultCluster) {
}

export function useListRuntimeObjects(
clusterName = DefaultCluster,
namespace = NoNamespace,
opts: ReactQueryOptions<ListRuntimeObjectsResponse, RequestError> = {
retry: false,
refetchInterval: 5000,
}
clusterName = DefaultCluster,
namespace = NoNamespace,
opts: ReactQueryOptions<ListRuntimeObjectsResponse, RequestError> = {
retry: false,
refetchInterval: 5000,
}
) {
const {api} = useContext(CoreClientContext);
const { api } = useContext(CoreClientContext);

return useQuery<ListRuntimeObjectsResponse, RequestError>(
"runtime_objects",
() => api.ListRuntimeObjects({namespace, clusterName}),
opts
);
return useQuery<ListRuntimeObjectsResponse, RequestError>(
"runtime_objects",
() => api.ListRuntimeObjects({ namespace, clusterName }),
opts
);
}

export function useListRuntimeCrds(clusterName = DefaultCluster) {
const {api} = useContext(CoreClientContext);
const { api } = useContext(CoreClientContext);

return useQuery<ListFluxCrdsResponse, RequestError>(
"runtime_crds",
() => api.ListRuntimeCrds({clusterName}),
{retry: false, refetchInterval: 5000}
);
return useQuery<ListFluxCrdsResponse, RequestError>(
"runtime_crds",
() => api.ListRuntimeCrds({ clusterName }),
{ retry: false, refetchInterval: 5000 }
);
}

export function flattenChildren(children: FluxObject[]) {
Expand Down
2 changes: 1 addition & 1 deletion ui/pages/v2/FluxRuntime.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function FluxRuntime({ className }: Props) {
error: crdsError,
} = useListFluxCrds();
return (
<Page
<Page
loading={isLoading || crdsLoading}
error={error || crdsError}
className={className}
Expand Down
4 changes: 2 additions & 2 deletions ui/pages/v2/Runtime.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from "react";
import styled from "styled-components";
import FluxRuntimeComponent from "../../components/FluxRuntime";
import Page from "../../components/Page";
import {useListRuntimeCrds, useListRuntimeObjects} from "../../hooks/flux";
import { useListRuntimeCrds, useListRuntimeObjects } from "../../hooks/flux";

type Props = {
className?: string;
Expand All @@ -16,7 +16,7 @@ function Runtime({ className }: Props) {
error: crdsError,
} = useListRuntimeCrds();
return (
<Page
<Page
loading={isLoading || crdsLoading}
error={error || crdsError}
className={className}
Expand Down

0 comments on commit 6e4cdbe

Please sign in to comment.