ara icon indicating copy to clipboard operation
ara copied to clipboard

ui: ability to search by host or task name instead of host ID and task ID

Open dmsimard opened this issue 3 years ago • 5 comments

What is the idea ?

When searching in a playbook task's results, we have host ID and task ID fields: Screenshot from 2021-04-01 10-14-30

These are not really meant for humans because they are not expected to know the "internal" IDs given by ara to hosts and tasks -- it would be better if users could search by host and task names instead.

I've explained why things are the way they are in a previous comment but in a nutshell, it's because we are searching task results and these are associated to task IDs and host IDs, not their names.

In that comment, I suggested a possible approach:

I haven't given this much thought yet but maybe under the hood we could search for a hostname for that playbook (/api/v1/hosts?playbook=<id>&name=foo), get it's ID and then filter with that -- but strictly API speaking, we cannot search a result by hostname right now.

It's worth noting that the current implementation is not useless, though. It allows the UI to provide links on things like host names and task names where clicking on them will search for their IDs.

dmsimard avatar Apr 01 '21 14:04 dmsimard

What makes this a bit complicated to implement in this particular table has already been explained but I realized that we had worked around this with the new "hosts" page which features search by host name (amongst other things).

There is a use case for searching by task name and I figured we might as well have a "tasks" page that works much in the same way. I've submitted a PR that adds this new tasks page: https://github.com/ansible-community/ara/pull/342

dmsimard avatar Dec 05 '21 01:12 dmsimard

Just looked into it, turned out, it is quite easy and straightforwared to a filter for hostname (for task would be the same):

UI image

API image

hille721 avatar Aug 05 '22 14:08 hille721

now with taskname filter as well:

image

@dmsimard : shoul I do a PR

hille721 avatar Aug 05 '22 15:08 hille721

It's nice that it works \o/

It would be nice to have inside the playbook page but I'm not sure about the playbooks' search box since the hosts and tasks page will immediately return the data vs needing to click on the playbook and then searching for it again.

You don't need my permission to open a PR :p

dmsimard avatar Aug 06 '22 23:08 dmsimard

It would be nice to have inside the playbook page but I'm not sure about the playbooks' search box since the hosts and tasks page will immediately return the data vs needing to click on the playbook and then searching for it again.

Ah now I got it. The search box with the host and task id was inside a certain playbook page. Was already wondering why I did't saw it :) But yeah, this is easy as well: image

Despite the host and task index page the search ability on the playook index page would be pretty nice as well. E.g. there you are able to filter for an Ansible controller or label and hostname.

hille721 avatar Aug 08 '22 06:08 hille721