[api] move more webui logic to use API models
[webui] use :xpath for xpath queries
[api] remove unused flag controller

We'll do it directly later
[webui] move comments logic completely into webui