mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2026-04-03 06:27:30 +02:00
Initial commit on branch: Rewrite config.tmpl as svelte component(s)
This commit is contained in:
27
web/frontend/src/config/admin/ShowUsersRow.svelte
Normal file
27
web/frontend/src/config/admin/ShowUsersRow.svelte
Normal file
@@ -0,0 +1,27 @@
|
||||
<script>
|
||||
import { Button } from 'sveltestrap'
|
||||
|
||||
export let user
|
||||
let jwt = ""
|
||||
|
||||
function getUserJwt(username) {
|
||||
fetch(`/api/jwt/?username=${username}`)
|
||||
.then(res => res.text())
|
||||
.then(text => {
|
||||
jwt = text
|
||||
navigator.clipboard.writeText(text).catch(reason => console.error(reason))
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<td>{user.username}</td>
|
||||
<td>{user.name}</td>
|
||||
<td>{user.email}</td>
|
||||
<td><code>{user.roles.join(', ')}</code></td>
|
||||
<td>
|
||||
{#if ! jwt}
|
||||
<Button color="success" on:click={getUserJwt(user.username)}>Gen. JWT</Button>
|
||||
{:else}
|
||||
<textarea rows="3" cols="20">{jwt}</textarea>
|
||||
{/if}
|
||||
</td>
|
||||
Reference in New Issue
Block a user