[stork-users] lease Search
Slawek Figiel
slawek at isc.org
Fri Jan 17 16:10:37 UTC 2025
Hello Ralf!
The API is called in line 161:
```
this.dhcpApi
.getLeases(searchText)
```
The UI API client is generated by the OpenAPI Generator, and its
requests are handled by the API generated by GoSwagger. The API is
defined in the /api directory.
The "getLeases" UI call executes the "GetLeases" handler in the backend
code (backend/server/restservice/leases.go:23).
The "GetLeases" handler calls the "FindLeases," "FindDeclinedLeases,"
and "FindLeasesByHostID" functions defined in the
backend/server/apps/kea/lease.go file. These functions prepare and send
the requests to the Stork agent through the
"agents.ForwardToKeaOverHTTP" calls.
The requests are received by the handler implemented in
"backend/agent/agent.go:367" and then passed throught to Kea API by the
"sa.KeaHTTPClient.Call" call (line 396).
> But in which file is the call itself /where are the search parameter set?
The search filter value is set in
"webui/src/app/lease-search-page/lease-search-page.component.ts" in line
149. It is bound to the text input with the "leases-search-input" ID
defined in
"webui/src/app/lease-search-page/lease-search-page.component.html:21".
I hope it will be helpful for you!
Regards,
Slawek Figiel
On 1/12/25 1:47 PM, Ralf Figge wrote:
> Hello Slawek,
> some points i have found.
> test, if the search text is ok : lease-search-page.component.ts (i have
> change/add)
> I think, this is for test-util: lease-search-page.component.spec.ts
> Help text : lease-search-page.component.html (i have change/add)
>
> But in which file is the call itself /where are the search parameter set?
>
> regards
> Ralf
>
> Am 31.12.2024 um 18:10 schrieb Slawek Figiel:
>> Hello Ralf!
>>
>> It is a bit complex question. ;)
>>
>> The lease search works this way: the Stork server looks for a lease in
>> all registered Kea DHCP daemons one by one by calling their lease_cmd
>> hook commands.
>>
>> It means that the search itself is performed on the Kea side, and if
>> you want to extend the search capabilities, you need to contribute to
>> Kea first.
>>
>> Answering your original question, the lease search is written in:
>>
>> - C++ - Kea core and Kea lease hook
>> - Golang - Stork backend
>> - HTML/SASS/TypeScript (Angular+PrimeNG) - Stork UI
>>
>> Happy New Year!
>> Regards,
>> Slawek Figiel
>>
>> In day 24.12.2024 17:33, Ralf Figge wrote:
>>> Hello,
>>>
>>> First of all, Merry Christmas to everyone. In which language is the
>>> lease search written ? I will add some new searches. In which files
>>> must i look and must change functions ? regards Ralf
>>>
>>>
>>
>
More information about the Stork-users
mailing list