chore: add button for copy logs

This commit is contained in:
jialin
2024-10-24 23:23:47 +08:00
parent 8afaf1a60e
commit 870ffa9dc1
3 changed files with 23 additions and 1 deletions
+1 -1
View File
@@ -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'
+14
View File
@@ -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);
+8
View File
@@ -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';
@@ -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 }}