mirror of
https://github.com/rowyio/rowy.git
synced 2025-12-29 00:16:39 +01:00
fix hardcoded project id
This commit is contained in:
@@ -22,18 +22,25 @@ import BuildLogs from "./BuildLogs";
|
||||
import EmptyState from "@src/components/EmptyState";
|
||||
|
||||
import { useProjectContext } from "@src/contexts/ProjectContext";
|
||||
import { useAppContext } from "@src/contexts/AppContext";
|
||||
import { cloudLogFiltersAtom, cloudLogFetcher } from "./utils";
|
||||
|
||||
export default function CloudLogsModal(props: IModalProps) {
|
||||
const { rowyRun, tableState, table, compatibleRowyRunVersion } =
|
||||
useProjectContext();
|
||||
|
||||
const { projectId } = useAppContext();
|
||||
const [cloudLogFilters, setCloudLogFilters] = useAtom(cloudLogFiltersAtom);
|
||||
|
||||
const { data, mutate, isValidating } = useSWR(
|
||||
cloudLogFilters.type === "build"
|
||||
? null
|
||||
: ["/logs", rowyRun, cloudLogFilters, tableState?.tablePath || ""],
|
||||
: [
|
||||
"/logs",
|
||||
rowyRun,
|
||||
projectId,
|
||||
cloudLogFilters,
|
||||
tableState?.tablePath || "",
|
||||
],
|
||||
cloudLogFetcher,
|
||||
{
|
||||
fallbackData: [],
|
||||
|
||||
@@ -26,6 +26,7 @@ export const cloudLogFiltersAtom = atomWithHash<CloudLogFilters>(
|
||||
export const cloudLogFetcher = (
|
||||
endpointRoot: string,
|
||||
rowyRun: IProjectContext["rowyRun"],
|
||||
projectId: string,
|
||||
cloudLogFilters: CloudLogFilters,
|
||||
tablePath: string
|
||||
) => {
|
||||
@@ -34,7 +35,9 @@ export const cloudLogFetcher = (
|
||||
|
||||
switch (cloudLogFilters.type) {
|
||||
case "webhook":
|
||||
logQuery.push(`logName = "projects/rowyio/logs/rowy-webhook-events"`);
|
||||
logQuery.push(
|
||||
`logName = "projects/${projectId}/logs/rowy-webhook-events"`
|
||||
);
|
||||
logQuery.push(`jsonPayload.url : "${tablePath}"`);
|
||||
if (
|
||||
Array.isArray(cloudLogFilters.webhook) &&
|
||||
@@ -48,7 +51,7 @@ export const cloudLogFetcher = (
|
||||
break;
|
||||
|
||||
case "audit":
|
||||
logQuery.push(`logName = "projects/rowyio/logs/rowy-audit"`);
|
||||
logQuery.push(`logName = "projects/${projectId}/logs/rowy-audit"`);
|
||||
logQuery.push(`jsonPayload.ref.collectionPath = "${tablePath}"`);
|
||||
if (cloudLogFilters.auditRowId)
|
||||
logQuery.push(
|
||||
|
||||
Reference in New Issue
Block a user