Skip to content
Closed
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
3 changes: 2 additions & 1 deletion frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
"sentryDsn": "%VITE_APP_SENTRY_DSN%",
"sentry": {
"dsn": "%VITE_APP_SENTRY_DSN%",
"projectId": "%VITE_APP_SENTRY_PROJECT_ID%"
"projectId": "%VITE_APP_SENTRY_PROJECT_ID%",
"tunnel": "%VITE_APP_SENTRY_TUNNEL%"
},
"posthog": {
"apiKey": "%VITE_APP_POSTHOG_API_KEY%",
Expand Down
1 change: 1 addition & 0 deletions frontend/packages/components/src/lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ interface Config {
sentry?: {
dsn: string;
projectId: string;
tunnel?: string;
};
outerbaseProviderToken: string;
}
Expand Down
1 change: 1 addition & 0 deletions frontend/packages/components/src/third-party-providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export function initThirdPartyProviders(router: unknown, debug: boolean) {
Sentry.init({
dsn: config.sentry.dsn,
integrations,
tunnel: getConfig().sentry?.tunnel,
});
}
}
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/app/data-providers/cloud-data-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,9 @@ export const createNamespaceContext = ({
namespaceQueryOptions() {
return parent.currentProjectNamespaceQueryOptions({ namespace });
},
currentNamespaceAccessTokenQueryOptions() {
return parent.accessTokenQueryOptions({ namespace });
},
engineAdminTokenQueryOptions() {
return queryOptions({
staleTime: 5 * 60 * 1000, // 5 minutes
Expand Down
9 changes: 3 additions & 6 deletions frontend/src/app/data-providers/engine-data-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -469,16 +469,13 @@ export const createNamespaceContext = ({
},
});
},
runnerByNameQueryOptions(opts: {
namespace: string;
runnerName: string;
}) {
runnerByNameQueryOptions(opts: { runnerName: string }) {
return queryOptions({
queryKey: [opts.namespace, "runner", opts.runnerName],
queryKey: [{ namespace }, "runner", opts.runnerName],
enabled: !!opts.runnerName,
queryFn: async ({ signal: abortSignal }) => {
const data = await client.runners.list(
{ namespace: opts.namespace, name: opts.runnerName },
{ namespace, name: opts.runnerName },
{
abortSignal,
},
Expand Down
30 changes: 13 additions & 17 deletions frontend/src/components/actors/actor-queries-context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { ActorId } from "./queries";

type RequestOptions = Parameters<typeof createActorInspectorClient>[1];

export const defaultActorContext = {
export const createDefaultActorContext = ({ hash }: { hash: string } = {}) => ({
createActorInspectorFetchConfiguration: (
actorId: ActorId | string,
): RequestOptions => ({
Expand All @@ -32,7 +32,7 @@ export const defaultActorContext = {
enabled: false,
refetchInterval: 1000,
...opts,
queryKey: ["actor", actorId, "ping"],
queryKey: [hash, "actor", actorId, "ping"],
queryFn: async ({ queryKey: [, actorId] }) => {
const client = this.createActorInspector(actorId);
const response = await client.ping.$get();
Expand All @@ -51,7 +51,7 @@ export const defaultActorContext = {
return queryOptions({
enabled,
refetchInterval: 1000,
queryKey: ["actor", actorId, "state"],
queryKey: [hash, "actor", actorId, "state"],
queryFn: async ({ queryKey: [, actorId] }) => {
const client = this.createActorInspector(actorId);
const response = await client.state.$get();
Expand All @@ -74,7 +74,7 @@ export const defaultActorContext = {
return queryOptions({
enabled,
refetchInterval: 1000,
queryKey: ["actor", actorId, "connections"],
queryKey: [hash, "actor", actorId, "connections"],
queryFn: async ({ queryKey: [, actorId] }) => {
const client = this.createActorInspector(actorId);
const response = await client.connections.$get();
Expand All @@ -93,7 +93,7 @@ export const defaultActorContext = {
) {
return queryOptions({
enabled,
queryKey: ["actor", actorId, "database"],
queryKey: [hash, "actor", actorId, "database"],
queryFn: async ({ queryKey: [, actorId] }) => {
const client = this.createActorInspector(actorId);
const response = await client.db.$get();
Expand Down Expand Up @@ -142,7 +142,7 @@ export const defaultActorContext = {
enabled,
staleTime: 0,
gcTime: 5000,
queryKey: ["actor", actorId, "database", table],
queryKey: [hash, "actor", actorId, "database", table],
queryFn: async ({ queryKey: [, actorId, , table] }) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The query key destructuring pattern doesn't account for the hash parameter that was added to the query key array. The current pattern [, actorId, , table] will extract incorrect values since the actual array structure is now [hash, "actor", actorId, "database", table]. This should be updated to [, , actorId, , table] to properly extract the values from their new positions in the array.

Suggested change
queryFn: async ({ queryKey: [, actorId, , table] }) => {
queryFn: async ({ queryKey: [, , actorId, , table] }) => {

Spotted by Diamond

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

This comment came from an experimental review—please leave feedback if it was helpful/unhelpful. Learn more about experimental comments here.

const client = this.createActorInspector(actorId);
const response = await client.db.$post({
Expand All @@ -163,7 +163,7 @@ export const defaultActorContext = {
return queryOptions({
enabled,
refetchInterval: 1000,
queryKey: ["actor", actorId, "events"],
queryKey: [hash, "actor", actorId, "events"],
queryFn: async ({ queryKey: [, actorId] }) => {
const client = this.createActorInspector(actorId);
const response = await client.events.$get();
Expand All @@ -182,7 +182,7 @@ export const defaultActorContext = {
) {
return queryOptions({
enabled,
queryKey: ["actor", actorId, "rpcs"],
queryKey: [hash, "actor", actorId, "rpcs"],
queryFn: async ({ queryKey: [, actorId] }) => {
const client = this.createActorInspector(actorId);
const response = await client.rpcs.$get();
Expand All @@ -197,7 +197,7 @@ export const defaultActorContext = {

actorClearEventsMutationOptions(actorId: ActorId) {
return {
mutationKey: ["actor", actorId, "clear-events"],
mutationKey: [hash, "actor", actorId, "clear-events"],
mutationFn: async () => {
const client = this.createActorInspector(actorId);
const response = await client.events.clear.$post();
Expand All @@ -211,7 +211,7 @@ export const defaultActorContext = {

actorWakeUpMutationOptions(actorId: ActorId) {
return {
mutationKey: ["actor", actorId, "wake-up"],
mutationKey: [hash, "actor", actorId, "wake-up"],
mutationFn: async () => {
const client = this.createActorInspector(actorId);
try {
Expand All @@ -233,7 +233,7 @@ export const defaultActorContext = {
refetchInterval: 1000,
staleTime: 0,
gcTime: 0,
queryKey: ["actor", actorId, "auto-wake-up"],
queryKey: [hash, "actor", actorId, "auto-wake-up"],
queryFn: async ({ queryKey: [, actorId] }) => {
const client = this.createActorInspector(actorId);
try {
Expand All @@ -246,13 +246,9 @@ export const defaultActorContext = {
retry: false,
});
},
};
});

export type ActorContext = typeof defaultActorContext;

export function createDefaultActorContext(): ActorContext {
return defaultActorContext;
}
export type ActorContext = ReturnType<typeof createDefaultActorContext>;

const ActorContext = createContext({} as ActorContext);

Expand Down
8 changes: 5 additions & 3 deletions frontend/src/components/actors/actors-list-row.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const ActorsListRow = memo(
/>
}
/>
<div className="min-w-0">
<div className="min-w-0 flex items-center">
<Id actorId={actorId} />
<Datacenter actorId={actorId} />
<Tags actorId={actorId} />
Expand Down Expand Up @@ -128,11 +128,13 @@ function Datacenter({ actorId }: { actorId: ActorId }) {
}

if (!datacenter) {
return <SmallText className="text-foreground">-</SmallText>;
return <SmallText className="text-foreground mr-2">-</SmallText>;
}

return (
<SmallText className="text-muted-foreground">{datacenter}</SmallText>
<SmallText className="text-muted-foreground mr-2">
{datacenter}
</SmallText>
);
}

Expand Down
Loading
Loading