From f46963b6b3176395acc07863c9936a7c7f31d31a Mon Sep 17 00:00:00 2001 From: Lorenzo Alberto Maria Ambrosi Date: Thu, 2 Sep 2021 11:04:17 +0200 Subject: [PATCH] Restore image file selection LED-drive pathing Change-type: patch Signed-off-by: Lorenzo Alberto Maria Ambrosi --- lib/gui/app/models/leds.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/gui/app/models/leds.ts b/lib/gui/app/models/leds.ts index 4fb2feea..85940055 100644 --- a/lib/gui/app/models/leds.ts +++ b/lib/gui/app/models/leds.ts @@ -17,9 +17,12 @@ import * as _ from 'lodash'; import { Animator, AnimationFunction, Color, RGBLed } from 'sys-class-rgb-led'; -import { DrivelistDrive } from '../../../shared/drive-constraints'; +import { + DrivelistDrive, + isSourceDrive, +} from '../../../shared/drive-constraints'; import { getDrives } from './available-drives'; -import { getImage, getSelectedDrives } from './selection-state'; +import { getSelectedDrives } from './selection-state'; import * as settings from './settings'; import { observe, store } from './store'; @@ -172,7 +175,9 @@ function stateObserver() { const availableDrives = getDrives().filter( (d: DrivelistDrive) => d.devicePath, ); - const sourceDrivePath = getImage()?.drive?.devicePath; + const sourceDrivePath = availableDrives.filter((d: DrivelistDrive) => + isSourceDrive(d, s.selection.image), + )[0]?.devicePath; const availableDrivesPaths = availableDrives.map( (d: DrivelistDrive) => d.devicePath, );