Skip to content

Commit

Permalink
chore: Organize imports
Browse files Browse the repository at this point in the history
  • Loading branch information
nas-tabchiche committed Sep 10, 2024
1 parent 2094c0f commit ec2537e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions backend/serdes/views.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import gzip
import io
import json
import sys
Expand All @@ -10,7 +11,6 @@
from rest_framework.parsers import FileUploadParser
from rest_framework.response import Response
from rest_framework.views import APIView
import gzip, io

from ciso_assistant.settings import VERSION
from serdes.serializers import LoadBackupSerializer
Expand All @@ -22,9 +22,9 @@ def get(self, request, *args, **kwargs):
return Response(status=status.HTTP_403_FORBIDDEN)
response = HttpResponse(content_type="application/json")
timestamp = datetime.now().strftime("%Y%m%d-%H%M%S")
response["Content-Disposition"] = (
f'attachment; filename="ciso-assistant-db-{timestamp}.json"'
)
response[
"Content-Disposition"
] = f'attachment; filename="ciso-assistant-db-{timestamp}.json"'

buffer = io.StringIO()
buffer.write(f'[{{"meta": [{{"media_version": "{VERSION}"}}]}},\n')
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/routes/(app)/backup-restore/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import { page } from '$app/stores';
import * as m from '$paraglide/messages';
const authorizedExtensions = ['.json', '.gz'];
import { getModalStore, type ModalSettings } from '@skeletonlabs/skeleton';
const modalStore = getModalStore();
Expand All @@ -16,19 +15,20 @@
type: 'confirm',
title: m.importBackup(),
body: m.confirmImportBackup(),
response: (r: boolean) => form.requestSubmit()
response: () => form.requestSubmit()
};
if (file) modalStore.trigger(modal);
}
$: uploadButtonStyles = file ? '' : 'chip-disabled';
const authorizedExtensions = ['.json', '.gz'];
const user = $page.data.user;
const canBackup: boolean = Object.hasOwn(user.permissions, 'backup');
</script>

{#if canBackup}
<div class=" flex grid grid-cols-2 space-x-4">
<div class="grid grid-cols-2 space-x-4">
<div class="card bg-white shadow py-4 px-6 space-y-2">
<h4 class="h4 font-semibold">{m.exportBackup()} <i class="fa-solid fa-download" /></h4>
<div class=" py-4">
Expand Down

0 comments on commit ec2537e

Please sign in to comment.