mirror of
https://github.com/LizardByte/Sunshine.git
synced 2026-08-07 10:20:46 +00:00
feat(web-ui): clipboard copy feedback on Troubleshooting logs (#4803)
Co-authored-by: eduardomozart <2974895+eduardomozart@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
5d219c7aa7
commit
655b1902bb
@@ -177,7 +177,8 @@
|
||||
<chevrons-down :size="18" class="icon"></chevrons-down>
|
||||
</button>
|
||||
<button class="log-nav-btn" @click="copyLogs" title="Copy Logs">
|
||||
<copy :size="18" class="icon"></copy>
|
||||
<check :size="18" class="icon text-success" v-if="logsCopied"></check>
|
||||
<copy :size="18" class="icon" v-else></copy>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -195,6 +196,7 @@
|
||||
import {
|
||||
AlertCircle,
|
||||
AlertTriangle,
|
||||
Check,
|
||||
CheckCircle,
|
||||
ChevronDown,
|
||||
ChevronUp,
|
||||
@@ -214,6 +216,7 @@
|
||||
Navbar,
|
||||
AlertCircle,
|
||||
AlertTriangle,
|
||||
Check,
|
||||
CheckCircle,
|
||||
ChevronDown,
|
||||
ChevronUp,
|
||||
@@ -234,6 +237,7 @@
|
||||
closeAppStatus: null,
|
||||
ddResetPressed: false,
|
||||
ddResetStatus: null,
|
||||
logsCopied: false,
|
||||
logs: 'Loading...',
|
||||
logFilter: null,
|
||||
logInterval: null,
|
||||
@@ -375,6 +379,7 @@
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this._logsCopyTimeout = null;
|
||||
fetch("/api/config")
|
||||
.then((r) => r.json())
|
||||
.then((r) => {
|
||||
@@ -468,7 +473,20 @@
|
||||
},
|
||||
copyLogs() {
|
||||
// Copy the filtered view if a filter is active.
|
||||
navigator.clipboard.writeText(this.actualLogs);
|
||||
navigator.clipboard.writeText(this.actualLogs).then(() => {
|
||||
// Clear any existing reset timer (handles rapid successive clicks).
|
||||
if (this._logsCopyTimeout) clearTimeout(this._logsCopyTimeout);
|
||||
|
||||
// Show checkmark feedback.
|
||||
this.logsCopied = true;
|
||||
|
||||
// Revert icon after 2 seconds.
|
||||
this._logsCopyTimeout = setTimeout(() => {
|
||||
this.logsCopied = false;
|
||||
}, 2000);
|
||||
}).catch((err) => {
|
||||
console.error('Failed to copy logs:', err);
|
||||
});
|
||||
},
|
||||
restart() {
|
||||
this.restartPressed = true;
|
||||
|
||||
Reference in New Issue
Block a user