Skip to content

Commit

Permalink
Merge pull request #17685 from ahmedhamidawan/purge_history_from_panel
Browse files Browse the repository at this point in the history
[24.0] Purge history from history panel
  • Loading branch information
dannon authored Mar 13, 2024
2 parents cbe4bc7 + ac6ca59 commit cc7e36e
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions client/src/components/History/CurrentHistory/HistoryNavigation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
BDropdownDivider,
BDropdownItem,
BDropdownText,
BFormCheckbox,
BModal,
BSpinner,
} from "bootstrap-vue";
Expand Down Expand Up @@ -63,19 +64,28 @@ interface Props {
historiesLoading?: boolean;
}
withDefaults(defineProps<Props>(), {
const props = withDefaults(defineProps<Props>(), {
title: "Histories",
historiesLoading: false,
});
const showSwitchModal = ref(false);
const purgeHistory = ref(false);
const userStore = useUserStore();
const historyStore = useHistoryStore();
const { isAnonymous } = storeToRefs(userStore);
const { totalHistoryCount } = storeToRefs(historyStore);
function onDelete() {
if (purgeHistory.value) {
historyStore.deleteHistory(props.history.id, true);
} else {
historyStore.deleteHistory(props.history.id, false);
}
}
function userTitle(title: string) {
if (isAnonymous.value) {
return localize("Log in to") + " " + localize(title);
Expand Down Expand Up @@ -264,16 +274,14 @@ function userTitle(title: string) {
id="delete-history-modal"
title="Delete History?"
title-tag="h2"
@ok="historyStore.deleteHistory(history.id, false)">
<p v-localize>Really delete the current history?</p>
</BModal>

<BModal
id="purge-history-modal"
title="Permanently Delete History?"
title-tag="h2"
@ok="historyStore.deleteHistory(history.id, true)">
<p v-localize>Really delete the current history permanently? This cannot be undone.</p>
@ok="onDelete"
@show="purgeHistory = false">
<p v-localize>
Do you also want to permanently delete the history <i class="ml-1">{{ history.name }}</i>
</p>
<BFormCheckbox id="purge-history" v-model="purgeHistory">
<span v-localize>Yes, permanently delete this history.</span>
</BFormCheckbox>
</BModal>
</div>
</template>

0 comments on commit cc7e36e

Please sign in to comment.