Skip to content

Commit

Permalink
[docs]: Add docs for v2.43.0 (#9768)
Browse files Browse the repository at this point in the history
* add: docs for v2.43.0

* fix: broken links

* update: database editor based on feedback

* update: next

* update: querying tjdb with fk

* move available-actions below  create fk

* update: foreign key actions
  • Loading branch information
amanregu committed May 17, 2024
1 parent 7fe653e commit 3c9b04c
Show file tree
Hide file tree
Showing 303 changed files with 63,612 additions and 30 deletions.
2 changes: 1 addition & 1 deletion docs/docs/app-builder/examples/sharing-apps.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ Gitsync can be used to maintain application version control and facilitate colla
- Follow the prompts to connect your ToolJet app with a GitHub repository.
- Utilize git operations to manage app development across different branches and versions.

Read more about Gitsync **[here](/docs/gitsync.md)**.
Read more about Gitsync **[here](/docs/gitsync)**.
94 changes: 67 additions & 27 deletions docs/docs/tooljet-db/database-editor.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,14 @@ The constraints for the primary key column ensure the integrity and uniqueness o

<img style={{ border:'0', marginBottom:'15px', borderRadius:'5px', boxShadow: '0px 1px 3px rgba(0, 0, 0, 0.2)' }} className="screenshot-full" src="/img/v2-beta/database/ux2/single-field-pk.gif" alt="ToolJet database"/>

#### Limitations
#### Constraints
- The primary key column cannot contain null values.
- The primary key column cannot have the Boolean data type.
- The primary key column must have unique values across all rows.

#### Limitations
- Every table must have at least one primary key.
- The primary key column cannot have the Boolean data type.

### Creating Composite Primary Key

You have the option to convert an existing primary key column into a composite primary key, consisting of two or more columns.
Expand All @@ -104,11 +107,13 @@ By utilizing a composite primary key, you can uniquely identify records based on

<img style={{ border:'0', marginBottom:'15px', borderRadius:'5px', boxShadow: '0px 1px 3px rgba(0, 0, 0, 0.2)' }} className="screenshot-full" src="/img/v2-beta/database/ux2/composite-pk.gif" alt="ToolJet database"/>

#### Limitations
#### Constraints
- None of the composite key columns can contain null values.
- The composite key columns cannot be of the Boolean data type.
- The combination of values across all composite key columns must be unique for each row in the table.

#### Limitation
- The composite key columns cannot be of the Boolean data type.

### Modifying Primary Key

After creating a table, you can designate any column as the primary key, provided it adheres to the required constraints. If the chosen column already contains data, the existing values must comply with the primary key constraints. However, you cannot update or modify the primary key of a target table if it is currently being referenced as a foreign key in any other source tables. To modify the primary key, follow these steps:
Expand Down Expand Up @@ -143,22 +148,18 @@ You cannot delete a Primary Key of a target table if it is being used as a forei

A foreign key relation refers to linking one column or set of columns of the current table with one column or set of columns in an existing table. This relationship establishes a connection between the two tables, enabling the current source table to reference the existing target table. While creating a Foreign Key relationship, you can select the desired [action](#available-actions) to be performed on the source row when the referenced(target) row is updated or deleted.

### Constraints
- The target table must contain a column having the same data type as the column in the source table.
- The column that has to be referenced in the target table must have Unique constraint explicitly.
- The target table must already exist before adding the Foreign Key relationship in the source table.

### Limitations
- Self-references are not allowed i.e. Target table and Source table cannot be the same.
- The target table must contain a column having the same data type as the column in the source table.
- No foreign key can be created with a column of serial data type in the source table.
- The foreign key created with a column having integer data type in the source table can also reference a column of serial data type in the target table.
- The source table must already exist before creating the Foreign Key relationship.
- No foreign key can be reference a column in target table that is a part of its composite Primary key.

### Available Actions

| Option | Description |
| --- | --- |
| No Action | If a row in the target table is updated, it will throw an error if there are rows in the source table referencing it. |
| Cascade | Updates to rows in the target table will be reflected in the corresponding rows of the source table that reference it. |
| Restrict | No updates can be made to the target table. |
| Set to NULL | If a default value is present, this option will set the foreign key value in the source table to NULL. |
| Set to Default | If a default value is present, this option will set the foreign key value in the source table to the default value of the column. |
### Exception
- The foreign key created with a column having integer data type in the source table can also reference a column of serial data type in the target table.

### Creating Foreign Key

Expand All @@ -178,6 +179,45 @@ To create a Foreign Key relationship, follow these steps:

</div>

### Foreign Key Actions

When creating a foreign key relationship, ToolJet Database lets you choose from several actions to be performed on the source row when the referenced row in the target table is updated or deleted.

#### On Update

| Option | Description |
| --- | --- |
| Restrict (default) | Restrict any updates on target table if any referenced row is being updated. |
| Cascade | Any updates in referenced row in target table will show up in the source table as well. |
| Set NULL | Any updates in referenced row in target table will set it's instances in the source table as NULL. |
| Set to Default | Any updates referenced row in target table will set it's instances in the source table as default value of foreign key column of source table. |

#### On Delete

| Option | Description |
| --- | --- |
| Restrict (default) | Restrict any deletion on target table if any referenced row is being updated. |
| Cascade | Any deletion of referenced row in target table will delete the row having it's instance in the source table as well. |
| Set NULL | Any deletion of referenced row in target table will set it's instances in the source table as NULL. |
| Set to Default | Any deletion of referenced row in target table will set it's instances in the source table as default value of foreign key column of source table. |

### Referential Integrity

The foreign key constraint ensures referential integrity between the source and target tables. This constraint enforces that the foreign key column in the source table has one of the unique values present in the foreign key column in the target table. <br/>
- When creating a new row in the source table the column with the foreign key relation will have a dropdown with the unique values present in the target table. This ensures that the data in the source table is always consistent with the data in the target table.
- On the bottom of the dropdown, there is a button to **Open referenced table** which will take you to the target table.

<div style={{textAlign: 'center'}}>
<img style={{ border:'0', marginBottom:'15px', borderRadius:'5px', boxShadow: '0px 1px 3px rgba(0, 0, 0, 0.2)' }} className="screenshot-full" src="/img/v2-beta/database/ux2/create-new-row-fk.png" alt="ToolJet database" />
</div>

- When editing the value of a foreign key cell in an existing row of the source table, the dropdown will show the unique values present in the target table. This ensures that even when the data in the source table is being updated, it is always consistent with the data in the target table.

<div style={{textAlign: 'center'}}>
<img style={{ border:'0', marginBottom:'15px', borderRadius:'5px', boxShadow: '0px 1px 3px rgba(0, 0, 0, 0.2)' }} className="screenshot-full" src="/img/v2-beta/database/ux2/edit-row-fk.png" alt="ToolJet database" />
</div>


### Example

Let's consider an example where we want to create a foreign key relationship between the `Orders` and `Customers` tables in an e-commerce application.
Expand All @@ -186,20 +226,20 @@ First, create the following two tables in the ToolJet Database:

**Customers**

| Column Name | Data Type | Primary Key | Null | Unique |
|-------------|-----------|:--------------:|:------:|:--------:|
| customer_id | int || ||
| name | varchar || ||
| email | varchar || ||
| Column Name | Data Type | Primary Key | Not Null | Unique |
|-------------|-----------|:--------------:|:--------:|:--------:|
| customer_id | int || | |
| name | varchar || | |
| email | varchar || | |

**Orders**

| Column Name | Data Type | Primary Key | Null | Unique |
|--------------|-----------|:--------------:|:------:|:--------:|
| order_id | int || ||
| customer_id | int || ||
| order_date | varchar || ||
| total_amount | float || ||
| Column Name | Data Type | Primary Key | Not Null | Unique |
|--------------|-----------|:--------------:|:--------:|:--------:|
| order_id | int || | |
| customer_id | int || | |
| order_date | varchar || | |
| total_amount | float || | |

We want to create a foreign key relationship between the `customer_id` column in the `Orders` table and the `customer_id` column in the `Customers` table.

Expand Down
11 changes: 11 additions & 0 deletions docs/docs/tooljet-db/querying-tooljet-db.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,17 @@ This operation deletes a record in the table. You can delete a single record or

</div>

### Modifying Tables with Foreign Key Constraints

When you are creating, updating, or deleting records in a table that has a foreign key constraint, you need to ensure that the foreign key constraint is not violated.
- If you are trying to create/update a new row in the source table, you need to ensure that the foreign key value exists in the target table. Otherwise, the operation will fail with an error message.

<div style={{textAlign: 'center'}}>
<img style={{ border:'0', marginBottom:'15px', borderRadius:'5px', boxShadow: '0px 1px 3px rgba(0, 0, 0, 0.2)' }} className="screenshot-full" src="/img/v2-beta/database/ux2/violate-fk.gif" alt="ToolJet database"/>
</div>

- Similarly, if you are trying to delete a row in the target table, you need to ensure that the foreign key value is not being referenced in the source table.

<div style={{paddingTop:'24px', paddingBottom:'24px'}}>

### Join Tables
Expand Down
2 changes: 1 addition & 1 deletion docs/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ module.exports = {
// Please change this to your repo.
editUrl: 'https://github.com/ToolJet/Tooljet/blob/develop/docs/',
includeCurrentVersion: false,
lastVersion: '2.39.0',
lastVersion: '2.43.0',
},
theme: {
customCss: require.resolve('./src/css/custom.css'),
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions docs/versioned_docs/version-2.43.0/Enterprise/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"label": "Enterprise",
"position": 9,
"collapsed": true
}
159 changes: 159 additions & 0 deletions docs/versioned_docs/version-2.43.0/Enterprise/audit_logs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
---
id: audit_logs
title: Audit logs
---

<div className='badge badge--primary heading-badge'>Available on: Paid plans</div>


The audit log is the report of all the activities done in your ToolJet account. It will capture and display events automatically by recording who performed an activity, what when, and where the activity was performed, along with other information such as IP address.

<div style={{textAlign: 'center'}}>

<img style={{ width:'100%', border:'0', marginBottom:'15px', borderRadius:'5px', boxShadow: '0px 1px 3px rgba(0, 0, 0, 0.2)' }} className="screenshot-full" src="/img/enterprise/audit_logs/logsnew-v2.png" alt="Audit logs" />

</div>

<div style={{paddingTop:'24px', paddingBottom:'24px'}}>

### Date Range

Retrieve the log of events that occurred within the specified date and time range using the range picker. By default, the system loads 24-hour logs for the initial view. The maximum duration that can be specified for the "from" and "to" dates is 30 days.

:::info
Pagination at the bottom allows navigation through the pages, with each page displaying a maximum of 7 logs.
:::

<div style={{textAlign: 'center'}}>

<img style={{ width:'100%', border:'0', marginBottom:'15px', borderRadius:'5px', boxShadow: '0px 1px 3px rgba(0, 0, 0, 0.2)' }} className="screenshot-full" src="/img/enterprise/audit_logs/filtersnew-v2.png" alt="Audit logs" />

</div>

</div>

<div style={{paddingTop:'24px', paddingBottom:'24px'}}>

### Filter Audit Logs

You can apply filters to the audited events based on the following criteria.

#### Select Users

Choose a specific user from the dropdown list to view all their activities.

#### Select Apps

The dropdown will display all the apps associated with your account. Select an app to filter the logs related to that particular app.

#### Select Resources

| <div style={{ width:"100px"}}> Resources </div> | <div style={{ width:"100px"}}> Description </div> |
| ----------- | ----------- |
| User | Filter all the User events like `USER_LOGIN`, `USER_SIGNUP`, `USER_INVITE`, AND `USER_INVITE_REDEEM`. |
| App | Filter all the App events like `APP_CREATE`, `APP_UPDATE`,`APP_VIEW`,`APP_DELETE`,`APP_IMPORT`,`APP_EXPORT`,`APP_CLONE`. |
| Data Query | Filters the events associated with Data Query like `DATA_QUERY_RUN`. |
| Group Permission | All the events associated with Group Permissions will be filtered. Group Permissions include `GROUP_CREATE`, `GROUP_UPDATE`, `GROUP_DELETE`. |
| App Group Permission | Within each group, you can set apps for read or edit privileges. These events get recorded as App Group Permissions. |

#### Select Actions

| <div style={{ width:"100px"}}> Actions </div> | <div style={{ width:"100px"}}> Description </div>|
| ----------- | ----------- |
| USER_LOGIN | This event is recorded everytime a user logins. |
| USER_SIGNUP | This event is recorded everytime a new signup is made. |
| USER_INVITE | You can invite users to your account from `Manage Users` section and an event is audited everytime an invite is sent. |
| USER_INVITE_REDEEM | This event is recorded whenever an invite is redeemed. |
| APP_CREATE | This event is recorded when a user creates a new app. |
| APP_UPDATE | This event is recorded whenever actions like renaming the app, making the app public, editing shareable link, or deploying the app are made. |
| APP_VIEW | This event is logged when someone views the launched app. (public apps aren't accounted for) |
| APP_DELETE | This event is recorded whenever a user deletes an app from the dashboard. |
| APP_IMPORT | This event is recorded whenever a user imports an app. |
| APP_EXPORT | This event is recorded whenever an app is exported. |
| APP_CLONE | This event is recorded whenever a clone of the existing app is created. |
| DATA_QUERY_RUN | This event is logged whenever a data source is added, a query is created, or whenever a query is run either from the query editor or from the launched app. |
| GROUP_PERMISSION_CREATE | This event is recorded whenever a group is created. |
| GROUP_PERMISSION_UPDATE | This event is recorded whenever an app or user is added to or removed from a group, or the permissions for a group are updated. |
| GROUP_PERMISSION_DELETE | This event is recorded whenever a user group is deleted from an account. |
| APP_GROUP_PERMISSION_UPDATE | For every app added in to user group, you can set privileges like `View` or `Edit` and whenever these privileges are updated this event is recorded. By default, the permission of an app for a user group is set to `View`. |

</div>

<div style={{paddingTop:'24px', paddingBottom:'24px'}}>

### Understanding Log Information

<div style={{textAlign: 'center'}}>

<img className="screenshot-full" src="/img/enterprise/audit_logs/readinglogv2.png" alt="Audit logs" />

</div>

| <div style={{ width:"100px"}}> Property </div> | <div style={{ width:"100px"}}> Description </div>|
| ----------- | ----------- |
| action_type | This indicates the type of action that was logged in the event. Refer to [this](#select-actions) for more information on actions. |
| created_at | Shows the date and time when the event was logged. |
| id | Each logged event is assigned a unique event ID. |
| ip_address | Displays the IP address from which the event was logged. |
| metadata | The metadata includes two sub-properties: `tooljet_version` and `user_agent`. `tooljet_version` shows the version of ToolJet used for the event, while `user_agent` contains information about the device and browser used. |
| organization_id | Every organization in ToolJet has a unique ID associated with it, which is recorded when an event occurs. |
| resource_id | Different [resources](#select-resources) have their respective IDs associated with them. These IDs are assigned when the resources are created. |
| resource_name | Shows the name of the [resources](#select-resources) that were involved in the logged event. For example, if an app was created or deleted, it will display the name of that app. |
| resource_type | Indicates the type of the [resources](#select-resources) involved in the logged event. |
| user_id | Each user account in ToolJet has a unique ID associated with it, which is recorded when an event occurs. |

</div>

<div style={{paddingTop:'24px', paddingBottom:'24px'}}>

### Log File

The file will contain all the data from audit logs. The log file can be created by specifying the path in the [environment variables](/docs/setup/env-vars). The log file is rotated on a daily basis and is updated dynamically every time a new audit log is generated.

Learn more about **setting up the log file generation** [here](/docs/how-to/setup-rsyslog).

#### Log Rotation

The log file is configured to rotate on a daily basis. This means that a new log file will be created every day, ensuring efficient management and organization of audit data.

#### Log File Path

The path for the log file is defined using the `LOG_FILE_PATH` variable in the environment. It's important to understand that this path is relative to the home directory of the machine. For instance, if `LOG_FILE_PATH` is set to `hsbc/dashboard/log`, the resulting log file path will be structured as follows:
```
homepath/hsbc/dashboard/log/tooljet_log/{process_id}-{date}/audit.log
```
Here, `{process_id}` is a placeholder for the unique process identifier, and `{date}` represents the current date. This structured path ensures that audit logs are organized by both process and date, facilitating easy traceability and analysis.

| <div style={{ width:"100px"}}> Variable </div>| <div style={{ width:"100px"}}> Description </div> |
| -------- | --------------------------------------------------------------------------- |
| LOG_FILE_PATH | the path where the log file will be created ( eg: tooljet/log/tooljet-audit.log) |

<details>
<summary>Example Log file data</summary>

```bash
{
level: 'info',
message: 'PERFORM APP_CREATE OF awdasdawdwd APP',
timestamp: '2023-11-02 17:12:40',
auditLog: {
userId: '0ad48e21-e7a2-4597-9568-c4535aedf687',
organizationId: 'cf8e132f-a68a-4c81-a0d4-3617b79e7b17',
resourceId: 'eac02f79-b8e2-495a-bffe-82633416c829',
resourceType: 'APP',
actionType: 'APP_CREATE',
resourceName: 'awdasdawdwd',
ipAddress: '::1',
metadata: {
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36',
tooljetVersion: '2.22.2-ee2.8.3'
}
},
label: 'APP'
}
```

</details>

</div>

Loading

0 comments on commit 3c9b04c

Please sign in to comment.