Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: refetch xray results when agent status updates #13012

Closed
wants to merge 4 commits into from
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
9 changes: 7 additions & 2 deletions site/src/api/queries/integrations.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import type { GetJFrogXRayScanParams } from "api/api";
import * as API from "api/api";
import type { WorkspaceAgentStatus } from "api/typesGenerated";

export const xrayScan = (params: GetJFrogXRayScanParams) => {
export const xrayScan = (
params: GetJFrogXRayScanParams,
status: WorkspaceAgentStatus,
) => {
return {
queryKey: ["xray", params],
// Reload the xray results whenever the status changes
queryKey: ["xray", params, status],
queryFn: () => API.getJFrogXRayScan(params),
};
};
1 change: 1 addition & 0 deletions site/src/modules/resources/AgentRow.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ export const WithXRayScan: Story = {
key: [
"xray",
{ agentId: M.MockWorkspaceAgent.id, workspaceId: M.MockWorkspace.id },
M.MockWorkspaceAgent.status,
],
data: {
workspace_id: M.MockWorkspace.id,
Expand Down
2 changes: 1 addition & 1 deletion site/src/modules/resources/AgentRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const AgentRow: FC<AgentRowProps> = ({
}) => {
// XRay integration
const xrayScanQuery = useQuery(
xrayScan({ workspaceId: workspace.id, agentId: agent.id }),
xrayScan({ workspaceId: workspace.id, agentId: agent.id }, agent.status),
);

// Apps visibility
Expand Down
1 change: 1 addition & 0 deletions site/src/testHelpers/entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,7 @@ export const MockWorkspaceAgentDeprecated: TypesGen.WorkspaceAgent = {
},
},
lifecycle_state: "ready",
status: "connected",
};

export const MockWorkspaceAgentConnecting: TypesGen.WorkspaceAgent = {
Expand Down
Loading