Commit Graph
58 Commits
Author SHA1 Message Date
robert dennis ec60d70e4c theme tooling 2026-10-12 14:24:49 -04:00
robert dennis 3bb514cefa layout views 2026-10-12 14:22:58 -04:00
robert dennis 9cf7804d20 skin primitives 2026-10-12 14:22:47 -04:00
robert dennis ae30c960e9 theme page view 2026-10-12 08:17:32 -04:00
robert dennis be99a0614b theme tests 2026-10-12 08:15:22 -04:00
robert dennis 01787b8c22 theme platform 2026-10-12 08:15:15 -04:00
robert dennis 117d8ee489 theme runtime tests 2026-10-12 08:14:53 -04:00
robert dennis 7b8b592900 theme views 2026-10-12 08:14:53 -04:00
robert dennis 4bf44634d1 node tag hints 2026-10-12 05:18:59 -04:00
robert dennis 12073c8f9b tag create by name 2026-10-12 05:18:59 -04:00
robert dennis 6c192cab79 node tags tab 2026-10-12 05:18:59 -04:00
robert dennis cb9e2b4624 tag lookups 2026-10-12 05:18:59 -04:00
robert dennis cd564977cd admin tag checks 2026-10-12 05:18:59 -04:00
robert dennis 6a654e6091 deployable node filters 2026-10-12 05:18:59 -04:00
robert dennis bdf28c1933 node tag includes 2026-10-12 05:18:59 -04:00
robert dennis fea87fd8f2 pin api base url 2026-10-12 05:18:57 -04:00
robert dennis 8acf6a0f1e activity docs 2026-10-12 05:18:56 -04:00
robert dennis 41dc05ec48 admin build rules 2026-10-12 05:18:56 -04:00
robert dennis 838b154168 validation cleanup 2026-10-12 05:18:56 -04:00
robert dennis 56662280a2 openapi fixes 2026-10-12 05:18:55 -04:00
robert dennis 77ec6c14a4 account key actions 2026-10-12 05:18:55 -04:00
robert dennis 2e56c584f0 password reset action 2026-10-12 05:18:55 -04:00
robert dennis 1a4b6b1a4f startup variable action 2026-10-12 05:18:55 -04:00
robert dennis 48628b5288 extension error history 2026-10-12 05:18:55 -04:00
robert dennis 1e79399c4b admin backup toggle 2026-10-12 05:18:55 -04:00
robert dennis ab3f169141 docker image validation 2026-10-12 05:18:55 -04:00
robert dennis 17b2091a98 egg import validation 2026-10-12 05:18:55 -04:00
robert dennis e1a9abde2d openapi path params 2026-10-12 05:18:54 -04:00
robert dennis 706d7ea5a9 console scrollbar 2026-10-11 01:11:32 -04:00
robert dennis cd5925da87 egg config round trip 2026-10-09 17:34:17 -04:00
Sky Mulleyandrobert dennis 71dd1911a5 Implement native support for hooking into forms with extensions (#7256)
## Problem

Extensions can render content before and after most admin pages, but not
inside the forms on them. The only exception was
`panel.users.detail.form`, and it could only re-render or validate the
user's existing fields. An extension had no way to add a field of its
own, because the Panel's save requests had nowhere to carry the value
and nothing loaded it back.

## Changes

### Slots inside every admin form

The create and edit forms for users, nodes, servers, eggs, locations,
mounts and database hosts each render a slot inside the form, such as
`panel.servers.create.form` and `panel.servers.detail.details.form`. The
slot receives the native `form`, the form's `kind` (`admin.server`), and
`mode` (`'create'` or `'edit'`). Edit slots also receive the saved
`resource`. Contributed `form.AppField` controls share the form's
validation, pending state and submit action.

### Extension-owned fields

An extension registers fields in its provider:

```php
$this->registerFormFields('admin.user', ['plan' => ['required', 'in:free,pro']]);

$this->registerFormFields(
    'admin.node',
    ['region' => ['required', 'string', 'max:32']],
    fn (Node $node): array => ['region' => NodeRegion::for($node)],
    fn (Node $node, array $values) => NodeRegion::store($node, $values['region']),
);
```

The 14 create and update endpoints accept an optional `extensions: {
[extensionId]: { [field]: value } }` body field. Each extension's rules
are applied as `extensions.{id}.{field}`, and only when the request
includes that extension's values. The extension's `save` callback runs
in the same database transaction as the core change, so a failure rolls
both back.

Server creation is the exception. Wings reads the new server while
provisioning it, so extension values are saved after provisioning
succeeds, outside the transaction.

For Node updates when Wings is unreachable. `UpdateNode` saves the node
and then throws `ConfigurationNotPersistedException` as a warning. The
node controller defers that exception until the extension values are
saved, so the node update is no longer rolled back.

`GET /api/admin/extensions/forms/{form}/{id}` returns every extension's
current values. It requires the resource's read permission. Edit pages
fetch it before rendering the form, but only when an extension has
registered fields for that form; the bootstrap payload now lists them
per extension in `forms`.

For users and servers the callbacks are optional, and values are stored
in the extension's scoped settings (`settings()->forUser($user)`,
`forServer($server)`). Values are limited to strings, numbers, booleans,
`null`, or lists of strings and numbers, which keeps the OpenAPI schema
and generated types concrete.

