@quazardous/qdadm 2.34.0 → 2.36.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/dist/styles/qdadm.css +1 -1
- package/package.json +1 -1
- package/src/components/layout/AppLayout.vue +88 -32
- package/src/components/layout/defaults/DefaultUserInfo.vue +45 -37
- package/src/components/pages/LoginPage.vue +38 -21
- package/src/components/tasks/TaskHost.vue +3 -0
- package/src/components/tasks/TaskTray.vue +4 -1
- package/src/composables/index.ts +1 -0
- package/src/composables/useUserBox.ts +119 -0
- package/src/i18n/defaults/core.en.generated.ts +27 -0
- package/src/i18n/defaults/core.en.yml +27 -0
- package/src/i18n/defaults/core.fr.generated.ts +27 -0
- package/src/i18n/defaults/core.fr.yml +27 -0
- package/src/index.ts +2 -0
- package/src/kernel/Kernel.registries.ts +1 -1
- package/src/kernel/Kernel.types.ts +8 -1
- package/src/kernel/Kernel.vue.ts +2 -0
- package/src/notifications/NotificationBadge.vue +4 -2
- package/src/notifications/NotificationPanel.vue +22 -12
- package/src/notifications/NotificationStore.ts +2 -0
- package/src/plugin.ts +28 -13
- package/src/styles/_tasks.scss +10 -4
- package/src/tasks/taskStore.ts +4 -3
- package/src/tasks/useTaskNotifications.ts +76 -0
- package/src/tasks/useTaskRunner.ts +10 -1
|
@@ -23,6 +23,7 @@ import Card from 'primevue/card'
|
|
|
23
23
|
import InputText from 'primevue/inputtext'
|
|
24
24
|
import Password from 'primevue/password'
|
|
25
25
|
import QdButton from '../base/QdButton.vue'
|
|
26
|
+
import { useI18n } from '../../i18n/useI18n'
|
|
26
27
|
import type { OrchestratorLike } from '../../entity/EntityManager.interface'
|
|
27
28
|
|
|
28
29
|
/**
|
|
@@ -97,25 +98,25 @@ const props = defineProps({
|
|
|
97
98
|
default: null
|
|
98
99
|
},
|
|
99
100
|
/**
|
|
100
|
-
* Username field label
|
|
101
|
+
* Username field label (default: core.login.username)
|
|
101
102
|
*/
|
|
102
103
|
usernameLabel: {
|
|
103
|
-
type: String
|
|
104
|
-
default:
|
|
104
|
+
type: String as PropType<string | null>,
|
|
105
|
+
default: null
|
|
105
106
|
},
|
|
106
107
|
/**
|
|
107
|
-
* Password field label
|
|
108
|
+
* Password field label (default: core.login.password)
|
|
108
109
|
*/
|
|
109
110
|
passwordLabel: {
|
|
110
|
-
type: String
|
|
111
|
-
default:
|
|
111
|
+
type: String as PropType<string | null>,
|
|
112
|
+
default: null
|
|
112
113
|
},
|
|
113
114
|
/**
|
|
114
|
-
* Submit button label
|
|
115
|
+
* Submit button label (default: core.login.submit)
|
|
115
116
|
*/
|
|
116
117
|
submitLabel: {
|
|
117
|
-
type: String
|
|
118
|
-
default:
|
|
118
|
+
type: String as PropType<string | null>,
|
|
119
|
+
default: null
|
|
119
120
|
},
|
|
120
121
|
/**
|
|
121
122
|
* Route to redirect after successful login
|
|
@@ -145,6 +146,13 @@ const props = defineProps({
|
|
|
145
146
|
emitSignal: {
|
|
146
147
|
type: Boolean,
|
|
147
148
|
default: true
|
|
149
|
+
},
|
|
150
|
+
/**
|
|
151
|
+
* Success toast ("Welcome / Logged in as …") after login
|
|
152
|
+
*/
|
|
153
|
+
welcomeToast: {
|
|
154
|
+
type: Boolean,
|
|
155
|
+
default: true
|
|
148
156
|
}
|
|
149
157
|
})
|
|
150
158
|
|
|
@@ -157,16 +165,23 @@ const router = useRouter()
|
|
|
157
165
|
const authAdapter = inject<AuthAdapter | null>('authAdapter', null)
|
|
158
166
|
const orchestrator = inject<Orchestrator | null>('qdadmOrchestrator', null)
|
|
159
167
|
const appConfig = inject<AppConfig>('qdadmApp', {})
|
|
168
|
+
const { tOr } = useI18n()
|
|
160
169
|
|
|
161
170
|
const username = ref<string>(props.defaultUsername)
|
|
162
171
|
const password = ref<string>(props.defaultPassword)
|
|
163
172
|
const loading = ref<boolean>(false)
|
|
164
173
|
|
|
174
|
+
const labels = computed(() => ({
|
|
175
|
+
username: props.usernameLabel ?? tOr('core.login.username', 'Username'),
|
|
176
|
+
password: props.passwordLabel ?? tOr('core.login.password', 'Password'),
|
|
177
|
+
submit: props.submitLabel ?? tOr('core.login.submit', 'Sign In'),
|
|
178
|
+
}))
|
|
179
|
+
|
|
165
180
|
const displayTitle = computed<string>(() => props.title || appConfig.name || 'Admin')
|
|
166
181
|
|
|
167
182
|
async function handleLogin(): Promise<void> {
|
|
168
183
|
if (!authAdapter?.login) {
|
|
169
|
-
orchestrator?.toast.error('Configuration Error', 'No auth adapter configured', 'LoginPage')
|
|
184
|
+
orchestrator?.toast.error(tOr('core.login.configError', 'Configuration Error'), tOr('core.login.noAuthAdapter', 'No auth adapter configured'), 'LoginPage')
|
|
170
185
|
return
|
|
171
186
|
}
|
|
172
187
|
|
|
@@ -179,11 +194,13 @@ async function handleLogin(): Promise<void> {
|
|
|
179
194
|
|
|
180
195
|
// Emit auth:login signal for debug bar and other listeners
|
|
181
196
|
orchestrator?.signals?.emit('auth:login', { user: result.user })
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
197
|
+
if (props.welcomeToast) {
|
|
198
|
+
orchestrator?.toast.success(
|
|
199
|
+
tOr('core.login.welcome', 'Welcome'),
|
|
200
|
+
tOr('core.login.loggedInAs', 'Logged in as {name}', { name: result.user?.username || result.user?.email || username.value }),
|
|
201
|
+
'LoginPage'
|
|
202
|
+
)
|
|
203
|
+
}
|
|
187
204
|
|
|
188
205
|
emit('login', result)
|
|
189
206
|
router.push(props.redirectTo)
|
|
@@ -194,14 +211,14 @@ async function handleLogin(): Promise<void> {
|
|
|
194
211
|
const message = axiosError.response?.data?.error?.message
|
|
195
212
|
|| axiosError.response?.data?.message
|
|
196
213
|
|| axiosError.message
|
|
197
|
-
|| 'Invalid credentials'
|
|
214
|
+
|| tOr('core.login.invalidCredentials', 'Invalid credentials')
|
|
198
215
|
|
|
199
216
|
orchestrator?.signals?.emit('auth:login:error', {
|
|
200
217
|
username: username.value,
|
|
201
218
|
error: message,
|
|
202
219
|
status: axiosError.response?.status
|
|
203
220
|
})
|
|
204
|
-
orchestrator?.toast.error('Login Failed', message, 'LoginPage')
|
|
221
|
+
orchestrator?.toast.error(tOr('core.login.failed', 'Login Failed'), message, 'LoginPage')
|
|
205
222
|
|
|
206
223
|
emit('error', error)
|
|
207
224
|
} finally {
|
|
@@ -225,7 +242,7 @@ async function handleLogin(): Promise<void> {
|
|
|
225
242
|
<template #content>
|
|
226
243
|
<form @submit.prevent="handleLogin" class="qdadm-login-form" autocomplete="off">
|
|
227
244
|
<div class="qdadm-login-field">
|
|
228
|
-
<label for="qdadm-username">{{
|
|
245
|
+
<label for="qdadm-username">{{ labels.username }}</label>
|
|
229
246
|
<InputText
|
|
230
247
|
v-model="username"
|
|
231
248
|
id="qdadm-username"
|
|
@@ -235,7 +252,7 @@ async function handleLogin(): Promise<void> {
|
|
|
235
252
|
/>
|
|
236
253
|
</div>
|
|
237
254
|
<div class="qdadm-login-field">
|
|
238
|
-
<label for="qdadm-password">{{
|
|
255
|
+
<label for="qdadm-password">{{ labels.password }}</label>
|
|
239
256
|
<Password
|
|
240
257
|
v-model="password"
|
|
241
258
|
inputId="qdadm-password"
|
|
@@ -247,7 +264,7 @@ async function handleLogin(): Promise<void> {
|
|
|
247
264
|
</div>
|
|
248
265
|
<QdButton
|
|
249
266
|
type="submit"
|
|
250
|
-
:label="
|
|
267
|
+
:label="labels.submit"
|
|
251
268
|
icon="pi pi-sign-in"
|
|
252
269
|
class="w-full"
|
|
253
270
|
:loading="loading"
|
|
@@ -256,7 +273,7 @@ async function handleLogin(): Promise<void> {
|
|
|
256
273
|
and the footer, which is where users look for them. Rendered
|
|
257
274
|
only when filled, so the divider never shows on its own. -->
|
|
258
275
|
<div v-if="$slots.alternatives" class="qdadm-login-alternatives">
|
|
259
|
-
<div class="qdadm-login-divider"><span>or</span></div>
|
|
276
|
+
<div class="qdadm-login-divider"><span>{{ tOr('core.login.or', 'or') }}</span></div>
|
|
260
277
|
<slot name="alternatives"></slot>
|
|
261
278
|
</div>
|
|
262
279
|
|
|
@@ -14,8 +14,11 @@ import TaskDialog from './TaskDialog.vue'
|
|
|
14
14
|
import { useI18n } from '../../i18n/useI18n'
|
|
15
15
|
import { useTaskRunner } from '../../tasks/useTaskRunner'
|
|
16
16
|
import { getTaskStore } from '../../tasks/taskStore'
|
|
17
|
+
import { useTaskNotifications } from '../../tasks/useTaskNotifications'
|
|
17
18
|
|
|
18
19
|
useTaskRunner()
|
|
20
|
+
// Running tasks in the notification zone, when it is on (#4171)
|
|
21
|
+
useTaskNotifications()
|
|
19
22
|
const store = getTaskStore()
|
|
20
23
|
const { t } = useI18n()
|
|
21
24
|
|
|
@@ -10,8 +10,11 @@ import Popover from 'primevue/popover'
|
|
|
10
10
|
import QdButton from '../base/QdButton.vue'
|
|
11
11
|
import { useI18n } from '../../i18n/useI18n'
|
|
12
12
|
import { getTaskStore } from '../../tasks/taskStore'
|
|
13
|
+
import { useTaskTrayVisible } from '../../tasks/useTaskNotifications'
|
|
13
14
|
|
|
14
15
|
const store = getTaskStore()
|
|
16
|
+
// With the notification zone on, running tasks show there instead (#4171)
|
|
17
|
+
const visible = useTaskTrayVisible()
|
|
15
18
|
const { t } = useI18n()
|
|
16
19
|
const popover = ref<InstanceType<typeof Popover> | null>(null)
|
|
17
20
|
|
|
@@ -29,7 +32,7 @@ const icon = (status: string) =>
|
|
|
29
32
|
</script>
|
|
30
33
|
|
|
31
34
|
<template>
|
|
32
|
-
<div v-if="runs.length" class="qd-task-tray">
|
|
35
|
+
<div v-if="visible && runs.length" class="qd-task-tray">
|
|
33
36
|
<button type="button" class="qd-task-tray-button" :class="{ 'qd-task-tray-button--busy': activeCount > 0 }"
|
|
34
37
|
:aria-label="t('core.task.tray', { count: activeCount })" @click="popover?.toggle($event)">
|
|
35
38
|
<i :class="activeCount ? 'pi pi-spin pi-cog' : 'pi pi-check'" />
|
package/src/composables/index.ts
CHANGED
|
@@ -50,6 +50,7 @@ export {
|
|
|
50
50
|
export { usePageTitle, type UsePageTitleReturn, type TitleParts, type TitleInput } from './usePageTitle'
|
|
51
51
|
export { useApp, type UseAppReturn } from './useApp'
|
|
52
52
|
export { useAuth, type UseAuthReturn } from './useAuth'
|
|
53
|
+
export { useUserBox, resolveUserAvatar, isExternalUserLink, type UseUserBoxReturn, type UserAvatarResolver, type UserBoxUser } from './useUserBox'
|
|
53
54
|
export { useSecurity, type UseSecurityReturn } from './useSecurity'
|
|
54
55
|
export {
|
|
55
56
|
useEntityItemPage,
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useUserBox - what the sidebar user box shows (#4157)
|
|
3
|
+
*
|
|
4
|
+
* Shared by AppLayout and DefaultUserInfo: the signed-in user's name,
|
|
5
|
+
* subtitle, initials, avatar picture and profile link, all read from the
|
|
6
|
+
* auth user and the `app` config (`app.userRoute`, `app.userAvatar`).
|
|
7
|
+
* `app.userRoute` is an app route, or an absolute URL opened in a new tab.
|
|
8
|
+
*/
|
|
9
|
+
import { computed, inject, ref, watch, type ComputedRef, type Ref } from 'vue'
|
|
10
|
+
import type { RouteLocationRaw } from 'vue-router'
|
|
11
|
+
import { useAuth } from './useAuth'
|
|
12
|
+
import { prettifyRole } from '../utils/formatters'
|
|
13
|
+
|
|
14
|
+
export interface UserBoxUser {
|
|
15
|
+
username?: string
|
|
16
|
+
name?: string
|
|
17
|
+
email?: string
|
|
18
|
+
role?: string
|
|
19
|
+
avatar?: string | null
|
|
20
|
+
avatarUrl?: string | null
|
|
21
|
+
[key: string]: unknown
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Where the avatar picture is, for a user; null or '' shows the initials. */
|
|
25
|
+
export type UserAvatarResolver = (user: UserBoxUser) => string | null | undefined
|
|
26
|
+
|
|
27
|
+
interface UserBoxAppConfig {
|
|
28
|
+
userRoute?: RouteLocationRaw | null
|
|
29
|
+
userAvatar?: UserAvatarResolver | null
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* An absolute URL (`https://…`, `http://…`, `//host/…`, `mailto:…`) rather
|
|
34
|
+
* than an app route. Only these schemes: a route name may hold a colon.
|
|
35
|
+
*/
|
|
36
|
+
export function isExternalUserLink(link: unknown): boolean {
|
|
37
|
+
return typeof link === 'string' && /^(https?:|mailto:|\/\/)/i.test(link.trim())
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The avatar URL of a user: the app's resolver when it has one, else
|
|
42
|
+
* `user.avatar` or `user.avatarUrl`.
|
|
43
|
+
*/
|
|
44
|
+
export function resolveUserAvatar(user: UserBoxUser | null | undefined, resolver?: UserAvatarResolver | null): string | null {
|
|
45
|
+
if (!user) return null
|
|
46
|
+
let url: unknown
|
|
47
|
+
if (resolver) {
|
|
48
|
+
try {
|
|
49
|
+
url = resolver(user)
|
|
50
|
+
} catch (err) {
|
|
51
|
+
console.warn('[qdadm] app.userAvatar threw, showing initials:', err)
|
|
52
|
+
return null
|
|
53
|
+
}
|
|
54
|
+
} else {
|
|
55
|
+
url = user.avatar || user.avatarUrl
|
|
56
|
+
}
|
|
57
|
+
return typeof url === 'string' && url.trim() ? url : null
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface UseUserBoxReturn {
|
|
61
|
+
user: ComputedRef<UserBoxUser | null>
|
|
62
|
+
displayName: ComputedRef<string>
|
|
63
|
+
subtitle: ComputedRef<string>
|
|
64
|
+
initials: ComputedRef<string>
|
|
65
|
+
/** The picture to show, or null for the initials (none, or it failed). */
|
|
66
|
+
avatarUrl: ComputedRef<string | null>
|
|
67
|
+
/** Call from the img's `error` event: the initials come back. */
|
|
68
|
+
avatarFailed: () => void
|
|
69
|
+
/** The profile page, when the app declares one: an app route or an external URL. */
|
|
70
|
+
userRoute: RouteLocationRaw | null
|
|
71
|
+
/** Bind on the profile link: `{ to }` for a route, `{ href, target, rel }` for an external URL. */
|
|
72
|
+
userLink: { is: 'a' | 'RouterLink'; attrs: Record<string, unknown> } | null
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function useUserBox(): UseUserBoxReturn {
|
|
76
|
+
const { user: authUser } = useAuth()
|
|
77
|
+
const app = inject<UserBoxAppConfig | null>('qdadmApp', null)
|
|
78
|
+
|
|
79
|
+
const user = computed(() => (authUser.value as UserBoxUser | null) ?? null)
|
|
80
|
+
|
|
81
|
+
const displayName = computed(() => user.value?.username || user.value?.name || 'User')
|
|
82
|
+
|
|
83
|
+
const subtitle = computed(() => {
|
|
84
|
+
if (user.value?.email) return user.value.email
|
|
85
|
+
// raw ROLE_* constants are ugly by default — prettify (#1388)
|
|
86
|
+
return user.value?.role ? prettifyRole(user.value.role) : ''
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
const initials = computed(() => {
|
|
90
|
+
const username = user.value?.username
|
|
91
|
+
if (!username) return '?'
|
|
92
|
+
return username.substring(0, 2).toUpperCase()
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
const resolved = computed(() => resolveUserAvatar(user.value, app?.userAvatar))
|
|
96
|
+
const failed: Ref<string | null> = ref(null)
|
|
97
|
+
// A new URL gets its own chance to load
|
|
98
|
+
watch(resolved, () => (failed.value = null))
|
|
99
|
+
const avatarUrl = computed(() => (resolved.value && resolved.value !== failed.value ? resolved.value : null))
|
|
100
|
+
|
|
101
|
+
const userRoute = app?.userRoute ?? null
|
|
102
|
+
const userLink = !userRoute
|
|
103
|
+
? null
|
|
104
|
+
: isExternalUserLink(userRoute)
|
|
105
|
+
? { is: 'a' as const, attrs: { href: userRoute as string, target: '_blank', rel: 'noopener noreferrer' } }
|
|
106
|
+
: // A bare string is a route name, as for homeRoute; '/…' is a path
|
|
107
|
+
{ is: 'RouterLink' as const, attrs: { to: typeof userRoute === 'string' && !userRoute.startsWith('/') ? { name: userRoute } : userRoute } }
|
|
108
|
+
|
|
109
|
+
return {
|
|
110
|
+
user,
|
|
111
|
+
displayName,
|
|
112
|
+
subtitle,
|
|
113
|
+
initials,
|
|
114
|
+
avatarUrl,
|
|
115
|
+
avatarFailed: () => (failed.value = resolved.value),
|
|
116
|
+
userRoute,
|
|
117
|
+
userLink,
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -26,6 +26,8 @@ export default `core:
|
|
|
26
26
|
refresh: Refresh
|
|
27
27
|
export: Export
|
|
28
28
|
import: Import
|
|
29
|
+
logout: Logout
|
|
30
|
+
profile: My profile
|
|
29
31
|
tooltips:
|
|
30
32
|
saveAndContinue: Save and continue editing
|
|
31
33
|
saveAndReturn: Save and return to list
|
|
@@ -160,6 +162,31 @@ export default `core:
|
|
|
160
162
|
tray: "{count} running task | {count} running tasks"
|
|
161
163
|
trayDone: Recent tasks
|
|
162
164
|
clear: Clear finished
|
|
165
|
+
# LoginPage (#4168)
|
|
166
|
+
login:
|
|
167
|
+
username: Username
|
|
168
|
+
password: Password
|
|
169
|
+
submit: Sign In
|
|
170
|
+
or: or
|
|
171
|
+
welcome: Welcome
|
|
172
|
+
loggedInAs: "Logged in as {name}"
|
|
173
|
+
failed: Login Failed
|
|
174
|
+
invalidCredentials: Invalid credentials
|
|
175
|
+
configError: Configuration Error
|
|
176
|
+
noAuthAdapter: No auth adapter configured
|
|
177
|
+
# NotificationPanel and NotificationBadge (#4171)
|
|
178
|
+
notifications:
|
|
179
|
+
title: Notifications
|
|
180
|
+
unread: "Notifications, {count} unread"
|
|
181
|
+
loading: Loading
|
|
182
|
+
markAllRead: Mark all read
|
|
183
|
+
clearAll: Clear all
|
|
184
|
+
close: Close
|
|
185
|
+
dismiss: Dismiss
|
|
186
|
+
empty: No notifications
|
|
187
|
+
justNow: just now
|
|
188
|
+
minutesAgo: "{count}m ago"
|
|
189
|
+
hoursAgo: "{count}h ago"
|
|
163
190
|
# NotFoundPage
|
|
164
191
|
notFound:
|
|
165
192
|
title: Page not found
|
|
@@ -24,6 +24,8 @@ core:
|
|
|
24
24
|
refresh: Refresh
|
|
25
25
|
export: Export
|
|
26
26
|
import: Import
|
|
27
|
+
logout: Logout
|
|
28
|
+
profile: My profile
|
|
27
29
|
tooltips:
|
|
28
30
|
saveAndContinue: Save and continue editing
|
|
29
31
|
saveAndReturn: Save and return to list
|
|
@@ -158,6 +160,31 @@ core:
|
|
|
158
160
|
tray: "{count} running task | {count} running tasks"
|
|
159
161
|
trayDone: Recent tasks
|
|
160
162
|
clear: Clear finished
|
|
163
|
+
# LoginPage (#4168)
|
|
164
|
+
login:
|
|
165
|
+
username: Username
|
|
166
|
+
password: Password
|
|
167
|
+
submit: Sign In
|
|
168
|
+
or: or
|
|
169
|
+
welcome: Welcome
|
|
170
|
+
loggedInAs: "Logged in as {name}"
|
|
171
|
+
failed: Login Failed
|
|
172
|
+
invalidCredentials: Invalid credentials
|
|
173
|
+
configError: Configuration Error
|
|
174
|
+
noAuthAdapter: No auth adapter configured
|
|
175
|
+
# NotificationPanel and NotificationBadge (#4171)
|
|
176
|
+
notifications:
|
|
177
|
+
title: Notifications
|
|
178
|
+
unread: "Notifications, {count} unread"
|
|
179
|
+
loading: Loading
|
|
180
|
+
markAllRead: Mark all read
|
|
181
|
+
clearAll: Clear all
|
|
182
|
+
close: Close
|
|
183
|
+
dismiss: Dismiss
|
|
184
|
+
empty: No notifications
|
|
185
|
+
justNow: just now
|
|
186
|
+
minutesAgo: "{count}m ago"
|
|
187
|
+
hoursAgo: "{count}h ago"
|
|
161
188
|
# NotFoundPage
|
|
162
189
|
notFound:
|
|
163
190
|
title: Page not found
|
|
@@ -26,6 +26,8 @@ export default `core:
|
|
|
26
26
|
refresh: Actualiser
|
|
27
27
|
export: Exporter
|
|
28
28
|
import: Importer
|
|
29
|
+
logout: Se déconnecter
|
|
30
|
+
profile: Mon profil
|
|
29
31
|
tooltips:
|
|
30
32
|
saveAndContinue: Enregistrer et continuer la modification
|
|
31
33
|
saveAndReturn: Enregistrer et revenir à la liste
|
|
@@ -160,6 +162,31 @@ export default `core:
|
|
|
160
162
|
tray: "{count} tâche en cours | {count} tâches en cours"
|
|
161
163
|
trayDone: Tâches récentes
|
|
162
164
|
clear: Effacer les terminées
|
|
165
|
+
# LoginPage (#4168)
|
|
166
|
+
login:
|
|
167
|
+
username: Identifiant
|
|
168
|
+
password: Mot de passe
|
|
169
|
+
submit: Se connecter
|
|
170
|
+
or: ou
|
|
171
|
+
welcome: Bienvenue
|
|
172
|
+
loggedInAs: "Connecté en tant que {name}"
|
|
173
|
+
failed: Échec de la connexion
|
|
174
|
+
invalidCredentials: Identifiants invalides
|
|
175
|
+
configError: Erreur de configuration
|
|
176
|
+
noAuthAdapter: Aucun adaptateur d'authentification configuré
|
|
177
|
+
# NotificationPanel and NotificationBadge (#4171)
|
|
178
|
+
notifications:
|
|
179
|
+
title: Notifications
|
|
180
|
+
unread: "Notifications, {count} non lue | Notifications, {count} non lues"
|
|
181
|
+
loading: Chargement
|
|
182
|
+
markAllRead: Tout marquer comme lu
|
|
183
|
+
clearAll: Tout effacer
|
|
184
|
+
close: Fermer
|
|
185
|
+
dismiss: Retirer
|
|
186
|
+
empty: Aucune notification
|
|
187
|
+
justNow: à l'instant
|
|
188
|
+
minutesAgo: "il y a {count} min"
|
|
189
|
+
hoursAgo: "il y a {count} h"
|
|
163
190
|
# NotFoundPage
|
|
164
191
|
notFound:
|
|
165
192
|
title: Page introuvable
|
|
@@ -24,6 +24,8 @@ core:
|
|
|
24
24
|
refresh: Actualiser
|
|
25
25
|
export: Exporter
|
|
26
26
|
import: Importer
|
|
27
|
+
logout: Se déconnecter
|
|
28
|
+
profile: Mon profil
|
|
27
29
|
tooltips:
|
|
28
30
|
saveAndContinue: Enregistrer et continuer la modification
|
|
29
31
|
saveAndReturn: Enregistrer et revenir à la liste
|
|
@@ -158,6 +160,31 @@ core:
|
|
|
158
160
|
tray: "{count} tâche en cours | {count} tâches en cours"
|
|
159
161
|
trayDone: Tâches récentes
|
|
160
162
|
clear: Effacer les terminées
|
|
163
|
+
# LoginPage (#4168)
|
|
164
|
+
login:
|
|
165
|
+
username: Identifiant
|
|
166
|
+
password: Mot de passe
|
|
167
|
+
submit: Se connecter
|
|
168
|
+
or: ou
|
|
169
|
+
welcome: Bienvenue
|
|
170
|
+
loggedInAs: "Connecté en tant que {name}"
|
|
171
|
+
failed: Échec de la connexion
|
|
172
|
+
invalidCredentials: Identifiants invalides
|
|
173
|
+
configError: Erreur de configuration
|
|
174
|
+
noAuthAdapter: Aucun adaptateur d'authentification configuré
|
|
175
|
+
# NotificationPanel and NotificationBadge (#4171)
|
|
176
|
+
notifications:
|
|
177
|
+
title: Notifications
|
|
178
|
+
unread: "Notifications, {count} non lue | Notifications, {count} non lues"
|
|
179
|
+
loading: Chargement
|
|
180
|
+
markAllRead: Tout marquer comme lu
|
|
181
|
+
clearAll: Tout effacer
|
|
182
|
+
close: Fermer
|
|
183
|
+
dismiss: Retirer
|
|
184
|
+
empty: Aucune notification
|
|
185
|
+
justNow: à l'instant
|
|
186
|
+
minutesAgo: "il y a {count} min"
|
|
187
|
+
hoursAgo: "il y a {count} h"
|
|
161
188
|
# NotFoundPage
|
|
162
189
|
notFound:
|
|
163
190
|
title: Page introuvable
|
package/src/index.ts
CHANGED
|
@@ -263,6 +263,7 @@ export {
|
|
|
263
263
|
} from './composables/usePageTitle'
|
|
264
264
|
export { useApp, type UseAppReturn } from './composables/useApp'
|
|
265
265
|
export { useAuth, type UseAuthReturn } from './composables/useAuth'
|
|
266
|
+
export { useUserBox, resolveUserAvatar, isExternalUserLink, type UseUserBoxReturn, type UserAvatarResolver, type UserBoxUser } from './composables/useUserBox'
|
|
266
267
|
export { useSecurity, type UseSecurityReturn } from './composables/useSecurity'
|
|
267
268
|
export {
|
|
268
269
|
useEntityItemPage,
|
|
@@ -407,6 +408,7 @@ export { useSidebarState, SIDEBAR_COLLAPSED_KEY } from './composables/useSidebar
|
|
|
407
408
|
// ════════════════════════════════════════════════════════════════════════════
|
|
408
409
|
export * from './components/index'
|
|
409
410
|
export { useTaskRunner, taskAction } from './tasks/useTaskRunner'
|
|
411
|
+
export { useTaskNotifications, useTaskTrayVisible, type TasksConfig } from './tasks/useTaskNotifications'
|
|
410
412
|
export {
|
|
411
413
|
getTaskStore,
|
|
412
414
|
registerTaskKind,
|
|
@@ -381,7 +381,7 @@ export function applyRegistryMethods(KernelClass: { prototype: Kernel }): void {
|
|
|
381
381
|
'managerResolver', 'managers', 'moduleDefs', 'modules', 'modulesOptions',
|
|
382
382
|
'notifications', 'onAuthExpired', 'pages', 'parentParamMode', 'primevue',
|
|
383
383
|
'root', 'routeParamResolver', 'routePrefix', 'routeState', 'sectionOrder',
|
|
384
|
-
'security', 'sse', 'storageResolver', 'toast', 'warmup',
|
|
384
|
+
'security', 'sse', 'storageResolver', 'tasks', 'toast', 'warmup',
|
|
385
385
|
])
|
|
386
386
|
|
|
387
387
|
proto._validateKernelOptions = function (this: Self): void {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Extracted from Kernel.ts for maintainability.
|
|
5
5
|
*/
|
|
6
6
|
import type { Component } from 'vue'
|
|
7
|
-
import type { RouteRecordRaw } from 'vue-router'
|
|
7
|
+
import type { RouteLocationRaw, RouteRecordRaw } from 'vue-router'
|
|
8
8
|
import type { SignalBus } from './SignalBus'
|
|
9
9
|
import type { RoutesConfig } from './EventRouter'
|
|
10
10
|
import type { EntityManager } from '../entity/EntityManager'
|
|
@@ -14,6 +14,7 @@ import type { GrantJudge } from '../entity/auth/SecurityChecker'
|
|
|
14
14
|
import type { I18nOptions } from '../i18n/types'
|
|
15
15
|
import type { ApiClientSource } from '../api/apiClient'
|
|
16
16
|
import type { RouteStatePersister } from '../routeState'
|
|
17
|
+
import type { UserAvatarResolver } from '../composables/useUserBox'
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
20
|
* Auth adapter interface (app-level authentication)
|
|
@@ -45,6 +46,10 @@ export interface AppConfig {
|
|
|
45
46
|
version?: string
|
|
46
47
|
logo?: string
|
|
47
48
|
theme?: string
|
|
49
|
+
/** The signed-in user's profile page, an app route or an absolute URL: the sidebar name and avatar link to it, the glyph logs out (#4157). */
|
|
50
|
+
userRoute?: RouteLocationRaw | string
|
|
51
|
+
/** The sidebar avatar picture; default `user.avatar` or `user.avatarUrl`, initials when none (#4157). */
|
|
52
|
+
userAvatar?: UserAvatarResolver
|
|
48
53
|
}
|
|
49
54
|
|
|
50
55
|
/**
|
|
@@ -268,6 +273,8 @@ export interface KernelOptions {
|
|
|
268
273
|
routeState?: string | RouteStatePersister
|
|
269
274
|
debugBar?: DebugBarConfig
|
|
270
275
|
notifications?: NotificationsConfig
|
|
276
|
+
/** TaskRunner UI (#4171). `tray`: show TaskTray in the sidebar; default only when notifications are off. */
|
|
277
|
+
tasks?: { tray?: boolean }
|
|
271
278
|
/** App-wide display defaults (#2772). */
|
|
272
279
|
display?: {
|
|
273
280
|
/** What a missing value shows, in detail pages and formatters. Default `'-'`. */
|
package/src/kernel/Kernel.vue.ts
CHANGED
|
@@ -362,6 +362,8 @@ export function applyVueMethods(KernelClass: { prototype: Kernel }): void {
|
|
|
362
362
|
app.provide('qdadmPermissionRegistry', this.permissionRegistry)
|
|
363
363
|
}
|
|
364
364
|
|
|
365
|
+
app.provide('qdadmTasksConfig', this.options.tasks ?? {})
|
|
366
|
+
|
|
365
367
|
// Create and provide notification store if notifications are enabled
|
|
366
368
|
if (this.options.notifications?.enabled) {
|
|
367
369
|
this.notificationStore = createNotificationStore({
|
|
@@ -14,8 +14,10 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import { computed } from 'vue'
|
|
16
16
|
import { useNotifications } from './NotificationStore'
|
|
17
|
+
import { useI18n } from '../i18n/useI18n'
|
|
17
18
|
|
|
18
19
|
const store = useNotifications()
|
|
20
|
+
const { tOr } = useI18n()
|
|
19
21
|
|
|
20
22
|
const unread = computed(() => store.unreadCount.value)
|
|
21
23
|
const unreadLabel = computed(() => (unread.value > 99 ? '99+' : String(unread.value)))
|
|
@@ -26,10 +28,10 @@ const unreadLabel = computed(() => (unread.value > 99 ? '99+' : String(unread.va
|
|
|
26
28
|
class="notification-badge-zone"
|
|
27
29
|
:class="{ 'notification-badge-zone--alert': store.hasAlert.value || unread > 0 }"
|
|
28
30
|
role="button"
|
|
29
|
-
:aria-label="unread > 0 ?
|
|
31
|
+
:aria-label="unread > 0 ? tOr('core.notifications.unread', 'Notifications, {count} unread', { count: unread }) : tOr('core.notifications.title', 'Notifications')"
|
|
30
32
|
@click.stop.prevent="store.toggle()"
|
|
31
33
|
>
|
|
32
|
-
<span v-if="store.isBusy.value" class="notification-badge-ring" role="progressbar" aria-label="Loading" />
|
|
34
|
+
<span v-if="store.isBusy.value" class="notification-badge-ring" role="progressbar" :aria-label="tOr('core.notifications.loading', 'Loading')" />
|
|
33
35
|
<span v-if="store.isFlashing.value" class="notification-badge-flash" aria-hidden="true" />
|
|
34
36
|
<span v-if="unread > 0" class="notification-badge-count">{{ unreadLabel }}</span>
|
|
35
37
|
</div>
|