From 303a3b24b9d9237798c96fa425ace4c0ddcf9e7b Mon Sep 17 00:00:00 2001 From: pelikhan Date: Fri, 22 Oct 2021 23:02:46 -0700 Subject: [PATCH] fix: use short id --- src/nodes/jacdac-command/jacdac-command.html/editor.html | 2 +- src/nodes/jacdac-event/jacdac-event.html/editor.html | 2 +- src/nodes/jacdac-report/jacdac-report.html/editor.html | 2 +- src/nodes/shared/filters.ts | 7 ++++--- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/nodes/jacdac-command/jacdac-command.html/editor.html b/src/nodes/jacdac-command/jacdac-command.html/editor.html index b12178f..d76feaa 100644 --- a/src/nodes/jacdac-command/jacdac-command.html/editor.html +++ b/src/nodes/jacdac-command/jacdac-command.html/editor.html @@ -11,7 +11,7 @@
Service code or id
diff --git a/src/nodes/jacdac-event/jacdac-event.html/editor.html b/src/nodes/jacdac-event/jacdac-event.html/editor.html index dc81750..cfa7242 100644 --- a/src/nodes/jacdac-event/jacdac-event.html/editor.html +++ b/src/nodes/jacdac-event/jacdac-event.html/editor.html @@ -11,7 +11,7 @@
Service code or id
diff --git a/src/nodes/jacdac-report/jacdac-report.html/editor.html b/src/nodes/jacdac-report/jacdac-report.html/editor.html index cb8ac46..01de257 100644 --- a/src/nodes/jacdac-report/jacdac-report.html/editor.html +++ b/src/nodes/jacdac-report/jacdac-report.html/editor.html @@ -11,7 +11,7 @@
Service code or id
diff --git a/src/nodes/shared/filters.ts b/src/nodes/shared/filters.ts index 72cffb7..5010553 100644 --- a/src/nodes/shared/filters.ts +++ b/src/nodes/shared/filters.ts @@ -20,15 +20,16 @@ export function createDeviceFilter(options: JacdacDeviceFilterOptions) { export function createServiceFilter(options: JacdacServiceFilterOptions) { const { service, serviceIndex, serviceInstanceName } = options + const nservice = service + ? service.toLowerCase().replace(/\s/g, "") + : service const instanceNameRx = serviceInstanceName ? new RegExp(serviceInstanceName, "i") : undefined return (srv: JDService) => (!service || srv.serviceClass === parseInt(service, 16) || - (srv.name && - srv.name.toLocaleLowerCase() === - service.toLocaleLowerCase())) && + (srv.specification && srv.specification.shortId === nservice)) && (serviceIndex === undefined || serviceIndex == srv.serviceIndex) && (!instanceNameRx || instanceNameRx.test(srv.instanceName)) }