A `load` callback that throws, or returns an invalid value, is recorded
against the extension in the `form` phase. The frontend then hides that
extension's slot contributions on the edit page, so a save cannot
overwrite its stored values with defaults. Fields of a disabled or
failed extension are neither validated, saved nor loaded.

---------

Co-authored-by: robert dennis <31261583+robertdrakedennis@users.noreply.github.com>
2026-10-09 01:26:45 -04:00
robert dennis 135b298560 alpha cleanup 2026-10-08 19:17:30 -04:00
robert dennis e217e42360 complexity cleanup 2026-10-08 18:49:15 -04:00
robert dennis 56fb932a73 action cleanup 2026-10-08 17:40:00 -04:00
robert dennis cceaa535b8 lint cleanup 2026-10-08 16:54:59 -04:00
robert dennis ea1818fab9 screen lookup cleanup 2026-10-08 16:53:56 -04:00
robert dennis 21c6071680 loader cleanup 2026-10-08 16:53:56 -04:00
robert dennis 1ba166e8a6 slot type cleanup 2026-10-08 16:53:56 -04:00
robert dennis b516dc3646 registry cleanup 2026-10-08 16:53:56 -04:00
robert dennis 8d4f47fa6a extensions facade 2026-10-08 16:53:56 -04:00
robert dennis f154449a80 console command cleanup 2026-10-07 16:32:56 -04:00
robert dennis bd2c62fc6f extension migration fixes 2026-10-07 16:27:19 -04:00
robert dennis fb08b51ae8 composer package checks 2026-10-07 16:22:56 -04:00
robert dennis 752a132773 composer autoloader guard 2026-10-07 16:16:18 -04:00
Sky Mulley dd81db5d4d implement ability to set icon for extensions 2026-10-07 10:46:54 +01:00
DarkZmaj 7fc5934616 Stop extension builds from preloading lazy chunks from the site root (#7253)
## Problem

An extension built with the SDK Vite preset whose lazy screens share a
module requests its shared chunk from the site root. For example
`/chunk.api.Hb1egxRz.js` returns the single page app shell (status 200,
`text/html`), and the browser logs `Failed to load module script:
Expected a JavaScript module script but the server responded with a MIME
type of "text/html"`. The extension still works, because the real
imports are relative, but every page load that touches such a screen
produces failing requests and console errors.

## Reproduction

1. Scaffold an extension with `php artisan p:extension:make demo`.
2. Register two screens with `screens.register('a', () =>
import('./A'))` and `screens.register('b', () => import('./B'))`, where
both import the same helper module.
3. Build it and enable it, then open one of the screens with the browser
network panel open.

The built `dist/client.js` starts with a `__vite__mapDeps` list of bare
chunk file names. Vite's preload helper resolves those names against the
document, not against the bundle.

## Root cause

Vite emits a `modulepreload` dependency map for dynamic imports. The
preset does not turn it off, and the helper's base is the page URL, so
the extension's chunk names resolve to the site root.

## Fix

Set `build.modulePreload` to `false` in `defineExtensionConfig`. Chunks
import each other with relative URLs, which already resolve against the
bundle, so nothing else changes. Preloading is only a hint.

## Testing

* New test in `packages/sdk/vite.spec.ts` builds an entry with two lazy
imports that share a module and asserts that the output contains no
preload map. It fails before the change and passes after it.
* `npx vitest run packages/sdk/vite.spec.ts` passes.
* Checked in a browser: the failing requests for the shared chunk
disappear and the screens still load.

## Compatibility considerations

Extensions rebuilt with the new preset lose a performance hint only.
Existing builds keep working as before.
2026-10-06 22:48:26 -04:00
robert dennis 5a15f59eab console command fixes 2026-10-06 20:11:59 -04:00
robert dennis c1b7294469 autoload validation 2026-10-06 20:11:59 -04:00
robert dennis cd24c7fe04 action wrapping cleanup 2026-10-06 20:11:59 -04:00
robert dennis 7db75f2e4a install handling cleanup 2026-10-06 20:11:59 -04:00