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

chore: add button for copy logs #172

Merged
merged 1 commit into from
Oct 24, 2024
Merged
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
2 changes: 1 addition & 1 deletion config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const isProduction = env === 'production';
const t = Date.now();
export default defineConfig({
proxy: {
...proxy('http://192.168.50.2:8088/')
...proxy()
},
history: {
type: 'hash'
Expand Down
14 changes: 14 additions & 0 deletions src/components/logs-viewer/index.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
.logs-viewer-wrap-w2 {
position: relative;

.copy {
position: absolute;
top: 10px;
right: 10px;
z-index: 100;

button {
background-color: rgba(255, 255, 255, 90%);
border: none;
}
}

.wrap {
padding: 5px 0 5px 10px;
background-color: var(--color-logs-bg);
Expand Down
8 changes: 8 additions & 0 deletions src/components/logs-viewer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import '@xterm/xterm/css/xterm.css';
import classNames from 'classnames';
import _ from 'lodash';
import { memo, useCallback, useEffect, useRef, useState } from 'react';
import CopyButton from '../copy-button';
import './index.less';
import useParseAnsi from './parse-ansi';

Expand Down Expand Up @@ -119,6 +120,13 @@ const LogsViewer: React.FC<LogsViewerProps> = (props) => {

return (
<div className="logs-viewer-wrap-w2">
<span className="copy">
<CopyButton
text={logs?.map((item) => item.content).join('\n')}
type="default"
size="small"
></CopyButton>
</span>
<div
className="wrap"
style={{ height: height }}
Expand Down