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

Add default sorting to trigger types API #4348

Merged
merged 6 commits into from
Sep 24, 2018
Merged

Add default sorting to trigger types API #4348

merged 6 commits into from
Sep 24, 2018

Conversation

LindsayHill
Copy link
Contributor

Trigger types were not sorted by default.

Output could look like this:

+--------------------------------------+----------+-----------------------------------------------------+
| ref                                  | pack     | description                                         |
+--------------------------------------+----------+-----------------------------------------------------+
| core.st2.generic.actiontrigger       | core     | Trigger encapsulating the completion of an action   |
|                                      |          | execution.                                          |
| core.st2.generic.notifytrigger       | core     | Notification trigger.                               |
| core.st2.action.file_writen          | core     | Trigger encapsulating action file being written on  |
|                                      |          | disk.                                               |
| core.st2.generic.inquiry             | core     | Trigger indicating a new "inquiry" has entered      |
|                                      |          | "pending" status                                    |
| core.st2.IntervalTimer               | core     | Triggers on specified intervals. e.g. every 30s,    |
|                                      |          | 1week etc.                                          |
| core.st2.DateTimer                   | core     | Triggers exactly once when the current time matches |
|                                      |          | the specified time. e.g. timezone:UTC               |
|                                      |          | date:2014-12-31 23:59:59.                           |
| core.st2.key_value_pair.create       | core     | Trigger encapsulating datastore item creation.      |
| core.st2.CronTimer                   | core     | Triggers whenever current time matches the          |
|                                      |          | specified time constaints like a UNIX cron          |
|                                      |          | scheduler.                                          |
| core.st2.key_value_pair.update       | core     | Trigger encapsulating datastore set action.         |
| core.st2.key_value_pair.value_change | core     | Trigger encapsulating a change of datastore item    |
|                                      |          | value.                                              |
| core.st2.key_value_pair.delete       | core     | Trigger encapsulating datastore item deletion.      |
| core.st2.sensor.process_spawn        | core     | Trigger indicating sensor process is started up.    |
| core.st2.sensor.process_exit         | core     | Trigger indicating sensor process is stopped.       |
| linux.file_watch.line                | linux    | Trigger which indicates a new line has been         |
|                                      |          | detected                                            |
| core.st2.webhook                     | core     | Trigger type for registering webhooks that can      |
|                                      |          | consume arbitrary payload.                          |
| napalm.LLDPNeighborDecrease          | napalm   | Trigger which occurs when a device's LLDP neighbors |
|                                      |          | decrease                                            |
| examples.sample_trigger              | examples | Sample trigger                                      |
| examples.echoflasksensor             | examples | Echo flask sensor.                                  |
| examples.fibonacci                   | examples | A fibonacci trigger.                                |
| examples.polling_event               | examples | An example trigger.                                 |
| examples.event                       | examples | An example trigger.                                 |
| fixtures.test_passive_trigger.dummy  | fixtures |                                                     |
| fixtures.test_trigger.dummy          | fixtures |                                                     |
+--------------------------------------+----------+-----------------------------------------------------+

(note the position of napalm.LLDPNeighborDecrease.

After changes:

+--------------------------------------+----------+-----------------------------------------------------+
| ref                                  | pack     | description                                         |
+--------------------------------------+----------+-----------------------------------------------------+
| core.st2.CronTimer                   | core     | Triggers whenever current time matches the          |
|                                      |          | specified time constaints like a UNIX cron          |
|                                      |          | scheduler.                                          |
| core.st2.DateTimer                   | core     | Triggers exactly once when the current time matches |
|                                      |          | the specified time. e.g. timezone:UTC               |
|                                      |          | date:2014-12-31 23:59:59.                           |
| core.st2.IntervalTimer               | core     | Triggers on specified intervals. e.g. every 30s,    |
|                                      |          | 1week etc.                                          |
| core.st2.action.file_writen          | core     | Trigger encapsulating action file being written on  |
|                                      |          | disk.                                               |
| core.st2.generic.actiontrigger       | core     | Trigger encapsulating the completion of an action   |
|                                      |          | execution.                                          |
| core.st2.generic.inquiry             | core     | Trigger indicating a new "inquiry" has entered      |
|                                      |          | "pending" status                                    |
| core.st2.generic.notifytrigger       | core     | Notification trigger.                               |
| core.st2.key_value_pair.create       | core     | Trigger encapsulating datastore item creation.      |
| core.st2.key_value_pair.delete       | core     | Trigger encapsulating datastore item deletion.      |
| core.st2.key_value_pair.update       | core     | Trigger encapsulating datastore set action.         |
| core.st2.key_value_pair.value_change | core     | Trigger encapsulating a change of datastore item    |
|                                      |          | value.                                              |
| core.st2.sensor.process_exit         | core     | Trigger indicating sensor process is stopped.       |
| core.st2.sensor.process_spawn        | core     | Trigger indicating sensor process is started up.    |
| core.st2.webhook                     | core     | Trigger type for registering webhooks that can      |
|                                      |          | consume arbitrary payload.                          |
| examples.echoflasksensor             | examples | Echo flask sensor.                                  |
| examples.event                       | examples | An example trigger.                                 |
| examples.fibonacci                   | examples | A fibonacci trigger.                                |
| examples.polling_event               | examples | An example trigger.                                 |
| examples.sample_trigger              | examples | Sample trigger                                      |
| fixtures.test_passive_trigger.dummy  | fixtures |                                                     |
| fixtures.test_trigger.dummy          | fixtures |                                                     |
| linux.file_watch.line                | linux    | Trigger which indicates a new line has been         |
|                                      |          | detected                                            |
| napalm.LLDPNeighborDecrease          | napalm   | Trigger which occurs when a device's LLDP neighbors |
|                                      |          | decrease                                            |
+--------------------------------------+----------+-----------------------------------------------------+

@LindsayHill
Copy link
Contributor Author

Resolves #3927

@Kami
Copy link
Member

Kami commented Sep 24, 2018

IIRC, we sort most of the pack resources by pack, name by default, but I believe end result with using ref should be the same (and might even be more performant since it's sorting on a single vs two fields, but would need to verify).

@Kami Kami added this to the 3.0.0 milestone Sep 24, 2018
@LindsayHill
Copy link
Contributor Author

Yeah, it was a bit of a mix - I think mostly pack, name, but one or two with ref. Works out same end result.

@LindsayHill LindsayHill merged commit 932fa32 into master Sep 24, 2018
@LindsayHill LindsayHill deleted the trigger_sort branch September 24, 2018 22:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants