Spaces:
Sleeping
Sleeping
Download frontend/src/components/InputPanel.js from Ilaa-1505/Error-Clustering-System: direct link, hf CLI and curl.
- Browser
- Download file 1.99 kB
-
https://huggingface.co/spaces/Ilaa-1505/Error-Clustering-System/resolve/main/frontend/src/components/InputPanel.js
- Command line
-
hf download hf://spaces/Ilaa-1505/Error-Clustering-System/frontend/src/components/InputPanel.js
-
curl -L -o InputPanel.js https://huggingface.co/spaces/Ilaa-1505/Error-Clustering-System/resolve/main/frontend/src/components/InputPanel.js
1.99 kB
| import { useRef } from 'react'; | |
| export default function InputPanel({ | |
| logs, setLogs, | |
| onAnalyse, onReset, | |
| tuning, hasResult | |
| }) { | |
| const fileRef = useRef(null); | |
| function handleFile(e) { | |
| const file = e.target.files[0]; | |
| if (!file) return; | |
| const reader = new FileReader(); | |
| reader.onload = (ev) => setLogs(ev.target.result); | |
| reader.readAsText(file); | |
| } | |
| return ( | |
| <div className="panel fade-in"> | |
| <div className="panel-header"> | |
| <span className="panel-title">INPUT LOGS</span> | |
| <div className="panel-actions"> | |
| <input | |
| ref={fileRef} | |
| type="file" | |
| accept=".log,.txt,.csv" | |
| style={{ display: 'none' }} | |
| onChange={handleFile} | |
| /> | |
| <button className="btn-ghost" onClick={() => fileRef.current.click()}> | |
| Upload File | |
| </button> | |
| {hasResult && ( | |
| <button className="btn-ghost" onClick={onReset}>Reset</button> | |
| )} | |
| </div> | |
| </div> | |
| <textarea | |
| className="log-input" | |
| placeholder="Paste your error logs here..." | |
| value={logs} | |
| onChange={e => setLogs(e.target.value)} | |
| rows={10} | |
| /> | |
| <div className="input-footer"> | |
| <div className="log-stats"> | |
| {logs && `${logs.trim().split('\n').filter(Boolean).length} lines`} | |
| </div> | |
| <button | |
| className="btn-primary" | |
| onClick={onAnalyse} | |
| disabled={tuning || !logs.trim()} | |
| > | |
| {tuning ? 'Analysing...' : 'Analyse Logs'} | |
| </button> | |
| </div> | |
| </div> | |
| ); | |
| } |