https://github.com/7span/directus-extension-custom-query-panel
An easy to use insight panel to see custom raw query data from database
https://github.com/7span/directus-extension-custom-query-panel
directus directus-extension directus-panel-quest
Last synced: 6 months ago
JSON representation
An easy to use insight panel to see custom raw query data from database
- Host: GitHub
- URL: https://github.com/7span/directus-extension-custom-query-panel
- Owner: 7span
- Created: 2023-07-27T05:42:50.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-12-15T20:00:56.000Z (almost 2 years ago)
- Last Synced: 2025-04-02T22:59:56.861Z (6 months ago)
- Topics: directus, directus-extension, directus-panel-quest
- Language: JavaScript
- Homepage:
- Size: 1.54 MB
- Stars: 43
- Watchers: 4
- Forks: 3
- Open Issues: 4
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# Directus Custom Query Panel
Behold the magic π©β¨ of our simple panel! View your data without the hassle of writing custom endpoints or preparing views - it's like having your cake π° and eating it too, but for data! πΎπ
## Details
- Execute custom SQL queries directly from the panel.
- Use dynamic parameters to reuse queries with different values.
- Display query results in a simple tabular structure for easy readability.
- Enhance data visibility and understanding by enabling users to extract meaningful insights from their data which is crucial for CRM and data-driven applications.## πSet Up Instructions
- Either install through NPM [npm install @7span/directus-extension-custom-query-panel](https://www.npmjs.com/) or [Installing Through the Extensions Folder](https://docs.directus.io/extensions/installing-extensions.html#installing-through-the-extensions-folder).
- Once Installed/configured extension you need hit the below curl request to create a default table(`cqp_queries`) to store the queries.**NOTE**: Replace `localhost:8055` with your domain
```bash
curl --location --request POST 'http://localhost:8055/custom-query-panel/create-table'
```- Table named `cqp_queries` will be available in your project.
## How To use This Extension
1. Create the queries in the table (`cqp_queries`) as explained in below example.
```bash
select first_name, last_name from employees where department = ${department}
```2. This extension provides support of *`global variables`* added in insights like department or week.
3. Use `variables` field give in panel settings below `fields`.
4. Use `double mustache` syntax for entering `value` field to get value from variables.
## π Environment Variables
- You can provide collection name in CUSTOM_QUERY_COLLECTION as per your needs.
- It Also provide support for custom query length using CUSTOM_QUERY_FIELD_LENGTH
```bash
# default value CUSTOM_QUERY_COLLECTION = "cqp_queries"
CUSTOM_QUERY_COLLECTION="custom_query"
# default value CUSTOM_QUERY_FIELD_LENGTH = 5000
CUSTOM_QUERY_FIELD_LENGTH=10000
```## Problem
- Getting data from database query and show it in a insights panel was missing.
- The ability to extract and display data from a database query within an insights panel is crucial for CRM and data-driven applications.
- Insights panels serve as a hub for users to access valuable information, gain actionable insights, and make informed decisions.
- This feature bridges the gap between raw data stored in the database and its meaningful interpretation, making Directus an even more versatile platform for managing customer relationships and data-driven business operations.## Extension Type
- π¦ Bundle ( Panel + Custom Endpoint )
## Screenshots





## Collaborators- [Harsh Kansagara](https://github.com/theharshin)
- [Jay Bharadia](https://github.com/jay-p-b-7span)
- [Bhagyesh Radiya](https://github.com/bhagyesh-7span)## Contact Details
- [Linkedin](https://www.linkedin.com/company/7span)
- [Gmail](mailto:yo@7span.com)## π§ Please note
- this extension uses raw query. Use with caution. It might do uninteded actions.
- Roles and permission check for query### Table Fields
- We have repeater interface with multiple columns support