-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 新增 logModal, 版本同步时展示对应日志, cc @RaoHai ![image](https://github.com/user-attachments/assets/6523497b-85ac-4666-8d06-8b21985e42bc) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a new dependency for enhanced log rendering. - Added a modal to the Sync component for displaying sync logs interactively. - Implemented a custom hook for fetching and caching sync log data. - **Bug Fixes** - Improved button functionality to open log modal upon successful sync instead of navigating away. - **Documentation** - Updated documentation to reflect the new log fetching mechanism and modal integration. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
- Loading branch information
Showing
3 changed files
with
46 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { REGISTRY } from '@/config'; | ||
import useSwr from 'swr'; | ||
|
||
export default function useSyncLog(pkgName: string, logId?: string) { | ||
return useSwr(logId ? `sync_log_${logId}` : null, async () => { | ||
try { | ||
const res = await fetch(`${REGISTRY}/-/package/${pkgName}/syncs/${logId}/log`).then((res) => res.text()); | ||
return res.split('\n'); | ||
} catch (e) { | ||
return null; | ||
} | ||
}, { | ||
refreshInterval() { | ||
return 1000; | ||
}, | ||
}); | ||
} |