Skip to content

Commit da6bd48

Browse files
committed
Adds template docs
Signed-off-by: Daniel Kastl <[email protected]>
1 parent 2408ff3 commit da6bd48

6 files changed

+140
-3
lines changed

app/models/subscription_template.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ def take_json_entities
8181
end
8282

8383
def take_json_geometry
84+
return if geometry_string.blank?
85+
8486
self.geometry = JSON.parse(geometry_string)
8587
rescue JSON::ParserError
8688
errors.add :geometry_string, I18n.t(:error_invalid_json)

doc/form_subscription_template.png

-162 KB
Binary file not shown.
-1.23 KB
Loading
1.68 KB
Loading
-2.12 KB
Loading

doc/subscription_template.md

Lines changed: 138 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,141 @@
11
# Subscription Templates
22

3-
Subscription Templates are a part of the Redmine GTT FIWARE Plugin.
4-
They are used to manage subscriptions to FIWARE context broker services.
3+
This section provides detailed instructions on how to create or edit a
4+
subscription template in the Redmine GTT FIWARE plugin. Subscription templates
5+
allow you to define how FIWARE notifications should be handled and converted
6+
into Redmine issues.
57

6-
TBD
8+
## Accessing the Subscription Template Page
9+
10+
1. Navigate to the project where you want to create or edit a subscription template.
11+
2. Go to **Settings**.
12+
3. Click on the **FIWARE** tab.
13+
4. Click on **New Subscription Template** or select an existing template to edit.
14+
15+
## General Settings
16+
17+
In the **General** section, you can configure the basic details of the
18+
subscription template.
19+
20+
![General Settings](form_subscription_template_general.png)
21+
22+
- **NGSI standard**: Select the NGSI standard to be used (defaults to *NGSIv2*).
23+
- **Name** (required): Enter a descriptive name for the subscription template.
24+
- **Broker URL** (required): Specify the URL of the FIWARE context broker.
25+
- **Status** (required): Set the status of the subscription (*active*,
26+
*inactive* or *oneshot*,).
27+
- **FIWARE Service** (optional): Define the FIWARE service.
28+
- **FIWARE Service Path** (optional): Specify the FIWARE service path.
29+
- **Expiration date** (optional): Set the expiration date for the subscription.
30+
- **Comment** (optional): Add any additional comments about the subscription template.
31+
32+
## Subscription Settings
33+
34+
In the **Subscription Settings** section, you can define the specifics of the
35+
subscription, including entities, attributes, and (geospatial) queries.
36+
37+
![Subscription Settings](form_subscription_template_subscription.png)
38+
39+
- **Subscription ID**: (Read-only) The unique identifier for the subscription,
40+
provided by the broker and automatically set when publishing through the plugin.
41+
- **Entities (array of)** (required): Define the entities that the subscription
42+
applies to; Must be a valid JSON array of objects, for example:
43+
44+
```json
45+
[
46+
{
47+
"idPattern": ".*",
48+
"type": "Room"
49+
}
50+
]
51+
```
52+
53+
- **Attributes (array of)**: List the attributes that will trigger notifications
54+
(e.g., `["temperature"]`). If left empty, all attributes will be considered.
55+
- **Query**: Specify the query condition (e.g., `temperature > 30`).
56+
- **Geospatial Query**: Define the geospatial query parameters. You must privide
57+
all or none of the following fields:
58+
- **Georel**: Set the geospatial relationship (e.g., `near;maxDistance:1000`).
59+
- **Geometry**: Choose the geometry type (e.g., `Point`).
60+
- **Coordinates**: Enter the coordinates for the geospatial query.
61+
- **Insert project boundary**: Automatically insert the project boundary as
62+
valid geospatial query.
63+
64+
- **Alteration types**: Select the types of alterations that will trigger
65+
notifications (e.g., `entityCreate`, `entityChange`, `entityUpdate`, `entityDelete`).
66+
- **Notify on metadata change**: Check if you want to receive notifications on
67+
metadata changes (defaults to `true`).
68+
69+
## Issue Template
70+
71+
In the **Issue Template** section, you can define how the Redmine issue should
72+
be created or updated based on the subscription notifications.
73+
74+
![Issue Template](form_subscription_template_issue.png)
75+
76+
- **Tracker**: Select the tracker for the issue (e.g., *Work*).
77+
- **Subject**: Define the subject of the issue. You can embed attribute readings
78+
using `${variable}`, for example:
79+
80+
```text
81+
Temperature Alert in ${Room}
82+
```
83+
84+
- **Description**: Provide the description for the issue. You can embed
85+
attribute readings using `${variable}`, for example:
86+
87+
```markdown
88+
The sensor in room ${Room} recorded a temperature of ${temperature}°C.
89+
- [ ] Open window
90+
- [ ] Turn on the air conditioning
91+
```
92+
93+
- **Notes**: Configure to post an issue note instead of creating a new issue if
94+
an issue has been created within the threshold. You can embed attribute
95+
readings using `${variable}`.
96+
- **Threshold (h)**: Set the threshold to create a new issue in hours. Subsequent
97+
notifications will be added as notes to the existing issue if the threshold
98+
has not been exceeded. Set to `0` to always create a new issue.
99+
- **Issue geometry (GeoJSON)** (optional): Define the issue geometry using
100+
GeoJSON. You can embed attribute readings using `${variable}`, for example:
101+
102+
```json
103+
{
104+
"type": "Feature",
105+
"geometry": "${location}"
106+
}
107+
```
108+
109+
You must use quotes around the `${variable}` to ensure the GeoJSON is valid!
110+
111+
- **Attachments (array of)** (optional): List any attachments to be included in
112+
the issue. You must provide a valid JSON array of objects. Each object must
113+
have the `url` field set to the URL of the attachment, and optionally the
114+
`filename` and `description` fields. You may embed attribute readings using
115+
`${variable}`, for example:
116+
117+
```json
118+
[
119+
{
120+
"filename": "image.jpg",
121+
"description": "Image of the room",
122+
"url": "${image_url}"
123+
}
124+
]
125+
```
126+
127+
- **Issue status**: Set the status of the issue (e.g., *New*).
128+
- **Priority**: Define the priority of the issue (e.g., *Normal*).
129+
- **Issue category**: Select the issue category. Categories can be created in
130+
the project settings.
131+
- **Version**: Specify the version. Versions can be created in the project settings.
132+
- **Sent from user**: Select the user from whom the issue is sent. The user must
133+
have the necessary permissions to create issues in this project. However, **for
134+
security reasons the user should not have administrator rights**, because its
135+
API key is stored in the subscription template.
136+
- **Private**: Check if the issue should be marked *private*.
137+
138+
## Applying Settings
139+
140+
After configuring all the sections, click the **Create** button to save the new
141+
subscription template or **Create and add another** to save and create another template.

0 commit comments

Comments
 (0)