Skip to content

Commit

Permalink
Disable storage dashboard for anon users
Browse files Browse the repository at this point in the history
  • Loading branch information
guerler committed Jun 28, 2024
1 parent b29c828 commit 360b147
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions client/src/components/Masthead/QuotaMeter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useUserStore } from "@/stores/userStore";
import { bytesToString } from "@/utils/utils";
const { config } = useConfig();
const { currentUser } = storeToRefs(useUserStore());
const { currentUser, isAnonymous } = storeToRefs(useUserStore());
const hasQuota = computed(() => {
const quotasEnabled = config.value.enable_quotas ?? false;
Expand All @@ -30,6 +30,10 @@ const usage = computed(() => {
return currentUser.value?.total_disk_usage ?? 0;
});
const quotaTitle = computed(() =>
isAnonymous.value ? "Login to Access Storage Details" : "Storage and Usage Details"
);
const variant = computed(() => {
if (!hasQuota.value || usage.value < 80) {
return "success";
Expand All @@ -41,8 +45,8 @@ const variant = computed(() => {
</script>

<template>
<div v-b-tooltip.hover.bottom class="quota-meter d-flex align-items-center" title="Storage and Usage Details">
<BLink class="quota-progress" to="/storage" data-description="storage dashboard link">
<div v-b-tooltip.hover.bottom class="quota-meter d-flex align-items-center" :title="quotaTitle">
<BLink class="quota-progress" to="/storage" data-description="storage dashboard link" :disabled="isAnonymous">
<BProgress :max="100">
<BProgressBar aria-label="Quota usage" :value="usage" :variant="variant" />
</BProgress>
Expand Down

0 comments on commit 360b147

Please sign in to comment.