diff --git a/package-lock.json b/package-lock.json
index ad290460f..dc96f3b12 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -8,7 +8,7 @@
"dependencies": {
"@analytics/google-analytics": "^1.0.5",
"@appwrite.io/console": "0.1.0",
- "@appwrite.io/pink": "^0.0.6-rc.10",
+ "@appwrite.io/pink": "0.0.6-rc.11",
"@popperjs/core": "^2.11.6",
"@sentry/svelte": "^7.44.2",
"@sentry/tracing": "^7.44.2",
@@ -157,9 +157,9 @@
}
},
"node_modules/@appwrite.io/pink": {
- "version": "0.0.6-rc.10",
- "resolved": "https://registry.npmjs.org/@appwrite.io/pink/-/pink-0.0.6-rc.10.tgz",
- "integrity": "sha512-mhpgjQVfQvghItgcCzsHN0Ynn4U9JNg8HlSJ+HVDUi/bNHxmlm7XdNJE6s65LMJ6LfepROn6zZMHquANvGfNDg==",
+ "version": "0.0.6-rc.11",
+ "resolved": "https://registry.npmjs.org/@appwrite.io/pink/-/pink-0.0.6-rc.11.tgz",
+ "integrity": "sha512-wHuWZM1SbBV7GQymBcBGDgtN5teu2OeMl9vB+IM6Ctg+Jkqjlc8QyO8Ef6Om8EFuSJCEzxCugMQPM0Ohtt/V2g==",
"dependencies": {
"@appwrite.io/pink-icons": "*",
"normalize.css": "^8.0.1",
diff --git a/package.json b/package.json
index 180fe7eff..54c201dc2 100644
--- a/package.json
+++ b/package.json
@@ -20,7 +20,7 @@
"dependencies": {
"@analytics/google-analytics": "^1.0.5",
"@appwrite.io/console": "0.1.0",
- "@appwrite.io/pink": "^0.0.6-rc.10",
+ "@appwrite.io/pink": "0.0.6-rc.11",
"@popperjs/core": "^2.11.6",
"@sentry/svelte": "^7.44.2",
"@sentry/tracing": "^7.44.2",
diff --git a/src/lib/components/progressBar.svelte b/src/lib/components/progressBar.svelte
index 73d77c5c7..406f69c02 100644
--- a/src/lib/components/progressBar.svelte
+++ b/src/lib/components/progressBar.svelte
@@ -30,9 +30,9 @@
class="progress-bar-container"
class:is-warning={status === 'warning'}
class:is-danger={status === 'error'}
- style:--graph-size={progress} />
+ style:--graph-size={progress + '%'} />
- {used}
+ {used}{unit}
{max}{unit}
diff --git a/src/lib/components/projectUsage.svelte b/src/lib/components/projectUsage.svelte
index 2b4a2f7ca..5a7158ad9 100644
--- a/src/lib/components/projectUsage.svelte
+++ b/src/lib/components/projectUsage.svelte
@@ -1,4 +1,6 @@
-
-
-
-
status
-
-
-
- {#each data as project}
- -
-
-
- {/each}
-
-
-
+
+
+
{title}
+ {#if data.some((d) => d.status === 'warning' || d.status === 'error')}
+ {@const highestUsage = data.reduce(
+ (acc, curr) => {
+ if (curr.status === 'error') return curr;
+ if (curr.status === 'warning' && acc.status !== 'error') return curr;
+ return acc;
+ },
+ { status: null, used: 0, max: 0 }
+ )}
+
+
+ {Math.round((highestUsage.used / highestUsage.max) * 100)}% of limit used
+
+
+ {/if}
+
+
+ {#each data as usage}
+ -
+
+
+ {/each}
+
+
+
diff --git a/src/routes/console/organization-[organization]/usage/[[period]]/+page.svelte b/src/routes/console/organization-[organization]/usage/[[period]]/+page.svelte
index 10397aa48..f091efc12 100644
--- a/src/routes/console/organization-[organization]/usage/[[period]]/+page.svelte
+++ b/src/routes/console/organization-[organization]/usage/[[period]]/+page.svelte
@@ -21,11 +21,9 @@
- {#each data.projectUsage as projectUsage}
- {@const usage}
-
+ style="--grid-gap:1.5rem; --grid-item-size:25rem;'}">
+ {#each data?.usageData as project}
+
{/each}
diff --git a/src/routes/console/organization-[organization]/usage/[[period]]/+page.ts b/src/routes/console/organization-[organization]/usage/[[period]]/+page.ts
index 3b202da76..30aea507d 100644
--- a/src/routes/console/organization-[organization]/usage/[[period]]/+page.ts
+++ b/src/routes/console/organization-[organization]/usage/[[period]]/+page.ts
@@ -1,21 +1,70 @@
import type { PageLoad } from './$types';
import { error } from '@sveltejs/kit';
+const MOCKDATA = [
+ {
+ name: 'test',
+ projectUsage: [
+ {
+ name: 'Bandwidth',
+ icon: 'chart-bar',
+ unit: 'GB',
+ max: 16,
+ used: 8,
+ status: null
+ },
+ {
+ name: 'Storage',
+ icon: 'folder',
+ unit: 'GB',
+ max: 3.5,
+ used: 3.7,
+ status: 'error'
+ },
+ {
+ name: 'Compute',
+ icon: 'lightning-bolt',
+ unit: 'hrs',
+ max: 2,
+ used: 1.8,
+ status: 'warning'
+ }
+ ]
+ },
+ {
+ name: 'Lol',
+ projectUsage: [
+ {
+ name: 'Bandwidth',
+ icon: 'chart-bar',
+ unit: 'GB',
+ max: 16,
+ used: 8,
+ status: null
+ },
+ {
+ name: 'Storage',
+ icon: 'folder',
+ unit: 'GB',
+ max: 10.5,
+ used: 3.7,
+ status: null
+ },
+ {
+ name: 'Compute',
+ icon: 'lightning-bolt',
+ unit: 'hrs',
+ max: 2,
+ used: 1.5,
+ status: null
+ }
+ ]
+ }
+];
+
export const load: PageLoad = async ({ params }) => {
try {
- return {
- projectUsage: [
- {
- title: 'Total',
- usage: {
- name: 'badwidth',
- max: 100,
- used: 50,
- unit: 'GB'
- }
- }
- ]
- };
+ return { usageData: MOCKDATA };
} catch (e) {
throw error(e.code, e.message);
}