Skip to content

Commit

Permalink
add purged/deleted/archived indicators for multiview items
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedhamidawan committed Jul 22, 2024
1 parent dc8164a commit 8ce94b5
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
19 changes: 17 additions & 2 deletions client/src/components/History/HistoryScrollList.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { library } from "@fortawesome/fontawesome-svg-core";
import { faCheckSquare, faListAlt, faSquare } from "@fortawesome/free-regular-svg-icons";
import { faArrowDown, faColumns, faSignInAlt } from "@fortawesome/free-solid-svg-icons";
import { faArchive, faArrowDown, faBurn, faColumns, faSignInAlt, faTrash } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
import { useInfiniteScroll } from "@vueuse/core";
import { BAlert, BBadge, BButton, BButtonGroup, BListGroup, BListGroupItem, BOverlay } from "bootstrap-vue";
Expand Down Expand Up @@ -54,7 +54,7 @@ const emit = defineEmits<{
(e: "update:show-modal", showModal: boolean): void;
}>();
library.add(faColumns, faSignInAlt, faListAlt, faArrowDown, faCheckSquare, faSquare);
library.add(faColumns, faSignInAlt, faListAlt, faArrowDown, faCheckSquare, faSquare, faBurn, faTrash, faArchive);
const busy = ref(false);
const showAdvanced = ref(false);
Expand Down Expand Up @@ -278,6 +278,21 @@ async function loadMore(noScroll = false) {
</div>
<TextSummary v-else component="h4" :description="history.name" one-line-summary />
<div class="d-flex align-items-center flex-gapx-1">
<BBadge pill>
<FontAwesomeIcon
v-if="history.purged"
title="Purged"
:icon="faBurn"
fixed-width />
<FontAwesomeIcon
v-else-if="history.deleted"
title="Deleted"
:icon="faTrash"
fixed-width />
</BBadge>
<BBadge v-if="history.archived" pill>
<FontAwesomeIcon title="Archived" :icon="faArchive" fixed-width />
</BBadge>
<BBadge pill :title="localize('Amount of items in history')">
{{ history.count }} {{ localize("items") }}
</BBadge>
Expand Down
16 changes: 14 additions & 2 deletions client/src/components/History/Multiple/MultipleViewItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@ const sameToCurrent = computed(() => {
return currentHistoryId.value === props.source.id;
});
const switchToText = computed(() => {
if (sameToCurrent.value) {
return "Current History";
} else if (history.value?.purged) {
return "Purged History";
} else if (history.value?.archived) {
return "Archived History";
} else {
return "Switch to this history";
}
});
function onViewCollection(collection: object) {
selectedCollections.value = [...selectedCollections.value, collection];
}
Expand All @@ -54,9 +66,9 @@ function onViewCollection(collection: object) {
<BButton
size="sm"
class="my-1"
:disabled="sameToCurrent"
:disabled="sameToCurrent || history.purged || history.archived"
:variant="sameToCurrent ? 'disabled' : 'outline-info'"
:title="sameToCurrent ? 'Current History' : 'Switch to this history'"
:title="switchToText"
@click="historyStore.setCurrentHistory(source.id)">
{{ sameToCurrent ? "Current History" : "Switch to" }}
</BButton>
Expand Down

0 comments on commit 8ce94b5

Please sign in to comment.