Merge pull request 'refactor-login-page' (#7) from refactor-login-page into main
Reviewed-on: #7
This commit was merged in pull request #7.
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
},
|
},
|
||||||
"jwt": {
|
"jwt": {
|
||||||
"secret": "@S2!q@@wXz$dCQ8JoVsHLpzaJ6JCfB",
|
"secret": "@S2!q@@wXz$dCQ8JoVsHLpzaJ6JCfB",
|
||||||
"expiresIn": 3600
|
"expiresIn": 36000
|
||||||
},
|
},
|
||||||
"auth": {
|
"auth": {
|
||||||
"admin": { "password": "A-InnoHUB_2025!", "admin": true },
|
"admin": { "password": "A-InnoHUB_2025!", "admin": true },
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
import { expect, test } from '@playwright/test';
|
|
||||||
|
|
||||||
test('home page has expected h1', async ({ page }) => {
|
|
||||||
await page.goto('/');
|
|
||||||
await expect(page.locator('h1')).toBeVisible();
|
|
||||||
});
|
|
||||||
@@ -20,7 +20,21 @@ export default ts.config(
|
|||||||
languageOptions: {
|
languageOptions: {
|
||||||
globals: { ...globals.browser, ...globals.node }
|
globals: { ...globals.browser, ...globals.node }
|
||||||
},
|
},
|
||||||
rules: { 'no-undef': 'off' }
|
rules: {
|
||||||
|
'no-undef': 'off',
|
||||||
|
'@typescript-eslint/no-unused-vars': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
args: 'all',
|
||||||
|
argsIgnorePattern: '^_',
|
||||||
|
caughtErrors: 'all',
|
||||||
|
caughtErrorsIgnorePattern: '^_',
|
||||||
|
destructuredArrayIgnorePattern: '^_',
|
||||||
|
varsIgnorePattern: '^_',
|
||||||
|
ignoreRestSiblings: true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
files: ['**/*.svelte', '**/*.svelte.ts', '**/*.svelte.js'],
|
files: ['**/*.svelte', '**/*.svelte.ts', '**/*.svelte.js'],
|
||||||
|
|||||||
801
package-lock.json
generated
801
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
43
package.json
43
package.json
@@ -13,31 +13,31 @@
|
|||||||
"format": "prettier --write .",
|
"format": "prettier --write .",
|
||||||
"lint": "prettier --check . && eslint .",
|
"lint": "prettier --check . && eslint .",
|
||||||
"test:unit": "vitest",
|
"test:unit": "vitest",
|
||||||
"test": "npm run test:unit -- --run && npm run test:e2e",
|
"test": "npm run test:unit -- --run && npm run test:e2e"
|
||||||
"test:e2e": "playwright test"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/compat": "^1.2.5",
|
"@eslint/compat": "^1.2.9",
|
||||||
"@eslint/js": "^9.18.0",
|
"@eslint/js": "^9.18.0",
|
||||||
"@playwright/test": "^1.49.1",
|
|
||||||
"@sveltejs/adapter-auto": "^4.0.0",
|
"@sveltejs/adapter-auto": "^4.0.0",
|
||||||
"@sveltejs/kit": "^2.16.0",
|
"@sveltejs/kit": "^2.21.3",
|
||||||
"@sveltejs/vite-plugin-svelte": "^5.0.0",
|
"@sveltejs/vite-plugin-svelte": "^5.1.0",
|
||||||
"@testing-library/jest-dom": "^6.6.3",
|
"@testing-library/jest-dom": "^6.6.3",
|
||||||
"@testing-library/svelte": "^5.2.4",
|
"@testing-library/svelte": "^5.2.8",
|
||||||
"eslint": "^9.18.0",
|
"@tsconfig/svelte": "^5.0.4",
|
||||||
"eslint-config-prettier": "^10.0.1",
|
"@types/jsonwebtoken": "^9.0.9",
|
||||||
"eslint-plugin-svelte": "^3.0.0",
|
"eslint": "^9.28.0",
|
||||||
"globals": "^16.0.0",
|
"eslint-config-prettier": "^10.1.5",
|
||||||
"jsdom": "^26.0.0",
|
"eslint-plugin-svelte": "^3.9.2",
|
||||||
"prettier": "^3.4.2",
|
"globals": "^16.2.0",
|
||||||
"prettier-plugin-svelte": "^3.3.3",
|
"jsdom": "^26.1.0",
|
||||||
"svelte": "^5.0.0",
|
"prettier": "^3.5.3",
|
||||||
"svelte-check": "^4.0.0",
|
"prettier-plugin-svelte": "^3.4.0",
|
||||||
"typescript": "^5.0.0",
|
"svelte": "^5.33.18",
|
||||||
"typescript-eslint": "^8.20.0",
|
"svelte-check": "^4.2.1",
|
||||||
"vite": "^6.2.5",
|
"typescript": "^5.8.3",
|
||||||
"vitest": "^3.0.0"
|
"typescript-eslint": "^8.34.0",
|
||||||
|
"vite": "^6.3.5",
|
||||||
|
"vitest": "^3.2.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@google/model-viewer": "^4.1.0",
|
"@google/model-viewer": "^4.1.0",
|
||||||
@@ -46,8 +46,7 @@
|
|||||||
"autoprefixer": "^10.4.21",
|
"autoprefixer": "^10.4.21",
|
||||||
"jsonwebtoken": "^9.0.2",
|
"jsonwebtoken": "^9.0.2",
|
||||||
"minio": "^8.0.5",
|
"minio": "^8.0.5",
|
||||||
"postcss": "^8.5.3",
|
"postcss": "^8.5.4",
|
||||||
"svelte-cubed": "^0.2.1",
|
|
||||||
"tailwindcss": "^3.4.17"
|
"tailwindcss": "^3.4.17"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
/** @type {import('@playwright/test').PlaywrightTestConfig} */
|
|
||||||
const config = {
|
|
||||||
webServer: {
|
|
||||||
command: 'npm run build && npm run preview',
|
|
||||||
port: 4173
|
|
||||||
},
|
|
||||||
testDir: 'tests',
|
|
||||||
testMatch: /(.+\.)?(test|spec)\.[jt]s/
|
|
||||||
};
|
|
||||||
|
|
||||||
export default config;
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
import { defineConfig } from '@playwright/test';
|
|
||||||
|
|
||||||
export default defineConfig({
|
|
||||||
webServer: {
|
|
||||||
command: 'npm run build && npm run preview',
|
|
||||||
port: 4173
|
|
||||||
},
|
|
||||||
testDir: 'e2e'
|
|
||||||
});
|
|
||||||
4
src/error.html
Normal file
4
src/error.html
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<h1>Du wurdest automatisch ausgeloggt</h1>
|
||||||
|
<p>Lösche deine Cookies aus dem Browser und logge dich neu ein</p>
|
||||||
|
<p>Code %sveltekit.status%</p>
|
||||||
|
<p>%sveltekit.error.message%</p>
|
||||||
@@ -1,16 +1,16 @@
|
|||||||
import { decryptToken } from '$lib/auth';
|
import { decryptToken } from '$lib/auth';
|
||||||
|
import type { Handle } from '@sveltejs/kit';
|
||||||
|
|
||||||
/** @type {import('@sveltejs/kit').Handle} */
|
export const handle: Handle = async ({ event, resolve }) => {
|
||||||
export async function handle({ event, resolve }) {
|
|
||||||
const jwt = event.cookies.get('session');
|
const jwt = event.cookies.get('session');
|
||||||
try {
|
try {
|
||||||
if (jwt) {
|
if (jwt) {
|
||||||
event.locals.user = decryptToken(jwt);
|
event.locals.user = decryptToken(jwt);
|
||||||
return resolve(event);
|
return resolve(event);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (_) {
|
||||||
await event.cookies.delete('session');
|
event.cookies.delete('session', {path: '/'});
|
||||||
event.locals.user = null;
|
event.locals.user = null;
|
||||||
}
|
}
|
||||||
return resolve(event);
|
return await resolve(event);
|
||||||
}
|
}
|
||||||
@@ -11,7 +11,7 @@ export function createToken(userData) {
|
|||||||
return jwt.sign(userData, SECRET, { expiresIn: EXPIRES_IN });
|
return jwt.sign(userData, SECRET, { expiresIn: EXPIRES_IN });
|
||||||
}
|
}
|
||||||
|
|
||||||
export function decryptToken(token) {
|
export function decryptToken(token: string) {
|
||||||
return jwt.verify(token, SECRET);
|
return jwt.verify(token, SECRET);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script lang="ts">
|
||||||
export let type = 'info';
|
export let type = 'info';
|
||||||
let classNames = '';
|
let classNames = '';
|
||||||
export { classNames as class };
|
export { classNames as class };
|
||||||
32
src/lib/components/BaseInputField.svelte
Normal file
32
src/lib/components/BaseInputField.svelte
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import Exclamation from '$lib/icons/Exclamation.svelte';
|
||||||
|
|
||||||
|
let { label = '', error = null, value, name, id, type = 'text'} = $props();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label for={name} class="block text-sm font-medium leading-6 text-gray-900"
|
||||||
|
><span class="flex"
|
||||||
|
>{#if error}
|
||||||
|
<span class="inline-block mr-1"><Exclamation /></span>
|
||||||
|
{/if}
|
||||||
|
{label}</span
|
||||||
|
></label
|
||||||
|
>
|
||||||
|
<div class="mt-2">
|
||||||
|
<div
|
||||||
|
class="flex rounded-md shadow-sm ring-1 ring-inset ring-gray-300 focus-within:ring-2 focus-within:ring-inset focus-within:ring-indigo-600"
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
class="block flex-1 border-0 bg-transparent py-1.5 pl-1 text-gray-900 placeholder:text-gray-400 focus:ring-0 text-sm leading-6"
|
||||||
|
bind:value
|
||||||
|
{type}
|
||||||
|
{name}
|
||||||
|
{id}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{#if error}
|
||||||
|
<p class="block text-sm leading-6 text-red-900 mt-2">{error}</p>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
@@ -173,7 +173,7 @@
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script lang="ts">
|
||||||
export let href = null;
|
export let href = null;
|
||||||
export let type = 'button';
|
export let type = 'button';
|
||||||
export let size = 'md';
|
export let size = 'md';
|
||||||
@@ -11,11 +11,11 @@
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script lang="ts">
|
||||||
import { page } from '$app/stores';
|
import { page } from '$app/stores';
|
||||||
import Trash from '$lib/icons/Trash.svelte';
|
import Trash from '$lib/icons/Trash.svelte';
|
||||||
import Panel from '$lib/components/ui/Panel.svelte';
|
import Panel from '$lib/components/Panel.svelte';
|
||||||
import Button from '$lib/components/ui/Button.svelte';
|
import Button from '$lib/components/Button.svelte';
|
||||||
import { clickOutside } from '$lib/helpers/clickOutside.js';
|
import { clickOutside } from '$lib/helpers/clickOutside.js';
|
||||||
const { adminMode, prediction, predictionRemove } = $page.data;
|
const { adminMode, prediction, predictionRemove } = $page.data;
|
||||||
|
|
||||||
37
src/lib/components/Footer.svelte
Normal file
37
src/lib/components/Footer.svelte
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<script>
|
||||||
|
import Profile from "$lib/icons/Profile.svelte";
|
||||||
|
|
||||||
|
export let data;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="flex-none">
|
||||||
|
<footer class="justify-end">
|
||||||
|
<div class="bg-gray-100">
|
||||||
|
<div class="mx-auto max-w-7xl px-6 lg:px-8">
|
||||||
|
<div class="flex justify-between divide-x divide-gray-900/5 border-x border-gray-900/5">
|
||||||
|
<a
|
||||||
|
href="/list"
|
||||||
|
class="px-4 py-1 -ml-4 flex items-center justify-center gap-x-2.5 text-sm font-semibold leading-6 text-gray-500 hover:bg-gray-200 hover:text-gray-700"
|
||||||
|
>
|
||||||
|
© 2023 Innovation Hub Niedersachen
|
||||||
|
</a>
|
||||||
|
<a
|
||||||
|
href="/"
|
||||||
|
class="px-4 py-1 flex items-center justify-center gap-x-2.5 text-sm font-semibold leading-6 text-gray-500 hover:bg-gray-200 hover:text-gray-700"
|
||||||
|
>
|
||||||
|
back
|
||||||
|
</a>
|
||||||
|
<a
|
||||||
|
href="/"
|
||||||
|
class="px-4 py-1 -mr-4 flex items-center justify-center gap-x-2.5 text-sm font-semibold leading-6 text-gray-500 hover:bg-gray-200 hover:text-gray-700"
|
||||||
|
>
|
||||||
|
<!--icon-->
|
||||||
|
<Profile />
|
||||||
|
|
||||||
|
{data?.user?.id}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
36
src/lib/components/Header.svelte
Normal file
36
src/lib/components/Header.svelte
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import Chevron from '$lib/icons/Chevron-right.svelte';
|
||||||
|
|
||||||
|
export let data;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="flex flex-col">
|
||||||
|
<header class="flex-none relative isolate z-10 bg-white px-8">
|
||||||
|
<nav
|
||||||
|
class="mx-auto flex max-w-7xl items-center justify-between p-6 lg:px-8"
|
||||||
|
aria-label="Global"
|
||||||
|
>
|
||||||
|
<div class="flex w-48">
|
||||||
|
<a href="/" class="-m-1.5 p-1.5 w-10">
|
||||||
|
<span class="sr-only">Tatort Niedersachen</span>
|
||||||
|
<img class="h-8 w-auto" src="/Landeswappen_NI.svg" alt="Landeswappen Niedersachsen" />
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<h1 class="text-3xl text-slate-400 font-bold">Tatort</h1>
|
||||||
|
<div class="lg:flex lg:justify-end w-48">
|
||||||
|
{#if data.user}
|
||||||
|
<form method="POST" action="/anmeldung?/logout">
|
||||||
|
<input type="hidden" />
|
||||||
|
<button type="submit" class="text-sm font-semibold leading-6 text-gray-900"
|
||||||
|
><span
|
||||||
|
><span class="align-middle inline-block">Abmelden</span><span
|
||||||
|
class="align-middle inline-block"><Chevron /></span
|
||||||
|
></span
|
||||||
|
></button
|
||||||
|
>
|
||||||
|
</form>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
</div>
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script lang="ts">
|
||||||
import { fade } from 'svelte/transition';
|
import { fade } from 'svelte/transition';
|
||||||
export let size = 'xl'; // https://tailwindcss.com/docs/max-width#class-reference
|
export let size = 'xl'; // https://tailwindcss.com/docs/max-width#class-reference
|
||||||
export let open = false;
|
export let open = false;
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script lang="ts">
|
||||||
export let scroll = true;
|
export let scroll = true;
|
||||||
export let padding = true;
|
export let padding = true;
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<script>
|
<script lang="ts">
|
||||||
export let title = 'Erfolgreich';
|
export let title = 'Erfolgreich';
|
||||||
export let show = false;
|
export let show = false;
|
||||||
|
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script lang="ts">
|
||||||
export let padding = 'p-6';
|
export let padding = 'p-6';
|
||||||
export let shadow = true;
|
export let shadow = true;
|
||||||
let classNames = '';
|
let classNames = '';
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script lang="ts">
|
||||||
import { clickOutside } from '$lib/helpers/clickOutside.js';
|
import { clickOutside } from '$lib/helpers/clickOutside.js';
|
||||||
import Check from '$lib/icons/Check.svelte';
|
import Check from '$lib/icons/Check.svelte';
|
||||||
import Selector from '$lib/icons/Selector.svelte';
|
import Selector from '$lib/icons/Selector.svelte';
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
import { readFileSync } from 'fs';
|
|
||||||
|
|
||||||
export default JSON.parse(readFileSync('./config.json'));
|
|
||||||
3
src/lib/config.ts
Normal file
3
src/lib/config.ts
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
import { readFileSync } from 'fs';
|
||||||
|
|
||||||
|
export default JSON.parse(readFileSync('./config.json').toString());
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
import { client } from '$lib/minio';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if caseNumber is used
|
|
||||||
* @param {string} caseNumber
|
|
||||||
* @returns {Promise<boolean}
|
|
||||||
*/
|
|
||||||
export default async function caseNumberOccupied(caseNumber) {
|
|
||||||
const prefix = `${caseNumber}/config.json`;
|
|
||||||
const promise = new Promise((resolve) => {
|
|
||||||
let stream = client.listObjectsV2('tatort', prefix, false, '');
|
|
||||||
stream.on('data', () => {
|
|
||||||
stream.destroy();
|
|
||||||
resolve(true);
|
|
||||||
});
|
|
||||||
stream.on('end', () => {
|
|
||||||
resolve(false);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
return promise;
|
|
||||||
}
|
|
||||||
17
src/lib/helper/caseNumberOccupied.ts
Normal file
17
src/lib/helper/caseNumberOccupied.ts
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
import { client } from '$lib/minio';
|
||||||
|
|
||||||
|
export default async function caseNumberOccupied (caseNumber: string): Promise<boolean> {
|
||||||
|
const prefix = `${caseNumber}`;
|
||||||
|
const promise: Promise<boolean> = new Promise((resolve) => {
|
||||||
|
const stream = client.listObjectsV2('tatort', prefix, false, '');
|
||||||
|
stream.on('data', () => {
|
||||||
|
stream.destroy();
|
||||||
|
resolve(true);
|
||||||
|
});
|
||||||
|
stream.on('end', () => {
|
||||||
|
resolve(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return promise;
|
||||||
|
}
|
||||||
10
src/lib/helper/getCode.ts
Normal file
10
src/lib/helper/getCode.ts
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
export default async function get_code(case_no) {
|
||||||
|
let url = `/api/list/${case_no}/code`;
|
||||||
|
const response = await fetch(url);
|
||||||
|
|
||||||
|
if (response.status == 200) {
|
||||||
|
return response.text();
|
||||||
|
} else {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,12 +2,7 @@ const KILO = 1024;
|
|||||||
const MEGA = KILO * KILO;
|
const MEGA = KILO * KILO;
|
||||||
const GIGA = MEGA * KILO;
|
const GIGA = MEGA * KILO;
|
||||||
|
|
||||||
/**
|
export default function shortenFileSize(size: number): string {
|
||||||
* Shortens the size in bytes
|
|
||||||
* @param {number} size
|
|
||||||
* @returns{string}
|
|
||||||
*/
|
|
||||||
export default function shortenFileSize(size) {
|
|
||||||
const giga = Math.floor(size / GIGA);
|
const giga = Math.floor(size / GIGA);
|
||||||
let remainder = size % GIGA;
|
let remainder = size % GIGA;
|
||||||
const mega = Math.floor(remainder / MEGA);
|
const mega = Math.floor(remainder / MEGA);
|
||||||
@@ -4,12 +4,7 @@ const DAY = 24 * HOUR;
|
|||||||
const YEAR = 365 * DAY;
|
const YEAR = 365 * DAY;
|
||||||
const MONTH = YEAR / 12;
|
const MONTH = YEAR / 12;
|
||||||
|
|
||||||
/**
|
export default function timeElapsed(date: Date): string {
|
||||||
* get readable string of time elapsed since date
|
|
||||||
* @param {Date} date
|
|
||||||
* @returns string
|
|
||||||
*/
|
|
||||||
export default function timeElapsed(date) {
|
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
const age = Math.floor((now.getTime() - date.getTime()) / 1000);
|
const age = Math.floor((now.getTime() - date.getTime()) / 1000);
|
||||||
|
|
||||||
19
src/lib/icons/Add-Process.svelte
Normal file
19
src/lib/icons/Add-Process.svelte
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<script>
|
||||||
|
let classNames = '';
|
||||||
|
export { classNames as class };
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<svg
|
||||||
|
class="h-6 w-6 text-gray-600 {classNames}"
|
||||||
|
fill="none"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
stroke-width="1.5"
|
||||||
|
stroke="currentColor"
|
||||||
|
aria-hidden="true"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
d="M13.5 16.875h3.375m0 0h3.375m-3.375 0V13.5m0 3.375v3.375M6 10.5h2.25a2.25 2.25 0 002.25-2.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v2.25A2.25 2.25 0 006 10.5zm0 9.75h2.25A2.25 2.25 0 0010.5 18v-2.25a2.25 2.25 0 00-2.25-2.25H6a2.25 2.25 0 00-2.25 2.25V18A2.25 2.25 0 006 20.25zm9.75-9.75H18a2.25 2.25 0 002.25-2.25V6A2.25 2.25 0 0018 3.75h-2.25A2.25 2.25 0 0013.5 6v2.25a2.25 2.25 0 002.25 2.25z"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
14
src/lib/icons/Cube.svelte
Normal file
14
src/lib/icons/Cube.svelte
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
fill="none"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
stroke-width="1.5"
|
||||||
|
stroke="currentColor"
|
||||||
|
class=" w-6 h-6"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
d="M21 7.5l-2.25-1.313M21 7.5v2.25m0-2.25l-2.25 1.313M3 7.5l2.25-1.313M3 7.5l2.25 1.313M3 7.5v2.25m9 3l2.25-1.313M12 12.75l-2.25-1.313M12 12.75V15m0 6.75l2.25-1.313M12 21.75V19.5m0 2.25l-2.25-1.313m0-16.875L12 2.25l2.25 1.313M21 14.25v2.25l-2.25 1.313m-13.5 0L3 16.5v-2.25"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 483 B |
7
src/lib/icons/Edit.svelte
Normal file
7
src/lib/icons/Edit.svelte
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<svg height="20" width="20" xmlns="http://www.w3.org/2000/svg"
|
||||||
|
><path
|
||||||
|
d="m14.996094 3-11.9921878 11.992188h-.0039062v4.007812h1 2 1.0078125v-.0039l11.9921875-11.9921938-.001953-.0019531.001953-.0019531-4-4-.002.00195zm-1.998047 3.4121094 2.589844 2.5898437-7.587891 7.5878909v-1.589844h-1-1v-1-.589844zm-7.998047 7.9980466v1.589844h1 1v1 .589844l-.4101562.410156h-1.5898438l-1-1v-1.589844z"
|
||||||
|
fill="#373737"
|
||||||
|
transform="translate(1 1)"
|
||||||
|
/></svg
|
||||||
|
>
|
||||||
|
After Width: | Height: | Size: 451 B |
35
src/lib/icons/File-rect.svelte
Normal file
35
src/lib/icons/File-rect.svelte
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<script>
|
||||||
|
export let outline = false;
|
||||||
|
let classNames = '';
|
||||||
|
export { classNames as class };
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#if outline}
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
fill="none"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
stroke-width="1.5"
|
||||||
|
stroke="currentColor"
|
||||||
|
class="w-6 h-6 {classNames}"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
d="M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 013.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 001.5-1.5V6a1.5 1.5 0 00-1.5-1.5H3.75A1.5 1.5 0 002.25 6v12a1.5 1.5 0 001.5 1.5zm10.5-11.25h.008v.008h-.008V8.25zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
{:else}
|
||||||
|
<svg
|
||||||
|
class="mx-auto h-12 w-12 text-gray-300 {classNames}"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
fill="currentColor"
|
||||||
|
aria-hidden="true"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
fill-rule="evenodd"
|
||||||
|
d="M1.5 6a2.25 2.25 0 012.25-2.25h16.5A2.25 2.25 0 0122.5 6v12a2.25 2.25 0 01-2.25 2.25H3.75A2.25 2.25 0 011.5 18V6zM3 16.06V18c0 .414.336.75.75.75h16.5A.75.75 0 0021 18v-1.94l-2.69-2.689a1.5 1.5 0 00-2.12 0l-.88.879.97.97a.75.75 0 11-1.06 1.06l-5.16-5.159a1.5 1.5 0 00-2.12 0L3 16.061zm10.125-7.81a1.125 1.125 0 112.25 0 1.125 1.125 0 01-2.25 0z"
|
||||||
|
clip-rule="evenodd"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
{/if}
|
||||||
14
src/lib/icons/Folder.svelte
Normal file
14
src/lib/icons/Folder.svelte
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
fill="none"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
stroke-width="1.5"
|
||||||
|
stroke="currentColor"
|
||||||
|
class="w-6 h-6"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
d="M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 460 B |
19
src/lib/icons/List-icon.svelte
Normal file
19
src/lib/icons/List-icon.svelte
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<script>
|
||||||
|
let classNames = '';
|
||||||
|
export { classNames as class };
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
fill="none"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
stroke-width="1.5"
|
||||||
|
stroke="currentColor"
|
||||||
|
class="w-6 h-6 {classNames}"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
d="M8.25 6.75h12M8.25 12h12m-12 5.25h12M3.75 6.75h.007v.008H3.75V6.75zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0zM3.75 12h.007v.008H3.75V12zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0zm-.375 5.25h.007v.008H3.75v-.008zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
14
src/lib/icons/Profile.svelte
Normal file
14
src/lib/icons/Profile.svelte
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
fill="none"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
stroke-width="1.5"
|
||||||
|
stroke="currentColor"
|
||||||
|
class="w-6 h-6"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
d="M17.982 18.725A7.488 7.488 0 0012 15.75a7.488 7.488 0 00-5.982 2.975m11.963 0a9 9 0 10-11.963 0m11.963 0A8.966 8.966 0 0112 21a8.966 8.966 0 01-5.982-2.275M15 9.75a3 3 0 11-6 0 3 3 0 016 0z"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 402 B |
@@ -6,3 +6,5 @@ import config from '$lib/config';
|
|||||||
|
|
||||||
/** export const client = new Minio.Client(config.minio); */
|
/** export const client = new Minio.Client(config.minio); */
|
||||||
export const client = new Client(config.minio);
|
export const client = new Client(config.minio);
|
||||||
|
|
||||||
|
export const BUCKET = 'tatort';
|
||||||
29
src/lib/server/authService.ts
Normal file
29
src/lib/server/authService.ts
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import { dev } from '$app/environment';
|
||||||
|
import { fail, redirect, type Cookies, type RequestEvent } from '@sveltejs/kit';
|
||||||
|
import { authenticate } from '$lib/auth';
|
||||||
|
|
||||||
|
const COOKIE_NAME = 'session';
|
||||||
|
|
||||||
|
export const loginUser = async ({ request, cookies }: { request: Request; cookies: Cookies }) => {
|
||||||
|
const data = await request.formData();
|
||||||
|
const user = data.get('user');
|
||||||
|
const password = data.get('password');
|
||||||
|
|
||||||
|
const token = authenticate(user, password);
|
||||||
|
|
||||||
|
if (!token) return fail(400, { user, incorrect: true });
|
||||||
|
|
||||||
|
cookies.set(COOKIE_NAME, token, {
|
||||||
|
path: '/',
|
||||||
|
httpOnly: true,
|
||||||
|
sameSite: 'strict',
|
||||||
|
secure: !dev
|
||||||
|
});
|
||||||
|
return redirect(303, '/');
|
||||||
|
};
|
||||||
|
|
||||||
|
export const logoutUser = async (event: RequestEvent) => {
|
||||||
|
event.cookies.delete(COOKIE_NAME, { path: '/' });
|
||||||
|
event.locals.user = null;
|
||||||
|
return { success: true };
|
||||||
|
};
|
||||||
21
src/lib/server/s3ClientService.ts
Normal file
21
src/lib/server/s3ClientService.ts
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
import { BUCKET, client } from '$lib/minio';
|
||||||
|
|
||||||
|
|
||||||
|
export const checkIfExactDirectoryExists = (dir: string): Promise<boolean> => {
|
||||||
|
return new Promise<boolean>((resolve, reject) => {
|
||||||
|
const prefix = dir.endsWith('/') ? dir : `${dir}/`;
|
||||||
|
|
||||||
|
const stream = client.listObjectsV2(BUCKET, prefix, false, '');
|
||||||
|
|
||||||
|
stream.on('data', (obj) => {
|
||||||
|
if (obj.prefix === undefined && obj.name.startsWith(prefix)) {
|
||||||
|
stream.destroy();
|
||||||
|
resolve(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
stream.on('error', (err) => reject(err));
|
||||||
|
|
||||||
|
stream.on('end', () => resolve(false));
|
||||||
|
});
|
||||||
|
}
|
||||||
97
src/lib/server/vorgangService.ts
Normal file
97
src/lib/server/vorgangService.ts
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
import { fail, redirect } from '@sveltejs/kit';
|
||||||
|
import { BUCKET, client } from '$lib/minio';
|
||||||
|
import { checkIfExactDirectoryExists } from './s3ClientService';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if Vorgang exists and token is valid.
|
||||||
|
* @param request
|
||||||
|
* @returns redirect to /list/caseId or error
|
||||||
|
*/
|
||||||
|
export const redirectIfVorgangExists = async (request: Request) => {
|
||||||
|
const data = await request.formData();
|
||||||
|
const caseId = data.get('case-id');
|
||||||
|
const caseToken = data.get('case-token');
|
||||||
|
|
||||||
|
if (!caseId) {
|
||||||
|
return fail(400, {
|
||||||
|
success: false,
|
||||||
|
caseId,
|
||||||
|
error: { message: 'Die Vorgangsnummer darf nicht leer sein.' }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof caseId === 'string' && !(await checkIfExactDirectoryExists(caseId))) {
|
||||||
|
return fail(400, {
|
||||||
|
success: false,
|
||||||
|
caseId,
|
||||||
|
error: { message: 'Die Vorgangsnummer existiert in dieser Anwendung nicht.' }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const isTokenValid = await hasValidToken(caseId, caseToken);
|
||||||
|
|
||||||
|
if (!isTokenValid) {
|
||||||
|
return fail(400, {
|
||||||
|
success: false,
|
||||||
|
caseId,
|
||||||
|
error: { message: 'Der Token ist ungültig.' }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
redirect(303, `/list/${caseId}`);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getVorgangByCaseId = ({ params }) => {
|
||||||
|
const prefix = params.vorgang ? `${params.vorgang}/` : '';
|
||||||
|
const stream = client.listObjectsV2(BUCKET, prefix, false, '');
|
||||||
|
const result = new ReadableStream({
|
||||||
|
start(controller) {
|
||||||
|
stream.on('data', (data) => {
|
||||||
|
if (prefix === '') {
|
||||||
|
if (data.prefix)
|
||||||
|
controller.enqueue(`${JSON.stringify({ ...data, name: data.prefix.slice(0, -1) })}\n`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const name = data.name.slice(prefix.length);
|
||||||
|
if (name === 'config.json') return;
|
||||||
|
// zugangscode datei
|
||||||
|
if (name === '__perm__') return;
|
||||||
|
|
||||||
|
controller.enqueue(`${JSON.stringify({ ...data, name, prefix })}\n`);
|
||||||
|
});
|
||||||
|
stream.on('end', () => {
|
||||||
|
controller.close();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
cancel() {
|
||||||
|
stream.destroy();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return new Response(result, {
|
||||||
|
headers: {
|
||||||
|
'content-type': 'text/event-stream'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const hasValidToken = async (caseId: string, caseToken: string) => {
|
||||||
|
const tokenFileName = '__perm__';
|
||||||
|
const objPath = `${caseId}/${tokenFileName}`;
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (!caseToken) return false;
|
||||||
|
|
||||||
|
const res = await client.getObject('tatort', objPath);
|
||||||
|
|
||||||
|
const savedToken = await new Response(res).text();
|
||||||
|
|
||||||
|
return savedToken === caseToken ? true : false;
|
||||||
|
} catch (error) {
|
||||||
|
if (error.name == 'S3Error') {
|
||||||
|
console.log(error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
import { redirect } from '@sveltejs/kit';
|
|
||||||
|
|
||||||
/** @type {import('./$types').PageServerLoad} */
|
|
||||||
export function load(event) {
|
|
||||||
if (!event.locals.user && event.url.pathname !== '/anmeldung') throw redirect(303, '/anmeldung');
|
|
||||||
return {
|
|
||||||
user: event.locals.user
|
|
||||||
};
|
|
||||||
}
|
|
||||||
9
src/routes/(angemeldet)/+layout.server.ts
Normal file
9
src/routes/(angemeldet)/+layout.server.ts
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import { redirect, type ServerLoadEvent } from '@sveltejs/kit';
|
||||||
|
import type { PageServerLoad } from '../anmeldung/$types';
|
||||||
|
|
||||||
|
export const load: PageServerLoad = (event: ServerLoadEvent) => {
|
||||||
|
if (!event.locals.user && event.url.pathname !== '/anmeldung') throw redirect(303, '/anmeldung');
|
||||||
|
return {
|
||||||
|
user: event.locals.user
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,84 +1,18 @@
|
|||||||
<script>
|
<script lang="ts">
|
||||||
import Chevron from '$lib/icons/Chevron-right.svelte';
|
import Footer from '$lib/components/Footer.svelte';
|
||||||
import Login from '$lib/icons/Login.svelte';
|
import Header from '$lib/components/Header.svelte';
|
||||||
|
|
||||||
export let data;
|
export let data;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="h-screen v-screen flex flex-col">
|
<div class="h-screen v-screen flex flex-col">
|
||||||
<div class="flex flex-col h-full">
|
<div class="flex flex-col h-full">
|
||||||
<header class="flex-none relative isolate z-10 bg-white px-8">
|
<Header {data}/>
|
||||||
<nav
|
|
||||||
class="mx-auto flex max-w-7xl items-center justify-between p-6 lg:px-8"
|
|
||||||
aria-label="Global"
|
|
||||||
>
|
|
||||||
<div class="flex w-48">
|
|
||||||
<a href="/" class="-m-1.5 p-1.5 w-10">
|
|
||||||
<span class="sr-only">Tatort Niedersachen</span>
|
|
||||||
<img class="h-8 w-auto" src="/Landeswappen_NI.svg" alt="Landeswappen Niedersachsen" />
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<h1 class="text-3xl text-slate-400 font-bold">Tatort</h1>
|
|
||||||
<div class="lg:flex lg:justify-end w-48">
|
|
||||||
{#if data.user}
|
|
||||||
<form method="POST" action="/anmeldung?/logout">
|
|
||||||
<input type="hidden" />
|
|
||||||
<button type="submit" class="text-sm font-semibold leading-6 text-gray-900"
|
|
||||||
><span
|
|
||||||
><span class="align-middle inline-block">Abmelden</span><span
|
|
||||||
class="align-middle inline-block"><Chevron /></span
|
|
||||||
></span
|
|
||||||
></button
|
|
||||||
>
|
|
||||||
</form>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
</header>
|
|
||||||
<div class="h-full grow overflow-scroll">
|
<div class="h-full grow overflow-scroll">
|
||||||
<slot />
|
<slot />
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-none">
|
<Footer {data}/>
|
||||||
<footer class="justify-end">
|
|
||||||
<div class="bg-gray-100">
|
|
||||||
<div class="mx-auto max-w-7xl px-6 lg:px-8">
|
|
||||||
<div class="flex justify-between divide-x divide-gray-900/5 border-x border-gray-900/5">
|
|
||||||
<a
|
|
||||||
href="/list"
|
|
||||||
class="px-4 py-1 -ml-4 flex items-center justify-center gap-x-2.5 text-sm font-semibold leading-6 text-gray-500 hover:bg-gray-200 hover:text-gray-700"
|
|
||||||
>
|
|
||||||
© 2023 Innovation Hub Niedersachen
|
|
||||||
</a>
|
|
||||||
<a
|
|
||||||
href="/"
|
|
||||||
class="px-4 py-1 flex items-center justify-center gap-x-2.5 text-sm font-semibold leading-6 text-gray-500 hover:bg-gray-200 hover:text-gray-700"
|
|
||||||
>
|
|
||||||
back
|
|
||||||
</a>
|
|
||||||
<a
|
|
||||||
href="/"
|
|
||||||
class="px-4 py-1 -mr-4 flex items-center justify-center gap-x-2.5 text-sm font-semibold leading-6 text-gray-500 hover:bg-gray-200 hover:text-gray-700"
|
|
||||||
>
|
|
||||||
<svg
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
fill="none"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
stroke-width="1.5"
|
|
||||||
stroke="currentColor"
|
|
||||||
class="w-6 h-6"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
stroke-linecap="round"
|
|
||||||
stroke-linejoin="round"
|
|
||||||
d="M17.982 18.725A7.488 7.488 0 0012 15.75a7.488 7.488 0 00-5.982 2.975m11.963 0a9 9 0 10-11.963 0m11.963 0A8.966 8.966 0 0112 21a8.966 8.966 0 01-5.982-2.275M15 9.75a3 3 0 11-6 0 3 3 0 016 0z"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
{data.user.id}
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</footer>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
<style>
|
<script lang="ts">
|
||||||
</style>
|
import AddProcess from '$lib/icons/Add-Process.svelte';
|
||||||
|
import FileRect from '$lib/icons/File-rect.svelte';
|
||||||
|
import ListIcon from '$lib/icons/List-icon.svelte';
|
||||||
|
|
||||||
<script>
|
|
||||||
import Panel from '$lib/components/ui/Panel.svelte';
|
|
||||||
|
|
||||||
export let data;
|
export let data;
|
||||||
|
export let outline = true;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
@@ -16,20 +17,7 @@
|
|||||||
<div
|
<div
|
||||||
class="flex h-11 w-11 items-center justify-center rounded-lg bg-gray-50 group-hover:bg-white"
|
class="flex h-11 w-11 items-center justify-center rounded-lg bg-gray-50 group-hover:bg-white"
|
||||||
>
|
>
|
||||||
<svg
|
<ListIcon class=" group-hover:text-indigo-600" />
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
fill="none"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
stroke-width="1.5"
|
|
||||||
stroke="currentColor"
|
|
||||||
class="w-6 h-6"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
stroke-linecap="round"
|
|
||||||
stroke-linejoin="round"
|
|
||||||
d="M8.25 6.75h12M8.25 12h12m-12 5.25h12M3.75 6.75h.007v.008H3.75V6.75zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0zM3.75 12h.007v.008H3.75V12zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0zm-.375 5.25h.007v.008H3.75v-.008zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</div>
|
</div>
|
||||||
<a href="/list" class="mt-6 block font-semibold text-gray-900">
|
<a href="/list" class="mt-6 block font-semibold text-gray-900">
|
||||||
Liste
|
Liste
|
||||||
@@ -45,47 +33,7 @@
|
|||||||
<div
|
<div
|
||||||
class="flex h-11 w-11 items-center justify-center rounded-lg bg-gray-50 group-hover:bg-white"
|
class="flex h-11 w-11 items-center justify-center rounded-lg bg-gray-50 group-hover:bg-white"
|
||||||
>
|
>
|
||||||
<svg
|
<AddProcess class=" group-hover:text-indigo-600" />
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
fill="none"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
stroke-width="1.5"
|
|
||||||
stroke="currentColor"
|
|
||||||
class="w-6 h-6"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
stroke-linecap="round"
|
|
||||||
stroke-linejoin="round"
|
|
||||||
d="M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m3.75 9v6m3-3H9m1.5-12H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</div>
|
|
||||||
<a href="/tatorte" class="mt-6 block font-semibold text-gray-900">
|
|
||||||
Neueer Vorgang
|
|
||||||
<span class="absolute inset-0"></span>
|
|
||||||
</a>
|
|
||||||
<p class="mt-1 text-gray-600">Stelle einen weiteren Tatort für die Anwendung bereit.</p>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
{#if data.user.admin}
|
|
||||||
<div class="group relative rounded-lg p-6 text-sm leading-6 hover:bg-gray-50 w-1/4">
|
|
||||||
<div
|
|
||||||
class="flex h-11 w-11 items-center justify-center rounded-lg bg-gray-50 group-hover:bg-white"
|
|
||||||
>
|
|
||||||
<svg
|
|
||||||
class="h-6 w-6 text-gray-600 group-hover:text-indigo-600"
|
|
||||||
fill="none"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
stroke-width="1.5"
|
|
||||||
stroke="currentColor"
|
|
||||||
aria-hidden="true"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
stroke-linecap="round"
|
|
||||||
stroke-linejoin="round"
|
|
||||||
d="M13.5 16.875h3.375m0 0h3.375m-3.375 0V13.5m0 3.375v3.375M6 10.5h2.25a2.25 2.25 0 002.25-2.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v2.25A2.25 2.25 0 006 10.5zm0 9.75h2.25A2.25 2.25 0 0010.5 18v-2.25a2.25 2.25 0 00-2.25-2.25H6a2.25 2.25 0 00-2.25 2.25V18A2.25 2.25 0 006 20.25zm9.75-9.75H18a2.25 2.25 0 002.25-2.25V6A2.25 2.25 0 0018 3.75h-2.25A2.25 2.25 0 0013.5 6v2.25a2.25 2.25 0 002.25 2.25z"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</div>
|
</div>
|
||||||
<a href="/upload" class="mt-6 block font-semibold text-gray-900">
|
<a href="/upload" class="mt-6 block font-semibold text-gray-900">
|
||||||
Hinzufügen
|
Hinzufügen
|
||||||
@@ -98,20 +46,7 @@
|
|||||||
<div
|
<div
|
||||||
class="flex h-11 w-11 items-center justify-center rounded-lg bg-gray-50 group-hover:bg-white"
|
class="flex h-11 w-11 items-center justify-center rounded-lg bg-gray-50 group-hover:bg-white"
|
||||||
>
|
>
|
||||||
<svg
|
<FileRect class=" group-hover:text-indigo-600" {outline} />
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
fill="none"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
stroke-width="1.5"
|
|
||||||
stroke="currentColor"
|
|
||||||
class="w-6 h-6"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
stroke-linecap="round"
|
|
||||||
stroke-linejoin="round"
|
|
||||||
d="M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 013.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 001.5-1.5V6a1.5 1.5 0 00-1.5-1.5H3.75A1.5 1.5 0 002.25 6v12a1.5 1.5 0 001.5 1.5zm10.5-11.25h.008v.008h-.008V8.25zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</div>
|
</div>
|
||||||
<a href="/view" class="mt-6 block font-semibold text-gray-900">
|
<a href="/view" class="mt-6 block font-semibold text-gray-900">
|
||||||
Ansicht
|
Ansicht
|
||||||
@@ -121,3 +56,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
</style>
|
||||||
@@ -1,119 +0,0 @@
|
|||||||
<style>
|
|
||||||
ul {
|
|
||||||
min-width: 24rem;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<script lang="ts">
|
|
||||||
import { onMount } from 'svelte';
|
|
||||||
import { page } from '$app/stores';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @type any[]
|
|
||||||
*/
|
|
||||||
let list: any[] = [];
|
|
||||||
//$: list;
|
|
||||||
|
|
||||||
onMount(async () => {
|
|
||||||
const response = await fetch('/api/list');
|
|
||||||
const stream = await response.body;
|
|
||||||
if (!stream) return;
|
|
||||||
|
|
||||||
const reader = stream.getReader();
|
|
||||||
|
|
||||||
while (true) {
|
|
||||||
const { done, value } = await reader.read();
|
|
||||||
if (done) return;
|
|
||||||
|
|
||||||
const objs = new TextDecoder()
|
|
||||||
.decode(value)
|
|
||||||
.split('\n')
|
|
||||||
.filter((i) => i.length > 0)
|
|
||||||
.map((i) => JSON.parse(i));
|
|
||||||
|
|
||||||
console.log(objs);
|
|
||||||
list = list.concat(objs);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
async function delete_item(ev: Event) {
|
|
||||||
let delete_item = window.confirm("Bist du sicher?");
|
|
||||||
|
|
||||||
if (delete_item) {
|
|
||||||
const target = ev.currentTarget as HTMLElement | null;
|
|
||||||
if (!target) return;
|
|
||||||
let filename = target.id.split('del__')[1]
|
|
||||||
|
|
||||||
// delete request
|
|
||||||
// --------------
|
|
||||||
|
|
||||||
let url = `/api/list/${filename}`
|
|
||||||
|
|
||||||
console.log(`--- ${filename} + ${url}`)
|
|
||||||
try {
|
|
||||||
const response = await fetch(url,
|
|
||||||
{method: 'DELETE'}
|
|
||||||
)
|
|
||||||
if (response.status == 204) {
|
|
||||||
setTimeout(() => {window.location.reload()}, 500)
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
if (error instanceof Error) {
|
|
||||||
console.log(error.message);
|
|
||||||
} else {
|
|
||||||
console.log(error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<div class="-z-10 bg-white">
|
|
||||||
<div class="flex flex-col items-center justify-center w-full">
|
|
||||||
<h1 class="text-xl">Liste der Vorgänge</h1>
|
|
||||||
</div>
|
|
||||||
<div class="mx-auto flex justify-center max-w-7xl h-full">
|
|
||||||
<ul role="list" class="divide-y divide-gray-100">
|
|
||||||
{#each list as item}
|
|
||||||
<li>
|
|
||||||
<a href="/list/{item.name}" class="flex justify-between gap-x-6 py-5">
|
|
||||||
<div class="flex gap-x-4">
|
|
||||||
<svg
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
fill="none"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
stroke-width="1.5"
|
|
||||||
stroke="currentColor"
|
|
||||||
class="w-6 h-6"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
stroke-linecap="round"
|
|
||||||
stroke-linejoin="round"
|
|
||||||
d="M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
<div class="min-w-0 flex-auto">
|
|
||||||
<span class="text-sm font-semibold leading-6 text-gray-900">{item.name}</span>
|
|
||||||
<!-- Delete button -->
|
|
||||||
<button
|
|
||||||
style="padding: 2px"
|
|
||||||
id="del__{item.name}"
|
|
||||||
on:click|preventDefault={delete_item}
|
|
||||||
aria-label="Vorgang {item.name} löschen"
|
|
||||||
>
|
|
||||||
<svg
|
|
||||||
height="20" width="20" xmlns="http://www.w3.org/2000/svg"><path d="m8 3v1 1h1v-1h4v1h1v-1-1zm-4 3v1h14v-1zm2 2v11h1 9v-1-10h-1v10h-8v-10z" fill="#373737" transform="translate(1 1)"/></svg>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="hidden sm:flex sm:flex-col sm:items-end">
|
|
||||||
<p class="text-sm leading-6 text-gray-900">Vorgang</p>
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
{/each}
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@@ -1,311 +0,0 @@
|
|||||||
<style>
|
|
||||||
ul {
|
|
||||||
min-width: 24rem;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<script lang="ts">
|
|
||||||
import { onMount, tick } from 'svelte';
|
|
||||||
import shortenFileSize from '$lib/helper/shortenFileSize';
|
|
||||||
import { page } from '$app/stores';
|
|
||||||
|
|
||||||
import timeElapsed from '$lib/helper/timeElapsed';
|
|
||||||
|
|
||||||
import Alert from '$lib/components/ui/Alert.svelte';
|
|
||||||
import Button from '$lib/components/ui/Button.svelte';
|
|
||||||
import Modal from '$lib/components/ui/Modal/Modal.svelte';
|
|
||||||
import ModalTitle from '$lib/components/ui/Modal/ModalTitle.svelte';
|
|
||||||
import ModalContent from '$lib/components/ui/Modal/ModalContent.svelte';
|
|
||||||
import ModalFooter from '$lib/components/ui/Modal/ModalFooter.svelte';
|
|
||||||
|
|
||||||
/** @type {import('./$types').PageData} */
|
|
||||||
/** export let data; */
|
|
||||||
|
|
||||||
interface ListItem {
|
|
||||||
name: string;
|
|
||||||
size: number;
|
|
||||||
lastModified: string | number | Date;
|
|
||||||
show_button?: boolean;
|
|
||||||
// add other properties as needed
|
|
||||||
}
|
|
||||||
|
|
||||||
let list: ListItem[] = [];
|
|
||||||
$: list;
|
|
||||||
|
|
||||||
let open = false;
|
|
||||||
$: open;
|
|
||||||
let inProgress = false;
|
|
||||||
$: inProgress;
|
|
||||||
let err = false;
|
|
||||||
$: err;
|
|
||||||
|
|
||||||
let rename_input;
|
|
||||||
$: rename_input;
|
|
||||||
|
|
||||||
onMount(async () => {
|
|
||||||
const response = await fetch('/api/list/' + $page.params.vorgang);
|
|
||||||
const stream = response.body;
|
|
||||||
if (!stream) return;
|
|
||||||
|
|
||||||
const reader = stream.getReader();
|
|
||||||
|
|
||||||
while (true) {
|
|
||||||
const { done, value } = await reader.read();
|
|
||||||
if (done) return;
|
|
||||||
|
|
||||||
const objs = new TextDecoder()
|
|
||||||
.decode(value)
|
|
||||||
.split('\n')
|
|
||||||
.filter((i) => i.length > 0)
|
|
||||||
.map((i) => JSON.parse(i));
|
|
||||||
|
|
||||||
console.log(objs);
|
|
||||||
list = list.concat(objs);
|
|
||||||
|
|
||||||
list = list.map((item) => {
|
|
||||||
item.show_button = true;
|
|
||||||
return item;
|
|
||||||
})
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
function uploadSuccessful() {
|
|
||||||
console.log('reset');
|
|
||||||
open = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function defocus_element(i: number) {
|
|
||||||
let item = list[i]
|
|
||||||
let text_field_id = `label__${item.name}`
|
|
||||||
|
|
||||||
let text_field = document.getElementById(text_field_id)
|
|
||||||
if (text_field) {
|
|
||||||
text_field.setAttribute("contenteditable", "false")
|
|
||||||
text_field.textContent = item.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
// reshow button
|
|
||||||
list[i].show_button = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function handle_input(ev: KeyboardEvent, i: number) {
|
|
||||||
let item = list[i]
|
|
||||||
if (ev.key == "Escape") {
|
|
||||||
let text_field_id = `label__${item.name}`
|
|
||||||
|
|
||||||
let text_field = document.getElementById(text_field_id)
|
|
||||||
if (text_field) {
|
|
||||||
text_field.setAttribute("contenteditable", "false");
|
|
||||||
text_field.textContent = item.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
// reshow button
|
|
||||||
item.show_button = true
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (ev.key == "Enter") {
|
|
||||||
console.log('--- hitted')
|
|
||||||
let name_field = ev.currentTarget as HTMLElement | null;
|
|
||||||
let new_name = name_field ? (name_field.textContent || (name_field as any).innerText || '') : '';
|
|
||||||
|
|
||||||
|
|
||||||
if (new_name == '') {
|
|
||||||
alert('Bitte einen gültigen Namen eingeben.');
|
|
||||||
ev.preventDefault();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// actual upload
|
|
||||||
// -------------
|
|
||||||
|
|
||||||
// to prevent from item being selected
|
|
||||||
ev.preventDefault();
|
|
||||||
|
|
||||||
// construct PUT URL
|
|
||||||
const url = $page.url
|
|
||||||
console.log(url);
|
|
||||||
|
|
||||||
let data_obj: { new_name: string; old_name: string } = { new_name: '', old_name: '' };
|
|
||||||
data_obj["new_name"] = new_name
|
|
||||||
data_obj["old_name"] = ev.currentTarget && (ev.currentTarget as HTMLElement).id ? (ev.currentTarget as HTMLElement).id.split('__')[1] : ''
|
|
||||||
|
|
||||||
|
|
||||||
open = true;
|
|
||||||
inProgress = true;
|
|
||||||
|
|
||||||
const response = await fetch(url,
|
|
||||||
{method: 'PUT', body: JSON.stringify( data_obj )
|
|
||||||
})
|
|
||||||
|
|
||||||
inProgress = false;
|
|
||||||
|
|
||||||
if (!response.ok) {
|
|
||||||
err = true;
|
|
||||||
if (response.status == 400) {
|
|
||||||
let json_res = await response.json()
|
|
||||||
// alert(json_res['msg'])
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
throw new Error(`Fehlgeschlagen: ${response.status}`)
|
|
||||||
} else {
|
|
||||||
uploadSuccessful();
|
|
||||||
setTimeout(() => {window.location.reload()}, 500)
|
|
||||||
}
|
|
||||||
|
|
||||||
// --- upload finished ---
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<div class="-z-10 bg-white">
|
|
||||||
<div class="flex flex-col items-center justify-center w-full">
|
|
||||||
<h1 class="text-xl">Vorgang {$page.params.vorgang}</h1>
|
|
||||||
</div>
|
|
||||||
<div class="mx-auto flex justify-center max-w-7xl h-full">
|
|
||||||
<ul class="divide-y divide-gray-100">
|
|
||||||
{#each list as item, i}
|
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
href="/view/{$page.params.vorgang}/{item.name}"
|
|
||||||
class="flex justify-between gap-x-6 py-5"
|
|
||||||
>
|
|
||||||
<div class="flex gap-x-4">
|
|
||||||
<svg
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
fill="none"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
stroke-width="1.5"
|
|
||||||
stroke="currentColor"
|
|
||||||
class="w-6 h-6"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
stroke-linecap="round"
|
|
||||||
stroke-linejoin="round"
|
|
||||||
d="M21 7.5l-2.25-1.313M21 7.5v2.25m0-2.25l-2.25 1.313M3 7.5l2.25-1.313M3 7.5l2.25 1.313M3 7.5v2.25m9 3l2.25-1.313M12 12.75l-2.25-1.313M12 12.75V15m0 6.75l2.25-1.313M12 21.75V19.5m0 2.25l-2.25-1.313m0-16.875L12 2.25l2.25 1.313M21 14.25v2.25l-2.25 1.313m-13.5 0L3 16.5v-2.25"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
<div class="min-w-0 flex-auto">
|
|
||||||
<span
|
|
||||||
style="display: inline-block; min-width: 5px;"
|
|
||||||
id="label__{item.name}"
|
|
||||||
class="text-sm font-semibold leading-6 text-gray-900"
|
|
||||||
contenteditable={! item.show_button}
|
|
||||||
role="textbox"
|
|
||||||
tabindex="0"
|
|
||||||
aria-label="Dateiname bearbeiten"
|
|
||||||
on:focusout={() => {
|
|
||||||
defocus_element(i);
|
|
||||||
}}
|
|
||||||
on:keydown|stopPropagation={
|
|
||||||
// event needed to identify ID
|
|
||||||
// TO-DO: check if event is needed or if index is sufficient
|
|
||||||
async (ev) => {handle_input(ev, i)}
|
|
||||||
}
|
|
||||||
|
|
||||||
>{item.name}</span>
|
|
||||||
<!-- https://iconduck.com/icons/192863/edit-rename -->
|
|
||||||
|
|
||||||
{#if item.show_button}
|
|
||||||
<button
|
|
||||||
style="padding: 2px"
|
|
||||||
id="edit__{item.name}"
|
|
||||||
aria-label="Datei umbenennen"
|
|
||||||
on:click|preventDefault={(ev) => {
|
|
||||||
let text_field_id = `label__${item.name}`
|
|
||||||
|
|
||||||
let text_field = document.getElementById(text_field_id)
|
|
||||||
if (text_field) {
|
|
||||||
text_field.setAttribute("contenteditable", "true");
|
|
||||||
text_field.focus();
|
|
||||||
text_field.textContent = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
// hide button
|
|
||||||
item.show_button = false
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<svg
|
|
||||||
height="20" width="20" xmlns="http://www.w3.org/2000/svg"><path d="m14.996094 3-11.9921878 11.992188h-.0039062v4.007812h1 2 1.0078125v-.0039l11.9921875-11.9921938-.001953-.0019531.001953-.0019531-4-4-.002.00195zm-1.998047 3.4121094 2.589844 2.5898437-7.587891 7.5878909v-1.589844h-1-1v-1-.589844zm-7.998047 7.9980466v1.589844h1 1v1 .589844l-.4101562.410156h-1.5898438l-1-1v-1.589844z" fill="#373737" transform="translate(1 1)"/></svg>
|
|
||||||
</button>
|
|
||||||
{/if}
|
|
||||||
<button
|
|
||||||
style="padding: 2px"
|
|
||||||
id="del__{item.name}"
|
|
||||||
on:click|preventDefault={async (ev) => {
|
|
||||||
let delete_item = window.confirm("Bist du sicher?");
|
|
||||||
|
|
||||||
if (delete_item) {
|
|
||||||
// bucket: tatort, name: <vorgang>/item-name
|
|
||||||
let vorgang = $page.params.vorgang
|
|
||||||
let filename = '';
|
|
||||||
if (ev && ev.currentTarget && (ev.currentTarget as HTMLElement).id) {
|
|
||||||
filename = (ev.currentTarget as HTMLElement).id.split('del__')[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// delete request
|
|
||||||
// --------------
|
|
||||||
|
|
||||||
let url = new URL($page.url);
|
|
||||||
url.pathname += `/${filename}`;
|
|
||||||
|
|
||||||
console.log(`--- ${vorgang} + ${filename} + ${url}`)
|
|
||||||
try {
|
|
||||||
const response = await fetch(url,
|
|
||||||
{method: 'DELETE'}
|
|
||||||
)
|
|
||||||
if (response.status == 204) {
|
|
||||||
setTimeout(() => {window.location.reload()}, 500)
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
if (error instanceof Error) {
|
|
||||||
console.log(error.message)
|
|
||||||
} else {
|
|
||||||
console.log(error)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
aria-label="Datei löschen"
|
|
||||||
>
|
|
||||||
<svg
|
|
||||||
height="20" width="20" xmlns="http://www.w3.org/2000/svg"><path d="m8 3v1 1h1v-1h4v1h1v-1-1zm-4 3v1h14v-1zm2 2v11h1 9v-1-10h-1v10h-8v-10z" fill="#373737" transform="translate(1 1)"/></svg>
|
|
||||||
</button>
|
|
||||||
<p class="mt-1 truncate text-xs leading-5 text-gray-500">
|
|
||||||
{shortenFileSize(item.size)}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="hidden sm:flex sm:flex-col sm:items-end">
|
|
||||||
<p class="text-sm leading-6 text-gray-900">3D Tatort</p>
|
|
||||||
<p class="mt-1 text-xs leading-5 text-gray-500">
|
|
||||||
Zuletzt geändert <time datetime="2023-01-23T13:23Z"
|
|
||||||
>{timeElapsed(new Date(item.lastModified))}</time
|
|
||||||
>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
{/each}
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<Modal {open}
|
|
||||||
><ModalTitle>Umbenennen</ModalTitle><ModalContent>
|
|
||||||
{#if inProgress}
|
|
||||||
<p class="py-2 mb-1">Vorgang läuft...</p>
|
|
||||||
{/if}
|
|
||||||
{#if err}
|
|
||||||
<Alert class="w-full" type="error">Fehler beim Umbenennen</Alert>
|
|
||||||
{/if}
|
|
||||||
</ModalContent>
|
|
||||||
<ModalFooter><Button disabled={inProgress} on:click={uploadSuccessful}>Ok</Button></ModalFooter>
|
|
||||||
</Modal>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
import { client } from '$lib/minio';
|
|
||||||
import { json } from '@sveltejs/kit';
|
|
||||||
|
|
||||||
export async function DELETE({ request }) {
|
|
||||||
|
|
||||||
let url_fragments = request.url.split('/')
|
|
||||||
let item = url_fragments.at(-1);
|
|
||||||
let vorgang = url_fragments.at(-2);
|
|
||||||
|
|
||||||
await client.removeObject('tatort', `${vorgang}/${item}`)
|
|
||||||
|
|
||||||
return new Response(null, { status: 204 });
|
|
||||||
};
|
|
||||||
@@ -5,7 +5,7 @@ import caseNumberOccupied from '$lib/helper/caseNumberOccupied';
|
|||||||
|
|
||||||
/** @type {import('./$types').Actions} */
|
/** @type {import('./$types').Actions} */
|
||||||
export const actions = {
|
export const actions = {
|
||||||
default: async ({ request }) => {
|
default: async ({ request }: {request: Request}) => {
|
||||||
const data = await request.formData();
|
const data = await request.formData();
|
||||||
const caseNumber = data.get('caseNumber');
|
const caseNumber = data.get('caseNumber');
|
||||||
const description = data.get('description');
|
const description = data.get('description');
|
||||||
@@ -28,7 +28,7 @@ export const actions = {
|
|||||||
|
|
||||||
const config = `${JSON.stringify({ caseNumber, description, version: 1 })}\n`;
|
const config = `${JSON.stringify({ caseNumber, description, version: 1 })}\n`;
|
||||||
|
|
||||||
await client.putObject('tatort', `${caseNumber}/config.json`, config, {
|
await client.putObject('tatort', `${caseNumber}/config.json`, config, undefined, {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
<script>
|
<script lang="ts">
|
||||||
import Alert from '$lib/components/ui/Alert.svelte';
|
import Alert from '$lib/components/Alert.svelte';
|
||||||
import Button from '$lib/components/ui/Button.svelte';
|
import Button from '$lib/components/Button.svelte';
|
||||||
import Modal from '$lib/components/ui/Modal/Modal.svelte';
|
import Modal from '$lib/components/Modal/Modal.svelte';
|
||||||
import ModalTitle from '$lib/components/ui/Modal/ModalTitle.svelte';
|
import ModalTitle from '$lib/components/Modal/ModalTitle.svelte';
|
||||||
import ModalContent from '$lib/components/ui/Modal/ModalContent.svelte';
|
import ModalContent from '$lib/components/Modal/ModalContent.svelte';
|
||||||
import ModalFooter from '$lib/components/ui/Modal/ModalFooter.svelte';
|
import ModalFooter from '$lib/components/Modal/ModalFooter.svelte';
|
||||||
import Exclamation from '$lib/icons/Exclamation.svelte';
|
import Exclamation from '$lib/icons/Exclamation.svelte';
|
||||||
|
|
||||||
export let form;
|
export let form;
|
||||||
@@ -55,26 +55,42 @@
|
|||||||
<div>
|
<div>
|
||||||
<label for="description" class="block text-sm font-medium leading-6 text-gray-900"
|
<label for="description" class="block text-sm font-medium leading-6 text-gray-900"
|
||||||
><span class="flex"
|
><span class="flex"
|
||||||
>{#if form?.error?.description}
|
>{#if form?.description}
|
||||||
<span class="inline-block mr-1"><Exclamation /></span>
|
<span class="inline-block mr-1"><Exclamation /></span>
|
||||||
{/if} Beschreibung</span
|
{/if} Beschreibung</span
|
||||||
></label
|
></label
|
||||||
>
|
>
|
||||||
<div class="mt-2">
|
<div class="mt-2">
|
||||||
<textarea
|
<textarea
|
||||||
value={form?.description ?? ''}
|
value={form?.description?.toString() ?? ''}
|
||||||
id="description"
|
id="description"
|
||||||
name="description"
|
name="description"
|
||||||
rows="3"
|
rows="3"
|
||||||
class="block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6"
|
class="block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6"
|
||||||
></textarea>
|
></textarea>
|
||||||
</div>
|
</div>
|
||||||
{#if form?.error?.description}
|
{#if form?.error}
|
||||||
<p class="block text-sm leading-6 text-red-900 mt-2">{form.error.description}</p>
|
<p class="block text-sm leading-6 text-red-900 mt-2">{form.description}</p>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<label for="code">
|
||||||
|
<span >Zugangscode (optional) </span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<div class="mt-2">
|
||||||
|
<div
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
id="code"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="mt-6 flex items-center justify-end gap-x-6">
|
<div class="mt-6 flex items-center justify-end gap-x-6">
|
||||||
<button type="button" class="text-sm font-semibold leading-6 text-gray-900">Cancel</button>
|
<button type="button" class="text-sm font-semibold leading-6 text-gray-900">Cancel</button>
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -1,13 +1,9 @@
|
|||||||
import path from 'path';
|
import { Buffer } from 'buffer';
|
||||||
import { writeFile } from 'fs/promises';
|
|
||||||
import { createReadStream } from 'fs';
|
|
||||||
/** import Minio from 'minio'; */
|
|
||||||
import { Readable } from 'stream';
|
import { Readable } from 'stream';
|
||||||
/** const MINIO_ACCESS_KEY = 'tMhLrfog47lMm0HZ'; */
|
|
||||||
import { client } from '$lib/minio';
|
import { client } from '$lib/minio';
|
||||||
import { fail } from '@sveltejs/kit';
|
import { fail } from '@sveltejs/kit';
|
||||||
|
|
||||||
function isRequiredFieldValid(value) {
|
const isRequiredFieldValid = (value: unknown) => {
|
||||||
if (value == null) return false;
|
if (value == null) return false;
|
||||||
|
|
||||||
if (typeof value === 'string' || value instanceof String) return value.trim() !== '';
|
if (typeof value === 'string' || value instanceof String) return value.trim() !== '';
|
||||||
@@ -15,13 +11,13 @@ function isRequiredFieldValid(value) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @type {import('./$types').Actions} */
|
|
||||||
export const actions = {
|
export const actions = {
|
||||||
url: async ({ request }) => {
|
url: async ({ request }: {request: Request}) => {
|
||||||
const data = await request.formData();
|
const data = await request.formData();
|
||||||
const vorgang = data.get('vorgang');
|
const vorgang = data.get('vorgang');
|
||||||
const name = data.get('name');
|
const name = data.get('name');
|
||||||
const type = data.get('type');
|
const type = data.get('type');
|
||||||
|
const code = data.get('zugangscode');
|
||||||
const fileName = data.get('fileName');
|
const fileName = data.get('fileName');
|
||||||
|
|
||||||
let objectName = `${vorgang}/${name}`;
|
let objectName = `${vorgang}/${name}`;
|
||||||
@@ -30,20 +26,29 @@ export const actions = {
|
|||||||
if (!objectName.endsWith('.png')) objectName += '.png';
|
if (!objectName.endsWith('.png')) objectName += '.png';
|
||||||
break;
|
break;
|
||||||
case '':
|
case '':
|
||||||
if (fileName.endsWith('.glb') && !objectName.endsWith('.glb')) objectName += '.glb';
|
if (fileName?.toString().endsWith('.glb') && !objectName.endsWith('.glb')) objectName += '.glb';
|
||||||
}
|
}
|
||||||
|
|
||||||
const url = await client.presignedPutObject('tatort', objectName);
|
const url = await client.presignedPutObject('tatort', objectName);
|
||||||
|
|
||||||
|
// store code in S3
|
||||||
|
// tatort/<vorgang>/__perm__
|
||||||
|
const code_filename = '__perm__';
|
||||||
|
const buf = Buffer.from(code, 'utf-8');
|
||||||
|
const code_stream = Readable.from(buf);
|
||||||
|
const code_path = `${vorgang}/${code_filename}`;
|
||||||
|
await client.putObject('tatort', code_path, code_stream);
|
||||||
|
|
||||||
return { url };
|
return { url };
|
||||||
},
|
},
|
||||||
validate: async ({ request }) => {
|
validate: async ({ request }: {request: Request}) => {
|
||||||
const requestData = await request.formData();
|
const requestData = await request.formData();
|
||||||
const data = Object.fromEntries(requestData);
|
const data = Object.fromEntries(requestData);
|
||||||
const vorgang = data.vorgang;
|
const vorgang = data.vorgang;
|
||||||
const name = data.name;
|
const name = data.name;
|
||||||
|
const zugangscode = data.zugangscode;
|
||||||
let success = true;
|
let success = true;
|
||||||
let err = {};
|
const err = {};
|
||||||
|
|
||||||
if (isRequiredFieldValid(vorgang)) err.vorgang = null;
|
if (isRequiredFieldValid(vorgang)) err.vorgang = null;
|
||||||
else {
|
else {
|
||||||
@@ -57,29 +62,32 @@ export const actions = {
|
|||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isRequiredFieldValid(zugangscode)) err.zugangscode = null;
|
||||||
|
else {
|
||||||
|
err.zugangscode = 'Das Feld Zugangscode darf nicht leer bleiben.';
|
||||||
|
success = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (success) return { success };
|
if (success) return { success };
|
||||||
|
|
||||||
return fail(400, err);
|
return fail(400, err);
|
||||||
},
|
},
|
||||||
|
|
||||||
upload: async ({ request }) => {
|
upload: async ({ request }: {request: Request}) => {
|
||||||
const requestData = await request.formData();
|
const requestData = await request.formData();
|
||||||
const data = Object.fromEntries(requestData);
|
const data = Object.fromEntries(requestData);
|
||||||
const vorgang = data.vorgang;
|
const vorgang = data.vorgang;
|
||||||
const name = data.name;
|
const name = data.name;
|
||||||
console.log('I:', vorgang, name);
|
|
||||||
|
|
||||||
const url = await client.presignedPutObject('tatort', `${vorgang}/${name}`, 60);
|
const url = await client.presignedPutObject('tatort', `${vorgang}/${name}`, 60);
|
||||||
|
|
||||||
console.log('O:', url);
|
|
||||||
return { url };
|
return { url };
|
||||||
},
|
},
|
||||||
upload3: async ({ request }) => {
|
upload3: async ({ request }: {request: Request}) => {
|
||||||
const requestData = await request.formData();
|
const requestData = await request.formData();
|
||||||
const data = Object.fromEntries(requestData);
|
const data = Object.fromEntries(requestData);
|
||||||
const name = data.name;
|
const name = data.name;
|
||||||
const stream = data.file.stream();
|
const stream = data.file.stream();
|
||||||
console.log('Data:', stream);
|
|
||||||
const metaData = { 'Content-Type': 'model-gtlf-binary', 'X-VorgangsNr': '4711' };
|
const metaData = { 'Content-Type': 'model-gtlf-binary', 'X-VorgangsNr': '4711' };
|
||||||
const result = new Promise((resolve, reject) => {
|
const result = new Promise((resolve, reject) => {
|
||||||
client.putObject('tatort', name, Readable.from(stream), metaData, function (err, etag) {
|
client.putObject('tatort', name, Readable.from(stream), metaData, function (err, etag) {
|
||||||
@@ -91,13 +99,11 @@ export const actions = {
|
|||||||
let error = null;
|
let error = null;
|
||||||
try {
|
try {
|
||||||
etag = await result;
|
etag = await result;
|
||||||
console.log(etag);
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
error = err;
|
error = err;
|
||||||
console.log('Error:', err);
|
console.log('Error:', err);
|
||||||
}
|
}
|
||||||
|
|
||||||
return { etag, error };
|
return { etag, error };
|
||||||
//await writeFile(filePath, Buffer.from(await data.file.arrayBuffer()));
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -1,34 +1,48 @@
|
|||||||
<script>
|
<script lang="ts">
|
||||||
import { deserialize, enhance } from '$app/forms';
|
import { deserialize } from '$app/forms';
|
||||||
import Alert from '$lib/components/ui/Alert.svelte';
|
import Alert from '$lib/components/Alert.svelte';
|
||||||
import Button from '$lib/components/ui/Button.svelte';
|
import Button from '$lib/components/Button.svelte';
|
||||||
import Modal from '$lib/components/ui/Modal/Modal.svelte';
|
import Modal from '$lib/components/Modal/Modal.svelte';
|
||||||
import ModalTitle from '$lib/components/ui/Modal/ModalTitle.svelte';
|
import ModalTitle from '$lib/components/Modal/ModalTitle.svelte';
|
||||||
import ModalContent from '$lib/components/ui/Modal/ModalContent.svelte';
|
import ModalContent from '$lib/components/Modal/ModalContent.svelte';
|
||||||
import ModalFooter from '$lib/components/ui/Modal/ModalFooter.svelte';
|
import ModalFooter from '$lib/components/Modal/ModalFooter.svelte';
|
||||||
import shortenFileSize from '$lib/helper/shortenFileSize.js';
|
import shortenFileSize from '$lib/helper/shortenFileSize.js';
|
||||||
import Exclamation from '$lib/icons/Exclamation.svelte';
|
import Exclamation from '$lib/icons/Exclamation.svelte';
|
||||||
|
import FileRect from '$lib/icons/File-rect.svelte';
|
||||||
|
|
||||||
export let form;
|
export let form;
|
||||||
|
|
||||||
let open = false;
|
let open = false;
|
||||||
let inProgress = false;
|
let inProgress = false;
|
||||||
let vorgang = '';
|
let vorgang = '';
|
||||||
|
const code_len = 8;
|
||||||
|
|
||||||
|
function generate_token() {
|
||||||
|
return Math.random()
|
||||||
|
.toString(36)
|
||||||
|
.slice(2, 2 + code_len);
|
||||||
|
}
|
||||||
|
let zugangscode = ''
|
||||||
|
let zugangscode_old = ''
|
||||||
|
$: zugangscode_old = generate_token();
|
||||||
|
$: zugangscode = zugangscode_old
|
||||||
|
|
||||||
|
let case_existing = undefined;
|
||||||
|
$: case_existing = false;
|
||||||
|
|
||||||
let name = '';
|
let name = '';
|
||||||
/** @type {?string}*/
|
let etag: string | null = null;
|
||||||
let etag = null;
|
let files: FileList | null = null;
|
||||||
/** @type {?FileList} */
|
|
||||||
let files = null;
|
|
||||||
|
|
||||||
$: inProgress = form === null;
|
$: inProgress = form === null;
|
||||||
|
|
||||||
/** @type {?Record<string,any>}*/
|
let formErrors: Record<string,any> | null;
|
||||||
let formErrors;
|
|
||||||
|
|
||||||
async function validateForm() {
|
async function validateForm() {
|
||||||
let data = new FormData();
|
let data = new FormData();
|
||||||
data.append('vorgang', vorgang);
|
data.append('vorgang', vorgang);
|
||||||
data.append('name', name);
|
data.append('name', name);
|
||||||
|
data.append('zugangscode', zugangscode);
|
||||||
const response = await fetch('?/validate', { method: 'POST', body: data });
|
const response = await fetch('?/validate', { method: 'POST', body: data });
|
||||||
/** @type {import('@sveltejs/kit').ActionResult} */
|
/** @type {import('@sveltejs/kit').ActionResult} */
|
||||||
const result = deserialize(await response.text());
|
const result = deserialize(await response.text());
|
||||||
@@ -41,7 +55,6 @@
|
|||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('File', files);
|
|
||||||
if (!files?.length) {
|
if (!files?.length) {
|
||||||
formErrors = { file: 'Sie haben keine Datei ausgewählt.', ...formErrors };
|
formErrors = { file: 'Sie haben keine Datei ausgewählt.', ...formErrors };
|
||||||
success = false;
|
success = false;
|
||||||
@@ -59,6 +72,7 @@
|
|||||||
let data = new FormData();
|
let data = new FormData();
|
||||||
data.append('vorgang', vorgang);
|
data.append('vorgang', vorgang);
|
||||||
data.append('name', name);
|
data.append('name', name);
|
||||||
|
data.append('zugangscode', zugangscode);
|
||||||
if (files?.length === 1) {
|
if (files?.length === 1) {
|
||||||
data.append('type', files[0].type);
|
data.append('type', files[0].type);
|
||||||
data.append('fileName', files[0].name);
|
data.append('fileName', files[0].name);
|
||||||
@@ -71,14 +85,12 @@
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @param {MouseEvent} event*/
|
async function buttonClick(event: MouseEvent) {
|
||||||
async function buttonClick(event) {
|
|
||||||
if (!(await validateForm())) {
|
if (!(await validateForm())) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const url = await getUrl();
|
const url = await getUrl();
|
||||||
console.log('URL', url);
|
|
||||||
open = true;
|
open = true;
|
||||||
inProgress = true;
|
inProgress = true;
|
||||||
|
|
||||||
@@ -86,7 +98,6 @@
|
|||||||
.then((response) => {
|
.then((response) => {
|
||||||
inProgress = false;
|
inProgress = false;
|
||||||
etag = '123';
|
etag = '123';
|
||||||
console.log('SUCCESS', response);
|
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
inProgress = false;
|
inProgress = false;
|
||||||
@@ -96,7 +107,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function uploadSuccessful() {
|
function uploadSuccessful() {
|
||||||
console.log('reset');
|
|
||||||
open = false;
|
open = false;
|
||||||
vorgang = '';
|
vorgang = '';
|
||||||
name = '';
|
name = '';
|
||||||
@@ -107,40 +117,86 @@
|
|||||||
function swap_endian(val) {
|
function swap_endian(val) {
|
||||||
// from https://www.geeksforgeeks.org/bit-manipulation-swap-endianness-of-a-number/
|
// from https://www.geeksforgeeks.org/bit-manipulation-swap-endianness-of-a-number/
|
||||||
|
|
||||||
let leftmost_byte = (val & eval(0x000000FF)) >> 0;
|
let leftmost_byte = (val & eval(0x000000ff)) >> 0;
|
||||||
let left_middle_byte = (val & eval(0x0000FF00)) >> 8;
|
let left_middle_byte = (val & eval(0x0000ff00)) >> 8;
|
||||||
let right_middle_byte = (val & eval(0x00FF0000)) >> 16;
|
let right_middle_byte = (val & eval(0x00ff0000)) >> 16;
|
||||||
let rightmost_byte = (val & eval(0xFF000000)) >> 24;
|
let rightmost_byte = (val & eval(0xff000000)) >> 24;
|
||||||
|
|
||||||
leftmost_byte <<= 24;
|
leftmost_byte <<= 24;
|
||||||
left_middle_byte <<= 16;
|
left_middle_byte <<= 16;
|
||||||
right_middle_byte <<= 8;
|
right_middle_byte <<= 8;
|
||||||
rightmost_byte <<= 0;
|
rightmost_byte <<= 0;
|
||||||
|
|
||||||
let res = (leftmost_byte | left_middle_byte | right_middle_byte | rightmost_byte)
|
let res = leftmost_byte | left_middle_byte | right_middle_byte | rightmost_byte;
|
||||||
|
|
||||||
return res
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async function check_valid_glb_file() {
|
async function check_valid_glb_file() {
|
||||||
// GLD Header, magic value 0x46546C67, identifies data as binary glTF, 4 bytes
|
// GLD Header, magic value 0x46546C67, identifies data as binary glTF, 4 bytes
|
||||||
// little endian!
|
// little endian!
|
||||||
const GLD_MAGIC = 0x46546C67;
|
const GLD_MAGIC = 0x46546c67;
|
||||||
|
|
||||||
// big endian!
|
// big endian!
|
||||||
let file = files[0];
|
let file = files[0];
|
||||||
let file_header = file.slice(0, 4)
|
let file_header = file.slice(0, 4);
|
||||||
let header_bytes = await file_header.bytes()
|
let header_bytes = await file_header.bytes();
|
||||||
let file_header_hex = '0x' + header_bytes.toHex().toString();
|
let file_header_hex = '0x' + header_bytes.toHex().toString();
|
||||||
|
|
||||||
|
|
||||||
if (GLD_MAGIC == swap_endian(file_header_hex)) {
|
if (GLD_MAGIC == swap_endian(file_header_hex)) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// `/(angemeldet)/view` return true or false
|
||||||
|
async function case_exists(case_no) {
|
||||||
|
|
||||||
|
if (case_no == '') {
|
||||||
|
zugangscode = zugangscode_old;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ping `/view` with caseNumber in POST body
|
||||||
|
let url = '/view';
|
||||||
|
|
||||||
|
let data = new FormData();
|
||||||
|
data.append('caseNumber', case_no);
|
||||||
|
|
||||||
|
// fetch code in parallel
|
||||||
|
const code = await get_code(case_no);
|
||||||
|
if (code != -1) {
|
||||||
|
zugangscode = code;
|
||||||
|
case_existing = true;
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
const response = await fetch(url, { method: 'POST', body: data });
|
||||||
|
|
||||||
|
const res_json = await response.json();
|
||||||
|
const status = res_json.status;
|
||||||
|
|
||||||
|
if (status != 303) {
|
||||||
|
case_existing = false;
|
||||||
|
zugangscode = zugangscode_old;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function get_code(case_no) {
|
||||||
|
|
||||||
|
if (case_no == '') return;
|
||||||
|
|
||||||
|
let url = `/api/list/${case_no}/code`;
|
||||||
|
const response = await fetch(url);
|
||||||
|
|
||||||
|
if (response.status == 200) {
|
||||||
|
return response.text();
|
||||||
|
} else {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@@ -177,12 +233,18 @@
|
|||||||
id="vorgang"
|
id="vorgang"
|
||||||
autocomplete={vorgang}
|
autocomplete={vorgang}
|
||||||
class="block flex-1 border-0 bg-transparent py-1.5 pl-1 text-gray-900 placeholder:text-gray-400 focus:ring-0 sm:text-sm sm:leading-6"
|
class="block flex-1 border-0 bg-transparent py-1.5 pl-1 text-gray-900 placeholder:text-gray-400 focus:ring-0 sm:text-sm sm:leading-6"
|
||||||
|
on:input={() => case_exists(vorgang)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{#if formErrors?.vorgang}
|
{#if formErrors?.vorgang}
|
||||||
<p class="block text-sm leading-6 text-red-900 mt-2">{formErrors.vorgang}</p>
|
<p class="block text-sm leading-6 text-red-900 mt-2">{formErrors.vorgang}</p>
|
||||||
{/if}
|
{/if}
|
||||||
|
{#if case_existing && vorgang.length > 0}
|
||||||
|
<span>Datei wird zum existierenden Vorgang hinzugefügt.</span>
|
||||||
|
{:else if vorgang.length > 0}
|
||||||
|
<span>Neuer Vorgang wird angelegt.</span>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
@@ -212,6 +274,41 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label for="zugangscode" class="block text-sm font-medium leading-6 text-gray-900"
|
||||||
|
><span class="flex"
|
||||||
|
>{#if formErrors?.zugangscode}
|
||||||
|
<span class="inline-block mr-1"><Exclamation /></span>
|
||||||
|
{/if} Zugangscode</span
|
||||||
|
></label
|
||||||
|
>
|
||||||
|
<div class="mt-2">
|
||||||
|
<div
|
||||||
|
class="flex rounded-md shadow-sm ring-1 ring-inset ring-gray-300 focus-within:ring-2 focus-within:ring-inset focus-within:ring-indigo-600"
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
bind:value={zugangscode}
|
||||||
|
type="text"
|
||||||
|
name="zugangscode"
|
||||||
|
id="zugangscode"
|
||||||
|
on:input="{ (ev) => { zugangscode_old = ev.target.value }}"
|
||||||
|
class="block flex-1 border-0 bg-transparent py-1.5 pl-1 text-gray-900 placeholder:text-gray-400 focus:ring-0 sm:text-sm sm:leading-6"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
class="rounded-md bg-blue-500 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
|
||||||
|
on:click="{() => {
|
||||||
|
zugangscode = zugangscode_old = generate_token(); }}"
|
||||||
|
type="button">
|
||||||
|
Generiere Zugangscode
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{#if formErrors?.code}
|
||||||
|
<p class="block text-sm leading-6 text-red-900 mt-2">{formErrors.code}</p>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="col-span-full">
|
<div class="col-span-full">
|
||||||
<label for="file" class="block text-sm font-medium leading-6 text-gray-900"
|
<label for="file" class="block text-sm font-medium leading-6 text-gray-900"
|
||||||
><span class="flex"
|
><span class="flex"
|
||||||
@@ -224,18 +321,7 @@
|
|||||||
class="mt-2 flex justify-center rounded-lg border border-dashed border-gray-900/25 px-6 py-10"
|
class="mt-2 flex justify-center rounded-lg border border-dashed border-gray-900/25 px-6 py-10"
|
||||||
>
|
>
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<svg
|
<FileRect />
|
||||||
class="mx-auto h-12 w-12 text-gray-300"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
fill="currentColor"
|
|
||||||
aria-hidden="true"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
fill-rule="evenodd"
|
|
||||||
d="M1.5 6a2.25 2.25 0 012.25-2.25h16.5A2.25 2.25 0 0122.5 6v12a2.25 2.25 0 01-2.25 2.25H3.75A2.25 2.25 0 011.5 18V6zM3 16.06V18c0 .414.336.75.75.75h16.5A.75.75 0 0021 18v-1.94l-2.69-2.689a1.5 1.5 0 00-2.12 0l-.88.879.97.97a.75.75 0 11-1.06 1.06l-5.16-5.159a1.5 1.5 0 00-2.12 0L3 16.061zm10.125-7.81a1.125 1.125 0 112.25 0 1.125 1.125 0 01-2.25 0z"
|
|
||||||
clip-rule="evenodd"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
<div class="mt-4 flex text-sm leading-6 text-gray-600">
|
<div class="mt-4 flex text-sm leading-6 text-gray-600">
|
||||||
<label
|
<label
|
||||||
for="file"
|
for="file"
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
import caseNumberOccupied from '$lib/helper/caseNumberOccupied';
|
|
||||||
import { fail, redirect } from '@sveltejs/kit';
|
|
||||||
|
|
||||||
/** @type {import('./$types').Actions} */
|
|
||||||
export const actions = {
|
|
||||||
default: async ({ request }) => {
|
|
||||||
const data = await request.formData();
|
|
||||||
const caseNumber = data.get('caseNumber');
|
|
||||||
|
|
||||||
if (!caseNumber) {
|
|
||||||
return fail(400, {
|
|
||||||
success: false,
|
|
||||||
caseNumber,
|
|
||||||
error: { caseNumber: 'Die Vorgangsnummer darf nicht leer sein.' }
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(await caseNumberOccupied(caseNumber))) {
|
|
||||||
return fail(400, {
|
|
||||||
success: false,
|
|
||||||
caseNumber,
|
|
||||||
error: { caseNumber: 'Die Vorgangsnummer existiert in dieser Anwendung nicht.' }
|
|
||||||
});
|
|
||||||
}
|
|
||||||
throw redirect(303, `/list/${caseNumber}`);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
<script>
|
|
||||||
import Alert from '$lib/components/ui/Alert.svelte';
|
|
||||||
import Button from '$lib/components/ui/Button.svelte';
|
|
||||||
import Modal from '$lib/components/ui/Modal/Modal.svelte';
|
|
||||||
import ModalTitle from '$lib/components/ui/Modal/ModalTitle.svelte';
|
|
||||||
import ModalContent from '$lib/components/ui/Modal/ModalContent.svelte';
|
|
||||||
import ModalFooter from '$lib/components/ui/Modal/ModalFooter.svelte';
|
|
||||||
import Exclamation from '$lib/icons/Exclamation.svelte';
|
|
||||||
|
|
||||||
export let form;
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<div class="mx-auto max-w-2xl">
|
|
||||||
<div class="flex flex-col items-center justify-center w-full">
|
|
||||||
<h1 class="text-xl">Vorgang ansehen</h1>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<form method="POST">
|
|
||||||
<div class="space-y-12">
|
|
||||||
<div class="border-b border-gray-900/10 pb-12">
|
|
||||||
<!-- <h2 class="text-base font-semibold leading-7 text-gray-900">Profile</h2> -->
|
|
||||||
<p class="mt-8 text-sm leading-6 text-gray-600">
|
|
||||||
Anhand der Vorgangsnummer werden Sie zu den Dateien des Vorgangs weitergeleitet und können
|
|
||||||
sich den Vorgang dann ansehen.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<div class="mt-10 grid grid-cols-1 gap-x-6 gap-y-8">
|
|
||||||
<div>
|
|
||||||
<label for="caseNumber" class="block text-sm font-medium leading-6 text-gray-900"
|
|
||||||
><span class="flex"
|
|
||||||
>{#if form?.error?.caseNumber}
|
|
||||||
<span class="inline-block mr-1"><Exclamation /></span>
|
|
||||||
{/if} Vorgangs-Nr.</span
|
|
||||||
></label
|
|
||||||
>
|
|
||||||
<div class="mt-2 w-full">
|
|
||||||
<div
|
|
||||||
class="flex w-full rounded-md shadow-sm ring-1 ring-inset ring-gray-300 focus-within:ring-2 focus-within:ring-inset focus-within:ring-indigo-600"
|
|
||||||
>
|
|
||||||
<input
|
|
||||||
value={form?.caseNumber ?? ''}
|
|
||||||
type="text"
|
|
||||||
name="caseNumber"
|
|
||||||
id="caseNumber"
|
|
||||||
class="block w-full flex-1 border-0 bg-transparent py-1.5 pl-1 text-gray-900 placeholder:text-gray-400 focus:ring-0 sm:text-sm sm:leading-6"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{#if form?.error?.caseNumber}
|
|
||||||
<p class="block text-sm leading-6 text-red-900 mt-2">{form.error.caseNumber}</p>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="mt-6 flex items-center justify-end gap-x-6">
|
|
||||||
<Button
|
|
||||||
type="submit"
|
|
||||||
class="rounded-md bg-indigo-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
|
|
||||||
>Weiter</Button
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
@@ -1,246 +0,0 @@
|
|||||||
<style>
|
|
||||||
model-viewer {
|
|
||||||
height: 100%;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.model{
|
|
||||||
height: calc(100%-84px)
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import { preloadCode } from '$app/navigation';
|
|
||||||
import Panel from '$lib/components/ui/Panel.svelte';
|
|
||||||
import { onMount } from 'svelte';
|
|
||||||
import Button from '$lib/components/ui/Button.svelte';
|
|
||||||
import autoprefixer from 'autoprefixer';
|
|
||||||
|
|
||||||
export let data;
|
|
||||||
|
|
||||||
onMount(() => {
|
|
||||||
import('@google/model-viewer');
|
|
||||||
console.log(modelViewer.getAttribute('camera-orbit'), modelViewer.getAttribute('camera-target'), modelViewer.getAttribute('rotation'))
|
|
||||||
});
|
|
||||||
|
|
||||||
let progress = 0;
|
|
||||||
let hideProgressScreen = false;
|
|
||||||
|
|
||||||
let cameraOrbit = '0deg 0deg 0m';
|
|
||||||
let cameraTarget ="0m 0m 0m";
|
|
||||||
let fieldOfView = '0deg';
|
|
||||||
|
|
||||||
let cameraAzimuth = 0;
|
|
||||||
let cameraPolar = 0;
|
|
||||||
let cameraZoom = 0;
|
|
||||||
let xRotation=0;
|
|
||||||
let yRotation=0;
|
|
||||||
let zRotation=0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @type {any}
|
|
||||||
*/
|
|
||||||
let modelViewer;
|
|
||||||
|
|
||||||
|
|
||||||
$: style = `width: ${progress}%`;
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
function onProgress({ detail }) {
|
|
||||||
progress = Math.ceil(detail.totalProgress * 100.0);
|
|
||||||
if (progress == 100) {
|
|
||||||
setTimeout(() => {
|
|
||||||
hideProgressScreen = true;
|
|
||||||
}, 250);
|
|
||||||
} else hideProgressScreen = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function onResetView() {
|
|
||||||
cameraOrbit = '0deg 0deg 0m';
|
|
||||||
cameraTarget ="0m 0m 0m"
|
|
||||||
|
|
||||||
console.log("show cameraOrbit:", modelViewer.getCameraOrbit(), modelViewer.cameraOrbit, modelViewer.getDimensions())
|
|
||||||
console.log("Camera-orbit: ",modelViewer.getAttribute('camera-orbit'), "camera-target: ",modelViewer.getAttribute('camera-target'), "object-rotation: ", modelViewer.getAttribute('rotation'))
|
|
||||||
|
|
||||||
modelViewer.cameraOrbit = cameraOrbit;
|
|
||||||
modelViewer.cameraTarget = cameraTarget;
|
|
||||||
xRotation = yRotation = zRotation = 0;
|
|
||||||
cameraOrbit = '0deg 0deg 0%';
|
|
||||||
cameraTarget ="0m 0m 0m";
|
|
||||||
fieldOfView = '0deg';
|
|
||||||
|
|
||||||
cameraAzimuth = 0;
|
|
||||||
cameraPolar = 0;
|
|
||||||
cameraZoom = 0;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} newOrbit
|
|
||||||
*/
|
|
||||||
function updateCameraOrbit(newOrbit) {
|
|
||||||
|
|
||||||
// cameraTarget ="0m 0m 0m"
|
|
||||||
console.log("update X",modelViewer.cameraOrbit,"target:", modelViewer.cameraTarget, newOrbit)
|
|
||||||
modelViewer.cameraOrbit = newOrbit;
|
|
||||||
modelViewer.cameraTarget = cameraTarget;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function slideCameraOrbit(){
|
|
||||||
modelViewer.cameraOrbit =`${cameraAzimuth}deg ${cameraPolar}deg ${cameraZoom}%`;
|
|
||||||
}
|
|
||||||
|
|
||||||
function slideRotation(){
|
|
||||||
modelViewer.orientation = `${xRotation}deg ${yRotation}deg ${zRotation}deg`
|
|
||||||
}
|
|
||||||
|
|
||||||
const disableMouseWheelZoom = (/** @type {{ preventDefault: () => void; }} */ event) => {
|
|
||||||
event.preventDefault(); // Blockiert das Mausrad-Ereignis
|
|
||||||
};
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<!-- <Button
|
|
||||||
on:click={toggleShowOptions}
|
|
||||||
{disabled}
|
|
||||||
type="button"
|
|
||||||
variant="white"
|
|
||||||
fullWidth
|
|
||||||
align="left"
|
|
||||||
class="relative cursor-default justify-start py-2 pl-3 pr-10 text-left"
|
|
||||||
> -->
|
|
||||||
|
|
||||||
<div class="h-full model w-full bg-neutral-200 p-4">
|
|
||||||
|
|
||||||
<!-- field-of-view="auto" -->
|
|
||||||
<!--
|
|
||||||
camera-controls
|
|
||||||
model-rotation="0rad 0rad 0rad"
|
|
||||||
|
|
||||||
camera-target="0m 0m 10m"
|
|
||||||
|
|
||||||
field-of-view="auto"
|
|
||||||
max-field-of-view="10deg"
|
|
||||||
min-field-of-view="0.1deg"-->
|
|
||||||
<model-viewer
|
|
||||||
src={data.url}
|
|
||||||
bind:this={modelViewer}
|
|
||||||
touch-action="pan-y"
|
|
||||||
field-of-view="auto"
|
|
||||||
camera-controls
|
|
||||||
orientation={`${xRotation}deg ${yRotation}deg ${zRotation}deg`}
|
|
||||||
camera-target="0m 0m 0m"
|
|
||||||
camera-orbit = {`${cameraAzimuth}deg ${cameraPolar}deg ${cameraZoom}`}
|
|
||||||
on:progress={onProgress}
|
|
||||||
>
|
|
||||||
<!--Buttons zum Steuern-->
|
|
||||||
<div class="bg-redx-500 p-4 flex z-10">
|
|
||||||
<div class="flex flex-col">
|
|
||||||
<!--3 Buttons-->
|
|
||||||
<div>
|
|
||||||
<Button
|
|
||||||
on:click={()=>{updateCameraOrbit('0deg 0deg 0%')}}
|
|
||||||
type="button"
|
|
||||||
variant="white"
|
|
||||||
|
|
||||||
align="left"
|
|
||||||
class="relative cursor-default justify-start py-2 pl-3 pr-10 text-left"
|
|
||||||
>
|
|
||||||
Draufsicht
|
|
||||||
</Button>
|
|
||||||
<Button
|
|
||||||
on:click={()=>{onResetView()}}
|
|
||||||
type="button"
|
|
||||||
variant="white"
|
|
||||||
|
|
||||||
align="left"
|
|
||||||
class="relative cursor-default justify-start py-2 pl-3 pr-10 text-left"
|
|
||||||
>
|
|
||||||
Werte zurücksetzen
|
|
||||||
</Button>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
|
|
||||||
on:click={()=>{updateCameraOrbit('0deg 90deg 0%')}}
|
|
||||||
|
|
||||||
type="button"
|
|
||||||
variant="white"
|
|
||||||
|
|
||||||
align="left"
|
|
||||||
class="relative cursor-default justify-start py-2 pl-3 pr-10 text-left"
|
|
||||||
>
|
|
||||||
Frontansicht
|
|
||||||
</Button>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!--Horizontal-->
|
|
||||||
<div>
|
|
||||||
<!-- svelte-ignore a11y_label_has_associated_control -->
|
|
||||||
<label>Horizontal drehen (Azimut):</label>
|
|
||||||
<input
|
|
||||||
type="range"
|
|
||||||
min="0" max="360"
|
|
||||||
bind:value={cameraAzimuth}
|
|
||||||
/>
|
|
||||||
<!-- on:input={slideCameraOrbit} -->
|
|
||||||
</div>
|
|
||||||
<!--Vertikal-->
|
|
||||||
<div class="">
|
|
||||||
<label class=" mb-2" for="polarSlider">Vertikal drehen (Polar):</label>
|
|
||||||
<input id="polarSlider" type="range" min=0 max=90 bind:value={cameraPolar} />
|
|
||||||
<!-- on:input={slideCameraOrbit} class="vertical-slider"-->
|
|
||||||
</div>
|
|
||||||
<!--Zoom/Distanz-->
|
|
||||||
<div>
|
|
||||||
<label for="cZoom">Zoomen</label>
|
|
||||||
<input id="cZoom" type="range"
|
|
||||||
min="0"
|
|
||||||
max="120"
|
|
||||||
|
|
||||||
bind:value={cameraZoom}
|
|
||||||
on:input={slideCameraOrbit}/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--Rotationen-->
|
|
||||||
<div class="flex mt-2 ml-2">
|
|
||||||
|
|
||||||
<div class="">
|
|
||||||
<label class="" for="polarSlider">Rotation X:</label>
|
|
||||||
<input id="polarSlider" type="range" min=0 max=360 bind:value={xRotation} />
|
|
||||||
<!-- on:input={slideCameraOrbit} class="vertical-slider"-->
|
|
||||||
</div>
|
|
||||||
<div class="">
|
|
||||||
<label class="" for="polarSlider">Rotation Y:</label>
|
|
||||||
<input id="polarSlider" type="range" min=0 max=360 bind:value={yRotation} />
|
|
||||||
<!-- on:input={slideCameraOrbit} class="vertical-slider"-->
|
|
||||||
</div>
|
|
||||||
<div class="">
|
|
||||||
<label class="" for="polarSlider">Rotation Z:</label>
|
|
||||||
<input id="polarSlider" type="range" min=0 max=360 bind:value={zRotation} />
|
|
||||||
<!-- on:input={slideCameraOrbit} class="vertical-slider"-->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--Loading-->
|
|
||||||
<div
|
|
||||||
slot="progress-bar"
|
|
||||||
class="flex items-center justify-center h-5/6 w-full transition-all delay-250"
|
|
||||||
class:opacity-0={hideProgressScreen}
|
|
||||||
class:hidden={hideProgressScreen}
|
|
||||||
>
|
|
||||||
<Panel class="w-72 bg-gray-50 flex items-center flex-col"
|
|
||||||
><p class="mb-5">Loading {progress}%</p>
|
|
||||||
<div class="h-1 w-full bg-neutral-200 dark:bg-neutral-600">
|
|
||||||
<div class="h-1 bg-blue-500" {style} ></div>
|
|
||||||
</div></Panel
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
</model-viewer>
|
|
||||||
</div>
|
|
||||||
10
src/routes/(token-based)/+layout.server.ts
Normal file
10
src/routes/(token-based)/+layout.server.ts
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import { type ServerLoadEvent } from '@sveltejs/kit';
|
||||||
|
import type { PageServerLoad } from '../anmeldung/$types';
|
||||||
|
|
||||||
|
export const load: PageServerLoad = (event: ServerLoadEvent) => {
|
||||||
|
if (event.locals.user) {
|
||||||
|
return {
|
||||||
|
user: event.locals.user
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
16
src/routes/(token-based)/+layout.svelte
Normal file
16
src/routes/(token-based)/+layout.svelte
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import Footer from '$lib/components/Footer.svelte';
|
||||||
|
import Header from '$lib/components/Header.svelte';
|
||||||
|
|
||||||
|
export let data;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="h-screen v-screen flex flex-col">
|
||||||
|
<Header {data} />
|
||||||
|
|
||||||
|
<div class="mt-10 flex-grow items-center justify-center">
|
||||||
|
<slot />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<Footer {data} />
|
||||||
|
</div>
|
||||||
103
src/routes/(token-based)/list/+page.svelte
Normal file
103
src/routes/(token-based)/list/+page.svelte
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { onMount } from 'svelte';
|
||||||
|
import Trash from '$lib/icons/Trash.svelte';
|
||||||
|
import Folder from '$lib/icons/Folder.svelte';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type any[]
|
||||||
|
*/
|
||||||
|
let list: any[] = [];
|
||||||
|
//$: list;
|
||||||
|
|
||||||
|
onMount(async () => {
|
||||||
|
const response = await fetch('/api/list');
|
||||||
|
const stream = await response.body;
|
||||||
|
if (!stream) return;
|
||||||
|
|
||||||
|
const reader = stream.getReader();
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
const { done, value } = await reader.read();
|
||||||
|
if (done) return;
|
||||||
|
|
||||||
|
const objs = new TextDecoder()
|
||||||
|
.decode(value)
|
||||||
|
.split('\n')
|
||||||
|
.filter((i) => i.length > 0)
|
||||||
|
.map((i) => JSON.parse(i));
|
||||||
|
|
||||||
|
list = list.concat(objs);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
async function delete_item(ev: Event) {
|
||||||
|
let delete_item = window.confirm('Bist du sicher?');
|
||||||
|
|
||||||
|
if (delete_item) {
|
||||||
|
const target = ev.currentTarget as HTMLElement | null;
|
||||||
|
if (!target) return;
|
||||||
|
let filename = target.id.split('del__')[1];
|
||||||
|
|
||||||
|
// delete request
|
||||||
|
// --------------
|
||||||
|
|
||||||
|
let url = `/api/list/${filename}`;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await fetch(url, { method: 'DELETE' });
|
||||||
|
if (response.status == 204) {
|
||||||
|
setTimeout(() => {
|
||||||
|
window.location.reload();
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
if (error instanceof Error) {
|
||||||
|
console.log(error.message);
|
||||||
|
} else {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="-z-10 bg-white">
|
||||||
|
<div class="flex flex-col items-center justify-center w-full">
|
||||||
|
<h1 class="text-xl">Liste der Vorgänge</h1>
|
||||||
|
</div>
|
||||||
|
<div class="mx-auto flex justify-center max-w-7xl h-full">
|
||||||
|
<ul role="list" class="divide-y divide-gray-100">
|
||||||
|
{#each list as item}
|
||||||
|
<li>
|
||||||
|
<a href="/list/{item.name}" class="flex justify-between gap-x-6 py-5">
|
||||||
|
<div class="flex gap-x-4">
|
||||||
|
<!-- Ordner -->
|
||||||
|
<Folder />
|
||||||
|
<div class="min-w-0 flex-auto">
|
||||||
|
<span class="text-sm font-semibold leading-6 text-gray-900">{item.name}</span>
|
||||||
|
<!-- Delete button -->
|
||||||
|
<button
|
||||||
|
style="padding: 2px"
|
||||||
|
id="del__{item.name}"
|
||||||
|
on:click|preventDefault={delete_item}
|
||||||
|
aria-label="Vorgang {item.name} löschen"
|
||||||
|
>
|
||||||
|
<Trash />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="hidden sm:flex sm:flex-col sm:items-end">
|
||||||
|
<p class="text-sm leading-6 text-gray-900">Vorgang</p>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{/each}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
ul {
|
||||||
|
min-width: 24rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
313
src/routes/(token-based)/list/[vorgang]/+page.svelte
Normal file
313
src/routes/(token-based)/list/[vorgang]/+page.svelte
Normal file
@@ -0,0 +1,313 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { onMount } from 'svelte';
|
||||||
|
import shortenFileSize from '$lib/helper/shortenFileSize';
|
||||||
|
import { page } from '$app/stores';
|
||||||
|
|
||||||
|
import timeElapsed from '$lib/helper/timeElapsed';
|
||||||
|
|
||||||
|
import Alert from '$lib/components/Alert.svelte';
|
||||||
|
import Button from '$lib/components/Button.svelte';
|
||||||
|
import Modal from '$lib/components/Modal/Modal.svelte';
|
||||||
|
import ModalTitle from '$lib/components/Modal/ModalTitle.svelte';
|
||||||
|
import ModalContent from '$lib/components/Modal/ModalContent.svelte';
|
||||||
|
import ModalFooter from '$lib/components/Modal/ModalFooter.svelte';
|
||||||
|
import Cube from '$lib/icons/Cube.svelte';
|
||||||
|
import Edit from '$lib/icons/Edit.svelte';
|
||||||
|
import Trash from '$lib/icons/Trash.svelte';
|
||||||
|
|
||||||
|
/** export let data; */
|
||||||
|
/** @type {import('./$types').PageData} */
|
||||||
|
export let data;
|
||||||
|
|
||||||
|
interface ListItem {
|
||||||
|
name: string;
|
||||||
|
size: number;
|
||||||
|
lastModified: string | number | Date;
|
||||||
|
show_button?: boolean;
|
||||||
|
// add other properties as needed
|
||||||
|
}
|
||||||
|
|
||||||
|
let list: ListItem[] = [];
|
||||||
|
$: list;
|
||||||
|
|
||||||
|
let open = false;
|
||||||
|
$: open;
|
||||||
|
let inProgress = false;
|
||||||
|
$: inProgress;
|
||||||
|
let err = false;
|
||||||
|
$: err;
|
||||||
|
|
||||||
|
let rename_input;
|
||||||
|
$: rename_input;
|
||||||
|
|
||||||
|
onMount(async () => {
|
||||||
|
const response = await fetch('/api/list/' + $page.params.vorgang);
|
||||||
|
const stream = response.body;
|
||||||
|
if (!stream) return;
|
||||||
|
|
||||||
|
const reader = stream.getReader();
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
const { done, value } = await reader.read();
|
||||||
|
if (done) return;
|
||||||
|
|
||||||
|
const objs = new TextDecoder()
|
||||||
|
.decode(value)
|
||||||
|
.split('\n')
|
||||||
|
.filter((i) => i.length > 0)
|
||||||
|
.map((i) => JSON.parse(i));
|
||||||
|
|
||||||
|
list = list.concat(objs);
|
||||||
|
|
||||||
|
list = list.map((item) => {
|
||||||
|
item.show_button = true;
|
||||||
|
return item;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function uploadSuccessful() {
|
||||||
|
open = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function defocus_element(i: number) {
|
||||||
|
let item = list[i];
|
||||||
|
let text_field_id = `label__${item.name}`;
|
||||||
|
|
||||||
|
let text_field = document.getElementById(text_field_id);
|
||||||
|
if (text_field) {
|
||||||
|
text_field.setAttribute('contenteditable', 'false');
|
||||||
|
text_field.textContent = item.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
// reshow button
|
||||||
|
list[i].show_button = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handle_input(ev: KeyboardEvent, i: number) {
|
||||||
|
let item = list[i];
|
||||||
|
if (ev.key == 'Escape') {
|
||||||
|
let text_field_id = `label__${item.name}`;
|
||||||
|
|
||||||
|
let text_field = document.getElementById(text_field_id);
|
||||||
|
if (text_field) {
|
||||||
|
text_field.setAttribute('contenteditable', 'false');
|
||||||
|
text_field.textContent = item.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
// reshow button
|
||||||
|
item.show_button = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (ev.key == 'Enter') {
|
||||||
|
let name_field = ev.currentTarget as HTMLElement | null;
|
||||||
|
let new_name = name_field
|
||||||
|
? name_field.textContent || (name_field as any).innerText || ''
|
||||||
|
: '';
|
||||||
|
|
||||||
|
if (new_name == '') {
|
||||||
|
alert('Bitte einen gültigen Namen eingeben.');
|
||||||
|
ev.preventDefault();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// actual upload
|
||||||
|
// -------------
|
||||||
|
|
||||||
|
// to prevent from item being selected
|
||||||
|
ev.preventDefault();
|
||||||
|
|
||||||
|
// construct PUT URL
|
||||||
|
const url = $page.url;
|
||||||
|
console.log(url);
|
||||||
|
|
||||||
|
let data_obj: { new_name: string; old_name: string } = { new_name: '', old_name: '' };
|
||||||
|
data_obj['new_name'] = new_name;
|
||||||
|
data_obj['old_name'] =
|
||||||
|
ev.currentTarget && (ev.currentTarget as HTMLElement).id
|
||||||
|
? (ev.currentTarget as HTMLElement).id.split('__')[1]
|
||||||
|
: '';
|
||||||
|
|
||||||
|
open = true;
|
||||||
|
inProgress = true;
|
||||||
|
|
||||||
|
const response = await fetch(url, { method: 'PUT', body: JSON.stringify(data_obj) });
|
||||||
|
|
||||||
|
inProgress = false;
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
err = true;
|
||||||
|
if (response.status == 400) {
|
||||||
|
let json_res = await response.json();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw new Error(`Fehlgeschlagen: ${response.status}`);
|
||||||
|
} else {
|
||||||
|
uploadSuccessful();
|
||||||
|
setTimeout(() => {
|
||||||
|
window.location.reload();
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- upload finished ---
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="-z-10 bg-white">
|
||||||
|
<div class="flex flex-col items-center justify-center w-full">
|
||||||
|
<h1 class="text-xl">Vorgang {$page.params.vorgang}</h1>
|
||||||
|
</div>
|
||||||
|
<div class="mx-auto flex justify-center max-w-7xl h-full">
|
||||||
|
<ul class="divide-y divide-gray-100">
|
||||||
|
{#each list as item, i}
|
||||||
|
<li>
|
||||||
|
<a
|
||||||
|
href="/view/{$page.params.vorgang}/{item.name}"
|
||||||
|
class=" flex justify-between gap-x-6 py-5"
|
||||||
|
aria-label="zum 3D-modell"
|
||||||
|
>
|
||||||
|
<div class=" flex gap-x-4">
|
||||||
|
<Cube />
|
||||||
|
<div class="min-w-0 flex-auto">
|
||||||
|
{#if data?.user?.admin}
|
||||||
|
<span
|
||||||
|
id="label__{item.name}"
|
||||||
|
class="text-sm font-semibold leading-6 text-gray-900 inline-block min-w-1"
|
||||||
|
contenteditable={!item.show_button}
|
||||||
|
role="textbox"
|
||||||
|
tabindex="0"
|
||||||
|
aria-label="Dateiname bearbeiten"
|
||||||
|
on:focusout={() => {
|
||||||
|
defocus_element(i);
|
||||||
|
}}
|
||||||
|
on:keydown|stopPropagation={// event needed to identify ID
|
||||||
|
// TO-DO: check if event is needed or if index is sufficient
|
||||||
|
async (ev) => {
|
||||||
|
handle_input(ev, i);
|
||||||
|
}}>{item.name}</span
|
||||||
|
>
|
||||||
|
|
||||||
|
<!--<input
|
||||||
|
class="text-sm font-semibold leading-6 text-gray-900 inline-block min-w-1"
|
||||||
|
type="text"
|
||||||
|
name=""
|
||||||
|
on:keydown|stopPropagation={// event needed to identify ID
|
||||||
|
// TO-DO: check if event is needed or if index is sufficient
|
||||||
|
async (ev) => {
|
||||||
|
handle_input(ev, i);
|
||||||
|
}}
|
||||||
|
bind:value={item.name}
|
||||||
|
id="label__{item.name}"
|
||||||
|
/>-->
|
||||||
|
<!-- disabled={item.show_button} -->
|
||||||
|
<!-- https://iconduck.com/icons/192863/edit-rename -->
|
||||||
|
|
||||||
|
{#if item.show_button}
|
||||||
|
<button
|
||||||
|
style="padding: 2px"
|
||||||
|
id="edit__{item.name}"
|
||||||
|
aria-label="Datei umbenennen"
|
||||||
|
on:click|preventDefault={(ev) => {
|
||||||
|
let text_field_id = `label__${item.name}`;
|
||||||
|
|
||||||
|
let text_field = document.getElementById(text_field_id);
|
||||||
|
if (text_field) {
|
||||||
|
text_field.setAttribute('contenteditable', 'true');
|
||||||
|
text_field.focus();
|
||||||
|
text_field.textContent = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// hide button
|
||||||
|
item.show_button = false;
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Edit />
|
||||||
|
</button>
|
||||||
|
{/if}
|
||||||
|
<button
|
||||||
|
style="padding: 2px"
|
||||||
|
id="del__{item.name}"
|
||||||
|
on:click|preventDefault={async (ev) => {
|
||||||
|
let delete_item = window.confirm('Bist du sicher?');
|
||||||
|
|
||||||
|
if (delete_item) {
|
||||||
|
// bucket: tatort, name: <vorgang>/item-name
|
||||||
|
let vorgang = $page.params.vorgang;
|
||||||
|
let filename = '';
|
||||||
|
if (ev && ev.currentTarget && (ev.currentTarget as HTMLElement).id) {
|
||||||
|
filename = (ev.currentTarget as HTMLElement).id.split('del__')[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
// delete request
|
||||||
|
// --------------
|
||||||
|
|
||||||
|
let url = new URL($page.url);
|
||||||
|
url.pathname += `/${filename}`;
|
||||||
|
|
||||||
|
console.log(`--- ${vorgang} + ${filename} + ${url}`);
|
||||||
|
try {
|
||||||
|
const response = await fetch(url, { method: 'DELETE' });
|
||||||
|
if (response.status == 204) {
|
||||||
|
setTimeout(() => {
|
||||||
|
window.location.reload();
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
if (error instanceof Error) {
|
||||||
|
console.log(error.message);
|
||||||
|
} else {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
aria-label="Datei löschen"
|
||||||
|
>
|
||||||
|
<Trash />
|
||||||
|
</button>
|
||||||
|
{:else}
|
||||||
|
<span class="text-sm font-semibold leading-6 text-gray-900 inline-block min-w-1"
|
||||||
|
>{item.name}</span
|
||||||
|
>
|
||||||
|
{/if}
|
||||||
|
<p class="mt-1 truncate text-xs leading-5 text-gray-500">
|
||||||
|
{shortenFileSize(item.size)}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="hidden sm:flex sm:flex-col sm:items-end">
|
||||||
|
<p class="text-sm leading-6 text-gray-900">3D Tatort</p>
|
||||||
|
<p class="mt-1 text-xs leading-5 text-gray-500">
|
||||||
|
Zuletzt geändert <time datetime="2023-01-23T13:23Z"
|
||||||
|
>{timeElapsed(new Date(item.lastModified))}</time
|
||||||
|
>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{/each}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<Modal {open}
|
||||||
|
><ModalTitle>Umbenennen</ModalTitle><ModalContent>
|
||||||
|
{#if inProgress}
|
||||||
|
<p class="py-2 mb-1">Vorgang läuft...</p>
|
||||||
|
{/if}
|
||||||
|
{#if err}
|
||||||
|
<Alert class="w-full" type="error">Fehler beim Umbenennen</Alert>
|
||||||
|
{/if}
|
||||||
|
</ModalContent>
|
||||||
|
<ModalFooter><Button disabled={inProgress} on:click={uploadSuccessful}>Ok</Button></ModalFooter>
|
||||||
|
</Modal>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
ul {
|
||||||
|
min-width: 24rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -3,25 +3,24 @@ import { json } from '@sveltejs/kit';
|
|||||||
|
|
||||||
|
|
||||||
// rename operation
|
// rename operation
|
||||||
export async function PUT({ request }) {
|
export async function PUT({ request }: {request: Request}) {
|
||||||
const data = await request.json();
|
const data = await request.json();
|
||||||
|
|
||||||
console.log(`--- ${request.url.split('/').at(-1)} +++ ${JSON.stringify(data)}`);
|
|
||||||
|
|
||||||
// Vorgang
|
// Vorgang
|
||||||
let vorgang = request.url.split('/').at(-1)
|
const vorgang = request.url.split('/').at(-1);
|
||||||
|
|
||||||
// prepare copy, incl. check if new name exists already
|
// prepare copy, incl. check if new name exists already
|
||||||
let old_name = data["old_name"]
|
const old_name = data["old_name"];
|
||||||
let src_full_path = `/tatort/${vorgang}/${old_name}`
|
const src_full_path = `/tatort/${vorgang}/${old_name}`;
|
||||||
let new_name = `${vorgang}/${data["new_name"]}`
|
const new_name = `${vorgang}/${data["new_name"]}`;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let file_stats = await client.statObject('tatort', new_name)
|
await client.statObject('tatort', new_name);
|
||||||
return json({ msg: 'Die Datei existiert bereits.' }, { status: 400 })
|
return json({ msg: 'Die Datei existiert bereits.' }, { status: 400 });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// continue operation
|
// continue operation
|
||||||
console.log('continue operation')
|
console.log(error, 'continue operation');
|
||||||
}
|
}
|
||||||
|
|
||||||
// actual copy operation
|
// actual copy operation
|
||||||
11
src/routes/(token-based)/list/[vorgang]/[tatort]/+server.ts
Normal file
11
src/routes/(token-based)/list/[vorgang]/[tatort]/+server.ts
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import { BUCKET, client } from '$lib/minio';
|
||||||
|
|
||||||
|
export async function DELETE({ request }: { request: Request }) {
|
||||||
|
const url_fragments = request.url.split('/');
|
||||||
|
const item = url_fragments.at(-1);
|
||||||
|
const vorgang = url_fragments.at(-2);
|
||||||
|
|
||||||
|
await client.removeObject(BUCKET, `${vorgang}/${item}`);
|
||||||
|
|
||||||
|
return new Response(null, { status: 204 });
|
||||||
|
}
|
||||||
6
src/routes/(token-based)/view/+page.server.ts
Normal file
6
src/routes/(token-based)/view/+page.server.ts
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import { redirectIfVorgangExists } from '$lib/server/vorgangService';
|
||||||
|
|
||||||
|
/** @type {import('./$types').Actions} */
|
||||||
|
export const actions = {
|
||||||
|
default: async ({request}: {request: Request}) => redirectIfVorgangExists(request)
|
||||||
|
}
|
||||||
40
src/routes/(token-based)/view/+page.svelte
Normal file
40
src/routes/(token-based)/view/+page.svelte
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import BaseInputField from '$lib/components/BaseInputField.svelte';
|
||||||
|
import Button from '$lib/components/Button.svelte';
|
||||||
|
import ArrowRight from '$lib/icons/Arrow-right.svelte';
|
||||||
|
import Exclamation from '$lib/icons/Exclamation.svelte';
|
||||||
|
|
||||||
|
export let form;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="mx-auto max-w-2xl">
|
||||||
|
<div class="flex flex-col items-center justify-center w-full">
|
||||||
|
<h1 class="text-xl">Vorgang ansehen</h1>
|
||||||
|
</div>
|
||||||
|
<p class="mt-8 mb-8 text-sm leading-6 text-gray-600">
|
||||||
|
Anhand der Vorgangsnummer werden Sie zu den Dateien des Vorgangs weitergeleitet und können sich
|
||||||
|
den Vorgang dann ansehen.
|
||||||
|
</p>
|
||||||
|
<form method="POST">
|
||||||
|
<BaseInputField
|
||||||
|
id="case-id"
|
||||||
|
name="case-id"
|
||||||
|
label="Vorgangskennung"
|
||||||
|
type="text"
|
||||||
|
value={form?.caseId}
|
||||||
|
/>
|
||||||
|
<div class="mt-5">
|
||||||
|
<BaseInputField
|
||||||
|
id="case-token"
|
||||||
|
name="case-token"
|
||||||
|
label="Zugangscode"
|
||||||
|
type="text"
|
||||||
|
value={form?.token}
|
||||||
|
error={form?.error?.message}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="flex justify-end pt-4">
|
||||||
|
<Button type="submit"><ArrowRight /></Button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
import { client } from '$lib/minio';
|
import { client } from '$lib/minio';
|
||||||
|
import type { PageServerLoad } from './$types';
|
||||||
|
|
||||||
/** @type {import('./$types').PageServerLoad} */
|
/** @type {import('./$types').PageServerLoad} */
|
||||||
export async function load({ params }) {
|
export const load: PageServerLoad = async ({ params }) => {
|
||||||
const { vorgang, tatort } = params;
|
const { vorgang, tatort } = params;
|
||||||
const url = await client.presignedUrl('GET', 'tatort', `${vorgang}/${tatort}`);
|
const url = await client.presignedUrl('GET', 'tatort', `${vorgang}/${tatort}`);
|
||||||
return { url };
|
return { url };
|
||||||
205
src/routes/(token-based)/view/[vorgang]/[tatort]/+page.svelte
Normal file
205
src/routes/(token-based)/view/[vorgang]/[tatort]/+page.svelte
Normal file
@@ -0,0 +1,205 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import Panel from '$lib/components/Panel.svelte';
|
||||||
|
import { onMount } from 'svelte';
|
||||||
|
import Button from '$lib/components/Button.svelte';
|
||||||
|
|
||||||
|
export let data;
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
import('@google/model-viewer');
|
||||||
|
});
|
||||||
|
|
||||||
|
let progress = 0;
|
||||||
|
let hideProgressScreen = false;
|
||||||
|
|
||||||
|
let cameraOrbit = '0deg 0deg 100%';
|
||||||
|
let cameraTarget = '0m 0m 0m';
|
||||||
|
let fieldOfView = '10deg';
|
||||||
|
|
||||||
|
let cameraAzimuth = 0;
|
||||||
|
let cameraPolar = 0;
|
||||||
|
|
||||||
|
let cameraZoom = 100;
|
||||||
|
let xRotation = 0;
|
||||||
|
let yRotation = 0;
|
||||||
|
let zRotation = 0;
|
||||||
|
|
||||||
|
let modelViewer;
|
||||||
|
|
||||||
|
$: style = `width: ${progress}%`;
|
||||||
|
|
||||||
|
const onProgress = ({ detail }) => {
|
||||||
|
progress = Math.ceil(detail.totalProgress * 100.0);
|
||||||
|
if (progress == 100) {
|
||||||
|
setTimeout(() => {
|
||||||
|
hideProgressScreen = true;
|
||||||
|
}, 250);
|
||||||
|
} else hideProgressScreen = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function onResetView() {
|
||||||
|
cameraAzimuth = 0;
|
||||||
|
cameraPolar = 0;
|
||||||
|
cameraZoom = 100;
|
||||||
|
|
||||||
|
modelViewer.cameraOrbit = cameraOrbit;
|
||||||
|
modelViewer.cameraTarget = cameraTarget;
|
||||||
|
modelViewer.fieldOfView = fieldOfView;
|
||||||
|
cameraAzimuth = 0;
|
||||||
|
cameraPolar = 0;
|
||||||
|
cameraZoom = 100;
|
||||||
|
fieldOfView = '10deg';
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateCameraOrbit(azimuth: number, polar: number, zoom: number) {
|
||||||
|
cameraAzimuth = azimuth;
|
||||||
|
cameraPolar = polar;
|
||||||
|
cameraZoom = zoom;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="h-full model w-full bg-neutral-200 p-4 transition-all delay-250">
|
||||||
|
<!-- xr-environment -->
|
||||||
|
<model-viewer
|
||||||
|
ar
|
||||||
|
shadow-intensity="1"
|
||||||
|
src={data.url}
|
||||||
|
bind:this={modelViewer}
|
||||||
|
touch-action="pan-y"
|
||||||
|
field-of-view={fieldOfView}
|
||||||
|
min-field-of-view="1deg"
|
||||||
|
max-field-of-view="10deg"
|
||||||
|
camera-controls
|
||||||
|
orientation={`${xRotation}deg ${yRotation}deg ${zRotation}deg`}
|
||||||
|
camera-target="0m 0m 0m"
|
||||||
|
camera-orbit={`${cameraAzimuth}deg ${cameraPolar}deg ${cameraZoom}%`}
|
||||||
|
on:progress={onProgress}
|
||||||
|
>
|
||||||
|
<!--Buttons zum Steuern-->
|
||||||
|
<div
|
||||||
|
class=" p-4 flex z-10 absolute bottom-0"
|
||||||
|
class:opacity-0={!hideProgressScreen}
|
||||||
|
class:hidden={!hideProgressScreen}
|
||||||
|
>
|
||||||
|
<button slot="ar-button" id="ar-button"> 👋 Activate AR </button>
|
||||||
|
|
||||||
|
<div id="ar-prompt">AR-Prompt</div>
|
||||||
|
|
||||||
|
<button id="ar-failure"> AR is not tracking! </button>
|
||||||
|
<div class="flex flex-col bg-white/50">
|
||||||
|
<button
|
||||||
|
on:click={() => {
|
||||||
|
console.log(modelViewer.ar, modelViewer.getAttribute('ar-status'));
|
||||||
|
}}>Test</button
|
||||||
|
>
|
||||||
|
|
||||||
|
<!--3 Buttons-->
|
||||||
|
<div class="p-2">
|
||||||
|
<Button
|
||||||
|
on:click={() => {
|
||||||
|
updateCameraOrbit(0, 0, cameraZoom);
|
||||||
|
}}
|
||||||
|
type="button"
|
||||||
|
variant="white"
|
||||||
|
align="left"
|
||||||
|
class="relative cursor-default justify-start py-2 pl-3 pr-10 text-left "
|
||||||
|
>
|
||||||
|
Draufsicht
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
on:click={() => {
|
||||||
|
onResetView();
|
||||||
|
}}
|
||||||
|
type="button"
|
||||||
|
variant="white"
|
||||||
|
align="left"
|
||||||
|
class="relative cursor-default justify-start py-2 pl-3 pr-10 text-left"
|
||||||
|
>
|
||||||
|
Werte zurücksetzen
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
on:click={() => {
|
||||||
|
updateCameraOrbit(0, 90, cameraZoom);
|
||||||
|
}}
|
||||||
|
type="button"
|
||||||
|
variant="white"
|
||||||
|
align="left"
|
||||||
|
class="relative cursor-default justify-start py-2 pl-3 pr-10 text-left"
|
||||||
|
>
|
||||||
|
Frontansicht
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!--Horizontal-->
|
||||||
|
<div class="p-2">
|
||||||
|
<label for="cazimuth">Horizontal drehen (Azimut):</label>
|
||||||
|
<input id="cazimuth" type="range" min="0" max="360" bind:value={cameraAzimuth} />
|
||||||
|
</div>
|
||||||
|
<!--Vertikal-->
|
||||||
|
<div class="p-2">
|
||||||
|
<label class=" mb-2" for="polarSlider">Vertikal drehen (Polar):</label>
|
||||||
|
<input id="polarSlider" type="range" min="0" max="90" bind:value={cameraPolar} />
|
||||||
|
</div>
|
||||||
|
<!--Zoom/Distanz-->
|
||||||
|
<div class="p-2">
|
||||||
|
<label for="cZoom">Abstand (zoom):</label>
|
||||||
|
<input id="cZoom" type="range" min="0" max="100" bind:value={cameraZoom} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--Rotationen-->
|
||||||
|
<div class="flex flex-col ml-2 p-4 bg-white/50">
|
||||||
|
Modell rotieren lassen:
|
||||||
|
<br />
|
||||||
|
Modell auf dem Kopf? -> y auf 270°
|
||||||
|
<div class="p-2">
|
||||||
|
<label class="" for="polarSlider">Rotation X:</label>
|
||||||
|
<input id="polarSlider" type="range" min="0" max="360" bind:value={xRotation} />
|
||||||
|
</div>
|
||||||
|
<div class="p-2">
|
||||||
|
<label class="" for="polarSlider">Rotation Y:</label>
|
||||||
|
<input id="polarSlider" type="range" min="0" max="360" bind:value={yRotation} />
|
||||||
|
</div>
|
||||||
|
<div class="p-2">
|
||||||
|
<label class="" for="polarSlider">Rotation Z:</label>
|
||||||
|
<input id="polarSlider" type="range" min="0" max="360" bind:value={zRotation} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--Loading-->
|
||||||
|
<div
|
||||||
|
slot="progress-bar"
|
||||||
|
class="flex items-center justify-center h-5/6 w-full transition-all delay-250"
|
||||||
|
class:opacity-0={hideProgressScreen}
|
||||||
|
class:hidden={hideProgressScreen}
|
||||||
|
>
|
||||||
|
<Panel class="w-72 bg-gray-50 flex items-center flex-col"
|
||||||
|
><p class="mb-5">Loading {progress}%</p>
|
||||||
|
<div class="h-1 w-full bg-neutral-200 dark:bg-neutral-600">
|
||||||
|
<div class="h-1 bg-blue-500" {style}></div>
|
||||||
|
</div></Panel
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</model-viewer>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
model-viewer {
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* .vertical-slider {
|
||||||
|
writing-mode: bt-lr; /* Schreibt von unten nach oben (Vertikale Darstellung)
|
||||||
|
transform: rotate(270deg); /* Slider um 270° drehen
|
||||||
|
height: 200px;
|
||||||
|
} */
|
||||||
|
|
||||||
|
.model {
|
||||||
|
height: calc(100%-84px);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* .active-border {
|
||||||
|
border: 2px blue solid;
|
||||||
|
} */
|
||||||
|
</style>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<script>
|
<script lang="ts">
|
||||||
import '../app.css';
|
import '../app.css';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
import { dev } from '$app/environment';
|
|
||||||
import { fail, redirect } from '@sveltejs/kit';
|
|
||||||
import { authenticate } from '$lib/auth';
|
|
||||||
|
|
||||||
const COOKIE_NAME = 'session';
|
|
||||||
|
|
||||||
/** @type {import('./$types').Actions} */
|
|
||||||
export const actions = {
|
|
||||||
login: async ({ request, cookies }) => {
|
|
||||||
const data = await request.formData();
|
|
||||||
const user = data.get('user');
|
|
||||||
const password = data.get('password');
|
|
||||||
|
|
||||||
const token = authenticate(user, password);
|
|
||||||
|
|
||||||
if (!token) return fail(400, { user, incorrect: true });
|
|
||||||
|
|
||||||
cookies.set(COOKIE_NAME, token, {
|
|
||||||
path: '/',
|
|
||||||
httpOnly: true,
|
|
||||||
sameSite: 'strict',
|
|
||||||
secure: !dev
|
|
||||||
});
|
|
||||||
throw redirect(303, '/');
|
|
||||||
},
|
|
||||||
logout: async (event) => {
|
|
||||||
event.cookies.delete(COOKIE_NAME, {path: '/'});
|
|
||||||
event.locals.user = null;
|
|
||||||
return { success: true };
|
|
||||||
}
|
|
||||||
};
|
|
||||||
9
src/routes/anmeldung/+page.server.ts
Normal file
9
src/routes/anmeldung/+page.server.ts
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import { loginUser, logoutUser } from '$lib/server/authService';
|
||||||
|
import { redirectIfVorgangExists } from '$lib/server/vorgangService.js';
|
||||||
|
|
||||||
|
|
||||||
|
export const actions = {
|
||||||
|
login: ({ request, cookies }) => loginUser({request, cookies}),
|
||||||
|
logout: (event) => logoutUser(event),
|
||||||
|
redirectToVorgang: ({request}) => redirectIfVorgangExists(request)
|
||||||
|
} as const;
|
||||||
@@ -1,38 +1,64 @@
|
|||||||
<script>
|
<script lang="ts">
|
||||||
import Panel from '$lib/components/ui/Panel.svelte';
|
import BaseInputField from '$lib/components/BaseInputField.svelte';
|
||||||
import Button from '$lib/components/ui/Button.svelte';
|
import Button from '$lib/components/Button.svelte';
|
||||||
import Alert from '$lib/components/ui/Alert.svelte';
|
import Modal from '$lib/components/Modal/Modal.svelte';
|
||||||
|
import ModalContent from '$lib/components/Modal/ModalContent.svelte';
|
||||||
|
import ModalFooter from '$lib/components/Modal/ModalFooter.svelte';
|
||||||
|
import ModalTitle from '$lib/components/Modal/ModalTitle.svelte';
|
||||||
|
import ArrowRight from '$lib/icons/Arrow-right.svelte';
|
||||||
import Login from '$lib/icons/Login.svelte';
|
import Login from '$lib/icons/Login.svelte';
|
||||||
|
|
||||||
/** @type {import('./$types').ActionData} */
|
|
||||||
export let form;
|
export let form;
|
||||||
|
|
||||||
let user = form?.user ?? '';
|
export let open = false;
|
||||||
|
|
||||||
function buttonClick() {}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!--
|
|
||||||
This example requires updating your template:
|
|
||||||
|
|
||||||
```
|
|
||||||
<html class="h-full bg-white">
|
|
||||||
<body class="h-full">
|
|
||||||
```
|
|
||||||
-->
|
|
||||||
<div class="flex min-h-full flex-col justify-center px-6 py-12 lg:px-8">
|
<div class="flex min-h-full flex-col justify-center px-6 py-12 lg:px-8">
|
||||||
<div class="sm:mx-auto sm:w-full sm:max-w-sm">
|
<div class="sm:mx-auto sm:w-full sm:max-w-sm">
|
||||||
<img class="mx-auto h-10 w-auto" src="/Landeswappen_NI.svg" alt="Landeswappen Niedersachsen" />
|
<img class="mx-auto h-10 w-auto" src="/Landeswappen_NI.svg" alt="Landeswappen Niedersachsen" />
|
||||||
|
|
||||||
<h2 class="mt-10 text-center text-2xl font-bold leading-9 tracking-tight text-gray-900">
|
<h2 class="mt-10 text-center text-2xl font-bold leading-9 tracking-tight text-gray-900">
|
||||||
Anmeldung zum 3D Tatort
|
Willkommen beim 3D Tatort
|
||||||
</h2>
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="w-full max-w-sm mx-auto">
|
||||||
<div class="mt-10 sm:mx-auto sm:w-full sm:max-w-sm">
|
<div class="relative mt-5 bg-gray-50 rounded-xl shadow-xl p-3 pt-1">
|
||||||
<form class="space-y-6" action="?/login" method="POST">
|
<div class="mt-10">
|
||||||
|
<form action="?/redirectToVorgang" method="POST">
|
||||||
|
<BaseInputField
|
||||||
|
id="case-id"
|
||||||
|
name="case-id"
|
||||||
|
label="Vorgangskennung"
|
||||||
|
type="text"
|
||||||
|
value={form?.caseId}
|
||||||
|
/>
|
||||||
|
<div class="mt-5">
|
||||||
|
<BaseInputField
|
||||||
|
id="case-token"
|
||||||
|
name="case-token"
|
||||||
|
label="Zugangscode"
|
||||||
|
type="text"
|
||||||
|
value={form?.token}
|
||||||
|
error={form?.error?.message}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="flex justify-end pt-4">
|
||||||
|
<Button type="submit"><ArrowRight /></Button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="flex justify-end mt-10 px-3">
|
||||||
|
<Button on:click={() => (open = true)}><Login /></Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<Modal {open}>
|
||||||
|
<ModalTitle>Anmelden</ModalTitle>
|
||||||
|
<ModalContent class="flex justify-center">
|
||||||
|
<form action="?/login" method="POST">
|
||||||
<div>
|
<div>
|
||||||
<label for="user" class="block text-sm font-medium leading-6 text-gray-900">Kennung</label>
|
<label for="user" class="text-sm font-medium leading-6 text-gray-900">Kennung</label>
|
||||||
<div class="mt-2">
|
<div class="mt-2">
|
||||||
<input
|
<input
|
||||||
id="user"
|
id="user"
|
||||||
@@ -40,17 +66,15 @@
|
|||||||
type="text"
|
type="text"
|
||||||
autocomplete="email"
|
autocomplete="email"
|
||||||
required
|
required
|
||||||
class="block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6"
|
class="rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<div class="flex items-center justify-between">
|
|
||||||
<label for="password" class="block text-sm font-medium leading-6 text-gray-900"
|
<label for="password" class="block text-sm font-medium leading-6 text-gray-900"
|
||||||
>Passwort</label
|
>Passwort</label
|
||||||
>
|
>
|
||||||
</div>
|
|
||||||
<div class="mt-2">
|
<div class="mt-2">
|
||||||
<input
|
<input
|
||||||
id="password"
|
id="password"
|
||||||
@@ -63,13 +87,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div class="flex justify-end">
|
||||||
<button
|
<Button type="submit" class="mt-5">Anmelden</Button>
|
||||||
type="submit"
|
|
||||||
class="mt-10 flex w-full justify-center rounded-md bg-indigo-600 px-3 py-1.5 text-sm font-semibold leading-6 text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
|
|
||||||
>Anmelden</button
|
|
||||||
>
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</ModalContent>
|
||||||
</div>
|
<ModalFooter><Button on:click={() => (open = false)}>Ok</Button></ModalFooter>
|
||||||
|
</Modal>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { client } from '$lib/minio';
|
|||||||
/** @type {import('./$types').RequestHandler} */
|
/** @type {import('./$types').RequestHandler} */
|
||||||
export async function GET({ params }) {
|
export async function GET({ params }) {
|
||||||
const prefix = params.vorgang ? `${params.vorgang}/` : '';
|
const prefix = params.vorgang ? `${params.vorgang}/` : '';
|
||||||
let stream = client.listObjectsV2('tatort', prefix, false, '');
|
const stream = client.listObjectsV2('tatort', prefix, false, '');
|
||||||
const result = new ReadableStream({
|
const result = new ReadableStream({
|
||||||
start(controller) {
|
start(controller) {
|
||||||
stream.on('data', (data) => {
|
stream.on('data', (data) => {
|
||||||
@@ -15,6 +15,8 @@ export async function GET({ params }) {
|
|||||||
|
|
||||||
const name = data.name.slice(prefix.length);
|
const name = data.name.slice(prefix.length);
|
||||||
if (name === 'config.json') return;
|
if (name === 'config.json') return;
|
||||||
|
// zugangscode datei
|
||||||
|
if (name === '__perm__') return;
|
||||||
|
|
||||||
controller.enqueue(`${JSON.stringify({ ...data, name, prefix })}\n`);
|
controller.enqueue(`${JSON.stringify({ ...data, name, prefix })}\n`);
|
||||||
});
|
});
|
||||||
@@ -34,30 +36,25 @@ export async function GET({ params }) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export async function DELETE({ params }) {
|
export async function DELETE({ params }) {
|
||||||
const vorgang = params.vorgang
|
const vorgang = params.vorgang;
|
||||||
|
|
||||||
const object_list = await new Promise((resolve, reject) => {
|
const object_list = await new Promise((resolve, reject) => {
|
||||||
|
const res = [];
|
||||||
const res = []
|
const items_str = client.listObjects('tatort', vorgang, true);
|
||||||
const items_str = client.listObjects('tatort', vorgang, true)
|
|
||||||
|
|
||||||
items_str.on('data', (obj) => {
|
items_str.on('data', (obj) => {
|
||||||
res.push(obj.name)
|
res.push(obj.name);
|
||||||
})
|
});
|
||||||
|
|
||||||
items_str.on('error', reject)
|
items_str.on('error', reject);
|
||||||
|
|
||||||
items_str.on('end', async () => {
|
items_str.on('end', async () => {
|
||||||
resolve(res)
|
resolve(res);
|
||||||
})
|
});
|
||||||
|
});
|
||||||
|
|
||||||
console.log(`+++ ${vorgang}`)
|
await client.removeObjects('tatort', object_list);
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
await client.removeObjects('tatort', object_list)
|
|
||||||
|
|
||||||
return new Response(null, { status: 204 });
|
return new Response(null, { status: 204 });
|
||||||
};
|
}
|
||||||
25
src/routes/api/list/[[vorgang]]/code/+server.ts
Normal file
25
src/routes/api/list/[[vorgang]]/code/+server.ts
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
import { client } from '$lib/minio';
|
||||||
|
|
||||||
|
/** @type {import('./$types').RequestHandler} */
|
||||||
|
export async function GET({ params }) {
|
||||||
|
const prefix = params.vorgang ? `${params.vorgang}` : '';
|
||||||
|
|
||||||
|
const code_name = '__perm__';
|
||||||
|
const obj_path = `${prefix}/${code_name}`;
|
||||||
|
|
||||||
|
let result = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
result = await client.getObject('tatort', obj_path);
|
||||||
|
} catch (error) {
|
||||||
|
if (error.name == 'S3Error') {
|
||||||
|
result = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result != null) {
|
||||||
|
return new Response(result, { status: 200 });
|
||||||
|
} else {
|
||||||
|
return new Response(null, { status: 404 });
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,12 +1,10 @@
|
|||||||
import { client } from '$lib/minio';
|
import { client } from '$lib/minio';
|
||||||
|
|
||||||
/** @type {import('./$types').RequestHandler} */
|
|
||||||
export async function GET() {
|
export async function GET() {
|
||||||
var stream = client.listObjectsV2('tatort', '', true);
|
const stream = client.listObjectsV2('tatort', '', true);
|
||||||
const result = new ReadableStream({
|
const result = new ReadableStream({
|
||||||
start(controller) {
|
start(controller) {
|
||||||
stream.on('data', (data) => {
|
stream.on('data', (data) => {
|
||||||
//console.log(data);
|
|
||||||
controller.enqueue(`${JSON.stringify(data)}\n`);
|
controller.enqueue(`${JSON.stringify(data)}\n`);
|
||||||
});
|
});
|
||||||
stream.on('end', () => {
|
stream.on('end', () => {
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
import { client } from '$lib/minio';
|
|
||||||
|
|
||||||
/** @type {import('./$types').RequestHandler} */
|
|
||||||
export async function GET(params) {
|
|
||||||
console.log('GET', params);
|
|
||||||
}
|
|
||||||
5
src/routes/api/upload/+server.ts
Normal file
5
src/routes/api/upload/+server.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
import type { RequestHandler } from "@sveltejs/kit";
|
||||||
|
|
||||||
|
export async function GET(params: RequestHandler) {
|
||||||
|
console.log('GET', params);
|
||||||
|
}
|
||||||
14
static/1.svg
Normal file
14
static/1.svg
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<svg
|
||||||
|
class="h-6 w-6 text-gray-600 group-hover:text-indigo-600"
|
||||||
|
fill="none"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
stroke-width="1.5"
|
||||||
|
stroke="currentColor"
|
||||||
|
aria-hidden="true"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
d="M13.5 16.875h3.375m0 0h3.375m-3.375 0V13.5m0 3.375v3.375M6 10.5h2.25a2.25 2.25 0 002.25-2.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v2.25A2.25 2.25 0 006 10.5zm0 9.75h2.25A2.25 2.25 0 0010.5 18v-2.25a2.25 2.25 0 00-2.25-2.25H6a2.25 2.25 0 00-2.25 2.25V18A2.25 2.25 0 006 20.25zm9.75-9.75H18a2.25 2.25 0 002.25-2.25V6A2.25 2.25 0 0018 3.75h-2.25A2.25 2.25 0 0013.5 6v2.25a2.25 2.25 0 002.25 2.25z"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 714 B |
@@ -10,7 +10,9 @@
|
|||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"moduleResolution": "bundler"
|
"moduleResolution": "bundler"
|
||||||
}
|
},
|
||||||
|
"include": ["src/**/*", "src/node_modules"],
|
||||||
|
"exclude": ["node_modules/*", "__sapper__/*", "public/*"]
|
||||||
// Path aliases are handled by https://svelte.dev/docs/kit/configuration#alias
|
// Path aliases are handled by https://svelte.dev/docs/kit/configuration#alias
|
||||||
// except $lib which is handled by https://svelte.dev/docs/kit/configuration#files
|
// except $lib which is handled by https://svelte.dev/docs/kit/configuration#files
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user