show configure page only for admin, formate code, choice if new user is admin
This commit is contained in:
parent
0898bcb241
commit
8f615c3582
@ -68,7 +68,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<button
|
<button
|
||||||
title="Start Playout Service"
|
title="Start Playout Service"
|
||||||
data-tooltip=tooltip
|
data-tooltip="tooltip"
|
||||||
class="btn btn-primary control-button control-button-play"
|
class="btn btn-primary control-button control-button-play"
|
||||||
:class="isPlaying"
|
:class="isPlaying"
|
||||||
@click="controlProcess('start')"
|
@click="controlProcess('start')"
|
||||||
@ -81,7 +81,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<button
|
<button
|
||||||
title="Stop Playout Service"
|
title="Stop Playout Service"
|
||||||
data-tooltip=tooltip
|
data-tooltip="tooltip"
|
||||||
class="btn btn-primary control-button control-button-stop"
|
class="btn btn-primary control-button control-button-stop"
|
||||||
@click="controlProcess('stop')"
|
@click="controlProcess('stop')"
|
||||||
>
|
>
|
||||||
@ -93,7 +93,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<button
|
<button
|
||||||
title="Restart Playout Service"
|
title="Restart Playout Service"
|
||||||
data-tooltip=tooltip
|
data-tooltip="tooltip"
|
||||||
class="btn btn-primary control-button control-button-restart"
|
class="btn btn-primary control-button control-button-restart"
|
||||||
@click="controlProcess('restart')"
|
@click="controlProcess('restart')"
|
||||||
>
|
>
|
||||||
@ -106,7 +106,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<button
|
<button
|
||||||
title="Jump to last Clip"
|
title="Jump to last Clip"
|
||||||
data-tooltip=tooltip
|
data-tooltip="tooltip"
|
||||||
class="btn btn-primary control-button control-button-control"
|
class="btn btn-primary control-button control-button-control"
|
||||||
@click="controlPlayout('back')"
|
@click="controlPlayout('back')"
|
||||||
>
|
>
|
||||||
@ -118,7 +118,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<button
|
<button
|
||||||
title="Reset Playout State"
|
title="Reset Playout State"
|
||||||
data-tooltip=tooltip
|
data-tooltip="tooltip"
|
||||||
class="btn btn-primary control-button control-button-control"
|
class="btn btn-primary control-button control-button-control"
|
||||||
@click="controlPlayout('reset')"
|
@click="controlPlayout('reset')"
|
||||||
>
|
>
|
||||||
@ -130,7 +130,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<button
|
<button
|
||||||
title="Jump to next Clip"
|
title="Jump to next Clip"
|
||||||
data-tooltip=tooltip
|
data-tooltip="tooltip"
|
||||||
class="btn btn-primary control-button control-button-control"
|
class="btn btn-primary control-button control-button-control"
|
||||||
@click="controlPlayout('next')"
|
@click="controlPlayout('next')"
|
||||||
>
|
>
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<NuxtLink class="btn btn-primary btn-sm" to="/logging">Logging</NuxtLink>
|
<NuxtLink class="btn btn-primary btn-sm" to="/logging">Logging</NuxtLink>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li v-if="authStore.role.toLowerCase() == 'admin'" class="nav-item">
|
||||||
<NuxtLink class="btn btn-primary btn-sm" to="/configure">Configure</NuxtLink>
|
<NuxtLink class="btn btn-primary btn-sm" to="/configure">Configure</NuxtLink>
|
||||||
</li>
|
</li>
|
||||||
<li v-if="configStore.configGui.length > 1" class="nav-item dropdown">
|
<li v-if="configStore.configGui.length > 1" class="nav-item dropdown">
|
||||||
|
@ -54,7 +54,14 @@
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="userModal" ref="userModal" class="modal" tabindex="-1" aria-labelledby="userModalLabel" aria-hidden="true">
|
<div
|
||||||
|
id="userModal"
|
||||||
|
ref="userModal"
|
||||||
|
class="modal"
|
||||||
|
tabindex="-1"
|
||||||
|
aria-labelledby="userModalLabel"
|
||||||
|
aria-hidden="true"
|
||||||
|
>
|
||||||
<div class="modal-dialog modal-dialog-centered">
|
<div class="modal-dialog modal-dialog-centered">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
@ -87,7 +94,7 @@
|
|||||||
class="form-control"
|
class="form-control"
|
||||||
id="pass-input"
|
id="pass-input"
|
||||||
aria-describedby="Password"
|
aria-describedby="Password"
|
||||||
v-model.number="user.password"
|
v-model.string="user.password"
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
<label for="confirm-input" class="form-label mt-2">Confirm Password</label>
|
<label for="confirm-input" class="form-label mt-2">Confirm Password</label>
|
||||||
@ -96,9 +103,18 @@
|
|||||||
class="form-control"
|
class="form-control"
|
||||||
id="confirm-input"
|
id="confirm-input"
|
||||||
aria-describedby="Confirm Password"
|
aria-describedby="Confirm Password"
|
||||||
v-model.number="user.confirm"
|
v-model.string="user.confirm"
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
|
<div class="form-check mt-3">
|
||||||
|
<input
|
||||||
|
class="form-check-input"
|
||||||
|
type="checkbox"
|
||||||
|
id="isAdmin"
|
||||||
|
v-model.number="user.admin"
|
||||||
|
/>
|
||||||
|
<label class="form-check-label" for="isAdmin">Admin</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="reset" class="btn btn-primary" data-bs-dismiss="modal" aria-label="Cancel">
|
<button type="reset" class="btn btn-primary" data-bs-dismiss="modal" aria-label="Cancel">
|
||||||
@ -133,18 +149,28 @@ const user = ref({
|
|||||||
mail: '',
|
mail: '',
|
||||||
password: '',
|
password: '',
|
||||||
confirm: '',
|
confirm: '',
|
||||||
role_id: 1,
|
admin: false,
|
||||||
})
|
role_id: 2,
|
||||||
|
} as User)
|
||||||
|
|
||||||
async function clearUser() {
|
async function clearUser() {
|
||||||
user.value.username = ''
|
user.value.username = ''
|
||||||
user.value.mail = ''
|
user.value.mail = ''
|
||||||
user.value.password = ''
|
user.value.password = ''
|
||||||
user.value.confirm = ''
|
user.value.confirm = ''
|
||||||
user.value.role_id = 1
|
user.value.admin = false,
|
||||||
|
user.value.role_id = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
async function addUser() {
|
async function addUser() {
|
||||||
|
if (user.value.admin) {
|
||||||
|
user.value.role_id = 1
|
||||||
|
} else {
|
||||||
|
user.value.role_id = 2
|
||||||
|
}
|
||||||
|
|
||||||
|
delete user.value.admin
|
||||||
|
|
||||||
if (user.value.password === user.value.confirm) {
|
if (user.value.password === user.value.confirm) {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const modal = $bootstrap.Modal.getOrCreateInstance(userModal.value)
|
const modal = $bootstrap.Modal.getOrCreateInstance(userModal.value)
|
||||||
@ -162,7 +188,6 @@ async function addUser() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
clearUser()
|
clearUser()
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
indexStore.alertVariant = 'alert-danger'
|
indexStore.alertVariant = 'alert-danger'
|
||||||
indexStore.alertMsg = 'Password mismatch!'
|
indexStore.alertMsg = 'Password mismatch!'
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
<NuxtLink to="/media" class="btn btn-primary">Media</NuxtLink>
|
<NuxtLink to="/media" class="btn btn-primary">Media</NuxtLink>
|
||||||
<NuxtLink to="/message" class="btn btn-primary">Message</NuxtLink>
|
<NuxtLink to="/message" class="btn btn-primary">Message</NuxtLink>
|
||||||
<NuxtLink to="logging" class="btn btn-primary">Logging</NuxtLink>
|
<NuxtLink to="logging" class="btn btn-primary">Logging</NuxtLink>
|
||||||
<NuxtLink to="/configure" class="btn btn-primary"> Configure </NuxtLink>
|
<NuxtLink v-if="authStore.role.toLowerCase() == 'admin'" to="/configure" class="btn btn-primary"> Configure </NuxtLink>
|
||||||
<button class="btn btn-primary" @click="logout()">Logout</button>
|
<button class="btn btn-primary" @click="logout()">Logout</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -477,7 +477,6 @@ async function getPath(path: string) {
|
|||||||
browserIsLoading.value = false
|
browserIsLoading.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function setPreviewData(path: string) {
|
function setPreviewData(path: string) {
|
||||||
/*
|
/*
|
||||||
Set path and player options for video preview.
|
Set path and player options for video preview.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { defineStore } from 'pinia'
|
import { defineStore } from 'pinia'
|
||||||
import jwtDecode, { JwtPayload } from 'jwt-decode'
|
import jwtDecode, { type JwtPayload } from 'jwt-decode'
|
||||||
|
|
||||||
interface JwtPayloadExt extends JwtPayload {
|
interface JwtPayloadExt extends JwtPayload {
|
||||||
role: string
|
role: string
|
||||||
|
1
types/index.d.ts
vendored
1
types/index.d.ts
vendored
@ -16,6 +16,7 @@ declare global {
|
|||||||
mail: String
|
mail: String
|
||||||
password?: String
|
password?: String
|
||||||
confirm?: String
|
confirm?: String
|
||||||
|
admin?: Boolean
|
||||||
role_id?: Number
|
role_id?: Number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user