Skip to content

Commit 78365be

Browse files
author
numen-bot
committed
fix: merge PR #50 (hotfix/admin-ui-bugs-r2) to main
1 parent d4449fb commit 78365be

File tree

5 files changed

+30
-13
lines changed

5 files changed

+30
-13
lines changed

resources/js/Components/Chat/ChatSidebar.vue

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,15 +205,12 @@ onMounted(async () => {
205205

206206
<template>
207207
<button
208+
v-show="!isOpen"
208209
class="fixed bottom-6 right-6 z-[60] flex items-center justify-center w-12 h-12 rounded-full bg-indigo-600 hover:bg-indigo-500 shadow-lg text-white text-xl transition-transform hover:scale-105"
209-
:class="isOpen ? 'scale-95' : ''"
210210
title="Toggle AI Chat"
211211
@click="toggleSidebar"
212212
>
213-
<span v-if="!isOpen">&#x1F4AC;</span>
214-
<svg v-else class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
215-
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
216-
</svg>
213+
<span>&#x1F4AC;</span>
217214
</button>
218215

219216
<div

resources/js/Components/Graph/KnowledgeGraphViewer.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,14 @@ async function fetchGraph() {
4343
const url = props.contentId
4444
? `/api/v1/graph/node/${props.contentId}`
4545
: `/api/v1/graph/space/${props.spaceId}`;
46+
const xsrfToken = document.cookie.match(/XSRF-TOKEN=([^;]+)/)?.[1] ?? '';
4647
const res = await fetch(url, {
47-
headers: { 'Accept': 'application/json', 'X-Requested-With': 'XMLHttpRequest' },
48+
credentials: 'same-origin',
49+
headers: {
50+
'Accept': 'application/json',
51+
'X-Requested-With': 'XMLHttpRequest',
52+
'X-XSRF-TOKEN': xsrfToken,
53+
},
4854
});
4955
if (!res.ok) throw new Error(`HTTP ${res.status}`);
5056
const data = await res.json();

resources/js/Components/Media/MediaUploadZone.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ async function uploadFile(file) {
7676
resolve({ ok: false });
7777
});
7878
79-
xhr.open('POST', '/v1/media');
79+
xhr.open('POST', '/api/media');
8080
xhr.setRequestHeader('Accept', 'application/json');
8181
xhr.setRequestHeader('X-XSRF-TOKEN', xsrfToken());
8282
xhr.withCredentials = true;

resources/js/Pages/Media/Index.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ async function fetchAssets(page = 1) {
2626
if (filters.type) params.set('type', filters.type);
2727
if (filters.tag) params.set('tag', filters.tag);
2828
await csrfCookie();
29-
const res = await fetch(`/api/v1/media?${params}`, {
29+
const res = await fetch(`/api/media?${params}`, {
3030
credentials: 'include',
3131
headers: { 'Accept': 'application/json', 'X-XSRF-TOKEN': xsrfToken() },
3232
});
@@ -72,7 +72,7 @@ function closeDetail() { activeAsset.value = null; }
7272
async function deleteAsset(asset) {
7373
if (!confirm(`Delete "${asset.filename}"? This cannot be undone.`)) return;
7474
await csrfCookie();
75-
const res = await fetch(`/api/v1/media/${asset.id}`, {
75+
const res = await fetch(`/api/media/${asset.id}`, {
7676
method: 'DELETE', credentials: 'include',
7777
headers: { 'Accept': 'application/json', 'X-XSRF-TOKEN': xsrfToken() },
7878
});

routes/web.php

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,12 +170,26 @@
170170
// Knowledge Graph
171171
Route::get('/graph', [GraphController::class, 'index'])->name('graph.index');
172172

173-
// Plugins (Bug 2: was missing web route)
174-
Route::get('/plugins', fn () => Inertia::render('Admin/Plugins/Index'))->name('admin.plugins');
173+
// Plugins
174+
Route::get('/plugins', function () {
175+
$plugins = \App\Models\Plugin::withTrashed()->with('settings')->orderBy('display_name')->get();
176+
177+
return Inertia::render('Admin/Plugins/Index', [
178+
'plugins' => \App\Http\Resources\PluginResource::collection($plugins)->resolve(),
179+
]);
180+
})->name('admin.plugins');
175181

176182
// Media (Bug 3: was missing web route)
177183
Route::get('/media', fn () => Inertia::render('Media/Index'))->name('admin.media');
178184

179-
// Locales / i18n settings (Bug 5: was missing web route)
180-
Route::get('/settings/locales', fn () => Inertia::render('Settings/Locales'))->name('admin.settings.locales');
185+
// Locales / i18n settings
186+
Route::get('/settings/locales', function () {
187+
$localeService = app(\App\Services\LocaleService::class);
188+
$space = app()->bound('current_space') ? app('current_space') : \App\Models\Space::first();
189+
$locales = $space ? $space->locales()->get() : collect();
190+
$rawSupported = $localeService->getSupportedLocales();
191+
$supported = collect($rawSupported)->map(fn ($label, $code) => ['code' => $code, 'label' => $label])->values();
192+
193+
return Inertia::render('Settings/Locales', ['locales' => $locales, 'supported' => $supported]);
194+
})->name('admin.settings.locales');
181195
});

0 commit comments

Comments
 (0)