Skip to content

feat: add build output history log echo functionality#1580

Merged
benjamin-747 merged 1 commit into
gitmono-dev:mainfrom
zyd123-cmd:main
Oct 24, 2025
Merged

feat: add build output history log echo functionality#1580
benjamin-747 merged 1 commit into
gitmono-dev:mainfrom
zyd123-cmd:main

Conversation

@zyd123-cmd

Copy link
Copy Markdown
Contributor

build output history log echo functionality

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the build output history log functionality to use a centralized API client (orionApiClient) instead of direct fetch calls, improving code consistency and maintainability. The changes also include replacing hardcoded URL logic with dynamic base URL resolution and cleaning up commented-out code.

Key Changes

  • Migrated from direct fetch calls to orionApiClient for task and log retrieval
  • Replaced hardcoded URL conditionals with dynamic base URL resolution from orionApiClient
  • Cleaned up unused types, commented code, and improved error messages

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
moon/apps/web/hooks/SSE/useGetHTTPLog.ts Refactored to use orionApiClient instead of direct HTTP calls; added fetchHTTPLog export
moon/apps/web/hooks/SSE/useGetClTask.ts Migrated to orionApiClient and removed duplicate type definitions
moon/apps/web/hooks/SSE/ssmRequest.ts Removed fetchTask and HttpTaskRes functions; replaced hardcoded paths with dynamic base URL
moon/apps/web/components/ClView/hook/useSSM.ts Replaced hardcoded URL conditionals with getTaskOutputSSEUrl helper; improved error messages
moon/apps/web/components/ClView/components/Checks/index.tsx Simplified log fetching logic; improved UI feedback for loading and empty states

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

import { SSEPATH } from '@/components/ClView/hook/useSSM'
import { orionApiClient } from '@/utils/queryClient'

const getBaseUrl = () => (orionApiClient as any).baseUrl || ''

Copilot AI Oct 24, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The use of (orionApiClient as any) bypasses type safety. Consider adding a proper type definition or accessor method to orionApiClient to expose baseUrl in a type-safe manner.

Copilot uses AI. Check for mistakes.
* Path: GET:/task-output/{id}
*/
export const getTaskOutputSSEUrl = (taskId: string) => {
const baseUrl = (orionApiClient as any).baseUrl || ''

Copilot AI Oct 24, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The use of (orionApiClient as any) bypasses type safety. Consider adding a proper type definition or accessor method to orionApiClient to expose baseUrl in a type-safe manner.

Copilot uses AI. Check for mistakes.
window.location.href.includes('app')
? (sseUrl.current = 'https://orion.gitmega.com/logs?follow=true')
: (sseUrl.current = '/sse/logs?follow=true')
const baseUrl = (orionApiClient as any).baseUrl || ''

Copilot AI Oct 24, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The use of (orionApiClient as any) bypasses type safety. Consider adding a proper type definition or accessor method to orionApiClient to expose baseUrl in a type-safe manner.

Copilot uses AI. Check for mistakes.
acc[i.value.task_id] = i.value.data === '' ? 'empty logs, please check it later' : i.value.data
(acc, item) => {
if (item.status === 'fulfilled' && item.value) {
const { id, res } = item.value

Copilot AI Oct 24, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The conditional logic assumes res.data could be either an array or a string, but this dual behavior is unclear. Consider adding a comment explaining when res.data is an array vs. a string, or standardizing the API response format.

Suggested change
const { id, res } = item.value
const { id, res } = item.value
// NOTE: res.data can be either an array (of log lines) or a string, depending on the API response.
// If the API returns an array, we join the lines; if it's a string, we use it directly.
// This dual behavior is due to inconsistent API responses. Update this logic if the API is standardized.

Copilot uses AI. Check for mistakes.
@benjamin-747 benjamin-747 added this pull request to the merge queue Oct 24, 2025
Merged via the queue into gitmono-dev:main with commit afdc798 Oct 24, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants