From 15d37d8e587af6f02c59bba80a8925c1c0fb8f9e Mon Sep 17 00:00:00 2001 From: Edward Moyse Date: Fri, 20 Sep 2024 14:18:30 +0200 Subject: [PATCH 1/3] No need to load files twice. --- packages/phoenix-event-display/src/helpers/file.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/phoenix-event-display/src/helpers/file.ts b/packages/phoenix-event-display/src/helpers/file.ts index be1ac540..86703aff 100644 --- a/packages/phoenix-event-display/src/helpers/file.ts +++ b/packages/phoenix-event-display/src/helpers/file.ts @@ -53,6 +53,6 @@ export const loadFile = ( }; inputFile.oninput = fileSelected; - inputFile.onchange = fileSelected; + // inputFile.onchange = fileSelected; inputFile.click(); }; From ee69d1b49ba3e338964374c1fdb9b0bed3b7f046 Mon Sep 17 00:00:00 2001 From: Edward Moyse Date: Sat, 21 Sep 2024 14:55:03 +0200 Subject: [PATCH 2/3] Update label text when loading labels file, and store label text with EDM object to do this --- .../src/loaders/phoenix-loader.ts | 4 +++- .../src/managers/ui-manager/index.ts | 10 ++++++++++ .../collections-info-overlay.component.html | 1 + .../collections-info-overlay.component.ts | 2 +- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/packages/phoenix-event-display/src/loaders/phoenix-loader.ts b/packages/phoenix-event-display/src/loaders/phoenix-loader.ts index 78114c52..c6ece63d 100644 --- a/packages/phoenix-event-display/src/loaders/phoenix-loader.ts +++ b/packages/phoenix-event-display/src/loaders/phoenix-loader.ts @@ -736,7 +736,9 @@ export class PhoenixLoader implements EventDataLoader { this.labelsObject[eventDataType][collection] || {}; this.labelsObject[eventDataType][collection][indexInCollection] = label; - + const tmp = + this.eventData[eventDataType][collection][indexInCollection]; + tmp.labelText = label; return getLabelTitle(eventDataType, collection, indexInCollection); } } diff --git a/packages/phoenix-event-display/src/managers/ui-manager/index.ts b/packages/phoenix-event-display/src/managers/ui-manager/index.ts index dd2207ea..d11585d8 100644 --- a/packages/phoenix-event-display/src/managers/ui-manager/index.ts +++ b/packages/phoenix-event-display/src/managers/ui-manager/index.ts @@ -566,10 +566,20 @@ export class UIManager { const labelsObject = eventDataLoader?.getLabelsObject(); if (eventDataLoader && labelsObject) { loadFile((data) => { + console.log('UIManager: loading Labels'); const labelsObject = JSON.parse(data); + // This contains the names of the labels, but not their colours. for (const eventDataType of Object.keys(labelsObject)) { for (const collection of Object.keys(labelsObject[eventDataType])) { const collectionObject = eventDataLoader.getCollection(collection); + if (!collectionObject) { + console.log( + 'WARNING - cannot find ', + collection, + ' in eventDataLoader. Skipping.', + ); + continue; + } for (const labelIndex of Object.keys( labelsObject[eventDataType][collection], )) { diff --git a/packages/phoenix-ng/projects/phoenix-ui-components/lib/components/ui-menu/collections-info/collections-info-overlay/collections-info-overlay.component.html b/packages/phoenix-ng/projects/phoenix-ui-components/lib/components/ui-menu/collections-info/collections-info-overlay/collections-info-overlay.component.html index e101e280..6d35341b 100644 --- a/packages/phoenix-ng/projects/phoenix-ui-components/lib/components/ui-menu/collections-info/collections-info-overlay/collections-info-overlay.component.html +++ b/packages/phoenix-ng/projects/phoenix-ui-components/lib/components/ui-menu/collections-info/collections-info-overlay/collections-info-overlay.component.html @@ -116,6 +116,7 @@ diff --git a/packages/phoenix-ng/projects/phoenix-ui-components/lib/components/ui-menu/collections-info/collections-info-overlay/collections-info-overlay.component.ts b/packages/phoenix-ng/projects/phoenix-ui-components/lib/components/ui-menu/collections-info/collections-info-overlay/collections-info-overlay.component.ts index 9548d560..c1c0b064 100644 --- a/packages/phoenix-ng/projects/phoenix-ui-components/lib/components/ui-menu/collections-info/collections-info-overlay/collections-info-overlay.component.ts +++ b/packages/phoenix-ng/projects/phoenix-ui-components/lib/components/ui-menu/collections-info/collections-info-overlay/collections-info-overlay.component.ts @@ -51,7 +51,7 @@ export class CollectionsInfoOverlayComponent implements OnInit { })); this.collectionColumns = Object.keys(this.showingCollection[0]).filter( - (column) => !['uuid', 'hits', 'isCut'].includes(column), // FIXME - this is an ugly hack. But currently hits from tracks make track collections unusable. Better to have exlusion list passed in. + (column) => !['uuid', 'hits', 'isCut', 'labelText'].includes(column), // FIXME - this is an ugly hack. But currently hits from tracks make track collections unusable. Better to have exlusion list passed in. ); } From 01c3b94ac65fd60655d07e3ac65dc6756924a9a5 Mon Sep 17 00:00:00 2001 From: Edward Moyse Date: Sat, 21 Sep 2024 14:57:59 +0200 Subject: [PATCH 3/3] Correctly reset GUI label colour when loading configuration --- .../ui-manager/phoenix-menu/phoenix-menu-node.ts | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/packages/phoenix-event-display/src/managers/ui-manager/phoenix-menu/phoenix-menu-node.ts b/packages/phoenix-event-display/src/managers/ui-manager/phoenix-menu/phoenix-menu-node.ts index 14b21811..498cd608 100644 --- a/packages/phoenix-event-display/src/managers/ui-manager/phoenix-menu/phoenix-menu-node.ts +++ b/packages/phoenix-event-display/src/managers/ui-manager/phoenix-menu/phoenix-menu-node.ts @@ -150,13 +150,12 @@ export class PhoenixMenuNode { // Apply configs of different config types - manual if (config.type === 'checkbox' && config?.['isChecked']) { config.onChange?.(config?.['isChecked']); - } else if ( - config.type === 'color' && - config?.['color'] && - config.group !== undefined - ) { - // Ignore color by options with `!config.group`, otherwise the collection color is overridden - config.onChange?.(config?.['color']); + } else if (config.type === 'color' && config?.['color']) { + if (config.group !== undefined || this.name === 'Labels') { + // Ignore color by options with `!config.group`, otherwise the collection color is overridden + // Exception for Labels node, which should always have color applied + config.onChange?.(config?.['color']); + } } else if (config.type === 'slider' && config?.['value']) { config.onChange?.(config?.['value']); } else if ( @@ -216,8 +215,6 @@ export class PhoenixMenuNode { nodeConfig.type === configState['type'] && nodeConfig.label === configState['label'], ); - // configs: PhoenixMenuConfigs[keyof PhoenixMenuConfigs][] = []; - if (nodeConfigs.length > 1) { console.error( 'Multiple configs found with same label and type in phoenix menu node.',