Skip to content

Commit bfeb8c9

Browse files
committed
rewrite
1 parent 2fe2c41 commit bfeb8c9

File tree

1 file changed

+29
-14
lines changed

1 file changed

+29
-14
lines changed

fern/docs/pages/references/snap-in-configuration.mdx

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
1-
## Snap-in configuration
1+
# Customizing Snap-in Configuration Pages
22

3-
Snap-ins have keyrings and inputs that can be set from the UI by going to the snap-in configuration page. The snap-in configuration page will list all the keyrings and inputs which can then be set by the user installing the snap-in.
4-
In some instances, the default rendering page is not easy to use or doesn't faciliate the user's needs.
5-
In such cases, the snap-in configuration page can be defined by the snap-in developer. The snap-in developer can define a snap-in function that can be used to generate a snap-kit which renders input elements as well as other elements to make the page easier to configure or pull in data from other systems as well.
6-
For example, if the developers needs to ask the user for a Slack channel, they may need to get the list of channels from their Slack workspace, show the channel names in the drop down and when the user selects a channel, the snap-kit can pass back the channel ID as that is what is used in the APIs.
7-
This enables a lot of flexibility in the snap-in configuration page making it easier to configure snap-ins and giving developers more control of how users interact with their snap-ins.
3+
DevRev Snap-ins platform allows developers to define custom configuration pages for their Snap-ins. This feature provides flexibility in designing user-friendly and intuitive configuration experiences tailored to the specific needs of the Snap-in.
84

9-
## How to define a snap-in configuration page
10-
In your manifest, add the following section to enable a configuration_handler:
5+
## Why Customize Configuration Pages?
6+
7+
While the default configuration page automatically renders input fields for keyrings and inputs, there may be cases where a custom configuration page is more suitable:
8+
9+
- Improved User Experience: Developers can design the configuration page to provide a more intuitive and streamlined experience for users setting up the Snap-in.
10+
- Advanced Input Handling: Custom configuration pages enable developers to handle complex input scenarios, such as fetching data from external systems to populate dropdown options or validating user input.
11+
- Branding and Styling: Developers can align the configuration page with their Snap-in's branding and style guidelines, ensuring a consistent look and feel.
12+
13+
## Defining Custom Configuration Pages
14+
15+
To create a custom configuration page for a Snap-in, developers need to define the following in the Snap-in manifest:
1116

1217
```yaml
1318
snap_kit_actions:
@@ -25,20 +30,24 @@ functions:
2530
description: Generates the initial configuration options for both organization and user.
2631

2732
configuration_handler:
28-
organization:
33+
organization:
2934
initializer: config_initializer
3035
snap_kit_action_name: org_snap_kit_action
31-
3236
user:
3337
initializer: config_initializer
3438
snap_kit_action_name: user_snap_kit_action
3539
```
3640
37-
The above YAML segment creates three functions and connects them to the configuration_handler to enable custom snap-kits to be rendered as the snap-in configuration page. The `config_initializer` function is used to generate the initial configuration options for both organization and user. The `org_snap_in_configuration_handler` and `user_snap_in_configuration_handler` functions are used to process the organization and user configuration options respectively.
41+
The `configuration_handler` section in the manifest connects the functions responsible for generating and processing the custom configuration page.
3842

39-
When the snap-in configuration page is loaded, the snap-in will call the `config_initializer` function to get the initial configuration options. Further actions on the returned snap-kit will then call the `org_snap_kit_action` or `user_snap_kit_action` snap-kit action to process and update the snap-kit for the organization or user respectively.
43+
- `config_initializer`: This function generates the initial configuration options for both organization and user. It is called when the configuration page is first loaded.
44+
- `org_snap_in_configuration_handler`: This function processes the organization configuration options. It is triggered when actions are performed on the organization configuration snap-kit.
45+
- `user_snap_in_configuration_handler`: This function processes the user configuration options. It is triggered when actions are performed on the user configuration snap-kit.
46+
47+
## Configuration Functions
48+
49+
The configuration functions should return a valid snap-kit JSON that defines the layout and elements of the custom configuration page. Here's an example of a snap-kit JSON:
4050

41-
The functions should always return a valid snap-kit JSON such as below:
4251
```json
4352
{
4453
"snap_kit_body": {
@@ -102,5 +111,11 @@ The functions should always return a valid snap-kit JSON such as below:
102111
}
103112
}
104113
```
105-
This will render a snap-kit with a dropdown to select between "Ticket" and "Conversation" and a "Next" button. The snap-kit will then call the `user_snap_in_configuration_handler` function when the "Next" button is clicked.
106114

115+
In this example, the snap-kit renders a dropdown select for choosing between "Ticket" and "Conversation," along with a "Next" button. When the "Next" button is clicked, the `user_snap_in_configuration_handler` function is invoked to process the user's selection.
116+
117+
## Conclusion
118+
119+
Customizing Snap-in configuration pages empowers developers to create tailored and user-friendly setup experiences. By defining the layout and elements of the configuration page using snap-kit JSON, developers can guide users through the configuration process, handle complex input scenarios, and ensure a seamless integration with their Snap-in's functionality.
120+
121+
For more details on the snap-kit JSON format and available elements, refer to the DevRev Snap-kit documentation.

0 commit comments

Comments
 (0)