fix: use short id
This commit is contained in:
Родитель
29a7c83edc
Коммит
303a3b24b9
|
@ -11,7 +11,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-service"
|
<label for="node-input-service"
|
||||||
><i class="icon-tag"></i> Service code or name</label
|
><i class="icon-tag"></i> Service code or id</label
|
||||||
>
|
>
|
||||||
<input type="text" id="node-input-service" placeholder="*" />
|
<input type="text" id="node-input-service" placeholder="*" />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-service"
|
<label for="node-input-service"
|
||||||
><i class="icon-tag"></i> Service code or name</label
|
><i class="icon-tag"></i> Service code or id</label
|
||||||
>
|
>
|
||||||
<input type="text" id="node-input-service" placeholder="*" />
|
<input type="text" id="node-input-service" placeholder="*" />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-service"
|
<label for="node-input-service"
|
||||||
><i class="icon-tag"></i> Service code or name</label
|
><i class="icon-tag"></i> Service code or id</label
|
||||||
>
|
>
|
||||||
<input type="text" id="node-input-service" placeholder="*" />
|
<input type="text" id="node-input-service" placeholder="*" />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -20,15 +20,16 @@ export function createDeviceFilter(options: JacdacDeviceFilterOptions) {
|
||||||
export function createServiceFilter(options: JacdacServiceFilterOptions) {
|
export function createServiceFilter(options: JacdacServiceFilterOptions) {
|
||||||
const { service, serviceIndex, serviceInstanceName } = options
|
const { service, serviceIndex, serviceInstanceName } = options
|
||||||
|
|
||||||
|
const nservice = service
|
||||||
|
? service.toLowerCase().replace(/\s/g, "")
|
||||||
|
: service
|
||||||
const instanceNameRx = serviceInstanceName
|
const instanceNameRx = serviceInstanceName
|
||||||
? new RegExp(serviceInstanceName, "i")
|
? new RegExp(serviceInstanceName, "i")
|
||||||
: undefined
|
: undefined
|
||||||
return (srv: JDService) =>
|
return (srv: JDService) =>
|
||||||
(!service ||
|
(!service ||
|
||||||
srv.serviceClass === parseInt(service, 16) ||
|
srv.serviceClass === parseInt(service, 16) ||
|
||||||
(srv.name &&
|
(srv.specification && srv.specification.shortId === nservice)) &&
|
||||||
srv.name.toLocaleLowerCase() ===
|
|
||||||
service.toLocaleLowerCase())) &&
|
|
||||||
(serviceIndex === undefined || serviceIndex == srv.serviceIndex) &&
|
(serviceIndex === undefined || serviceIndex == srv.serviceIndex) &&
|
||||||
(!instanceNameRx || instanceNameRx.test(srv.instanceName))
|
(!instanceNameRx || instanceNameRx.test(srv.instanceName))
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче