Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions resources/js/tasks/components/TaskListRowButtons.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<slot name="body">
<span v-for="(button, index) in buttons" :key="index">
<b-button :id="button.id + rowIndex"
v-if="button.show"
v-if="shouldShow(button)"
aria-label="button.title"
@click="onClick(button)"
variant="light"
Expand All @@ -19,6 +19,7 @@
:alt="button.title"/>
</b-button>
<b-tooltip
v-if="shouldShow(button)"
:target="button.id + rowIndex"
:title="button.title"
custom-class="task-hover-tooltip"
Expand All @@ -27,7 +28,7 @@
boundary="viewport"
:no-fade="true"
/>
<div v-if="index < buttons.length - 1 && button.show"
<div v-if="index < buttons.length - 1 && shouldShow(button)"
class="task-vertical-separator">
</div>
</span>
Expand All @@ -51,6 +52,12 @@
showButtons: null
},
methods: {
shouldShow(button) {
if (typeof button.show === "function") {
return button.show(this.row);
}
return button.show;
},
show() {
this.triggerFloatingButtons(() => {
if (!this.showButtons) {
Expand Down
13 changes: 12 additions & 1 deletion resources/js/tasks/components/TasksList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ export default {
click: this.previewTasks,
icon: "fas fa-eye",
title: this.$t("Preview"),
show: !this.verifyURL("saved-searches") || false,
show: (row) => this.shouldShowPreviewButton(row),
},
{
id: "openCaseButton",
Expand Down Expand Up @@ -444,6 +444,7 @@ export default {
record.process_request,
record,
);
record.task_status = record.status;
record.status = this.formatStatus(record);
record.assignee = this.formatAvatar(record.user);
record.request = this.formatRequest(record);
Expand Down Expand Up @@ -759,6 +760,16 @@ export default {
}
return isInUrl;
},
/**
* Hide Preview for completed tasks (API status CLOSED) and on normal saved searches.
* Use task_status because status is replaced with badge HTML in the data watcher.
*/
shouldShowPreviewButton(row) {
if (this.verifyURL("saved-searches") && !this.processesIManage) {
return false;
}
return row?.task_status !== "CLOSED";
Comment thread
CarliPinell marked this conversation as resolved.
},
/**
* This method is used in PMColumnFilterPopoverCommonMixin.js
*/
Expand Down
Loading