Last change
on this file since 41ac15d was
261d490,
checked in by OpenGnSys Support Team <soporte-og@…>, 4 years ago
|
#1052 Populate session column when adding actions
If the scope of a command, procedure or task is related to a group of
computers then actions associated with that schedule can share the same
session value.
og_dbi_add_action was not initializing session value, as it is only used
for visualization purposes in the legacy web interface.
This patch enables og_dbi_add_action to populate session column by
assigning it the id value of the first action related to the scope.
Example: Power off command for a room scope of 4 clients will result in
4 actions, a power off for each client. The first action id will determine
the session value for the rest.
|
-
Property mode set to
100644
|
File size:
1.5 KB
|
Rev | Line | |
---|
[83b242c] | 1 | #ifndef _OG_SCHEDULE_H_ |
---|
| 2 | #define _OG_SCHEDULE_H_ |
---|
| 3 | |
---|
| 4 | #include <stdint.h> |
---|
[6c7d827] | 5 | #include <stdbool.h> |
---|
[83b242c] | 6 | #include "dbi.h" |
---|
| 7 | #include "list.h" |
---|
| 8 | #include <ev.h> |
---|
| 9 | |
---|
| 10 | struct og_schedule_time { |
---|
| 11 | uint32_t years; |
---|
| 12 | uint32_t months; |
---|
| 13 | uint32_t weeks; |
---|
| 14 | uint32_t week_days; |
---|
| 15 | uint32_t days; |
---|
| 16 | uint32_t hours; |
---|
| 17 | uint32_t am_pm; |
---|
| 18 | uint32_t minutes; |
---|
[e68fefe] | 19 | bool check_stale; |
---|
[83b242c] | 20 | }; |
---|
| 21 | |
---|
[63c4ea5] | 22 | enum og_schedule_type { |
---|
| 23 | OG_SCHEDULE_TASK, |
---|
[a63ec0b] | 24 | OG_SCHEDULE_PROCEDURE, |
---|
[894d833] | 25 | OG_SCHEDULE_COMMAND, |
---|
[63c4ea5] | 26 | }; |
---|
| 27 | |
---|
[83b242c] | 28 | struct og_schedule { |
---|
| 29 | struct list_head list; |
---|
| 30 | struct ev_timer timer; |
---|
| 31 | time_t seconds; |
---|
| 32 | unsigned int task_id; |
---|
| 33 | unsigned int schedule_id; |
---|
[63c4ea5] | 34 | enum og_schedule_type type; |
---|
[83b242c] | 35 | }; |
---|
| 36 | |
---|
| 37 | void og_schedule_create(unsigned int schedule_id, unsigned int task_id, |
---|
[63c4ea5] | 38 | enum og_schedule_type type, |
---|
[83b242c] | 39 | struct og_schedule_time *time); |
---|
| 40 | void og_schedule_update(struct ev_loop *loop, unsigned int schedule_id, |
---|
| 41 | unsigned int task_id, struct og_schedule_time *time); |
---|
| 42 | void og_schedule_delete(struct ev_loop *loop, uint32_t schedule_id); |
---|
| 43 | void og_schedule_next(struct ev_loop *loop); |
---|
| 44 | void og_schedule_refresh(struct ev_loop *loop); |
---|
[894d833] | 45 | void og_schedule_run(unsigned int task_id, unsigned int schedule_id, |
---|
| 46 | enum og_schedule_type type); |
---|
[83b242c] | 47 | |
---|
[04ca20e] | 48 | int og_dbi_schedule_get(void); |
---|
| 49 | int og_dbi_update_action(uint32_t id, bool success); |
---|
| 50 | |
---|
| 51 | struct og_task { |
---|
| 52 | uint32_t task_id; |
---|
| 53 | uint32_t procedure_id; |
---|
| 54 | uint32_t command_id; |
---|
| 55 | uint32_t center_id; |
---|
| 56 | uint32_t schedule_id; |
---|
| 57 | uint32_t type_scope; |
---|
[261d490] | 58 | uint32_t session; |
---|
[04ca20e] | 59 | uint32_t scope; |
---|
| 60 | const char *filtered_scope; |
---|
| 61 | const char *params; |
---|
| 62 | }; |
---|
| 63 | |
---|
| 64 | int og_dbi_queue_procedure(struct og_dbi *dbi, struct og_task *task); |
---|
| 65 | |
---|
[83b242c] | 66 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.