Skip to content

Commit c2f3b1c

Browse files
Update README.md
1 parent 1e9dfcc commit c2f3b1c

File tree

1 file changed

+58
-234
lines changed

1 file changed

+58
-234
lines changed

README.md

Lines changed: 58 additions & 234 deletions
Original file line numberDiff line numberDiff line change
@@ -1,124 +1,32 @@
11
## Introduction
2-
![Tutorials UI](docs/tutorials.png)
3-
4-
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!
104

5+
This page provides an overview of the Tutorials structure, its elements and contains instructions, recommendations, and best practices for updating and sharing Tutorials.
116

127
## Navigation
138

14-
1. Examples
15-
2. [Structure](#Structure)
9+
1. [Structure](#Structure)
10+
2. [Examples](#Examples)
1611
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.
22-
23-
[Redis Stack Tutorials.zip](https://github.com/RedisInsight/Tutorials/files/10911840/Redis.Stack.Tutorials.zip)
12+
4. [Advanced button parameters](#Advanced)
2413

2514
## Structure
26-
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.)
2915

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
3219

33-
| Prop | Type | Description |
34-
| -------------------- | --------------------------------------- | ----------- |
35-
| id (**required**) | string | |
36-
| type (**required**) | "group", "internal-link", "code-button" | |
37-
| label (**required**) | string | Label that will be displayed on UI for Node |
38-
| children | Record<string, Node> | Use only for "group" type |
39-
| args | Record<string, any> | A special set of parameters required by a certain type of node (each type has its own) |
40-
41-
A Node can be represented by various UI components and is specified by `type` prop. Supported types are listed below.
42-
43-
| Type | Description | Args |
44-
|----------------- |------------------------------------------------------------------------------------- |-------------- |
45-
| **"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
52-
```json
53-
{
54-
"tutorials": {
55-
"type": "group",
56-
"id": "tutorials",
57-
"label": "TUTORIALS",
58-
"args": {
59-
"withBorder": true,
60-
"initialIsOpen": true
61-
},
62-
"children": {
63-
"redis_stack": {
64-
"type": "group",
65-
"id": "redis_stack",
66-
"label": "Redis Stack",
67-
"args": {
68-
"initialIsOpen": false
69-
},
70-
"children": {
71-
"working_with_json": {
72-
"type": "internal-link",
73-
"id": "working_with_json",
74-
"label": "Working with JSON",
75-
"args": {
76-
"path": "/redis_stack/working_with_json.md"
77-
}
78-
},
79-
"vss": {
80-
"type": "internal-link",
81-
"id": "vector_similarity_search",
82-
"label": "Vector Similarity Search",
83-
"args": {
84-
"path": "/redis_stack/vector_similarity_search.md"
85-
}
86-
}
87-
}
88-
}
89-
}
90-
}
91-
}
92-
```
93-
## Pages
94-
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:
97-
* Plain text
98-
* [Basic Markdown Syntax](https://www.markdownguide.org/basic-syntax/)
99-
* [Extended Markdown Syntax](https://www.markdownguide.org/extended-syntax/)
100-
* [HTML tags](https://www.markdownguide.org/basic-syntax/#html)
101-
* Images
102-
* Custom Syntax
20+
## Examples
21+
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.
10322

104-
### Images
105-
Basic Markdown syntax provides the ability to render images. ([Image Markdown Syntax](https://www.markdownguide.org/basic-syntax/#images-1))
23+
[Redis Stack Tutorials.zip](https://github.com/RedisInsight/Tutorials/files/10911840/Redis.Stack.Tutorials.zip)
10624

107-
You can use the absolute path
108-
```
109-
![RedisInsight Browser screenshot](https://github.com/RedisInsight/RedisInsight/blob/main/.github/redisinsight_browser.png)
110-
```
111-
or relative path to image inside the [statics](https://github.com/RedisInsight/Tutorials)
112-
```
113-
![RedisInsight Browser screenshot](/_images/browser.png)
114-
```
25+
## Markdown files
11526

116-
#### Redis Code block
117-
![Redis Code block](docs/tutorials-redis-code-block.png)
27+
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).
11829

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).
12230
````
12331
```redis Create
12432
// 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
13341
```
13442
````
13543

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
54+
below (it will be displayed as type "group"):
55+
56+
| Prop | Type | Description |
57+
|-------------------------|--------------------------|-------------------------------------------------------------------------------------------------------------------------------|
58+
| label (**required**) | string | Label that will be displayed on UI for Node |
59+
| children (**required**) | Node[] | List of Nodes (nested groups or markdown files) |
60+
| type | | Can be skipped - RedisInsight will always use the "group" parameter |
61+
| author | string | Not required, Author name |
62+
| URL | string | Not required, link to repository/web-site |
63+
| industry | string[] | Not required, tags to show relevant industry |
64+
| description | string | Not required, short description of tutorials |
65+
66+
Each Node requires a `label`,`type` (all available properties are described in the table below).
67+
68+
| Prop | Type | Description |
69+
|----------------------|--------------------------|----------------------------------------------------------------------------------------|
70+
| id | string | |
71+
| type (**required**) | "group", "internal-link" | |
72+
| label (**required**) | string | Label that will be displayed on UI for Node |
73+
| children | Node[] | Use only for the "group" type |
74+
| args | Record<string, any> | A special set of parameters required by a certain type of node (each type has its own) |
75+
76+
A Node can be represented by various UI components and is specified by `type` prop. Supported types are listed below.
77+
78+
| Type | Description | Args |
79+
|-----------------------|------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------|
80+
| **"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
13787

13888
You can customize the run parameters to configure the raw mode, pipeline parameter and group mode. If specified, they will override
13989
the configuration set in RedisInsight. If not specified - the behaviour will be defined by parameters set in RedisInsight.
@@ -173,130 +123,4 @@ redis:[results=group;mode=ascii]
173123
redis:[auto=true;pipeline=8;mode=raw;results=single;]
174124
```
175125

176-
###### Auto-execute button
177-
![img.png](docs/tutorials-redis-auto-code-block.png)
178-
179-
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"
187-
HSET permit:2 "description" "To construct a loft" "construction_value" 53000 "building_type" "apartment" "address_city" "Porto" "work_type" "construction" "permit_timestamp" "1556546400" "address_street" "Rua da Boavista" "location" "41.155854, -8.616721"
188-
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).
301-
302126

0 commit comments

Comments
 (0)