Skip to content
Merged
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
6 changes: 5 additions & 1 deletion services/console/src/components/auth/AuthOAuth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ const AuthOAuth = (props: Props) => {
);
});
};
const [_jsonAuthUser] = createResource<JsonAuthUser>(fetcher, getAuthUser);
const [_jsonAuthUser] = createResource<
// biome-ignore lint/suspicious/noConfusingVoidType: getAuthUser navigates and returns nothing
void | null,
ReturnType<typeof fetcher>
>(fetcher, getAuthUser);

return <></>;
};
Expand Down
22 changes: 11 additions & 11 deletions services/console/src/components/auth/AuthRedirect.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import * as Sentry from "@sentry/astro";
import { Show, createMemo, createResource } from "solid-js";
import type {
JsonAccept,
JsonAuthAck,
JsonAuthUser,
JsonOrganization,
} from "../../types/bencher";
import type { JsonAccept, JsonAuthUser } from "../../types/bencher";
import { authUser } from "../../util/auth";
import { httpPost } from "../../util/http";
import { NotifyKind, navigateNotify } from "../../util/notify";
Expand Down Expand Up @@ -57,7 +52,11 @@ const AuthRedirect = (props: { apiUrl?: string; path: string }) => {
);
});
};
const [_jsonAuth] = createResource<JsonAuthAck>(acceptFetcher, acceptInvite);
const [_jsonAuth] = createResource<
// biome-ignore lint/suspicious/noConfusingVoidType: acceptInvite navigates and returns nothing
void | null,
ReturnType<typeof acceptFetcher>
>(acceptFetcher, acceptInvite);

const claimFetcher = createMemo(() => {
return {
Expand Down Expand Up @@ -97,10 +96,11 @@ const AuthRedirect = (props: { apiUrl?: string; path: string }) => {
);
});
};
const [_jsonOrganization] = createResource<JsonOrganization>(
claimFetcher,
claimProject,
);
const [_jsonOrganization] = createResource<
// biome-ignore lint/suspicious/noConfusingVoidType: claimProject navigates and returns nothing
void | null,
ReturnType<typeof claimFetcher>
>(claimFetcher, claimProject);

return (
<Show
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ const BillingPanel = (props: Props) => {
return null;
});
};
const [usage, { refetch }] = createResource<null | JsonUsage>(
fetcher,
fetchPlan,
);
const [usage, { refetch }] = createResource<
null | JsonUsage,
ReturnType<typeof fetcher>
>(fetcher, fetchPlan);

return (
<Show
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ const OnboardInvite = (props: Props) => {
return;
});
};
const [organizations] = createResource<undefined | JsonOrganization[]>(
orgsFetcher,
getOrganizations,
);
const [organizations] = createResource<
undefined | JsonOrganization[],
ReturnType<typeof orgsFetcher>
>(orgsFetcher, getOrganizations);

const organization = createMemo(() => {
const orgs = organizations();
Expand Down Expand Up @@ -178,10 +178,10 @@ const OnboardInvite = (props: Props) => {
return null;
});
};
const [_invite] = createResource<undefined | JsonAuthAck>(
inviteFetcher,
postInvite,
);
const [_invite] = createResource<
undefined | JsonAuthAck,
ReturnType<typeof inviteFetcher>
>(inviteFetcher, postInvite);

return (
<>
Expand Down
28 changes: 15 additions & 13 deletions services/console/src/components/console/onboard/OnboardKey.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ const OnboardKey = (props: Props) => {
return;
});
};
const [organizations] = createResource<undefined | JsonOrganization[]>(
orgsFetcher,
getOrganizations,
);
const [organizations] = createResource<
undefined | JsonOrganization[],
ReturnType<typeof orgsFetcher>
>(orgsFetcher, getOrganizations);

const organization = createMemo(() => {
const orgs = organizations();
Expand Down Expand Up @@ -129,10 +129,10 @@ const OnboardKey = (props: Props) => {
return;
});
};
const [projects] = createResource<undefined | JsonProject[]>(
projectsFetcher,
getProjects,
);
const [projects] = createResource<
undefined | JsonProject[],
ReturnType<typeof projectsFetcher>
>(projectsFetcher, getProjects);

const project = createMemo(() => {
const orgProjects = projects();
Expand Down Expand Up @@ -174,10 +174,10 @@ const OnboardKey = (props: Props) => {
return;
});
};
const [apiKeys] = createResource<undefined | JsonProjectKey[]>(
keysFetcher,
getKeys,
);
const [apiKeys] = createResource<
undefined | JsonProjectKey[],
ReturnType<typeof keysFetcher>
>(keysFetcher, getKeys);

const keyFetcher = createMemo(() => {
return {
Expand Down Expand Up @@ -225,7 +225,9 @@ const OnboardKey = (props: Props) => {
});
};
const [apiKey] = createResource<
undefined | JsonProjectKey | JsonProjectKeyCreated
// biome-ignore lint/suspicious/noConfusingVoidType: getKey returns early without a value
void | JsonProjectKey | JsonProjectKeyCreated,
ReturnType<typeof keyFetcher>
>(keyFetcher, getKey);

const keyValue = createMemo(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ const OnboardPlan = (props: Props) => {
return;
});
};
const [organizations] = createResource<undefined | JsonOrganization[]>(
orgsFetcher,
getOrganizations,
);
const [organizations] = createResource<
undefined | JsonOrganization[],
ReturnType<typeof orgsFetcher>
>(orgsFetcher, getOrganizations);

const organization = createMemo(() => {
const orgs = organizations();
Expand Down
27 changes: 14 additions & 13 deletions services/console/src/components/console/onboard/OnboardProject.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ const OnboardProject = (props: Props) => {
return;
});
};
const [organizations] = createResource<undefined | JsonOrganization[]>(
orgsFetcher,
getOrganizations,
);
const [organizations] = createResource<
undefined | JsonOrganization[],
ReturnType<typeof orgsFetcher>
>(orgsFetcher, getOrganizations);

const organization = createMemo(() => {
const orgs = organizations();
Expand Down Expand Up @@ -133,7 +133,8 @@ const OnboardProject = (props: Props) => {
});
};
const [projects, { refetch: refetchProjects }] = createResource<
undefined | JsonProject[]
undefined | JsonProject[],
ReturnType<typeof projectsFetcher>
>(projectsFetcher, getProjects);

const organizationProject = createMemo(() => {
Expand Down Expand Up @@ -186,10 +187,10 @@ const OnboardProject = (props: Props) => {
return;
});
};
const [project] = createResource<undefined | JsonProject>(
projectFetcher,
getProject,
);
const [project] = createResource<
undefined | JsonProject,
ReturnType<typeof projectFetcher>
>(projectFetcher, getProject);

const [renameProject, setRenameProject] = createSignal<null | string>(null);
const [renameValid, setRenameValid] = createSignal<null | boolean>(null);
Expand Down Expand Up @@ -255,10 +256,10 @@ const OnboardProject = (props: Props) => {
return;
});
};
const [_updatedProject] = createResource<undefined | JsonProject>(
updateProjectFetcher,
updateProject,
);
const [_updatedProject] = createResource<
undefined | JsonProject,
ReturnType<typeof updateProjectFetcher>
>(updateProjectFetcher, updateProject);

return (
<>
Expand Down
16 changes: 8 additions & 8 deletions services/console/src/components/console/onboard/OnboardRun.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ const OnboardRun = (props: Props) => {
return null;
});
};
const [organizations] = createResource<null | JsonOrganization[]>(
orgsFetcher,
getOrganizations,
);
const [organizations] = createResource<
null | JsonOrganization[],
ReturnType<typeof orgsFetcher>
>(orgsFetcher, getOrganizations);

const organization = createMemo(() => {
const orgs = organizations();
Expand Down Expand Up @@ -134,10 +134,10 @@ const OnboardRun = (props: Props) => {
return null;
});
};
const [projects] = createResource<null | JsonProject[]>(
projectsFetcher,
getProjects,
);
const [projects] = createResource<
null | JsonProject[],
ReturnType<typeof projectsFetcher>
>(projectsFetcher, getProjects);

const runCode = createMemo(() => {
const orgProjects = projects();
Expand Down
70 changes: 35 additions & 35 deletions services/console/src/components/console/perf/PerfPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -746,29 +746,29 @@ const PerfPanel = (props: Props) => {
token: user?.token,
};
});
const [plot_selected] = createResource<JsonPlot[]>(
selectedPlotFetcher,
async (fetcher) => {
if (
!fetcher.bencher_valid ||
!fetcher.plot ||
!fetcher.project_slug ||
fetcher.project_slug === "undefined" ||
(props.isConsole && !validJwt(fetcher.token)) ||
props.isEmbed === true
) {
const [plot_selected] = createResource<
JsonPlot[],
ReturnType<typeof selectedPlotFetcher>
>(selectedPlotFetcher, async (fetcher) => {
if (
!fetcher.bencher_valid ||
!fetcher.plot ||
!fetcher.project_slug ||
fetcher.project_slug === "undefined" ||
(props.isConsole && !validJwt(fetcher.token)) ||
props.isEmbed === true
) {
return [];
}
const path = `/v0/projects/${fetcher.project_slug}/plots/${fetcher.plot}`;
return await httpGet(props.apiUrl, path, fetcher.token)
.then((resp) => [resp?.data as JsonPlot])
.catch((error) => {
console.error(error);
Sentry.captureException(error);
return [];
}
const path = `/v0/projects/${fetcher.project_slug}/plots/${fetcher.plot}`;
return await httpGet(props.apiUrl, path, fetcher.token)
.then((resp) => [resp?.data as JsonPlot])
.catch((error) => {
console.error(error);
Sentry.captureException(error);
return [];
});
},
);
});
});
// Drop only the pinned plot association; the rest of the view is untouched.
const handlePlotSelected = () => {
setSearchParams({
Expand Down Expand Up @@ -863,19 +863,19 @@ const PerfPanel = (props: Props) => {
}
return undefined;
});
const [first_report_data] = createResource<undefined | JsonReport>(
first_report_fetcher,
async (uuid) => {
const path = `/v0/projects/${project_slug()}/reports/${uuid}`;
return await httpGet(props.apiUrl, path, user?.token)
.then((resp) => resp?.data)
.catch((error) => {
console.error(error);
Sentry.captureException(error);
return undefined;
});
},
);
const [first_report_data] = createResource<
undefined | JsonReport,
ReturnType<typeof first_report_fetcher>
>(first_report_fetcher, async (uuid) => {
const path = `/v0/projects/${project_slug()}/reports/${uuid}`;
return await httpGet(props.apiUrl, path, user?.token)
.then((resp) => resp?.data)
.catch((error) => {
console.error(error);
Sentry.captureException(error);
return undefined;
});
});
createEffect(() => {
const data = reports_data();
if (data) {
Expand Down
36 changes: 18 additions & 18 deletions services/console/src/components/console/perf/header/UpdateModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,25 +74,25 @@ const UpdateModal = (props: Props) => {
token: props.user?.token,
};
});
const [plots_list] = createResource<JsonPlot[]>(
plotsFetcher,
async (fetcher) => {
if (!fetcher.project || !fetcher.plot) {
const [plots_list] = createResource<
JsonPlot[],
ReturnType<typeof plotsFetcher>
>(plotsFetcher, async (fetcher) => {
if (!fetcher.project || !fetcher.plot) {
return [];
}
return await httpGet(
props.apiUrl,
`/v0/projects/${fetcher.project}/plots?per_page=${MAX_PLOTS}`,
fetcher.token,
)
.then((resp) => resp?.data as JsonPlot[])
.catch((error) => {
console.error(error);
Sentry.captureException(error);
return [];
}
return await httpGet(
props.apiUrl,
`/v0/projects/${fetcher.project}/plots?per_page=${MAX_PLOTS}`,
fetcher.token,
)
.then((resp) => resp?.data as JsonPlot[])
.catch((error) => {
console.error(error);
Sentry.captureException(error);
return [];
});
},
);
});
});
const position = createMemo(() => {
const index = (plots_list() ?? []).findIndex(
(list_plot) => list_plot.uuid === props.plot(),
Expand Down
Loading
Loading