Commit Graph
69 Commits
Author SHA1 Message Date
robert dennis 89d8cd8717 server startup action 2026-10-12 05:18:56 -04:00
robert dennis ac79b03483 server details action 2026-10-12 05:18:56 -04:00
robert dennis f4eee5e3f6 server build action 2026-10-12 05:18:56 -04:00
robert dennis b218339495 server create action 2026-10-12 05:18:56 -04:00
robert dennis 735308cdd3 database actions 2026-10-12 05:18:56 -04:00
robert dennis b91a8696b0 allocation actions 2026-10-12 05:18:56 -04:00
robert dennis e99328e03f node actions 2026-10-12 05:18:56 -04:00
robert dennis 25ec34fad4 user actions 2026-10-12 05:18:55 -04:00
robert dennis 66765eef2d location actions 2026-10-12 05:18:55 -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
6c0413e39b Start 2.0 development
Co-authored-by: Anthony <anthony@infraly.co>
Co-authored-by: Sky Mulley <daniel.mulley@outlook.com>
2026-10-05 18:10:18 -04:00
Dane Everitt a264791fd4 Update PHP and JS dependencies to latest versions and modernize codebase (#5446) 2025-12-20 15:55:13 -08:00
Matthew Penner 8ca098940a chore: update composer dependencies (#5198)
Signed-off-by: Matthew Penner <me@matthewp.io>
2024-10-21 19:18:20 -06:00
Matthew PennerandDaneEveritt cbcf62086f Upgrade to Laravel 9 (#4413)
Co-authored-by: DaneEveritt <dane@daneeveritt.com>
2022-10-14 10:59:20 -06:00
DaneEveritt ca39830333 allow filtering servers by description; closes #4150 2022-06-26 13:26:12 -04:00
DaneEveritt e9c633fd03 Update transformers and controllers to no longer pull an API key attribute 2022-05-22 15:37:39 -04:00
DaneEveritt e313dff674 Massively simplify API binding logic
Changes the API internals to use normal Laravel binding which automatically supports nested-models and can determine their relationships. This removes a lot of confusingly complex internal logic and replaces it with standard Laravel code.

This also removes a deprecated "getModel" method and fully replaces it with a "parameter" method that does stricter type-checking.
2022-05-22 14:10:01 -04:00
DaneEveritt 634b80ed42 Add support for filtering allocations to determine if they're assigned or not; closes #3872 2022-05-07 16:16:11 -04:00
DaneEveritt 530558b0f8 Update deprecated JSON response creation and unnecessary middleware 2022-05-04 19:23:01 -04:00
Mark Ross d45c67a6e1 Allow to find servers by short UUID (Application API) (#3340) 2021-06-05 08:43:57 -07:00
Dane Everitt 48ad8f538e Always allow specifying a page size with the API; closes #3218 2021-03-26 09:03:51 -07:00
Dane Everitt c449ca5155 Use more standardized phpcs 2021-01-23 12:33:34 -08:00
Dane Everitt ff21d83e2d Add endpoint to get all nodes meeting memory & disk requirements for a server; closes #1012 2021-01-10 13:08:43 -08:00
Dane Everitt 8697185900 Fix up database creation and handling code for servers; ref #2447 2020-10-11 11:59:46 -07:00
Dane Everitt 2560163655 Modify how deletion service works (actually fixes #2085); cover changes with test 2020-10-08 21:08:55 -07:00
Dane Everitt 83efb2d7b6 More fixes for broken unit tests 2020-10-05 21:54:29 -07:00
Dane Everitt d8c338df3e Update all remaining code pathways to use new search tooling 2020-09-13 12:21:44 -07:00
Dane Everitt f31dd4706c Fix location controller searches 2020-09-13 11:59:52 -07:00
Dane Everitt a66623d8e1 Fix user search via the API; ref #2100 2020-09-13 11:55:39 -07:00
Dane Everitt f0e18ba6f7 Code cleanup 2020-07-06 20:05:42 -07:00
Dane Everitt 8fb21a5048 Fix error while updating user 2020-06-25 21:42:21 -07:00
Dane Everitt b78aa180ea Prevent creating a new database via the application API if server is at its limit; closes #2129 2020-06-23 20:07:37 -07:00
Dane Everitt fda88940f7 Fix up node autodeployment 2020-04-12 17:20:09 -07:00
Dane Everitt 34ffcdae7a Remove unnecessary API calls to daemon 2019-12-22 13:45:40 -08:00
Dane Everitt ed50259484 [#3896cn] Clean up code handling server suspension 2019-11-30 15:37:13 -08:00
Dane Everitt 8f0044575f Update server creation data logic 2019-11-16 13:33:01 -08:00
Dane Everitt 7543ef085d Format files 2019-09-05 21:32:57 -07:00
Dane Everitt fb9c106448 Update server listing and associated logic to pull from the panel dynamiacally 2019-08-17 16:03:10 -07:00
Dane Everitt eb81e1ed20 Support special characters in database password, closes #1508 2019-08-03 14:42:32 -07:00
Lance Pioch db937af616 Apply fixes from StyleCI
[ci skip] [skip ci]
2019-01-26 23:26:15 +00:00
Dane Everitt 7c73f21b30 Fix Node daemon secret not being reset, closes #1390 2018-12-02 13:40:12 -08:00
Matthew Penner 0cbedd9c90 Fix LocationController#store() 2018-11-19 22:04:05 -07:00
Matthew Penner afe128042f Wait a second, that method doesn't return an array 2018-11-19 21:54:15 -07:00
Dane Everitt f9542c98e2 Fix tests broken by bad namespaces 2018-09-03 15:59:30 -07:00
Dane Everitt 3bb9bf04e5 Pass the updated model through for updating node config, rather than old model, ref #1237 2018-09-03 14:54:50 -07:00
Dane Everitt 6967b9ba12 Fix exception thrown due to lack of pre-validation on the model.
closes #1158
2018-05-20 17:11:52 -07:00
Dane Everitt 40c74ae1e7 Add validation to prevent invalid ports, closes #1034 2018-03-10 13:10:40 -06:00
Dane Everitt 070239abcf Fix inability to edit certain environment vars and start line, closes #1008 2018-03-01 19:26:11 -06:00
Dane Everitt cef3e4ced4 Add base routes for managing servers as a client 2018-02-27 21:28:43 -06:00