Remove edit controls from planner for read-only users.

Left over from #108.
This commit is contained in:
D. Berge
2021-05-27 01:31:37 +02:00
parent c30e54a515
commit 14b2e55a2e

View File

@@ -16,7 +16,7 @@
</v-card-title>
<v-card-text>
<v-menu
<v-menu v-if="writeaccess"
v-model="contextMenuShow"
:position-x="contextMenuX"
:position-y="contextMenuY"
@@ -49,7 +49,7 @@
</template>
<template v-slot:item.sequence="{item, value}">
<v-edit-dialog
<v-edit-dialog v-if="writeaccess"
large
@open="editItem(item, 'sequence')"
@save="edit = null"
@@ -70,10 +70,11 @@
></v-checkbox>
</template>
</v-edit-dialog>
<span v-else>{{ value }}</span>
</template>
<template v-slot:item.name="{item, value}">
<v-edit-dialog
<v-edit-dialog v-if="writeaccess"
large
@open="editItem(item, 'name')"
@save="edit = null"
@@ -88,10 +89,11 @@
</v-text-field>
</template>
</v-edit-dialog>
<span v-else>{{ value }}</span>
</template>
<template v-slot:item.fsp="{item, value}">
<v-edit-dialog
<v-edit-dialog v-if="writeaccess"
large
@open="editItem(item, 'fsp')"
@save="edit = null"
@@ -107,10 +109,11 @@
</v-text-field>
</template>
</v-edit-dialog>
<span v-else>{{ value }}</span>
</template>
<template v-slot:item.lsp="{item, value}">
<v-edit-dialog
<v-edit-dialog v-if="writeaccess"
large
@open="editItem(item, 'lsp')"
@save="edit = null"
@@ -126,10 +129,11 @@
</v-text-field>
</template>
</v-edit-dialog>
<span v-else>{{ value }}</span>
</template>
<template v-slot:item.ts0="{item, value}">
<v-edit-dialog
<v-edit-dialog v-if="writeaccess"
large
@open="editItem(item, 'ts0', item.ts1.toISOString())"
@save="edit = null"
@@ -145,10 +149,11 @@
</v-text-field>
</template>
</v-edit-dialog>
<span v-else>{{ value.toISOString ? value.toISOString().slice(0, 16) : "" }}</span>
</template>
<template v-slot:item.ts1="{item, value}">
<v-edit-dialog
<v-edit-dialog v-if="writeaccess"
large
@open="editItem(item, 'ts1', item.ts1.toISOString())"
@save="edit = null"
@@ -164,6 +169,7 @@
</v-text-field>
</template>
</v-edit-dialog>
<span v-else>{{ value.toISOString ? value.toISOString().slice(0, 16) : "" }}</span>
</template>
<template v-slot:item.length="props">
@@ -175,7 +181,7 @@
</template>
<template v-slot:item.remarks="{item}">
<v-text-field v-if="edit && edit.sequence == item.sequence && edit.key == 'remarks'"
<v-text-field v-if="writeaccess && edit && edit.sequence == item.sequence && edit.key == 'remarks'"
type="text"
v-model="edit.value"
prepend-icon="mdi-restore"
@@ -185,8 +191,9 @@
@click:append-outer="edit = null"
>
</v-text-field>
<div v-else v-html="$options.filters.markdownInline(item.remarks)">
<v-btn v-if="edit === null"
<div v-else>
<span v-html="$options.filters.markdownInline(item.remarks)"></span>
<v-btn v-if="edit === null && writeaccess"
icon
small
title="Edit"
@@ -200,7 +207,7 @@
</template>
<template v-slot:item.speed="{item}">
<v-edit-dialog
<v-edit-dialog v-if="writeaccess"
large
@open="editItem(item, 'speed', knots(item).toFixed(1))"
@save="edit = null"
@@ -218,10 +225,11 @@
</v-text-field>
</template>
</v-edit-dialog>
<span v-else style="white-space:nowrap;">{{ knots(item).toFixed(1) }} kt</span>
</template>
<template v-slot:item.lag="{item}">
<v-edit-dialog
<v-edit-dialog v-if="writeaccess"
large
@open="editItem(item, 'lagAfter', Math.round(lagAfter(item)/(60*1000)))"
@save="edit = null"
@@ -238,6 +246,7 @@
</v-text-field>
</template>
</v-edit-dialog>
<span v-else>{{ Math.round(lagAfter(item) / (60*1000)) }} min</span>
</template>
</v-data-table>
@@ -346,7 +355,7 @@ export default {
},
computed: {
...mapGetters(['user', 'loading', 'serverEvent'])
...mapGetters(['user', 'writeaccess', 'loading', 'serverEvent'])
},
watch: {