Skip to content

Commit

Permalink
Merge pull request #18092 from ahmedhamidawan/pinned_histories_on_top…
Browse files Browse the repository at this point in the history
…_multiview

[24.0] History Multiview panel shows pinned histories on top
  • Loading branch information
martenson authored May 3, 2024
2 parents dcf8207 + 2866345 commit 9c43535
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions client/src/components/History/HistoryScrollList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ const filtered = computed<HistorySummary[]>(() => {
return -1;
} else if (!isMultiviewPanel.value && b.id == currentHistoryId.value) {
return 1;
} else if (isMultiviewPanel.value && isPinned(a.id) && !isPinned(b.id)) {
return -1;
} else if (isMultiviewPanel.value && !isPinned(a.id) && isPinned(b.id)) {
return 1;
} else if (a.update_time < b.update_time) {
return 1;
} else {
Expand All @@ -161,16 +165,20 @@ const isMultiviewPanel = computed(() => !props.inModal && props.multiple);
function isActiveItem(history: HistorySummary) {
if (isMultiviewPanel.value) {
return pinnedHistories.value.some((item: PinnedHistory) => item.id == history.id);
return isPinned(history.id);
} else {
return props.selectedHistories.some((item: PinnedHistory) => item.id == history.id);
}
}
function isPinned(historyId: string) {
return pinnedHistories.value.some((item: PinnedHistory) => item.id == historyId);
}
function historyClicked(history: HistorySummary) {
emit("selectHistory", history);
if (isMultiviewPanel.value) {
if (pinnedHistories.value.some((item: PinnedHistory) => item.id == history.id)) {
if (isPinned(history.id)) {
historyStore.unpinHistories([history.id]);
} else {
openInMulti(history);
Expand Down Expand Up @@ -263,18 +271,14 @@ async function loadMore(noScroll = false) {
<i v-if="history.id === currentHistoryId">(Current)</i>
</Heading>
<i
v-if="props.multiple && pinnedHistories.some((h) => h.id === history.id)"
v-b-tooltip.noninteractive.hover
v-if="props.multiple && isPinned(history.id)"
title="This history is currently pinned in the multi-history view">
(currently pinned)
</i>
</div>
<TextSummary v-else component="h4" :description="history.name" one-line-summary />
<div class="d-flex align-items-center flex-gapx-1">
<BBadge
v-b-tooltip.noninteractive.hover
pill
:title="localize('Amount of items in history')">
<BBadge pill :title="localize('Amount of items in history')">
{{ history.count }} {{ localize("items") }}
</BBadge>
<BBadge
Expand Down

0 comments on commit 9c43535

Please sign in to comment.