Update usage page

This commit is contained in:
Rory Powell 2022-09-14 20:58:58 +01:00
parent 1bc0d13429
commit 40f1bb3067
1 changed files with 14 additions and 7 deletions

View File

@ -25,7 +25,8 @@
const upgradeUrl = `${$admin.accountPortalUrl}/portal/upgrade` const upgradeUrl = `${$admin.accountPortalUrl}/portal/upgrade`
const manageUrl = `${$admin.accountPortalUrl}/portal/billing` const manageUrl = `${$admin.accountPortalUrl}/portal/billing`
const warnUsage = ["Queries", "Automations", "Rows", "Day Passes"] const WARN_USAGE = ["Queries", "Automations", "Rows", "Day Passes"]
const EXCLUDE_QUOTAS = ["Queries"]
$: quotaUsage = $licensing.quotaUsage $: quotaUsage = $licensing.quotaUsage
$: license = $auth.user?.license $: license = $auth.user?.license
@ -36,11 +37,14 @@
monthlyUsage = [] monthlyUsage = []
if (quotaUsage.monthly) { if (quotaUsage.monthly) {
for (let [key, value] of Object.entries(license.quotas.usage.monthly)) { for (let [key, value] of Object.entries(license.quotas.usage.monthly)) {
if (EXCLUDE_QUOTAS.includes(value.name)) {
continue
}
const used = quotaUsage.monthly.current[key] const used = quotaUsage.monthly.current[key]
if (used !== undefined) { if (value.value !== 0) {
monthlyUsage.push({ monthlyUsage.push({
name: value.name, name: value.name,
used: used, used: used ? used : 0,
total: value.value, total: value.value,
}) })
} }
@ -52,11 +56,14 @@
const setStaticUsage = () => { const setStaticUsage = () => {
staticUsage = [] staticUsage = []
for (let [key, value] of Object.entries(license.quotas.usage.static)) { for (let [key, value] of Object.entries(license.quotas.usage.static)) {
if (EXCLUDE_QUOTAS.includes(value.name)) {
continue
}
const used = quotaUsage.usageQuota[key] const used = quotaUsage.usageQuota[key]
if (used !== undefined) { if (value.value !== 0) {
staticUsage.push({ staticUsage.push({
name: value.name, name: value.name,
used: used, used: used ? used : 0,
total: value.value, total: value.value,
}) })
} }
@ -199,7 +206,7 @@
<div class="usage"> <div class="usage">
<Usage <Usage
{usage} {usage}
warnWhenFull={warnUsage.includes(usage.name)} warnWhenFull={WARN_USAGE.includes(usage.name)}
/> />
</div> </div>
{/each} {/each}
@ -222,7 +229,7 @@
<div class="usage"> <div class="usage">
<Usage <Usage
{usage} {usage}
warnWhenFull={warnUsage.includes(usage.name)} warnWhenFull={WARN_USAGE.includes(usage.name)}
/> />
</div> </div>
{/each} {/each}