@enlt-bakusoku/nuxt4 0.0.0-stage → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -2
- package/dist/module.d.mts +25 -0
- package/dist/module.json +9 -0
- package/dist/module.mjs +208 -0
- package/dist/runtime/shared/schemas/user.d.ts +40 -0
- package/dist/runtime/shared/schemas/user.js +21 -0
- package/dist/runtime/tasks-catalog.d.ts +6 -0
- package/dist/runtime/tasks-catalog.js +7 -0
- package/dist/types.d.mts +9 -0
- package/package.json +120 -3
- package/scripts/bakusoku-dev.mjs +387 -0
- package/scripts/dev-log-relay.mjs +96 -0
- package/scripts/predeploy.mjs +24 -0
- package/scripts/prepare-firebase-artifact.mjs +43 -0
- package/scripts/setup-worktree.sh +59 -0
- package/scripts/verify-firebase-artifacts.mjs +70 -0
- package/src/layer/app/components/admin/AdminExecutionHistory.vue +137 -0
- package/src/layer/app/components/admin/TaskRunDialog.vue +162 -0
- package/src/layer/app/components/admin/UserManagementPage.vue +342 -0
- package/src/layer/app/components/debug/DebugApplicationLogs.vue +87 -0
- package/src/layer/app/components/debug/DebugErrorLogs.vue +47 -0
- package/src/layer/app/components/debug/DebugFirestoreOperations.vue +48 -0
- package/src/layer/app/components/debug/DebugHttpRequests.vue +86 -0
- package/src/layer/app/components/debug/DebugNavigation.vue +60 -0
- package/src/layer/app/components/debug/DebugNowControl.vue +243 -0
- package/src/layer/app/components/debug/DebugPublicConfig.vue +24 -0
- package/src/layer/app/components/debug/DebugTestAdmin.vue +67 -0
- package/src/layer/app/components/demo/DemoDebug.vue +266 -0
- package/src/layer/app/components/demo/DemoHome.vue +347 -0
- package/src/layer/app/components/demo/DemoLogin.vue +391 -0
- package/src/layer/app/components/demo/DemoPassword.vue +224 -0
- package/src/layer/app/components/demo/DemoRegister.vue +148 -0
- package/src/layer/app/components/home/HomePage.vue +77 -0
- package/src/layer/app/layouts/dashboard.vue +126 -0
- package/src/layer/app/layouts/default.vue +3 -0
- package/src/layer/app/middleware/admin.ts +15 -0
- package/src/layer/app/middleware/authenticated.ts +19 -0
- package/src/layer/app/pages/admin/migrations.vue +463 -0
- package/src/layer/app/pages/admin/tasks/[id].vue +276 -0
- package/src/layer/app/pages/admin/tasks/index.vue +220 -0
- package/src/layer/app/pages/admin/users.vue +17 -0
- package/src/layer/app/pages/bakusoku-devtools.vue +294 -0
- package/src/layer/app/plugins/auth-init.ts +36 -0
- package/src/layer/app/plugins/debug-devtools.client.ts +20 -0
- package/src/layer/app/plugins/debug-errors.client.ts +78 -0
- package/src/layer/app/plugins/debug-http.client.ts +154 -0
- package/src/layer/app/plugins/debug-nav.client.ts +28 -0
- package/src/layer/app/plugins/vuefire-inspect.ts +18 -0
- package/src/layer/app/stores/auth.ts +462 -0
- package/src/layer/app/stores/datetime.ts +41 -0
- package/src/layer/app/stores/debug.ts +235 -0
- package/src/layer/app/stores/user.ts +170 -0
- package/src/layer/app/utils/admin-execution.ts +48 -0
- package/src/layer/app/utils/dashboard-heading.ts +36 -0
- package/src/layer/app/utils/debug-bridge.ts +270 -0
- package/src/layer/app/utils/debug-firestore.ts +38 -0
- package/src/layer/app/utils/debug-format.ts +19 -0
- package/src/layer/app/utils/execution-refresh.ts +66 -0
- package/src/layer/app/utils/framework-version.ts +4 -0
- package/src/layer/app/utils/inspect-nuxt-vuefire.ts +288 -0
- package/src/layer/app/utils/is-debug-enabled.ts +13 -0
- package/src/layer/app/utils/logger.ts +235 -0
- package/src/layer/app/utils/map-auth-error.ts +11 -0
- package/src/layer/app/utils/mask-secrets.ts +100 -0
- package/src/layer/app/utils/resolve-auth-user.ts +53 -0
- package/src/layer/app/utils/resolve-firestore.ts +20 -0
- package/src/layer/app/utils/task-run.ts +15 -0
- package/src/layer/build-credentials.mjs +33 -0
- package/src/layer/nuxt.config.ts +86 -0
- package/src/layer/package.json +5 -0
- package/src/layer/server/api/debug/test-admin.post.ts +38 -0
- package/src/layer/server/api/tasks/executions/cancel.post.ts +21 -0
- package/src/layer/server/api/tasks/executions/index.get.ts +22 -0
- package/src/layer/server/api/tasks/executions/index.post.ts +25 -0
- package/src/layer/server/api/tasks/index.get.ts +70 -0
- package/src/layer/server/api/tasks/migrations/index.post.ts +27 -0
- package/src/layer/server/api/tasks/migrations/recovery.post.ts +20 -0
- package/src/layer/server/api/users/[id].delete.ts +57 -0
- package/src/layer/server/api/users/[id].put.ts +110 -0
- package/src/layer/server/api/users/index.post.ts +232 -0
- package/src/layer/server/utils/admin-access.ts +32 -0
- package/src/layer/server/utils/debug-test-admin.ts +17 -0
- package/src/layer/server/utils/firebase-admin.ts +22 -0
- package/src/layer/server/utils/logger.ts +172 -0
- package/src/layer/server/utils/tasks-gateway.ts +57 -0
- package/src/layer/server/utils/user-mutations.ts +103 -0
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="inDashboard ? '' : 'p-4 pt-14 md:p-6 lg:p-8'">
|
|
3
|
+
<div v-if="!inDashboard" class="mb-6">
|
|
4
|
+
<h1 class="text-2xl font-semibold">Debug Dashboard</h1>
|
|
5
|
+
<p class="mt-1 text-sm text-gray-600 dark:text-gray-400">
|
|
6
|
+
開発時の検証・デバッグ用ページ。Nuxt DevTools の Bakusoku タブからも、この画面と同じ情報を操作できます。
|
|
7
|
+
</p>
|
|
8
|
+
</div>
|
|
9
|
+
<div class="mx-auto flex max-w-5xl flex-col gap-6">
|
|
10
|
+
<div class="flex justify-end">
|
|
11
|
+
<UButton
|
|
12
|
+
size="xs"
|
|
13
|
+
variant="outline"
|
|
14
|
+
color="neutral"
|
|
15
|
+
icon="i-lucide-trash-2"
|
|
16
|
+
@click="debugStore.clearAllLogs()"
|
|
17
|
+
>
|
|
18
|
+
ログをクリア
|
|
19
|
+
</UButton>
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
<div class="grid grid-cols-1 gap-4 md:grid-cols-3">
|
|
23
|
+
<UCard>
|
|
24
|
+
<template #header>
|
|
25
|
+
<div class="flex items-center gap-2">
|
|
26
|
+
<UIcon name="i-lucide-monitor-smartphone" />
|
|
27
|
+
<span class="font-semibold">環境情報</span>
|
|
28
|
+
</div>
|
|
29
|
+
</template>
|
|
30
|
+
<div class="space-y-2 text-xs">
|
|
31
|
+
<div class="flex justify-between gap-4">
|
|
32
|
+
<span class="text-gray-500">NODE_ENV</span>
|
|
33
|
+
<span>{{ nodeEnv }}</span>
|
|
34
|
+
</div>
|
|
35
|
+
<div class="flex justify-between gap-4">
|
|
36
|
+
<span class="text-gray-500">APP_ENV</span>
|
|
37
|
+
<span>{{ appEnv || '-' }}</span>
|
|
38
|
+
</div>
|
|
39
|
+
<div class="flex justify-between gap-4">
|
|
40
|
+
<span class="text-gray-500">Firebase projectId</span>
|
|
41
|
+
<span class="truncate">{{ firebaseProjectId || '-' }}</span>
|
|
42
|
+
</div>
|
|
43
|
+
<div class="flex justify-between gap-4">
|
|
44
|
+
<span class="text-gray-500">authDomain</span>
|
|
45
|
+
<span class="truncate">{{ firebaseAuthDomain || '-' }}</span>
|
|
46
|
+
</div>
|
|
47
|
+
<div class="flex justify-between gap-4">
|
|
48
|
+
<span class="text-gray-500">emulators</span>
|
|
49
|
+
<span class="truncate text-right">{{ emulatorSummary }}</span>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
</UCard>
|
|
53
|
+
|
|
54
|
+
<UCard>
|
|
55
|
+
<template #header>
|
|
56
|
+
<div class="flex items-center gap-2">
|
|
57
|
+
<UIcon name="i-lucide-user" />
|
|
58
|
+
<span class="font-semibold">認証情報</span>
|
|
59
|
+
</div>
|
|
60
|
+
</template>
|
|
61
|
+
<div class="space-y-2 text-xs">
|
|
62
|
+
<div class="flex justify-between gap-4">
|
|
63
|
+
<span class="text-gray-500">ログイン状態</span>
|
|
64
|
+
<span>{{ authStore.isAuthenticated ? 'ログイン中' : '未ログイン' }}</span>
|
|
65
|
+
</div>
|
|
66
|
+
<div class="flex justify-between gap-4">
|
|
67
|
+
<span class="text-gray-500">UID</span>
|
|
68
|
+
<span class="truncate">{{ authStore.user?.uid || '-' }}</span>
|
|
69
|
+
</div>
|
|
70
|
+
<div class="flex justify-between gap-4">
|
|
71
|
+
<span class="text-gray-500">メール</span>
|
|
72
|
+
<span class="truncate">{{ authStore.user?.email || '-' }}</span>
|
|
73
|
+
</div>
|
|
74
|
+
<div class="flex justify-between gap-4">
|
|
75
|
+
<span class="text-gray-500">ロール</span>
|
|
76
|
+
<span>{{ authStore.user?.role || '-' }}</span>
|
|
77
|
+
</div>
|
|
78
|
+
<div class="flex justify-between gap-4">
|
|
79
|
+
<span class="text-gray-500">トークン有効期限</span>
|
|
80
|
+
<span>{{ tokenExpiryText }}</span>
|
|
81
|
+
</div>
|
|
82
|
+
<div class="flex justify-between gap-4">
|
|
83
|
+
<span class="text-gray-500">sign-in provider</span>
|
|
84
|
+
<span class="truncate">{{ tokenSignInProvider || '-' }}</span>
|
|
85
|
+
</div>
|
|
86
|
+
<div class="flex flex-wrap gap-2 pt-1">
|
|
87
|
+
<UButton
|
|
88
|
+
size="xs"
|
|
89
|
+
variant="soft"
|
|
90
|
+
color="neutral"
|
|
91
|
+
:loading="tokenLoading"
|
|
92
|
+
@click="refreshTokenInfo"
|
|
93
|
+
>
|
|
94
|
+
トークン再取得
|
|
95
|
+
</UButton>
|
|
96
|
+
<DebugTestAdmin />
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
</UCard>
|
|
100
|
+
|
|
101
|
+
<DebugNowControl
|
|
102
|
+
:now="dateTimeStore.effectiveNow.toISOString()"
|
|
103
|
+
:overridden="dateTimeStore.nowOverride != null"
|
|
104
|
+
@shift="shiftNow"
|
|
105
|
+
@set="setNow"
|
|
106
|
+
@reset="resetNow"
|
|
107
|
+
/>
|
|
108
|
+
</div>
|
|
109
|
+
|
|
110
|
+
<DebugHttpRequests :entries="debugStore.httpEntries" @clear="debugStore.clearHttp()" />
|
|
111
|
+
|
|
112
|
+
<div class="grid grid-cols-1 gap-4 lg:grid-cols-2">
|
|
113
|
+
<DebugNavigation
|
|
114
|
+
:entries="debugStore.navEntries"
|
|
115
|
+
:route="{ fullPath: route.fullPath, name: route.name == null ? null : String(route.name) }"
|
|
116
|
+
@clear="debugStore.clearNav()"
|
|
117
|
+
/>
|
|
118
|
+
|
|
119
|
+
<DebugFirestoreOperations :entries="debugStore.firestoreEntries" @clear="debugStore.clearFirestore()" />
|
|
120
|
+
</div>
|
|
121
|
+
|
|
122
|
+
<DebugApplicationLogs :entries="debugStore.logEntries" @clear="debugStore.clearLogs()" />
|
|
123
|
+
|
|
124
|
+
<div class="grid grid-cols-1 gap-4 lg:grid-cols-2">
|
|
125
|
+
<DebugErrorLogs :entries="debugStore.errorEntries" @clear="debugStore.clearErrors()" />
|
|
126
|
+
|
|
127
|
+
<DebugPublicConfig :entries="publicConfigEntries" />
|
|
128
|
+
</div>
|
|
129
|
+
</div>
|
|
130
|
+
</div>
|
|
131
|
+
</template>
|
|
132
|
+
|
|
133
|
+
<script setup lang="ts">
|
|
134
|
+
import { computed, createError, onMounted, ref, useRoute, useRuntimeConfig } from '#imports'
|
|
135
|
+
import { useBakusokuAuthStore } from '../../stores/auth'
|
|
136
|
+
import { useBakusokuDateTimeStore } from '../../stores/datetime'
|
|
137
|
+
import { useBakusokuDebugStore } from '../../stores/debug'
|
|
138
|
+
import DebugApplicationLogs from '../debug/DebugApplicationLogs.vue'
|
|
139
|
+
import DebugErrorLogs from '../debug/DebugErrorLogs.vue'
|
|
140
|
+
import DebugFirestoreOperations from '../debug/DebugFirestoreOperations.vue'
|
|
141
|
+
import DebugHttpRequests from '../debug/DebugHttpRequests.vue'
|
|
142
|
+
import DebugNavigation from '../debug/DebugNavigation.vue'
|
|
143
|
+
import DebugNowControl from '../debug/DebugNowControl.vue'
|
|
144
|
+
import DebugPublicConfig from '../debug/DebugPublicConfig.vue'
|
|
145
|
+
import DebugTestAdmin from '../debug/DebugTestAdmin.vue'
|
|
146
|
+
import { useDashboardHeading, useInDashboardLayout } from '../../utils/dashboard-heading'
|
|
147
|
+
import { isBakusokuDebugEnabled } from '../../utils/is-debug-enabled'
|
|
148
|
+
|
|
149
|
+
if (!isBakusokuDebugEnabled()) {
|
|
150
|
+
throw createError({ statusCode: 404, statusMessage: 'Not Found' })
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const route = useRoute()
|
|
154
|
+
const runtimeConfig = useRuntimeConfig()
|
|
155
|
+
const inDashboard = useInDashboardLayout()
|
|
156
|
+
|
|
157
|
+
useDashboardHeading({
|
|
158
|
+
title: 'デバッグ',
|
|
159
|
+
description: '開発時の検証用です。Nuxt DevTools の Bakusoku タブからも同じ情報を操作できます。',
|
|
160
|
+
})
|
|
161
|
+
const authStore = useBakusokuAuthStore()
|
|
162
|
+
const dateTimeStore = useBakusokuDateTimeStore()
|
|
163
|
+
const debugStore = useBakusokuDebugStore()
|
|
164
|
+
|
|
165
|
+
const nodeEnv = process.env.NODE_ENV
|
|
166
|
+
const appEnv = runtimeConfig.public.appEnv
|
|
167
|
+
|
|
168
|
+
const publicVuefire = (runtimeConfig.public.vuefire ?? {}) as {
|
|
169
|
+
config?: Record<string, string>
|
|
170
|
+
emulators?: Record<string, { host?: string; port?: number }>
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
const firebaseProjectId = publicVuefire.config?.projectId ?? ''
|
|
174
|
+
const firebaseAuthDomain = publicVuefire.config?.authDomain ?? ''
|
|
175
|
+
|
|
176
|
+
const emulatorSummary = computed(() => {
|
|
177
|
+
const emulators = publicVuefire.emulators
|
|
178
|
+
if (!emulators || !Object.keys(emulators).length) {
|
|
179
|
+
return 'なし'
|
|
180
|
+
}
|
|
181
|
+
return Object.entries(emulators)
|
|
182
|
+
.map(([name, value]) => `${name}=${value?.host}:${value?.port}`)
|
|
183
|
+
.join(', ')
|
|
184
|
+
})
|
|
185
|
+
|
|
186
|
+
const publicConfigEntries = computed(() => {
|
|
187
|
+
const pub = runtimeConfig.public as Record<string, unknown>
|
|
188
|
+
return Object.keys(pub)
|
|
189
|
+
.sort()
|
|
190
|
+
.map((key) => {
|
|
191
|
+
const value = pub[key]
|
|
192
|
+
if (value == null) {
|
|
193
|
+
return { key, value: String(value) }
|
|
194
|
+
}
|
|
195
|
+
if (typeof value === 'object') {
|
|
196
|
+
try {
|
|
197
|
+
return { key, value: JSON.stringify(value) }
|
|
198
|
+
}
|
|
199
|
+
catch {
|
|
200
|
+
return { key, value: '[object]' }
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
return { key, value: String(value) }
|
|
204
|
+
})
|
|
205
|
+
})
|
|
206
|
+
|
|
207
|
+
const tokenLoading = ref(false)
|
|
208
|
+
const tokenExpiryText = ref('-')
|
|
209
|
+
const tokenSignInProvider = ref('')
|
|
210
|
+
|
|
211
|
+
/** Firebase Auth のトークン情報を取得し、デバッグ表示を更新する。 */
|
|
212
|
+
async function refreshTokenInfo(): Promise<void> {
|
|
213
|
+
tokenLoading.value = true
|
|
214
|
+
try {
|
|
215
|
+
if (!import.meta.client) {
|
|
216
|
+
tokenExpiryText.value = 'client のみ'
|
|
217
|
+
tokenSignInProvider.value = ''
|
|
218
|
+
return
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
const { useFirebaseAuth } = await import('vuefire')
|
|
222
|
+
const auth = useFirebaseAuth()
|
|
223
|
+
const current = auth?.currentUser
|
|
224
|
+
if (!current) {
|
|
225
|
+
tokenExpiryText.value = '未ログイン'
|
|
226
|
+
tokenSignInProvider.value = ''
|
|
227
|
+
return
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
const result = await current.getIdTokenResult()
|
|
231
|
+
tokenExpiryText.value = new Date(result.expirationTime).toLocaleString('ja-JP')
|
|
232
|
+
tokenSignInProvider.value = result.signInProvider ?? ''
|
|
233
|
+
}
|
|
234
|
+
catch (error) {
|
|
235
|
+
tokenExpiryText.value = error instanceof Error ? error.message : '取得失敗'
|
|
236
|
+
tokenSignInProvider.value = ''
|
|
237
|
+
}
|
|
238
|
+
finally {
|
|
239
|
+
tokenLoading.value = false
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
onMounted(() => {
|
|
244
|
+
void refreshTokenInfo()
|
|
245
|
+
})
|
|
246
|
+
|
|
247
|
+
/** デバッグ時刻の上書きを解除して実時刻に戻す。 */
|
|
248
|
+
function resetNow(): void {
|
|
249
|
+
debugStore.clearOverride()
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/** 現在のデバッグ時刻を指定した差分だけ変更する。 */
|
|
253
|
+
function shiftNow(ms: number): void {
|
|
254
|
+
debugStore.setNowOverride(new Date(dateTimeStore.effectiveNow.getTime() + ms))
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/** 入力された日時を解釈してデバッグ時刻に設定する。 */
|
|
258
|
+
function setNow(iso: string): void {
|
|
259
|
+
const next = new Date(iso)
|
|
260
|
+
if (Number.isNaN(next.getTime())) {
|
|
261
|
+
return
|
|
262
|
+
}
|
|
263
|
+
debugStore.setNowOverride(next)
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
</script>
|
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="inDashboard ? '' : 'px-3 py-4 sm:px-4 md:py-6 lg:py-8'">
|
|
3
|
+
<div v-if="!inDashboard" class="mb-8 flex flex-wrap items-start justify-between gap-4">
|
|
4
|
+
<div>
|
|
5
|
+
<h1 class="text-2xl font-semibold">Bakusoku Demo</h1>
|
|
6
|
+
<p class="mt-1 text-sm text-gray-600 dark:text-gray-400">
|
|
7
|
+
{{ pageDescription }}
|
|
8
|
+
</p>
|
|
9
|
+
</div>
|
|
10
|
+
<div class="flex flex-wrap items-center gap-2">
|
|
11
|
+
<UBadge color="primary" variant="subtle" size="lg">
|
|
12
|
+
nuxt4 {{ FRAMEWORK_VERSION }}
|
|
13
|
+
</UBadge>
|
|
14
|
+
<UButton
|
|
15
|
+
color="error"
|
|
16
|
+
variant="outline"
|
|
17
|
+
icon="i-lucide-log-out"
|
|
18
|
+
:loading="isLoading"
|
|
19
|
+
@click="handleLogout"
|
|
20
|
+
>
|
|
21
|
+
ログアウト
|
|
22
|
+
</UButton>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
<div class="mx-auto flex max-w-6xl flex-col gap-8">
|
|
27
|
+
<UCard v-if="isLoading" class="py-12 text-center">
|
|
28
|
+
<div class="flex flex-col items-center gap-4">
|
|
29
|
+
<UIcon name="i-lucide-loader-circle" class="size-10 animate-spin text-primary" />
|
|
30
|
+
<p class="text-gray-600 dark:text-gray-400">読み込み中...</p>
|
|
31
|
+
</div>
|
|
32
|
+
</UCard>
|
|
33
|
+
|
|
34
|
+
<template v-else>
|
|
35
|
+
<!-- セッション概要 -->
|
|
36
|
+
<section class="grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4">
|
|
37
|
+
<UCard
|
|
38
|
+
v-for="stat in sessionStats"
|
|
39
|
+
:key="stat.label"
|
|
40
|
+
:ui="{ body: 'space-y-1' }"
|
|
41
|
+
>
|
|
42
|
+
<p class="text-sm font-medium text-gray-500 dark:text-gray-400">
|
|
43
|
+
{{ stat.label }}
|
|
44
|
+
</p>
|
|
45
|
+
<ClientOnly v-if="stat.clientOnly">
|
|
46
|
+
<p class="truncate text-lg font-semibold">
|
|
47
|
+
{{ stat.value }}
|
|
48
|
+
</p>
|
|
49
|
+
<template #fallback>
|
|
50
|
+
<p class="truncate text-lg font-semibold">—</p>
|
|
51
|
+
</template>
|
|
52
|
+
</ClientOnly>
|
|
53
|
+
<p v-else class="wrap-anywhere text-lg font-semibold">
|
|
54
|
+
{{ stat.value }}
|
|
55
|
+
</p>
|
|
56
|
+
<p v-if="stat.email" class="wrap-anywhere text-sm text-gray-600 dark:text-gray-400">
|
|
57
|
+
{{ stat.email }}
|
|
58
|
+
</p>
|
|
59
|
+
<p v-if="stat.hint" class="text-xs text-gray-500 dark:text-gray-400">
|
|
60
|
+
{{ stat.hint }}
|
|
61
|
+
</p>
|
|
62
|
+
</UCard>
|
|
63
|
+
</section>
|
|
64
|
+
|
|
65
|
+
<!-- 機能紹介 -->
|
|
66
|
+
<section class="space-y-4">
|
|
67
|
+
<h2 class="text-xl font-semibold">機能一覧</h2>
|
|
68
|
+
|
|
69
|
+
<div class="grid grid-cols-1 gap-4 md:grid-cols-2">
|
|
70
|
+
<UCard
|
|
71
|
+
v-for="feature in features"
|
|
72
|
+
:key="feature.title"
|
|
73
|
+
class="h-full"
|
|
74
|
+
:ui="{ body: 'flex h-full flex-col gap-4' }"
|
|
75
|
+
>
|
|
76
|
+
<div class="flex items-start gap-3">
|
|
77
|
+
<div class="rounded-lg bg-primary/10 p-2.5 text-primary">
|
|
78
|
+
<UIcon :name="feature.icon" class="size-5" />
|
|
79
|
+
</div>
|
|
80
|
+
<div class="min-w-0 flex-1 space-y-1">
|
|
81
|
+
<div class="flex flex-wrap items-center gap-2">
|
|
82
|
+
<h3 class="font-semibold">{{ feature.title }}</h3>
|
|
83
|
+
<UBadge
|
|
84
|
+
v-if="feature.badge"
|
|
85
|
+
:color="feature.badgeColor || 'neutral'"
|
|
86
|
+
variant="subtle"
|
|
87
|
+
size="sm"
|
|
88
|
+
>
|
|
89
|
+
{{ feature.badge }}
|
|
90
|
+
</UBadge>
|
|
91
|
+
</div>
|
|
92
|
+
<p class="text-sm text-gray-600 dark:text-gray-400">
|
|
93
|
+
{{ feature.description }}
|
|
94
|
+
</p>
|
|
95
|
+
</div>
|
|
96
|
+
</div>
|
|
97
|
+
<div v-if="feature.actions.length" class="mt-auto flex flex-wrap gap-2">
|
|
98
|
+
<UButton
|
|
99
|
+
v-for="action in feature.actions"
|
|
100
|
+
:key="action.label"
|
|
101
|
+
:to="action.to"
|
|
102
|
+
:color="action.color || 'neutral'"
|
|
103
|
+
:variant="action.variant || 'outline'"
|
|
104
|
+
:icon="action.icon"
|
|
105
|
+
size="sm"
|
|
106
|
+
>
|
|
107
|
+
{{ action.label }}
|
|
108
|
+
</UButton>
|
|
109
|
+
</div>
|
|
110
|
+
</UCard>
|
|
111
|
+
</div>
|
|
112
|
+
</section>
|
|
113
|
+
|
|
114
|
+
<!-- サンプル操作フロー -->
|
|
115
|
+
<section class="space-y-4">
|
|
116
|
+
<div>
|
|
117
|
+
<h2 class="text-xl font-semibold">サンプル操作フロー</h2>
|
|
118
|
+
<p class="mt-1 text-sm text-gray-600 dark:text-gray-400">
|
|
119
|
+
5分で一通り見せるときの推奨ルートです。
|
|
120
|
+
</p>
|
|
121
|
+
</div>
|
|
122
|
+
|
|
123
|
+
<UCard>
|
|
124
|
+
<ol class="space-y-5">
|
|
125
|
+
<li
|
|
126
|
+
v-for="(step, index) in walkthrough"
|
|
127
|
+
:key="step.title"
|
|
128
|
+
class="flex gap-4 border-b border-gray-100 pb-5 last:border-0 last:pb-0 dark:border-gray-800"
|
|
129
|
+
>
|
|
130
|
+
<div
|
|
131
|
+
class="flex size-8 shrink-0 items-center justify-center rounded-full bg-primary text-sm font-semibold text-white"
|
|
132
|
+
>
|
|
133
|
+
{{ index + 1 }}
|
|
134
|
+
</div>
|
|
135
|
+
<div class="min-w-0 flex-1 space-y-2">
|
|
136
|
+
<div class="flex flex-wrap items-center justify-between gap-2">
|
|
137
|
+
<h3 class="font-semibold">{{ step.title }}</h3>
|
|
138
|
+
<UButton
|
|
139
|
+
v-if="step.cta"
|
|
140
|
+
:to="step.to"
|
|
141
|
+
size="xs"
|
|
142
|
+
color="neutral"
|
|
143
|
+
variant="soft"
|
|
144
|
+
:icon="step.icon"
|
|
145
|
+
:trailing-icon="step.to ? 'i-lucide-arrow-right' : undefined"
|
|
146
|
+
:loading="step.action === 'logout' && isLoading"
|
|
147
|
+
@click="step.action === 'logout' ? handleLogout() : undefined"
|
|
148
|
+
>
|
|
149
|
+
{{ step.cta }}
|
|
150
|
+
</UButton>
|
|
151
|
+
</div>
|
|
152
|
+
<p class="text-sm text-gray-600 dark:text-gray-400">
|
|
153
|
+
{{ step.description }}
|
|
154
|
+
</p>
|
|
155
|
+
</div>
|
|
156
|
+
</li>
|
|
157
|
+
</ol>
|
|
158
|
+
</UCard>
|
|
159
|
+
</section>
|
|
160
|
+
|
|
161
|
+
</template>
|
|
162
|
+
</div>
|
|
163
|
+
</div>
|
|
164
|
+
</template>
|
|
165
|
+
|
|
166
|
+
<script setup lang="ts">
|
|
167
|
+
import { useBakusokuAuthStore } from '../../stores/auth'
|
|
168
|
+
import { useBakusokuDateTimeStore } from '../../stores/datetime'
|
|
169
|
+
import { useDashboardHeading, useInDashboardLayout } from '../../utils/dashboard-heading'
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
import { computed, ref, useRuntimeConfig } from '#imports'
|
|
173
|
+
|
|
174
|
+
const authStore = useBakusokuAuthStore()
|
|
175
|
+
const dateTimeStore = useBakusokuDateTimeStore()
|
|
176
|
+
const runtimeConfig = useRuntimeConfig()
|
|
177
|
+
const inDashboard = useInDashboardLayout()
|
|
178
|
+
const isLoading = ref(false)
|
|
179
|
+
const isAdmin = computed(() => authStore.user?.role === 'admin')
|
|
180
|
+
const tasksEnabled = computed(() => runtimeConfig.public.tasksEnabled === true)
|
|
181
|
+
|
|
182
|
+
const pageDescription = computed(() => (
|
|
183
|
+
isAdmin.value
|
|
184
|
+
? '認証、ロール、デバッグ時刻の確認用です。管理機能はサイドバーにあります。'
|
|
185
|
+
: '認証、ロール、デバッグ時刻の確認用です。'
|
|
186
|
+
))
|
|
187
|
+
|
|
188
|
+
useDashboardHeading(computed(() => ({
|
|
189
|
+
title: 'デモ',
|
|
190
|
+
description: pageDescription.value,
|
|
191
|
+
})))
|
|
192
|
+
|
|
193
|
+
const sessionStats = computed(() => [
|
|
194
|
+
{
|
|
195
|
+
label: 'ログイン中',
|
|
196
|
+
value: authStore.user?.displayName || authStore.user?.email || 'ユーザー',
|
|
197
|
+
email: authStore.user?.displayName ? authStore.user.email : undefined,
|
|
198
|
+
hint: authStore.user?.uid ? `uid: ${authStore.user.uid.slice(0, 8)}…` : undefined,
|
|
199
|
+
clientOnly: false,
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
label: 'ロール',
|
|
203
|
+
value: authStore.user?.role || '未設定',
|
|
204
|
+
hint: isAdmin.value ? '管理者画面へアクセス可' : '一般ユーザー',
|
|
205
|
+
clientOnly: false,
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
label: 'effectiveNow',
|
|
209
|
+
value: dateTimeStore.effectiveNow.toLocaleString('ja-JP'),
|
|
210
|
+
hint: 'Debug Toolbar で上書き可能',
|
|
211
|
+
clientOnly: true,
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
label: 'フレームワーク',
|
|
215
|
+
value: '@enlt-bakusoku/nuxt4',
|
|
216
|
+
hint: `v${FRAMEWORK_VERSION}`,
|
|
217
|
+
clientOnly: false,
|
|
218
|
+
},
|
|
219
|
+
])
|
|
220
|
+
|
|
221
|
+
type FeatureAction = {
|
|
222
|
+
label: string
|
|
223
|
+
to?: string
|
|
224
|
+
icon?: string
|
|
225
|
+
color?: 'primary' | 'neutral' | 'error' | 'success' | 'warning' | 'info' | 'secondary'
|
|
226
|
+
variant?: 'solid' | 'outline' | 'soft' | 'subtle' | 'ghost' | 'link'
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
const features = computed(() => {
|
|
230
|
+
const items: Array<{
|
|
231
|
+
title: string
|
|
232
|
+
description: string
|
|
233
|
+
icon: string
|
|
234
|
+
badge?: string
|
|
235
|
+
badgeColor?: 'primary' | 'neutral' | 'success' | 'warning' | 'error' | 'info' | 'secondary'
|
|
236
|
+
actions: FeatureAction[]
|
|
237
|
+
}> = [
|
|
238
|
+
{
|
|
239
|
+
title: '認証フロー',
|
|
240
|
+
description: 'パスワード・Google・メールリンクの3系統。ログアウト後に別方式で入り直すと見せやすいです。',
|
|
241
|
+
icon: 'i-lucide-shield-check',
|
|
242
|
+
badge: 'Auth',
|
|
243
|
+
badgeColor: 'primary',
|
|
244
|
+
actions: [
|
|
245
|
+
{ label: 'パスワード変更', to: '/settings/password', icon: 'i-lucide-key-round' },
|
|
246
|
+
{ label: '登録画面を見る', to: '/register', icon: 'i-lucide-user-plus' },
|
|
247
|
+
],
|
|
248
|
+
},
|
|
249
|
+
...(isAdmin.value
|
|
250
|
+
? [{
|
|
251
|
+
title: 'ロールとユーザー管理',
|
|
252
|
+
description: 'Firestore プロフィールの role で画面を分岐します。管理者はサイドバーからユーザーの作成・編集・無効化を確認できます。',
|
|
253
|
+
icon: 'i-lucide-users-round',
|
|
254
|
+
badge: 'admin',
|
|
255
|
+
badgeColor: 'success' as const,
|
|
256
|
+
actions: [
|
|
257
|
+
{ label: 'ユーザー管理を開く', to: '/admin/users', icon: 'i-lucide-user-cog', color: 'primary' as const, variant: 'soft' as const },
|
|
258
|
+
],
|
|
259
|
+
}]
|
|
260
|
+
: []),
|
|
261
|
+
...(isAdmin.value && tasksEnabled.value
|
|
262
|
+
? [{
|
|
263
|
+
title: 'Tasks',
|
|
264
|
+
description: 'サイドバーのタスク管理から実行し、詳細で履歴を確認します。マイグレーション管理は隣の項目です。',
|
|
265
|
+
icon: 'i-lucide-timer',
|
|
266
|
+
badge: 'Tasks',
|
|
267
|
+
badgeColor: 'info' as const,
|
|
268
|
+
actions: [
|
|
269
|
+
{ label: 'タスク管理を開く', to: '/admin/tasks', icon: 'i-lucide-timer', color: 'primary' as const, variant: 'soft' as const },
|
|
270
|
+
{ label: 'マイグレーション管理を開く', to: '/admin/migrations', icon: 'i-lucide-database', color: 'neutral' as const, variant: 'soft' as const },
|
|
271
|
+
],
|
|
272
|
+
}]
|
|
273
|
+
: []),
|
|
274
|
+
{
|
|
275
|
+
title: 'デバッグ時刻',
|
|
276
|
+
description: '画面下の Debug Toolbar か /debug から effectiveNow をずらせます。日時依存ロジックのデモ向きです。',
|
|
277
|
+
icon: 'i-lucide-clock-3',
|
|
278
|
+
badge: 'Debug',
|
|
279
|
+
badgeColor: 'warning',
|
|
280
|
+
actions: [
|
|
281
|
+
{ label: 'Debug Dashboard', to: '/debug', icon: 'i-lucide-bug', color: 'primary', variant: 'soft' },
|
|
282
|
+
],
|
|
283
|
+
},
|
|
284
|
+
]
|
|
285
|
+
|
|
286
|
+
return items
|
|
287
|
+
})
|
|
288
|
+
|
|
289
|
+
type WalkthroughStep = {
|
|
290
|
+
title: string
|
|
291
|
+
description: string
|
|
292
|
+
cta?: string
|
|
293
|
+
to?: string
|
|
294
|
+
icon?: string
|
|
295
|
+
action?: 'logout'
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
const walkthrough = computed((): WalkthroughStep[] => [
|
|
299
|
+
{
|
|
300
|
+
title: 'セッションを確認する',
|
|
301
|
+
description: '上のカードで表示名・ロール・effectiveNow を確認します。ここがデモの出発点です。',
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
title: '時刻をずらして live 感を出す',
|
|
305
|
+
description: 'Debug Dashboard か下部ツールバーで +1h / -1d を押し、この画面の effectiveNow が追従することを見せます。',
|
|
306
|
+
cta: 'Debug へ',
|
|
307
|
+
to: '/debug',
|
|
308
|
+
icon: 'i-lucide-bug',
|
|
309
|
+
},
|
|
310
|
+
...(isAdmin.value
|
|
311
|
+
? [{
|
|
312
|
+
title: 'ユーザー管理を一巡する',
|
|
313
|
+
description: '一覧・検索・作成・編集・無効化まで。',
|
|
314
|
+
cta: 'ユーザー管理',
|
|
315
|
+
to: '/admin/users',
|
|
316
|
+
icon: 'i-lucide-users',
|
|
317
|
+
}]
|
|
318
|
+
: []),
|
|
319
|
+
{
|
|
320
|
+
title: 'パスワード変更を試す',
|
|
321
|
+
description: 'メール/パスワードアカウント向け。再認証付きの変更フローを確認できます。',
|
|
322
|
+
cta: 'パスワード変更',
|
|
323
|
+
to: '/settings/password',
|
|
324
|
+
icon: 'i-lucide-key-round',
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
title: '別の認証方法で入り直す',
|
|
328
|
+
description: 'ログアウト後、Google またはメールリンクで再ログインし、認証手段の切り替えを見せます。',
|
|
329
|
+
cta: 'ログアウトしてログインへ',
|
|
330
|
+
icon: 'i-lucide-log-out',
|
|
331
|
+
action: 'logout',
|
|
332
|
+
},
|
|
333
|
+
])
|
|
334
|
+
|
|
335
|
+
/** 認証ストアを通じてログアウトする。 */
|
|
336
|
+
const handleLogout = async () => {
|
|
337
|
+
isLoading.value = true
|
|
338
|
+
try {
|
|
339
|
+
await authStore.logout()
|
|
340
|
+
await navigateTo('/login')
|
|
341
|
+
} catch (error) {
|
|
342
|
+
console.error('ログアウトエラー:', error)
|
|
343
|
+
} finally {
|
|
344
|
+
isLoading.value = false
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
</script>
|