Add filesystem storage limit to usage card

This commit is contained in:
2024-07-11 14:02:59 +02:00
parent 94cc04b746
commit 4e0e446fc8
2 changed files with 58 additions and 45 deletions

View File

@@ -4,6 +4,7 @@ import ProgressBar from "../util/ProgressBar.svelte";
export let total = 0 export let total = 0
export let used = 0 export let used = 0
export let disable_warnings = false
$: frac = used / total $: frac = used / total
</script> </script>
@@ -21,46 +22,50 @@ $: frac = used / total
</div> </div>
</div> </div>
{#if frac > 2.0} {#if !disable_warnings}
<div class="highlight_red"> {#if frac > 2.0}
<span class="warn_text">You are using more than 200% of your allowed storage space!</span> <div class="highlight_red">
<p> <span class="warn_text">
We have started deleting your files to free up space. If you do not You are using more than 200% of your allowed storage space!
want to lose any more files please upgrade to a subscription which </span>
supports the volume of storage which you need. <p>
</p> We have started deleting your files to free up space. If you do not
<a class="button button_highlight" href="/#pro"> want to lose any more files please upgrade to a subscription which
<i class="icon">bolt</i> Upgrade options supports the volume of storage which you need.
</a> </p>
</div> <a class="button button_highlight" href="/#pro">
{:else if frac > 1.0} <i class="icon">bolt</i> Upgrade options
<div class="highlight_red"> </a>
<p> </div>
You have used all of your storage space. You won't be able to {:else if frac > 1.0}
upload new files anymore. Please upgrade to a higher support <div class="highlight_red">
tier to continue uploading files. <p>
</p> You have used all of your storage space. You won't be able to
<a class="button button_highlight" href="/#pro"> upload new files anymore. Please upgrade to a higher support
<i class="icon">bolt</i> Upgrade options tier to continue uploading files.
</a> </p>
<p> <a class="button button_highlight" href="/#pro">
Your files will not be deleted any sooner than normal at this <i class="icon">bolt</i> Upgrade options
moment. When your storage usage is over 200% we will start </a>
deleting your files to free up the space. <p>
</p> Your files will not be deleted any sooner than normal at this
</div> moment. When your storage usage is over 200% we will start
{:else if frac > 0.8} deleting your files to free up the space.
<div class="highlight_yellow"> </p>
<p> </div>
You have used {(frac*100).toFixed(0)}% of your {:else if frac > 0.8}
storage space. If your storage space runs out you won't be able <div class="highlight_yellow">
to upload new files anymore. Please upgrade to a higher support <p>
tier to continue uploading files. You have used {(frac*100).toFixed(0)}% of your
</p> storage space. If your storage space runs out you won't be able
<a class="button button_highlight" href="/#pro"> to upload new files anymore. Please upgrade to a higher support
<i class="icon">bolt</i> Upgrade options tier to continue uploading files.
</a> </p>
</div> <a class="button button_highlight" href="/#pro">
<i class="icon">bolt</i> Upgrade options
</a>
</div>
{/if}
{/if} {/if}
<style> <style>

View File

@@ -3,11 +3,10 @@ import { onMount } from "svelte";
import HotlinkProgressBar from "../HotlinkProgressBar.svelte"; import HotlinkProgressBar from "../HotlinkProgressBar.svelte";
import StorageProgressBar from "../StorageProgressBar.svelte"; import StorageProgressBar from "../StorageProgressBar.svelte";
let transfer_cap = 0 let transfer_cap = 0
let transfer_used = 0 let transfer_used = 0
let storage_used = window.user.storage_space_used
let storage_limit = window.user.subscription.storage_space let storage_limit = window.user.subscription.storage_space
let fs_storage_limit = window.user.subscription.filesystem_storage_limit
let load_direct_bw = () => { let load_direct_bw = () => {
let today = new Date() let today = new Date()
let start = new Date() let start = new Date()
@@ -43,11 +42,20 @@ onMount(() => {
</script> </script>
Storage space used: Total storage space used:
<StorageProgressBar used={storage_used} total={storage_limit}/> <StorageProgressBar used={window.user.storage_space_used} total={storage_limit}/>
<br/> <br/>
{#if window.user.subscription.filesystem_access === true}
Filesystem storage space used:
<StorageProgressBar
used={window.user.filesystem_storage_used}
total={fs_storage_limit > 0 ? fs_storage_limit : storage_limit}
disable_warnings
/>
<br/>
{/if}
Premium data transfer: Premium data transfer:
(<a href="/user/sharing/bandwidth">set custom limit</a>) (<a href="/user/sharing/bandwidth">set custom limit</a>)
<HotlinkProgressBar used={transfer_used} total={transfer_cap}></HotlinkProgressBar> <HotlinkProgressBar used={transfer_used} total={transfer_cap}></HotlinkProgressBar>