Skip to content

Commit

Permalink
Merge branch 'begelundmuller/async-reconcile-integration' of https://…
Browse files Browse the repository at this point in the history
…github.com/rilldata/rill into begelundmuller/async-reconcile-integration
  • Loading branch information
begelundmuller committed Oct 3, 2023
2 parents 1a20387 + 7613430 commit 682eb0c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 18 deletions.
8 changes: 5 additions & 3 deletions web-admin/src/features/projects/ProjectDeploymentLogs.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@
<span class="text-red-600 break-all">
{error.message}
</span>
<span class="text-stone-500 font-semibold shrink-0">
{error.filePath}
</span>
{#if error.filePath}
<span class="text-stone-500 font-semibold shrink-0">
{error.filePath}
</span>
{/if}
</li>
{/each}
{/if}
Expand Down
7 changes: 1 addition & 6 deletions web-admin/src/features/projects/dashboards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@ import {
ResourceKind,
useFilteredResources,
} from "@rilldata/web-common/features/entity-management/resource-selectors";
import type {
V1CatalogEntry,
V1MetricsView,
V1MetricsViewSpec,
V1Resource,
} from "@rilldata/web-common/runtime-client";
import type { V1Resource } from "@rilldata/web-common/runtime-client";
import Axios from "axios";

export interface DashboardListItem {
Expand Down
8 changes: 6 additions & 2 deletions web-admin/src/features/projects/getProjectErrors.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { MainResourceKinds } from "@rilldata/web-common/features/entity-management/resource-invalidations";
import { useProjectParser } from "@rilldata/web-common/features/entity-management/resource-selectors";
import {
createRuntimeServiceListResources,
Expand All @@ -20,9 +21,12 @@ export function getProjectErrors(
projectParserResp.data?.projectParser?.state?.parseErrors ?? [];
const resourceErrors: Array<V1ParseError> =
resourcesResp.data?.resources
?.filter((r) => !!r.meta.reconcileError)
?.filter(
(r) =>
!!r.meta.reconcileError && MainResourceKinds[r.meta.name.kind]
)
.map((r) => ({
filePath: r.meta.filePaths[0],
filePath: r.meta.filePaths[0], // TODO: handle multiple files mapping to same resource
message: r.meta.reconcileError,
})) ?? [];
return [...projectParserErrors, ...resourceErrors];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,29 @@ import { runtime } from "@rilldata/web-common/runtime-client/runtime-store";
import type { QueryClient } from "@tanstack/svelte-query";
import { get } from "svelte/store";

const MainResources: {
export const MainResourceKinds: {
[kind in ResourceKind]?: true;
} = {
[ResourceKind.Source]: true,
[ResourceKind.Model]: true,
[ResourceKind.MetricsView]: true,
};
const UsedResources: {
const UsedResourceKinds: {
[kind in ResourceKind]?: true;
} = {
[ResourceKind.ProjectParser]: true,
...MainResources,
...MainResourceKinds,
};

export function invalidateResourceResponse(
queryClient: QueryClient,
res: V1WatchResourcesResponse
) {
// only process for the `ResourceKind` present in `UsedResources`
if (!UsedResources[res.name.kind]) return;
// only process for the `ResourceKind` present in `UsedResourceKinds`
if (!UsedResourceKinds[res.name.kind]) return;
// for main resources only invalidate if it became idle
if (
MainResources[res.name.kind] &&
MainResourceKinds[res.name.kind] &&
res.resource.meta.reconcileStatus !==
V1ReconcileStatus.RECONCILE_STATUS_IDLE
)
Expand All @@ -62,7 +62,7 @@ export function invalidateResourceResponse(
}

// only re-fetch list queries for kinds in `MainResources`
if (!MainResources[res.name.kind]) return;
if (!MainResourceKinds[res.name.kind]) return;
resourcesStore.setResource(res.resource);
return queryClient.refetchQueries(
// we only use individual kind's queries
Expand Down

0 comments on commit 682eb0c

Please sign in to comment.