You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Tutorials are documents that contain helpful use cases, comments and interesting experience about Redis features and capabilities.
5
-
6
-
The content of the Tutorials can be updated autonomously without a need to update the entire application.
7
-
8
-
This document provides an overview of the Tutorials structure, its elements and contains instructions, recommendations, and best practices for updating the content of Tutorials.
9
-
2
+
Tutorials are documents that contain helpful use cases, comments and interesting experience about Redis and Redis Stack capabilities.
3
+
It is a perfect tool to present your use cases and experience using RedisInsight Workbench and share them with others!
10
4
5
+
This page provides an overview of the Tutorials structure, its elements and contains instructions, recommendations, and best practices for updating and sharing Tutorials.
11
6
12
7
## Navigation
13
8
14
-
1.Examples
15
-
2.[Structure](#Structure)
9
+
1.[Structure](#Structure)
10
+
2.[Examples](#Examples)
16
11
3.[Pages](#Pages)
17
-
4.[Autoupdate Flow](#Autoupdate)
18
-
5.[Development Flow](#Development)
19
-
20
-
## Examples
21
-
Download this example with Redis Stack Tutorials and upload the archive using the "Upload Tutorial" feature in Workbench so you can view and work with them in RedisInsight.
Tutorials allows you to render recursive objects, such as a file directory.
27
-
28
-
On the root level of [sources](https://github.com/RedisInsight/Tutorials/tree/main/src) folder, we have `tutorials.json` and all necessary static files (markdowns, images, etc.)
29
15
30
-
The content of this area is generated based on Nodes specified inside `tutorials.json`.
31
-
This JSON file is described as a simple [Object](https://javascript.info/object) (Hash map), where key is a **string** and value is a **Node** (`Record<string, Node>`). Each Node requires a `label`,`type` and a unique `id` (all available properties are described in the table below).
16
+
Tutorials should be combined into a .zip archive that contains the following:
17
+
1.[Markdown files](#Markdown) with content of Tutorials
18
+
2.[manifest.json](#manifest.json) that describes the structure and befavior of Tutorials
|**"internal-link"**| A link that opens a page inside the Tutorials <br> (e.g. link to Redis Stack tutorial). | - "path" (required, string) - relative file path |
46
-
|**"code-button"**| A button that inserts content into the Code Editor. | - "path" (required, string) - relative file path |
47
-
|**"group"**| Grouping several nodes into one directory/folder. <br> Allows you to create nested lists | - "initialIsOpen" (boolean) - The group will start in the open state (default value - false) <br> - "withBorder" (boolean) - Display border at the bottom (default value - false) |
48
-
49
-
> _**!Note.** All **"internal-link"** nodes located in the same **"group"** will be connected to each other. And using pagination (created dynamically) you can go directly from one page to another. Therefore, it is best to combine elements into groups related to the same topic._
50
-
51
-
### Example with "Tutorials" group and two sections inside it
By using **“internal-link”** node we can open other pages inside of Tutorials. To display more pages, add relevant files to the [src](https://github.com/RedisInsight/Tutorials/tree/main/src) folder.
95
-
96
-
These tutorials may contain the following elements:
If you would like to start with Tutorials, download this example with Redis Stack Tutorials and upload the archive using the "Upload Tutorial" feature in RedisInsight Workbench so you can view and understand the overall logic.
103
22
104
-
### Images
105
-
Basic Markdown syntax provides the ability to render images. ([Image Markdown Syntax](https://www.markdownguide.org/basic-syntax/#images-1))
In short, Tutorials support the basic [Markdown syntax](https://www.markdownguide.org/basic-syntax/) that you can use to specify your information.
28
+
If you would like to add a button that will insert Redis commands to the Workbench Editor, use Redis Code block that is almost the same as for the [Fenced Code Block](https://www.markdownguide.org/extended-syntax/#fenced-code-blocks), but you need to specify `redis` as language and the label next to it (see the `Create` button example below).
118
29
119
-
###### Manual-execute button
120
-
A button that inserts Redis commands in the Editor. The syntax is almost the same as for the [Fenced Code Block](https://www.markdownguide.org/extended-syntax/#fenced-code-blocks),
121
-
the only difference is that you must specify `redis` as language and the label next to it (`Create` in the example below).
122
30
````
123
31
```redis Create
124
32
// Let's add three documents as Hashes.
@@ -133,7 +41,49 @@ the only difference is that you must specify `redis` as language and the label n
133
41
```
134
42
````
135
43
136
-
###### Button parameters
44
+
## manifest.json
45
+
46
+
Manifest.json is not required and can be skipped, in the case of missing manifest.json, RedisInsight will:
47
+
1. Take the Tutorial name from the .zip archive
48
+
2. All the pages will have names the same as file names in the .zip archive
49
+
3. The order of pages will be the same as in the .zip archive
50
+
51
+
If you would like to customize or prettify the archive name, page names, or the order, you can use the manifest.json. This JSON file is described as simple [Objects](https://javascript.info/object) which represents tree node and might have children nodes inside.
52
+
53
+
Manifest file should start with single Node and should have properties described
|**"internal-link"**| A link that opens a page inside the Enablement Area <br> (e.g. link to guide page). | - "path" (required, string) - relative file path |
81
+
|**"group"**| Grouping several nodes into one directory/folder. <br> Allows you to create nested lists | - "initialIsOpen" (boolean) - The group will start in the open state (default value - false) |
82
+
83
+
> _**!Note.** All **"internal-link"** nodes located in the same **"group"** will be connected to each other. And using pagination (created dynamically) you can go directly from one page to another. Therefore, it is better to combine elements into groups related to the same topic._
84
+
85
+
86
+
## Advanced button parameters
137
87
138
88
You can customize the run parameters to configure the raw mode, pipeline parameter and group mode. If specified, they will override
139
89
the configuration set in RedisInsight. If not specified - the behaviour will be defined by parameters set in RedisInsight.
A button that automatically executes the Redis commands (without inserting it into the Editor). Such buttons will be displayed with the "Play" icon inside.
180
-
The code syntax is the same as for the manually executed buttons, just insert parameter `[auto=true]` with any other parameters before the button.
181
-
182
-
````
183
-
```redis:[auto=true;mode=raw] Create
184
-
// Let's add three documents as Hashes.
185
-
// Each document represents a building permit.
186
-
HSET permit:1 "description" "To reconstruct a single detached house with a front covered veranda." "construction_value" 42000 "building_type" "single detached house" "address_city" "Lisbon" "work_type" "demolition,reconstruction" "permit_timestamp" "1602156878" "address_street" "R. Da Palma" "location" "38.717746, -9.135839"
HSET permit:3 "description" "New house build" "construction_value" 260000 "building_type" "house" "address_city" "Lagos" "work_type" "construction;design" "permit_timestamp" "1612947600" "address_street" "R. Antonio Gedeao" "location" "37.114864, -8.668521"
189
-
```
190
-
````
191
-
192
-
## Autoupdate
193
-
Our application supports the ability to quickly update the static files of the Enablement area so that we can provide users with up-to-date information.
194
-
195
-
EA tutorials auto-update flow:
196
-
1. Push commit with updates to the main branch
197
-
2. Wait until changes are merged into the latest branch
198
-
3. Reopen the Redisinsight with a working internet connection. In the background, new files will be downloaded to the user's local home directory:
199
-
***Mac**: In the `/Users/<your-username>/.redisinsight-v2/tutorials` directory.
200
-
***Windows**: In the `C:\Users\<your-username>\.redisinsight-v2/tutorials` directory.
201
-
***Linux**: In the `/home/<your-username>/.redisinsight-v2/tutorials` directory.
202
-
4. Open Enablement area on UI
203
-
204
-
## Development
205
-
Let's imagine that we need to add a new group (Streams) with 2 pages (Basics, Getting data).
206
-
207
-
Step by step implementation would be as follows:
208
-
1. First of all, it's best to create new pages locally and make sure that everything looks like it was planned.
209
-
2. Clone Tutorials repository (if you haven't done it before) and go into `<folder to tutorials repo>/src`
210
-
3. Create a new branch from the `main`
211
-
4. Add new `streams` folder with `basics.md` and `getting-data.md`. As a result, the folder structure will look something like this.
212
-
```
213
-
Tutorials
214
-
> Redis Stack
215
-
> Working with JSON
216
-
> streams
217
-
basics.md
218
-
getting-data.md
219
-
tutorials.json
220
-
```
221
-
5. Add new nodes inside `tutorials.json`
222
-
```json
223
-
{
224
-
"tutorials": {
225
-
"type": "group",
226
-
"id": "tutorials",
227
-
"label": "TUTORIALS",
228
-
"children": {
229
-
"redis_stack": {"id": "redis_stack"...},
230
-
"streams": {
231
-
"type": "group",
232
-
"id": "streams",
233
-
"label": "Streams",
234
-
"children": {
235
-
"basics": {
236
-
"type": "internal-link",
237
-
"id": "basics",
238
-
"label": "Basics",
239
-
"args": {
240
-
"path": "/streams/basics.md"
241
-
}
242
-
},
243
-
"get-data": {
244
-
"type": "internal-link",
245
-
"id": "getting-data",
246
-
"label": "Get Data",
247
-
"args": {
248
-
"path": "/streams/getting-data.md"
249
-
}
250
-
}
251
-
}
252
-
}
253
-
}
254
-
}
255
-
}
256
-
257
-
```
258
-
> _**!Note.** Markdown file name should have the same value as Node `id` to properly create pagination. _
259
-
6. Fill markdowns with content.
260
-
261
-
`basics.md`
262
-
````
263
-
For the goal of understanding what Redis Streams are and how to use them, we will ignore all the advanced features, and instead focus on the data structure itself, in terms of commands used to manipulate and access it.
264
-
This is, basically, the part that is common to most of the other Redis data types, like Lists, Sets, Sorted Sets and so forth.
265
-
However, note that lists also have an optional more complex blocking API, exported by commands like BLPOP and similar.
266
-
So streams are not much different than lists in this regard, it's just that the additional API is more complex and more powerful.
267
-
268
-
Because Streams are an append-only data structure, the fundamental write command, called **XADD**, appends a new entry into the specified stream.
269
-
A stream entry is not just a string but is instead composed of one or multiple field-value pairs.
270
-
This way, each entry of a stream is already structured, like an append-only file written in CSV format where multiple separated fields are present in each line.
271
-
272
-
```redis Create
273
-
XADD mystream * sensor-id 1234 temperature 19.8
274
-
```
275
-
276
-
````
277
-
278
-
`getting-data.md`
279
-
````
280
-
Querying by range: **XRANGE** and **XREVRANGE*
281
-
To query the stream by the range we are only required to specify two IDs, _start_ and _end_.
282
-
The range returned will include the elements having start or end as ID, so the range is inclusive. The two special IDs - and + respectively mean the smallest and the greatest ID possible.
283
-
284
-
```redis XRANGE
285
-
XRANGE mystream - +
286
-
```
287
-
288
-
```redis XREVRANGE
289
-
XREVRANGE mystream + - COUNT 1
290
-
```
291
-
292
-
293
-
````
294
-
7. Open **RedisInsight** application with `TUTORIALS` environment variable `TUTORIALS_DEV_PATH='<path to Tutorials repo>/src' ./<path to RedisInsight binary>`
295
-
296
-
Example on Linux: `TUTORIALS='/home/user/projects/Tutorials/src' ./home/user/programms/RedisInsight.AppImage`
297
-
8. Make sure that everything looks fine.
298
-
299
-
300
-
9. After that, just commit and push, and then create Pull Request to the main branch. (Release flow described in the [Autoupdate Flow](#Autoupdate) section).
0 commit comments