mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-03 08:53:36 +00:00
feat: address pr comments
This commit is contained in:
@@ -14,7 +14,6 @@ describe('running-agents routes', () => {
|
|||||||
|
|
||||||
mockAutoModeService = {
|
mockAutoModeService = {
|
||||||
getRunningAgents: vi.fn(),
|
getRunningAgents: vi.fn(),
|
||||||
getStatus: vi.fn(),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const context = createMockExpressContext();
|
const context = createMockExpressContext();
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ interface AgentOutputModalProps {
|
|||||||
featureStatus?: string;
|
featureStatus?: string;
|
||||||
/** Called when a number key (0-9) is pressed while the modal is open */
|
/** Called when a number key (0-9) is pressed while the modal is open */
|
||||||
onNumberKeyPress?: (key: string) => void;
|
onNumberKeyPress?: (key: string) => void;
|
||||||
|
/** Project path - if not provided, falls back to window.__currentProject for backward compatibility */
|
||||||
|
projectPath?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
type ViewMode = 'parsed' | 'raw' | 'changes';
|
type ViewMode = 'parsed' | 'raw' | 'changes';
|
||||||
@@ -34,6 +36,7 @@ export function AgentOutputModal({
|
|||||||
featureId,
|
featureId,
|
||||||
featureStatus,
|
featureStatus,
|
||||||
onNumberKeyPress,
|
onNumberKeyPress,
|
||||||
|
projectPath: projectPathProp,
|
||||||
}: AgentOutputModalProps) {
|
}: AgentOutputModalProps) {
|
||||||
const [output, setOutput] = useState<string>('');
|
const [output, setOutput] = useState<string>('');
|
||||||
const [isLoading, setIsLoading] = useState(true);
|
const [isLoading, setIsLoading] = useState(true);
|
||||||
@@ -62,19 +65,20 @@ export function AgentOutputModal({
|
|||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Get current project path from store (we'll need to pass this)
|
// Use projectPath prop if provided, otherwise fall back to window.__currentProject for backward compatibility
|
||||||
const currentProject = (window as any).__currentProject;
|
const resolvedProjectPath =
|
||||||
if (!currentProject?.path) {
|
projectPathProp || (window as any).__currentProject?.path;
|
||||||
|
if (!resolvedProjectPath) {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
projectPathRef.current = currentProject.path;
|
projectPathRef.current = resolvedProjectPath;
|
||||||
setProjectPath(currentProject.path);
|
setProjectPath(resolvedProjectPath);
|
||||||
|
|
||||||
// Use features API to get agent output
|
// Use features API to get agent output
|
||||||
if (api.features) {
|
if (api.features) {
|
||||||
const result = await api.features.getAgentOutput(currentProject.path, featureId);
|
const result = await api.features.getAgentOutput(resolvedProjectPath, featureId);
|
||||||
|
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
setOutput(result.content || '');
|
setOutput(result.content || '');
|
||||||
@@ -93,7 +97,7 @@ export function AgentOutputModal({
|
|||||||
};
|
};
|
||||||
|
|
||||||
loadOutput();
|
loadOutput();
|
||||||
}, [open, featureId]);
|
}, [open, featureId, projectPathProp]);
|
||||||
|
|
||||||
// Listen to auto mode events and update output
|
// Listen to auto mode events and update output
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -97,13 +97,8 @@ export function RunningAgentsView() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const handleViewLogs = useCallback((agent: RunningAgent) => {
|
const handleViewLogs = useCallback((agent: RunningAgent) => {
|
||||||
// Set the current project context for the modal
|
|
||||||
const project = projects.find((p) => p.path === agent.projectPath);
|
|
||||||
if (project) {
|
|
||||||
(window as any).__currentProject = project;
|
|
||||||
}
|
|
||||||
setSelectedAgent(agent);
|
setSelectedAgent(agent);
|
||||||
}, [projects]);
|
}, []);
|
||||||
|
|
||||||
if (loading) {
|
if (loading) {
|
||||||
return (
|
return (
|
||||||
@@ -232,6 +227,7 @@ export function RunningAgentsView() {
|
|||||||
<AgentOutputModal
|
<AgentOutputModal
|
||||||
open={true}
|
open={true}
|
||||||
onClose={() => setSelectedAgent(null)}
|
onClose={() => setSelectedAgent(null)}
|
||||||
|
projectPath={selectedAgent.projectPath}
|
||||||
featureDescription={selectedAgent.description || selectedAgent.title || selectedAgent.featureId}
|
featureDescription={selectedAgent.description || selectedAgent.title || selectedAgent.featureId}
|
||||||
featureId={selectedAgent.featureId}
|
featureId={selectedAgent.featureId}
|
||||||
featureStatus="running"
|
featureStatus="running"
|
||||||
|
|||||||
Reference in New Issue
Block a user