AppNodeEditor Documentation
Purpose
The AppNodeEditor component is designed for editing per-app workflow nodes in the Vantage analytics and data platform. It facilitates the configuration of specific settings associated with different node types while automatically inferring the app type from the node category. Its primary goal is to present relevant fields based on the node type, allowing users to specify parameters necessary for interacting with app records and queries.
How It Works
When the AppNodeEditor is rendered, it evaluates the selectedNode props to derive its node type, which dictates what configuration fields should be displayed. Depending on the identified node action—such as fetching, updating, or deleting records—the relevant input fields are shown, allowing the user to provide necessary information. This dynamic behavior ensures a streamlined user experience by only presenting fields that are applicable to the given node context.
Data Expectations
The AppNodeEditor expects the following data structures through its props:
- selectedNode: An object containing the node data which includes the
node_typeto determine the operation (e.g.,contacts/listRecords). - config: An object containing the current configuration settings for the node (e.g.,
recordId,idColumn,query,limit). - updateField: A function that updates the configuration fields based on user input.
Settings
The following are the settings available in the AppNodeEditor, alongside detailed explanations of each:
1. Record ID
- Input Type: String
- Description: This field allows the user to specify a fixed record ID for actions such as
getRecord,updateRecord, ordeleteRecord. If left empty, the system will default to using IDs from upstream input data. - Default Value:
''(empty string)
2. ID Column
- Input Type: String
- Description: This input is necessary for
updateRecordanddeleteRecordactions. It specifies the column name within upstream data that contains the record IDs to be acted upon. This allows for clear marking of which IDs are being utilized for updates or deletions. - Default Value:
'id'
3. Search Query
- Input Type: String
- Description: For the
searchRecordsaction, this field accepts a keyword to search across all relevant fields within the data. The input can be overridden by upstream data, allowing flexibility in how searches are conducted based on previous nodes. - Default Value:
''(empty string)
4. Max Results
- Input Type: Numeric
- Description: This setting is also relevant for the
searchRecordsaction and allows the user to specify the maximum number of results returned from a query. Setting this value too high could affect performance, but the limit up to 5000 ensures data remains manageable. - Default Value:
100 - Range: 1 to 5000
Use Cases & Examples
Use Cases
- Data Retrieval: An analytics team needs to fetch specific records based on filters set through user-generated input, like fetching user records based on unique identifiers.
- Data Update: A user wants to update specific records based on new input data, ensuring that the ID column correctly identifies which records to modify.
- Data Deletion: A system administrator needs to delete records based on their IDs, which can vary depending on prior data operations and flow.
Example Configuration
Use Case: Updating User Records
Let's consider a scenario where a company collects feedback and needs to update the status of users based on their feedback. The records will be identified using unique user IDs, and we will specify the ID column as "userId".
Configuration Data:
const selectedNode = {
data: {
node_type: 'contacts/updateRecord'
}
};
const config = {
recordId: '', // Leave empty to use upstream data
idColumn: 'userId', // Identify column in input data
query: '', // Not needed for this operation
limit: 100 // Limit can be adjusted if needed
};
// Function to update fields (example stub)
const updateField = (fieldName, value) => {
// Logic to update the node's configuration
};
// Use in AppNodeEditor
<AppNodeEditor selectedNode={selectedNode} config={config} updateField={updateField} />This setup allows the user to dynamically update user records while correlating with upstream data from previous nodes—simplifying management and operational strategies within the Vantage platform.