Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement better filtering for autocompletion #48

Open
onitake opened this issue Mar 12, 2019 · 2 comments
Open

Implement better filtering for autocompletion #48

onitake opened this issue Mar 12, 2019 · 2 comments
Labels
Milestone

Comments

@onitake
Copy link

onitake commented Mar 12, 2019

When sending actions against a resource, there is no way to filter the autocompletion results, except via fields that the API accepts.

For example, the start virtualmachine API only accepts the VM UUID, which is a global value and almost useless for autocompletion if there are a lot of VMs for the current account.

Please implement a better way to select resources, for example by adding name, project or other arguments that would query the respective APIs for a list of resources first.

@rohityadavcloud rohityadavcloud added this to the 6.1.0 milestone May 9, 2020
@rohityadavcloud rohityadavcloud removed this from the 6.1.0 milestone May 26, 2020
@onitake
Copy link
Author

onitake commented Jun 9, 2020

This will probably need special cases for each API call or group of API calls. Alternatively, it may be possible to attach a special-case filter to arguments (such as name) instead. This would then automatically apply to all API calls that have this parameter.

Additional care must be taken to "inject" the other parameters given by the user into the query call.

Usage scenaria with special handling for project and name:

  1. User enters start virtualmachine project=abc<TAB>
  2. cmk jumps into the special handler for the project parameter and issues a list projects API call
  3. cmk filters the results by the user-specified prefix "abc" and returns the list to the user
  4. User selects a project from the list, then enters name=xy<TAB>
  5. cmk jumps into the special handler for name and issues a list virtualmachines call, passing along the other parameters (project in this case)
  6. cmk filters the results by the "xy" prefix and presents the list of VMs to the user
  7. User selects the VM from the list and presses enter to send the start command

To make this work, it may be necessary to implement a sort of "translation" between the special parameters and the actual parameters sent later with the API call. For example, when autocompletion for one parameter terminates, the parameter could be automagically transformed into the actual parameter. For project this would mean that after the user selects the project from the list, the parameter is replaced with projectid=<UUID>.

@rohityadavcloud
Copy link
Member

@onitake you probably want to do filtering by manually calling APIs/response to find what you need or use the UI for adv. search capabilities which will probably require a lot of rewriting of cmk code; (to show a widget on CLI with probably a ncurses UI that takes in these filtering parameter while autocompletion).

@rohityadavcloud rohityadavcloud added this to the 6.2.0 milestone Apr 28, 2021
@Pearl1594 Pearl1594 modified the milestones: 6.2.0, 6.3.0 Jul 13, 2021
@borisstoyanov borisstoyanov modified the milestones: 6.3.0, 6.4.0 Apr 28, 2023
@rohityadavcloud rohityadavcloud modified the milestones: 6.4.0, 6.5.0 Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants