Skip to content

Commit

Permalink
fix: refresh button in the overview page (#441)
Browse files Browse the repository at this point in the history
  • Loading branch information
JivusAyrus authored Jan 18, 2024
1 parent b5a10a1 commit d4988d9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 29 deletions.
35 changes: 10 additions & 25 deletions controlplane/src/core/bufservices/PlatformService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4733,34 +4733,19 @@ export default function (opts: RouterOptions): Partial<ServiceImpl<typeof Platfo
featureId: 'analytics-retention',
});

const { dateRange } = validateDateRanges({
const { range, dateRange } = validateDateRanges({
limit: analyticsRetention?.limit ?? 7,
range: 0,
dateRange: {
start: req.startDate,
end: req.endDate,
},
range: req.range,
dateRange:
req.startDate !== '' && req.endDate !== ''
? {
start: req.startDate,
end: req.endDate,
}
: undefined,
});

if (!dateRange) {
return {
response: {
code: EnumStatusCode.ERR,
details: 'Invalid date range',
},
mostRequestedOperations: [],
requestSeries: [],
subgraphMetrics: [],
};
}

const timeFilters = parseTimeFilters(
{
start: dateRange.start,
end: dateRange.end,
},
req.range,
);
const timeFilters = parseTimeFilters(dateRange, range);

const subgraphRepo = new SubgraphRepository(opts.db, authContext.organizationId);
const subgraphs = await subgraphRepo.listByFederatedGraph(graph.name, { published: true });
Expand Down
6 changes: 2 additions & 4 deletions studio/src/pages/[organizationSlug]/graph/[slug]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,10 @@ import {
} from "@tanstack/react-query";
import { getDashboardAnalyticsView } from "@wundergraph/cosmo-connect/dist/platform/v1/platform-PlatformService_connectquery";
import { formatISO } from "date-fns";
import { useRouter } from "next/router";
import { useContext, useState } from "react";
import { ReactFlowProvider } from "reactflow";

const GraphOverviewPage: NextPageWithLayout = () => {
const router = useRouter();
const graphData = useContext(GraphContext);
const [open, setOpen] = useState(false);
const applyParams = useApplyParams();
Expand All @@ -62,9 +60,9 @@ const GraphOverviewPage: NextPageWithLayout = () => {

const getView = getDashboardAnalyticsView.useQuery({
federatedGraphName: graphData?.graph?.name,
startDate: formatISO(dateRange.start),
endDate: formatISO(dateRange.end),
range,
startDate: range ? undefined : formatISO(dateRange.start),
endDate: range ? undefined : formatISO(dateRange.end),
});
const {
data: dashboardView,
Expand Down

0 comments on commit d4988d9

Please sign in to comment.