Compare commits

...

1 Commits

Author SHA1 Message Date
German Jablonski
c78a4821ba initial setup 2025-09-03 19:54:24 +01:00
6 changed files with 91 additions and 1 deletions

View File

@@ -258,6 +258,7 @@ jobs:
- auth
- auth-basic
- bulk-edit
- dashboard
- joins
- field-error-states
- fields-relationship
@@ -396,6 +397,7 @@ jobs:
- auth
- auth-basic
- bulk-edit
- dashboard
- joins
- field-error-states
- fields-relationship

View File

@@ -733,6 +733,11 @@ export type AfterErrorHook = (
args: AfterErrorHookArgs,
) => AfterErrorResult | Promise<AfterErrorResult>
export type DashboardWidget = {
Component: PayloadComponent
slug: string
}
/**
* This is the central configuration
*
@@ -767,7 +772,6 @@ export type Config = {
| {
Component: PayloadComponent
}
/**
* Add extra and/or replace built-in components with custom components
*
@@ -845,6 +849,13 @@ export type Config = {
}
/** Extension point to add your custom data. Available in server and client. */
custom?: Record<string, any>
/**
* Customize the dashboard widgets
*/
dashboard?: {
components?: Array<DashboardWidget>
defaults?: Array<DashboardWidget>
}
/** Global date format that will be used for all dates in the Admin panel. Any valid date-fns format pattern can be used. */
dateFormat?: string
/**

15
test/dashboard/config.ts Normal file
View File

@@ -0,0 +1,15 @@
import { buildConfigWithDefaults } from '../buildConfigWithDefaults.js'
import { devUser } from '../credentials.js'
export default buildConfigWithDefaults({
admin: {},
onInit: async (payload) => {
await payload.create({
collection: 'users',
data: {
email: devUser.email,
password: devUser.password,
},
})
},
})

View File

@@ -0,0 +1,46 @@
import { expect, test } from '@playwright/test'
import { ensureCompilationIsDone } from 'helpers.js'
import { AdminUrlUtil } from 'helpers/adminUrlUtil.js'
import { initPayloadE2ENoConfig } from 'helpers/initPayloadE2ENoConfig.js'
import { reInitializeDB } from 'helpers/reInitializeDB.js'
import path from 'path'
import { TEST_TIMEOUT_LONG } from 'playwright.config.js'
import { fileURLToPath } from 'url'
const filename = fileURLToPath(import.meta.url)
const currentFolder = path.dirname(filename)
const dirname = path.resolve(currentFolder, '../../')
const { beforeAll, beforeEach, describe } = test
// Unlike the other suites, this one runs in parallel, as they run on the `lexical-fully-featured/create` URL and are "pure" tests
test.describe.configure({ mode: 'parallel' })
const { serverURL } = await initPayloadE2ENoConfig({
dirname,
})
const url = new AdminUrlUtil(serverURL, 'users')
describe('Dashboard', () => {
beforeAll(async ({ browser }, testInfo) => {
testInfo.setTimeout(TEST_TIMEOUT_LONG)
process.env.SEED_IN_CONFIG_ONINIT = 'false' // Makes it so the payload config onInit seed is not run. Otherwise, the seed would be run unnecessarily twice for the initial test run - once for beforeEach and once for onInit
const page = await browser.newPage()
await ensureCompilationIsDone({ page, serverURL })
await page.close()
})
beforeEach(async ({ page }) => {
await reInitializeDB({
serverURL,
snapshotKey: 'lexicalTest',
uploadsDir: [path.resolve(dirname, './collections/Upload/uploads')],
})
await page.goto(url.admin)
})
test('todo', async ({ page }) => {
await page.goto(serverURL)
expect(1).toBe(1)
})
})

View File

@@ -0,0 +1,13 @@
{
// extend your base config to share compilerOptions, etc
//"extends": "./tsconfig.json",
"compilerOptions": {
// ensure that nobody can accidentally use this config for a build
"noEmit": true
},
"include": [
// whatever paths you intend to lint
"./**/*.ts",
"./**/*.tsx"
]
}

View File

@@ -0,0 +1,3 @@
{
"extends": "../tsconfig.json"
}