diff --git a/@xen-orchestra/web/docs/rest-api.md b/@xen-orchestra/web/docs/rest-api.md new file mode 100644 index 0000000000..cf00f7f510 --- /dev/null +++ b/@xen-orchestra/web/docs/rest-api.md @@ -0,0 +1,20 @@ +# REST API + +## How to handle a new record type from the REST API? + +1. Create the new record type in the `types/xo/.type.ts` + + Define the `id` as a branded property (e.g.: `id: Branded<'vm'>`) + + Define the relations with `id` property of the relational record (e.g.: `pool: XoPool['id']`) + +2. Add the REST API configuration for this record in `utils/xo-api-definition.util.ts` +3. Create the store in `stores/xo-rest-api/.store.ts` + + For a basic store: + + ```typescript + const config = createXoStoreConfig('') + + return createSubscribableStoreContext(config, {}) + ``` diff --git a/@xen-orchestra/web/src/components/host/HostHeader.vue b/@xen-orchestra/web/src/components/host/HostHeader.vue index a324144b39..8584ba91c9 100644 --- a/@xen-orchestra/web/src/components/host/HostHeader.vue +++ b/@xen-orchestra/web/src/components/host/HostHeader.vue @@ -23,7 +23,7 @@ diff --git a/@xen-orchestra/web/src/components/pool/PoolHeader.vue b/@xen-orchestra/web/src/components/pool/PoolHeader.vue index c8bd93b60e..4edad32394 100644 --- a/@xen-orchestra/web/src/components/pool/PoolHeader.vue +++ b/@xen-orchestra/web/src/components/pool/PoolHeader.vue @@ -24,13 +24,13 @@ diff --git a/@xen-orchestra/web/src/components/site/dashboard/HostsStatus.vue b/@xen-orchestra/web/src/components/site/dashboard/HostsStatus.vue index 9cc1e892ea..90790909ce 100644 --- a/@xen-orchestra/web/src/components/site/dashboard/HostsStatus.vue +++ b/@xen-orchestra/web/src/components/site/dashboard/HostsStatus.vue @@ -10,7 +10,7 @@ diff --git a/@xen-orchestra/web/src/pages/host/[id]/vms.vue b/@xen-orchestra/web/src/pages/host/[id]/vms.vue index 1c34003bd4..0460a0f7ad 100644 --- a/@xen-orchestra/web/src/pages/host/[id]/vms.vue +++ b/@xen-orchestra/web/src/pages/host/[id]/vms.vue @@ -29,7 +29,7 @@ diff --git a/@xen-orchestra/web/src/pages/pool/[id]/hosts.vue b/@xen-orchestra/web/src/pages/pool/[id]/hosts.vue index ccf35176de..b51163e509 100644 --- a/@xen-orchestra/web/src/pages/pool/[id]/hosts.vue +++ b/@xen-orchestra/web/src/pages/pool/[id]/hosts.vue @@ -29,7 +29,7 @@ diff --git a/@xen-orchestra/web/src/pages/vm/[id]/console.vue b/@xen-orchestra/web/src/pages/vm/[id]/console.vue index c57d40c8f8..aafa01d57a 100644 --- a/@xen-orchestra/web/src/pages/vm/[id]/console.vue +++ b/@xen-orchestra/web/src/pages/vm/[id]/console.vue @@ -4,12 +4,12 @@