IRIS Extension for interactive Webhook execution
We’ve developed a webhook-based integration feature that enables IRIS to send structured requests to external tools and display responses in a visually intuitive format. More details are outlined in the following document:
Summary by CodeRabbit
-
New Features
- Introduced comprehensive webhook management, including UI for adding, editing, uploading, and deleting webhooks, with detailed validation and JSON schema support.
- Added support for triggers and actions in case templates, enabling automated workflows via webhooks.
- Implemented execution of triggers and actions with asynchronous HTTP requests and real-time response tracking.
- Enhanced case and task management with new UI elements for viewing and executing webhook actions and visualizing responses.
- Added new REST API endpoints for managing case triggers, task actions, and webhook responses.
- Expanded navigation menus to include direct access to webhooks and triggers.
-
Improvements
- Improved validation and error messaging for case templates, triggers, actions, and webhooks.
- Updated templates and UI for better clarity, modularity, and user experience, including new modal dialogs and responsive tables.
- Refined permission system to include webhook-specific access controls.
-
Bug Fixes
- Addressed cleanup of related task responses when deleting tasks to prevent orphaned data.
-
Documentation
- Updated example JSON structures and in-app documentation to reflect new triggers and actions fields.
-
Style
- Enhanced code and template formatting for consistency and readability.
- Added new CSS for improved modal presentation.
-
Chores
- Added new dependencies for debugging and functionality support.
[!IMPORTANT]
Review skipped
Auto reviews are disabled on base/target branches other than the default branch.
🗂️ Base branches to auto review (1)
- api_*
Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.
Walkthrough
This update introduces a comprehensive webhook integration framework into the application. It adds new database models, schemas, and RESTful endpoints for managing webhooks, task and case responses, and their interactions with cases and tasks. The case template system is extended to support actions and triggers linked to webhooks, enabling automated execution of webhooks during case and task lifecycles. The UI is enhanced with new pages and modals for managing webhooks, viewing and executing task actions, and visualizing trigger responses. Supporting backend logic includes validation, asynchronous execution, and result persistence for webhook calls. Numerous templates and JavaScript files are updated or added to support these features.
Changes
| File(s) | Change Summary |
|---|---|
docker-compose.base.yml, docker-compose.yml, docker/nginx/entrypoint.sh, docker/nginx/nginx.conf, docker/webApp/Dockerfile |
Docker configuration updates: environment file for DB, local image builds, ports, CSP header expansion, and script shebang adjustment. |
source/app/blueprints/case/case_routes.py, source/app/blueprints/case/case_tasks_routes.py, source/app/blueprints/pages/case/case_triggers_routes.py |
New Flask blueprints for case management, tasks, and triggers: routes for viewing, editing, and synchronizing case/task data, triggers, activities, and real-time features. |
source/app/blueprints/pages/case/templates/case-nav.html, .../case/templates/case-nav_actions.html, .../case/templates/case.html, .../case/templates/case_tasks.html, .../case/templates/case_triggers.html, .../case/templates/modal_add_case_task.html |
UI templates updated/added for navigation, actions, triggers, task actions, and modals with improved formatting and new functionality for actions and triggers. |
source/app/blueprints/pages/manage/manage_case_templates_routes.py, .../manage_webhooks_routes.py |
Backend routes for managing case templates and webhooks, including modal rendering, CRUD operations, validation, and error handling. |
source/app/blueprints/pages/manage/templates/manage_webhooks.html, .../modal_case_template.html, .../modal_upload_case_template.html, .../modal_upload_webhook.html, .../modal_webhook.html |
New and updated templates for webhook and case template management, including modals for editing, uploading, and viewing JSON schema details. |
source/app/blueprints/rest/api_routes.py, .../rest/case/case_tasks_routes.py, .../rest/manage/manage_case_templates_routes.py, .../rest/manage/manage_cases_routes.py |
REST API endpoints for ping/version, case/task action responses, triggers execution, and improved error messages in template creation. |
source/app/business/cases.py, source/app/datamgmt/case/case_tasks_db.py |
Internal logic for case/task creation/deletion: trigger execution, response persistence, and cleanup for new models. |
source/app/datamgmt/manage/manage_case_response_db.py, .../manage_case_templates_db.py, .../manage_cases_db.py, .../manage_task_response_db.py, .../manage_webhooks_db.py |
New modules and extended logic for managing case/task responses, webhooks, validation, and execution. |
source/app/forms.py |
Added WebhookForm for webhook JSON input. |
source/app/models/authorization.py, .../cases.py, .../models.py |
Models updated: new permissions, new/extended models for webhook, task/case responses, and extended case/case template fields. |
source/app/post_init.py |
Post-initialization now enables pgcrypto extension and logs migrations. |
source/app/schema/marshables.py |
Added Marshmallow schemas for new models and extended existing schemas for webhooks, actions, triggers, and input parameters. |
source/app/static/assets/css/webhooks/webhooks.css |
New CSS for webhook modals and backdrops. |
source/app/templates/includes/sidenav.html |
Sidebar updated with "Webhooks" menu under "Manage" for administrators. |
source/app/views.py |
Registered new blueprints for webhooks and triggers. |
source/requirements.txt |
Added Debugpy package. |
ui/src/pages/case.taskaction.response.js, .../case.tasks.js, .../case.triggers.js, .../manage.case.templates.js, .../manage.webhooks.js |
New and updated JS for managing webhooks, task actions, triggers, DataTables, JSON editors, and UI enhancements. |
Sequence Diagram(s)
sequenceDiagram
participant User
participant UI
participant FlaskApp
participant DB
participant Webhook
User->>UI: Initiate case creation (select template)
UI->>FlaskApp: POST /api/cases (with case_template_id)
FlaskApp->>DB: Create new case
FlaskApp->>DB: Fetch triggers for case_template_id
alt Triggers exist
loop For each trigger
FlaskApp->>Webhook: POST trigger payload (async)
Webhook-->>FlaskApp: JSON response
FlaskApp->>DB: Save CaseResponse
end
else No triggers
FlaskApp-->>User: Error (no triggers)
end
FlaskApp-->>UI: Success response (case created)
UI-->>User: Show case details
sequenceDiagram
participant User
participant UI
participant FlaskApp
participant DB
participant Webhook
User->>UI: Execute task action (select action)
UI->>FlaskApp: POST /case/jsoneditor (payload, task_id, action_id)
FlaskApp->>DB: Fetch webhook for action_id
FlaskApp->>Webhook: POST action payload
Webhook-->>FlaskApp: JSON response
FlaskApp->>DB: Save TaskResponse
FlaskApp-->>UI: Success response (action result)
UI-->>User: Display action result (JSON viewer)
Poem
In burrows deep, where webhooks leap,
The rabbits code, no time for sleep!
Triggers fire and actions run,
JSON flows and tasks are spun.
New menus bloom, the tables dance,
With modals bright, we seize the chance—
To automate, connect, and cheer,
For webhooks’ magic now is here!((\
( -.-)
o_(")(")
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
🪧 Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
I pushed a fix in commit <commit_id>, please review it.Explain this complex logic.Open a follow-up GitHub issue for this discussion.
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:@coderabbitai explain this code block.@coderabbitai modularize this function.
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.@coderabbitai read src/utils.ts and explain its main purpose.@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.@coderabbitai help me debug CodeRabbit configuration file.
Support
Need help? Create a ticket on our support page for assistance with any issues or questions.
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (Invoked using PR comments)
@coderabbitai pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai generate docstringsto generate docstrings for this PR.@coderabbitai generate sequence diagramto generate a sequence diagram of the changes in this PR.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - Please see the configuration documentation for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.