[Electron] Show server launch args in server config panel (#1669)

* Move revertChanges

* Show launch args

* Explicit ServerConfigValue type

* nit

* nit

* Add tests
This commit is contained in:
Chenlei Hu
2024-11-24 15:14:05 -08:00
committed by GitHub
parent c61ed4da37
commit e01c8f06c7
6 changed files with 238 additions and 99 deletions

View File

@@ -0,0 +1,37 @@
import { useClipboard } from '@vueuse/core'
import { useToast } from 'primevue/usetoast'
export function useCopyToClipboard() {
const { copy, isSupported } = useClipboard()
const toast = useToast()
const copyToClipboard = async (text: string) => {
if (isSupported) {
try {
await copy(text)
toast.add({
severity: 'success',
summary: 'Success',
detail: 'Copied to clipboard',
life: 3000
})
} catch (err) {
toast.add({
severity: 'error',
summary: 'Error',
detail: 'Failed to copy report'
})
}
} else {
toast.add({
severity: 'error',
summary: 'Error',
detail: 'Clipboard API not supported in your browser'
})
}
}
return {
copyToClipboard
}
}