Skip to content

Commit

Permalink
Svelte November improvements #1454
Browse files Browse the repository at this point in the history
  • Loading branch information
niemyjski authored Nov 10, 2023
2 parents 7eb0f3b + ad8f764 commit cb95d45
Show file tree
Hide file tree
Showing 28 changed files with 1,141 additions and 291 deletions.
8 changes: 4 additions & 4 deletions src/Exceptionless.Web/ClientApp/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,31 @@
"type": "msedge",
"request": "launch",
"name": "Web (Edge)",
"url": "http://localhost:5173",
"url": "http://localhost:5173/next",
"webRoot": "${workspaceFolder}",
"preLaunchTask": "npm run dev"
},
{
"type": "msedge",
"request": "launch",
"name": "Web Dev Api (Edge)",
"url": "http://localhost:5173",
"url": "http://localhost:5173/next",
"webRoot": "${workspaceFolder}",
"preLaunchTask": "npm run dev:api"
},
{
"type": "chrome",
"request": "launch",
"name": "Web (Chrome)",
"url": "http://localhost:5173",
"url": "http://localhost:5173/next",
"webRoot": "${workspaceFolder}",
"preLaunchTask": "npm run dev"
},
{
"type": "chrome",
"request": "launch",
"name": "Web Dev Api (Chrome)",
"url": "http://localhost:5173",
"url": "http://localhost:5173/next",
"webRoot": "${workspaceFolder}",
"preLaunchTask": "npm run dev:api"
}
Expand Down
149 changes: 113 additions & 36 deletions src/Exceptionless.Web/ClientApp/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions src/Exceptionless.Web/ClientApp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@
"devDependencies": {
"@playwright/test": "^1.39.0",
"@sveltejs/adapter-static": "^2.0.3",
"@sveltejs/kit": "^1.27.2",
"@sveltejs/kit": "^1.27.3",
"@sveltejs/vite-plugin-svelte": "^2.4.6",
"@typescript-eslint/eslint-plugin": "^6.9.1",
"@typescript-eslint/parser": "^6.9.1",
"autoprefixer": "^10.4.16",
"cross-env": "^7.0.3",
"eslint": "^8.52.0",
"eslint": "^8.53.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-svelte": "^2.34.0",
"eslint-plugin-svelte": "^2.34.1",
"npm-run-all": "^4.1.5",
"postcss": "^8.4.31",
"prettier": "^3.0.3",
Expand All @@ -48,17 +48,20 @@
"dependencies": {
"@exceptionless/browser": "^3.0.5",
"@iconify-json/mdi": "^1.1.55",
"@tanstack/svelte-query": "^5.6.1",
"@tanstack/svelte-query-devtools": "^5.6.1",
"@tanstack/svelte-table": "^8.10.7",
"@web3-storage/parse-link-header": "^3.1.0",
"class-validator": "^0.14.0",
"daisyui": "^3.9.4",
"oidc-client-ts": "^2.4.0",
"pretty-ms": "^8.0.0",
"svelte-legos": "^0.2.2",
"svelte-local-storage-store": "^0.6.4",
"svelte-time": "^0.8.0",
"svoast": "^2.3.0",
"tailwindcss": "^3.3.5",
"unplugin-icons": "^0.17.1"
"unplugin-icons": "^0.17.3"
},
"type": "module"
}
28 changes: 28 additions & 0 deletions src/Exceptionless.Web/ClientApp/src/lib/api/queries/events.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { createQuery } from '@tanstack/svelte-query';
import type { PersistentEvent } from '$lib/models/api';
import { FetchClient, type ProblemDetails } from '$api/FetchClient';
import { derived, readable, type Readable } from 'svelte/store';

export const queryKey: string = 'PersistentEvent';

export function getEventByIdQuery(id: string | Readable<string | null>) {
const readableId = typeof id === 'string' ? readable(id) : id;
return createQuery<PersistentEvent, ProblemDetails>(
derived(readableId, ($id) => ({
enabled: !!$id,
queryKey: [queryKey, $id],
queryFn: async ({ signal }: { signal: AbortSignal }) => {
const api = new FetchClient();
const response = await api.getJSON<PersistentEvent>(`events/${$id}`, {
signal
});

if (response.ok) {
return response.data!;
}

throw response.problem;
}
}))
);
}
Loading

0 comments on commit cb95d45

Please sign in to comment.