misc: fixes and updates.

This commit is contained in:
ItzNotABug committed 2024-09-27 13:27:10 +05:30
1 parent 9f527aed12
commit 9653a51201
4 files changed
+90 -40

No files matched your search

+41 -5
View File
@@ -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<Roles> {
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(
@@ -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 */
}
}
</style>
@@ -1,7 +1,7 @@
<script lang="ts">
import Card from '$lib/components/card.svelte';
import { DropList, DropListItem, Modal } from '$lib/components';
import { Button } from '$lib/elements/forms/index';
import { Button, FormList, InputCheckbox } from '$lib/elements/forms/index';
import { type Models } from '@appwrite.io/console';
import { app } from '$lib/stores/app';
@@ -13,7 +13,6 @@
import { Dependencies } from '$lib/constants';
import { parseExpression } from 'cron-parser';
import { toLocaleDateTime } from '$lib/helpers/date';
import { FormList, InputCheckbox } from '$lib/elements/forms/index.js';
let showDropdown = [];
let showDelete = false;
@@ -260,11 +259,13 @@
irreversible.</b>
</p>
<InputCheckbox
required
size="small"
id="delete_policy"
label="I understand and confirm" />
<div class="input-check-box-friction">
<InputCheckbox
required
size="small"
id="delete_policy"
label="I understand and confirm" />
</div>
</div>
</FormList>
<svelte:fragment slot="footer">
@@ -330,6 +331,10 @@
margin-block: 0.125rem;
}
:global(.input-check-box-friction .choice-item-title) {
margin-block-start: 1px;
}
:global(.theme-light .policy-item-subtitles) {
color: var(--color-fgColor-neutral-secondary, #56565c);
}
@@ -38,6 +38,10 @@
let newDatabaseInfo: { name: string; id: string } = { name: null, id: null };
const deleteBackups = async () => {
if (!selectedBackups.length && selectedBackup) {
selectedBackups.push(selectedBackup.$id);
}
const message = `${selectedBackups.length} backup${selectedBackups.length > 1 ? 's' : ''} deleted`;
const promises = selectedBackups.map((archiveId) =>
@@ -58,6 +62,7 @@
});
} finally {
showDelete = false;
selectedBackup = null;
selectedBackups = [];
}
};