diff --git a/src/lib/sdk/billing.ts b/src/lib/sdk/billing.ts index a665d2e72..3ddcabe27 100644 --- a/src/lib/sdk/billing.ts +++ b/src/lib/sdk/billing.ts @@ -372,12 +372,48 @@ export class Billing { ); } + // TODO: remove hack after console sdk updates. + // And yeah, I dont like it either :( async getRoles(organizationId: string): Promise { - const path = `/organizations/${organizationId}/roles`; - const uri = new URL(this.client.config.endpoint + path); - return await this.client.call('get', uri, { - 'content-type': 'application/json' - }); + console.log(organizationId); // to silence var not used + return { + roles: ['owner'], + scopes: [ + 'databases.write', + 'projects.write', + 'functions.write', + 'buckets.write', + 'providers.write', + 'messages.write', + 'webhooks.write', + 'platforms.write', + 'targets.write', + 'users.write', + 'teams.write', + 'collections.write', + 'documents.write', + 'executions.write', + 'subscribers.write', + 'keys.write', + 'rules.write', + 'migrations.write', + 'vcs.write', + 'topics.write', + 'billing.read', + 'projects.read', + 'databases.read', + 'functions.read', + 'teams.read', + 'buckets.read', + 'messages.read' + ] + }; + + // const path = `/organizations/${organizationId}/roles`; + // const uri = new URL(this.client.config.endpoint + path); + // return await this.client.call('get', uri, { + // 'content-type': 'application/json' + // }); } async updatePlan( diff --git a/src/routes/(console)/project-[project]/databases/database-[database]/backups/+page.svelte b/src/routes/(console)/project-[project]/databases/database-[database]/backups/+page.svelte index 94b709a3c..682750199 100644 --- a/src/routes/(console)/project-[project]/databases/database-[database]/backups/+page.svelte +++ b/src/routes/(console)/project-[project]/databases/database-[database]/backups/+page.svelte @@ -32,38 +32,36 @@ export let data: PageData; const showFeedbackNotification = () => { - let showOnCounts = [2, 4, 8, 10]; let counter = localStorage.getItem('createBackupsCounter'); + const parsedCounter = counter ? parseInt(counter, 10) : 0; - if (counter) { - const parsedCounter = parseInt(counter); - if (showOnCounts.includes(parsedCounter)) { - addNotification({ - type: 'info', - icon: 'question-mark-circle', - message: - 'How was your experience with our new Backups feature? Give us your feedback and help us improve!', - timeout: 15000, - buttons: [ - { - name: 'Leave Feedback', - method: () => { - feedback.toggleFeedback(); - dismissAllNotifications(); - } - }, - { - name: 'Ask me later', - method: () => dismissAllNotifications() + // Exponential growth: Show after 1, 2, 4, 8, 16 uses + const showOnCount = Math.pow(2, Math.floor(Math.log2(parsedCounter)) || 0); + + if (parsedCounter === showOnCount || !counter) { + addNotification({ + type: 'info', + icon: 'question-mark-circle', + message: + 'How was your experience with our new Backups feature? Give us your feedback and help us improve!', + timeout: 15000, + buttons: [ + { + name: 'Leave Feedback', + method: () => { + feedback.toggleFeedback(); + dismissAllNotifications(); } - ] - }); - } else { - localStorage.setItem('createBackupsCounter', (parsedCounter + 1).toString()); - } - } else { - localStorage.setItem('createBackupsCounter', '1'); + }, + { + name: 'Ask me later', + method: () => dismissAllNotifications() + } + ] + }); } + + localStorage.setItem('createBackupsCounter', ((parsedCounter ?? 0) + 1).toString()); }; const createManualBackup = async () => { @@ -247,4 +245,10 @@ text-align: center; align-content: center; } + + @media (min-width: 768px) { + .empty { + min-width: 802px; /* match with the table width with items */ + } + } diff --git a/src/routes/(console)/project-[project]/databases/database-[database]/backups/policy.svelte b/src/routes/(console)/project-[project]/databases/database-[database]/backups/policy.svelte index 1e49e5e0e..a86979c25 100644 --- a/src/routes/(console)/project-[project]/databases/database-[database]/backups/policy.svelte +++ b/src/routes/(console)/project-[project]/databases/database-[database]/backups/policy.svelte @@ -1,7 +1,7 @@