PUT /panels/ carries a version and refuses a stale one with 409
The Panels dialog re-reads the list on 409. A panels.json without a version reads as 0.
This commit is contained in:
@@ -2933,6 +2933,11 @@ export const PanelsConfigSchema = {
|
||||
},
|
||||
type: 'array',
|
||||
title: 'Panels'
|
||||
},
|
||||
version: {
|
||||
type: 'integer',
|
||||
title: 'Version',
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
type: 'object',
|
||||
@@ -2949,6 +2954,11 @@ export const PanelsPublicSchema = {
|
||||
type: 'array',
|
||||
title: 'Panels'
|
||||
},
|
||||
version: {
|
||||
type: 'integer',
|
||||
title: 'Version',
|
||||
default: 0
|
||||
},
|
||||
frontend_host: {
|
||||
type: 'string',
|
||||
title: 'Frontend Host',
|
||||
|
||||
@@ -1946,6 +1946,11 @@ export class PanelsService {
|
||||
* A panel that disappears here takes its credential with it, so this is also
|
||||
* how a device is unpaired along with its assignment. Re-pairing one screen
|
||||
* and keeping the assignment is ``/{panel_id}/unpair`` below.
|
||||
*
|
||||
* The body carries the ``version`` it was based on, and a save someone else
|
||||
* has moved past is refused with 409, as a dashboard's is. Two clients each
|
||||
* writing back the whole list would otherwise drop each other's panels, and
|
||||
* a dropped panel revokes its screen at once.
|
||||
* @param data The data for the request.
|
||||
* @param data.requestBody
|
||||
* @returns PanelsPublic Successful Response
|
||||
|
||||
@@ -994,6 +994,7 @@ export type direction = 'in' | 'out';
|
||||
*/
|
||||
export type PanelsConfig = {
|
||||
panels?: Array<PanelDef>;
|
||||
version?: number;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -1009,6 +1010,7 @@ export type PanelsConfig = {
|
||||
*/
|
||||
export type PanelsPublic = {
|
||||
panels?: Array<PanelDef>;
|
||||
version?: number;
|
||||
frontend_host?: string;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user