Skip to content

Commit

Permalink
fix style
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 9c56d27 commit ae61afe
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 31 deletions.
10 changes: 6 additions & 4 deletions api/core/core.proto
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ service Core {
}

/*
* ListRuntimeObjects lists Weave GitOps runtime components from a cluster. Weave GitOps runtime is composed of Flux runtime
* but also the other components in the ecosystem like TF-controller or Policy Agent.
* ListRuntimeObjects lists Weave GitOps runtime components.
* Weave GitOps runtime is composed of Flux runtime but also other components
* in the ecosystem like TF-controller or Policy Agent.
*/
rpc ListRuntimeObjects(ListRuntimeObjectsRequest)
returns (ListRuntimeObjectsResponse) {
Expand All @@ -76,8 +77,9 @@ service Core {
}

/*
* ListRuntimeCrds lists Weave GitOps runtime components CRDs from a cluster. Weave GitOps runtime is composed of Flux runtime
* but also the other components in the ecosystem like TF-controller or Policy Agent.
* ListRuntimeCrds lists Weave GitOps runtime components CRDs.
* Weave GitOps runtime is composed of Flux runtime but also other components
* in the ecosystem like TF-controller or Policy Agent.
*/
rpc ListRuntimeCrds(ListRuntimeCrdsRequest)
returns (ListRuntimeCrdsResponse) {
Expand Down
3 changes: 2 additions & 1 deletion api/core/core.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,7 @@
},
"/v1/runtime_crds": {
"get": {
"summary": "ListRuntimeCrds lists Weave GitOps runtime components CRDs from a cluster. Weave GitOps runtime is composed of Flux runtime\nbut also the other components in the ecosystem like TF-controller or Policy Agent.",
"operationId": "Core_ListRuntimeCrds",
"responses": {
"200": {
Expand Down Expand Up @@ -634,7 +635,7 @@
},
"/v1/runtime_objects": {
"get": {
"summary": "ListRuntimeObjects lists Weave GitOps runtime components from a clusters. Weave GitOps runtime is composed of Flux runtime\nbut also the other components in the ecosystem like TF-controller or Policy Agent.",
"summary": "ListRuntimeObjects lists Weave GitOps runtime components from a cluster. Weave GitOps runtime is composed of Flux runtime\nbut also the other components in the ecosystem like TF-controller or Policy Agent.",
"operationId": "Core_ListRuntimeObjects",
"responses": {
"200": {
Expand Down
8 changes: 6 additions & 2 deletions pkg/api/core/core_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions ui/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,15 +202,12 @@ const App = () => {
component={withSearchParams(PolicyViolationPage)}
/>
<Route path={V2Routes.UserInfo} component={UserInfo} />

<Route path={V2Routes.Policies} component={PoliciesList} />
<Route
path={V2Routes.PolicyDetailsPage}
component={withSearchParams(PolicyDetailsPage)}
/>

<Redirect exact from="/" to={V2Routes.Automations} />

<Route exact path="*" component={Error} />
</Switch>
</ErrorBoundary>
Expand Down
24 changes: 13 additions & 11 deletions ui/components/FluxRuntime.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,19 @@ 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,
};
}
});
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,
};
}
});

const supportMultipleFlux = true;

Expand Down
13 changes: 7 additions & 6 deletions ui/hooks/flux.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { useMutation, useQuery, useQueryClient } from "react-query";
import { CoreClientContext } from "../contexts/CoreClientContext";
import {
ListFluxCrdsResponse,
ListFluxRuntimeObjectsResponse, ListRuntimeObjectsResponse,
ListFluxRuntimeObjectsResponse,
ListRuntimeObjectsResponse,
ToggleSuspendResourceRequest,
ToggleSuspendResourceResponse,
} from "../lib/api/core/core.pb";
Expand Down Expand Up @@ -52,22 +53,22 @@ export function useListRuntimeObjects(
refetchInterval: 5000,
}
) {
const { api } = useContext(CoreClientContext);
const {api} = useContext(CoreClientContext);

return useQuery<ListRuntimeObjectsResponse, RequestError>(
"runtime_objects",
() => api.ListRuntimeObjects({ namespace, clusterName }),
() => 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 }
() => api.ListRuntimeCrds({clusterName}),
{retry: false, refetchInterval: 5000}
);
}

Expand Down
3 changes: 1 addition & 2 deletions ui/pages/v2/FluxRuntime.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ function FluxRuntime({ className }: Props) {
error: crdsError,
} = useListFluxCrds();
return (

<Page
<Page
loading={isLoading || crdsLoading}
error={error || crdsError}
className={className}
Expand Down
3 changes: 1 addition & 2 deletions ui/pages/v2/Runtime.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +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 ae61afe

Please sign in to comment.