@postxl/generators 1.20.0 → 1.20.1
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/backend-ai/ai.generator.js +2 -2
- package/dist/e2e/template/e2e/specs/example.spec.ts +4 -2
- package/dist/e2e/template/e2e/specs/example.spec.ts-snapshots/Navigate-to-homepage-and-take-snapshot-1-chromium-linux.png +0 -0
- package/dist/frontend-core/template/src/pages/dashboard/dashboard.page.tsx +17 -17
- package/package.json +1 -1
|
@@ -68,7 +68,7 @@ exports.generator = {
|
|
|
68
68
|
},
|
|
69
69
|
envConfig: {
|
|
70
70
|
decoder: Generator.ts(`
|
|
71
|
-
AI_ENABLED: zEnvBoolean.optional().default(
|
|
71
|
+
AI_ENABLED: zEnvBoolean.optional().default(false),
|
|
72
72
|
AI_OPENAI_KEY: z.string().optional(),
|
|
73
73
|
AI_OPENAI_MODEL: z.string().optional().default('gpt-4.1-mini'),
|
|
74
74
|
AI_OPENAI_KEYS: z.string().optional(),
|
|
@@ -120,7 +120,7 @@ ai: {
|
|
|
120
120
|
`),
|
|
121
121
|
dotEnvExample: Generator.ts(`
|
|
122
122
|
# Enable or disable AI assistant features on the backend
|
|
123
|
-
AI_ENABLED=
|
|
123
|
+
AI_ENABLED=false
|
|
124
124
|
# Required when AI is enabled unless AI_OPENAI_KEYS is set
|
|
125
125
|
AI_OPENAI_KEY="${apiKeyDummyValue}"
|
|
126
126
|
# Optional: key pool for rotation (comma-separated); used before AI_OPENAI_KEY when set
|
|
@@ -13,6 +13,7 @@ import { expect, test } from '../fixtures/test-fixtures'
|
|
|
13
13
|
test('Navigate to homepage and take snapshot', async ({ page }) => {
|
|
14
14
|
await page.goto('/')
|
|
15
15
|
|
|
16
|
+
await expect(page.getByText('Hi Test User!')).toBeVisible({ timeout: 15000 })
|
|
16
17
|
await expect(page).toHaveScreenshot()
|
|
17
18
|
})
|
|
18
19
|
|
|
@@ -37,7 +38,7 @@ test('Dashboard page is accessible ', async ({ page }) => {
|
|
|
37
38
|
test('Dashboard displays user greeting message', async ({ page }) => {
|
|
38
39
|
await page.goto('/dashboard')
|
|
39
40
|
|
|
40
|
-
await expect(page.getByText('Hi Test User!')).toBeVisible()
|
|
41
|
+
await expect(page.getByText('Hi Test User!')).toBeVisible({ timeout: 15000 })
|
|
41
42
|
})
|
|
42
43
|
|
|
43
44
|
// ------------------------------------------------------------
|
|
@@ -52,9 +53,10 @@ test('Dashboard displays user greeting message', async ({ page }) => {
|
|
|
52
53
|
test('Theme toggle switches to dark mode successfully', async ({ page }) => {
|
|
53
54
|
await page.goto('/dashboard')
|
|
54
55
|
|
|
56
|
+
await expect(page.getByText('Hi Test User!')).toBeVisible({ timeout: 15000 })
|
|
55
57
|
await page.getByTestId('button-toggle-theme').click()
|
|
56
58
|
|
|
57
|
-
await expect(page.getByText("As you may see now it's dark")).toBeVisible()
|
|
59
|
+
await expect(page.getByText("As you may see now it's dark")).toBeVisible({ timeout: 15000 })
|
|
58
60
|
})
|
|
59
61
|
|
|
60
62
|
/**
|
|
Binary file
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { AdminSidebarNavContent } from '@admin/admin-sidebar-nav-content'
|
|
2
2
|
import { AiSidebarContent } from '@app-actions/ai-sidebar-content'
|
|
3
3
|
import { useAuth } from '@context-providers/auth-context-provider'
|
|
4
|
-
import {
|
|
4
|
+
import { UserViewModel } from '@types'
|
|
5
5
|
|
|
6
6
|
import { FunnelPlus, ListTree, ScrollText, Sparkles } from 'lucide-react'
|
|
7
7
|
import React, { useState } from 'react'
|
|
8
8
|
import { toast } from 'sonner'
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import { UpdateUserModal } from '@components/forms/user/update'
|
|
11
11
|
import { Spreadsheet } from '@components/ui/spreadsheet'
|
|
12
12
|
import model from '@components/ui/spreadsheet/model.json'
|
|
13
13
|
import type { Model } from '@components/ui/spreadsheet/types'
|
|
14
|
-
import {
|
|
14
|
+
import { useUsers } from '@hooks/use-users'
|
|
15
15
|
import { hasAnyRole } from '@lib/authorization'
|
|
16
16
|
import {
|
|
17
17
|
ContentFrame,
|
|
@@ -48,10 +48,10 @@ export const DashboardPage = () => {
|
|
|
48
48
|
const { viewerData } = useAuth()
|
|
49
49
|
const userRoles = viewerData?.userRoles ?? []
|
|
50
50
|
const canAccessAdminPage = hasAnyRole(userRoles, ['admin', 'superadmin'])
|
|
51
|
-
const [
|
|
51
|
+
const [selectedUser, setSelectedUser] = useState<UserViewModel | null>(null)
|
|
52
52
|
const [isUpdateModalOpen, setIsUpdateModalOpen] = useState(false)
|
|
53
53
|
|
|
54
|
-
const { list } =
|
|
54
|
+
const { list } = useUsers()
|
|
55
55
|
|
|
56
56
|
const data = {
|
|
57
57
|
Sales: [100, null, 110, 120, 130, 140, null, 160, 170, 180, 190, null, 200, 210, 220, 230, null, null],
|
|
@@ -71,20 +71,20 @@ export const DashboardPage = () => {
|
|
|
71
71
|
<p>roles: {viewerData?.userRoles.join(', ')}</p>
|
|
72
72
|
</div>
|
|
73
73
|
<div className="p-3">
|
|
74
|
-
<h3 className="mb-4">
|
|
74
|
+
<h3 className="mb-4">Users:</h3>
|
|
75
75
|
<ul>
|
|
76
76
|
{list
|
|
77
|
-
.toSorted((a, b) => a.
|
|
78
|
-
.map((
|
|
77
|
+
.toSorted((a, b) => a.name.localeCompare(b.name))
|
|
78
|
+
.map((user) => (
|
|
79
79
|
<li
|
|
80
|
-
key={
|
|
80
|
+
key={user.id}
|
|
81
81
|
onClick={() => {
|
|
82
|
-
|
|
82
|
+
setSelectedUser(user)
|
|
83
83
|
setIsUpdateModalOpen(true)
|
|
84
84
|
}}
|
|
85
85
|
className="cursor-pointer mb-2 hover:underline"
|
|
86
86
|
>
|
|
87
|
-
<strong>{
|
|
87
|
+
<strong>{user.name}</strong>: {user.email}
|
|
88
88
|
</li>
|
|
89
89
|
))}
|
|
90
90
|
</ul>
|
|
@@ -94,16 +94,16 @@ export const DashboardPage = () => {
|
|
|
94
94
|
</div>
|
|
95
95
|
</div>
|
|
96
96
|
</ContentFrame>
|
|
97
|
-
<
|
|
98
|
-
initial={
|
|
97
|
+
<UpdateUserModal
|
|
98
|
+
initial={selectedUser!}
|
|
99
99
|
open={isUpdateModalOpen}
|
|
100
100
|
onClose={() => setIsUpdateModalOpen(false)}
|
|
101
|
-
onSuccess={(
|
|
102
|
-
toast.success(`
|
|
101
|
+
onSuccess={(updatedUser) => {
|
|
102
|
+
toast.success(`User "${updatedUser.name}" updated successfully!`)
|
|
103
103
|
setIsUpdateModalOpen(false)
|
|
104
104
|
}}
|
|
105
|
-
onError={(
|
|
106
|
-
toast.error(`Error updating
|
|
105
|
+
onError={(updatedUser, error) => {
|
|
106
|
+
toast.error(`Error updating user "${updatedUser.name}": ${String(error)}`)
|
|
107
107
|
}}
|
|
108
108
|
/>
|
|
109
109
|
<SidebarTab side="left" id="tab-l-1" icon={ListTree} label="Tab 1 label" order={0}>
|
package/package.json
CHANGED