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
12 changes: 10 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 Expand Up @@ -89,6 +96,7 @@
position: relative;
display: inline-block;
height: 30px;
vertical-align: middle;
}
.task-vertical-separator {
display: inline;
Expand Down
34 changes: 17 additions & 17 deletions resources/js/tasks/components/TasksList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
<div
:id="`element-${rowIndex}-${colIndex}`"
:class="{ 'pm-table-truncate': header.truncate }"
:style="{ maxWidth: header.width + 'px' }"
:style="{ maxWidth: header.width + 'px', display: 'inline-block', verticalAlign: 'middle' }"
>
<span
v-html="sanitize(getNestedPropertyValue(row, header))"
Expand Down Expand Up @@ -169,7 +169,7 @@
<div
:id="`element-${rowIndex}-${colIndex}`"
:class="{ 'pm-table-truncate': header.truncate }"
:style="{ maxWidth: header.width + 'px' }"
:style="{ maxWidth: header.width + 'px', display: 'inline-block', verticalAlign: 'middle' }"
>
{{ getNestedPropertyValue(row, header) }}
<b-tooltip
Expand Down Expand Up @@ -216,7 +216,6 @@
/>
</div>
<tasks-preview
v-if="!verifyURL('saved-searches')"
ref="preview"
:tooltip-button="tooltipFromButton"
@mark-selected-row="markSelectedRow"
Expand Down Expand Up @@ -349,21 +348,21 @@ 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",
title: this.$t("Open Case"),
click: this.redirectToRequest,
imgSrc: "/img/smartinbox-images/open-case.svg",
show: !this.verifyURL("saved-searches") || true,
show: true,
},
{
id: "openTaskButton",
title: this.$t("Open Task"),
click: this.redirectToTask,
icon: "fas fa-external-link-alt",
show: !this.verifyURL("saved-searches") || true,
show: true,
},
],
actions: [
Expand Down Expand Up @@ -445,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 @@ -550,7 +550,7 @@ export default {
return link;
},
previewTasks(info, size = null, fromButton = null) {
if (!info || !this.$refs.preview) {
if (!info || !this.$refs.preview || !this.shouldShowPreviewButton(info)) {
Comment thread
cursor[bot] marked this conversation as resolved.
Resolved
return;
}
this.tooltipFromButton = fromButton;
Expand Down Expand Up @@ -589,10 +589,7 @@ export default {
label = this.$t("Completed");
}

return `
<span class="badge badge-${color} status-${color}">
${label}
</span>`;
return `<span class="badge badge-${color} status-${color}">${label}</span>`;
},
formatDueDate(date) {
return date === null ? "-" : moment(date).format("MM/DD/YY HH:mm");
Expand Down Expand Up @@ -752,13 +749,16 @@ export default {
this.sortOrder[0].sortField = by;
this.sortOrder[0].direction = direction;
},
verifyURL(string) {
const currentUrl = window.location.href;
let isInUrl = currentUrl.includes(string);
if (this.processesIManage) {
isInUrl = false;
/**
* Preview is available for active/self-service tasks (including on saved searches).
* Completed tasks are excluded on normal task lists, but Quick Fill / Inbox Rules
* intentionally preview completed tasks (fromButton: previewTask|fullTask|inboxRules).
*/
shouldShowPreviewButton(row) {
if (["previewTask", "fullTask", "inboxRules"].includes(this.fromButton)) {
return true;
}
return isInUrl;
return row?.task_status !== "CLOSED";
},
/**
* This method is used in PMColumnFilterPopoverCommonMixin.js
Expand Down
Loading