feat(manager): built-in collection in the Media page and picker; signage screen settings in Devices (platform-v2 step 5.4a)
Media page and picker filter Everything / Your own / Built-in; built-in items are marked and can't be renamed or deleted. The Devices page offers the playlists for a signage screen (with its orientation and rotation). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -10,7 +10,7 @@ import client from '../../api/client'
|
||||
import { configGroups, configValue, refOptions } from './devicesLogic'
|
||||
|
||||
// Where a `ref` field's choices come from (the device list is passed in)
|
||||
const REF_URLS = { prep_zones: '/api/prep-zones', categories: '/api/products/categories', printers: '/api/system/printers', display_looks: '/api/display/looks' }
|
||||
const REF_URLS = { prep_zones: '/api/prep-zones', categories: '/api/products/categories', printers: '/api/system/printers', display_looks: '/api/display/looks', signage_playlists: '/api/signage/playlists' }
|
||||
|
||||
export default function DeviceConfigFields({ appKey, fields = [], value, onChange, devices = [], selfId = null }) {
|
||||
const { t } = useTranslation('manager')
|
||||
@@ -29,6 +29,7 @@ export default function DeviceConfigFields({ appKey, fields = [], value, onChang
|
||||
const categories = lists.categories ?? []
|
||||
const printers = lists.printers ?? []
|
||||
const looks = lists.display_looks ?? []
|
||||
const playlists = lists.signage_playlists ?? []
|
||||
|
||||
if (!fields.length) return null
|
||||
const base = key => `modules:${appKey}.config.${key}`
|
||||
@@ -54,7 +55,7 @@ export default function DeviceConfigFields({ appKey, fields = [], value, onChang
|
||||
<Field key={f.key} label={label} hint={hint}>
|
||||
<Select value={v == null ? '' : String(v)} onChange={e => set(f, e.target.value)} data-config={f.key}
|
||||
options={[{ value: '', label: t(`${base(f.key)}.none`, { defaultValue: t('devices.form.none') }) },
|
||||
...refOptions(f, { zones, categories, printers, looks, devices, selfId })]} />
|
||||
...refOptions(f, { zones, categories, printers, looks, playlists, devices, selfId })]} />
|
||||
</Field>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -86,7 +86,8 @@ export function configGroups(fields = []) {
|
||||
}
|
||||
|
||||
/** Options of a `ref` field: prep zones, categories, printers, customer display looks, or live devices of one app ("devices:<app>"). */
|
||||
export function refOptions(field, { zones = [], categories = [], printers = [], looks = [], devices = [], selfId = null } = {}) {
|
||||
export function refOptions(field, { zones = [], categories = [], printers = [], looks = [], playlists = [], devices = [], selfId = null } = {}) {
|
||||
if (field.choices_from === 'signage_playlists') return playlists.map(p => ({ value: String(p.id), label: p.name }))
|
||||
if (field.choices_from === 'display_looks') return looks.map(l => ({ value: String(l.id), label: l.name }))
|
||||
if (field.choices_from === 'prep_zones') return zones.map(z => ({ value: String(z.id), label: z.name }))
|
||||
if (field.choices_from === 'categories') return categories.map(c => ({ value: String(c.id), label: c.name }))
|
||||
|
||||
Reference in New Issue
Block a user