Expand usage of writable prop in history panel to allow read only histories

This commit is contained in:
guerler
2022-09-21 14:01:41 -04:00
parent 3c04f727e8
commit 976f9487b0
7 changed files with 21 additions and 8 deletions
@@ -52,6 +52,7 @@
</span>
<ContentOptions
v-else
:writable="writable"
:is-dataset="isDataset"
:is-deleted="item.deleted"
:is-history-item="isHistoryItem"
@@ -85,6 +86,7 @@
<DatasetDetails
v-if="expandDataset"
:dataset="item"
:writable="writable"
:show-highlight="isHistoryItem"
:item-urls="itemUrls"
@edit="onEdit"
@@ -117,6 +119,7 @@ export default {
FontAwesomeIcon,
},
props: {
writable: { type: Boolean, default: true },
expandDataset: { type: Boolean, required: true },
highlight: { type: String, default: null },
id: { type: Number, required: true },
@@ -169,7 +172,7 @@ export default {
return this.item.tags;
},
tagsDisabled() {
return !this.expandDataset || !this.isHistoryItem;
return !this.writable || !this.expandDataset || !this.isHistoryItem;
},
isCollection() {
return "collection_type" in this.item;
@@ -12,7 +12,7 @@
<icon icon="eye" />
</b-button>
<b-button
v-if="isHistoryItem"
v-if="writable && isHistoryItem"
:disabled="editDisabled"
:title="editButtonTitle"
class="edit-btn px-1"
@@ -23,7 +23,7 @@
<icon icon="pen" />
</b-button>
<b-button
v-if="isHistoryItem && !isDeleted"
v-if="writable && isHistoryItem && !isDeleted"
class="delete-btn px-1"
title="Delete"
size="sm"
@@ -32,7 +32,7 @@
<icon icon="trash" />
</b-button>
<b-button
v-if="isHistoryItem && isDeleted"
v-if="writable && isHistoryItem && isDeleted"
class="undelete-btn px-1"
title="Undelete"
size="sm"
@@ -41,7 +41,7 @@
<icon icon="trash-restore" />
</b-button>
<b-button
v-if="isHistoryItem && !isVisible"
v-if="writable && isHistoryItem && !isVisible"
class="unhide-btn px-1"
title="Unhide"
size="sm"
@@ -56,6 +56,7 @@
import { prependPath } from "utils/redirect.js";
export default {
props: {
writable: { type: Boolean, default: true },
isDataset: { type: Boolean, required: true },
isDeleted: { type: Boolean, default: false },
isHistoryItem: { type: Boolean, required: true },
@@ -33,7 +33,7 @@
<span class="fa fa-info-circle" />
</b-button>
<b-button
v-if="showRerun"
v-if="writable && showRerun"
class="rerun-btn px-1"
title="Run Job Again"
size="sm"
@@ -83,6 +83,7 @@ export default {
mixins: [downloadUrlMixin],
props: {
item: { type: Object, required: true },
writable: { type: Boolean, default: true },
showHighlight: { type: Boolean, default: false },
itemUrls: { type: Object, required: true },
},
@@ -23,6 +23,7 @@
</div>
<DatasetActions
:item="result"
:writable="writable"
:show-highlight="showHighlight"
:item-urls="itemUrls"
@toggleHighlights="toggleHighlights" />
@@ -97,6 +98,7 @@ export default {
},
props: {
dataset: { type: Object, required: true },
writable: { type: Boolean, default: true },
showHighlight: { type: Boolean, default: false },
itemUrls: { type: Object, required: true },
},
@@ -35,7 +35,10 @@
:filter-text.sync="filterText"
:show-advanced.sync="showAdvanced" />
<section v-if="!showAdvanced">
<HistoryDetails :history="history" @update:history="$emit('updateHistory', $event)" />
<HistoryDetails
:history="history"
:writeable="writable"
@update:history="$emit('updateHistory', $event)" />
<HistoryMessages :history="history" />
<HistoryCounter
v-if="showControls"
@@ -108,6 +111,7 @@
is-history-item
:item="item"
:name="item.name"
:writable="writable"
:expand-dataset="isExpanded(item)"
:is-dataset="isDataset(item)"
:highlight="getHighlight(item)"
@@ -177,6 +181,7 @@ export default {
listOffset: { type: Number, default: 0 },
history: { type: Object, required: true },
filter: { type: String, default: "" },
writable: { type: Boolean, default: true },
showControls: { type: Boolean, default: true },
},
data() {
@@ -31,6 +31,7 @@
v-else
v-on="handlers"
:history="history"
:writable="user.id == history.user_id"
:show-controls="false"
@view-collection="onViewCollection" />
<CopyModal id="copy-history-modal" :history="history" />
@@ -1,7 +1,7 @@
<template>
<section class="m-3 details" data-description="edit details">
<b-button
:disabled="currentUser.isAnonymous || !writeable"
v-if="writeable && !currentUser.isAnonymous"
class="edit-button ml-1 float-right"
data-description="editor toggle"
size="sm"