mirror of https://github.com/abpframework/abp.git
Browse Source
Introduce a set of JSON Schema definitions to support dashboards and visualizations (aggregation, chart, chart-type, descriptor, filter, group, list, number, position, user-filter, visualization, visualization-type). Update page-descriptor.schema.json to include a dashboard property and a conditional requirement when page type is "dashboard", and extend page-type.schema.json enum to include "dashboard". These changes add schema-level validation for dashboard configuration, visualizations (number/chart/list), positioning, and filters.pull/25052/head
14 changed files with 443 additions and 1 deletions
@ -0,0 +1,8 @@ |
|||
{ |
|||
"$schema": "https://json-schema.org/draft/2020-12/schema", |
|||
"$id": "dashboard-aggregation-type.schema.json", |
|||
"title": "DashboardAggregationType", |
|||
"description": "The type of aggregation to perform", |
|||
"type": "string", |
|||
"enum": ["count", "sum", "average", "min", "max", "percentFilled", "percentEmpty"] |
|||
} |
|||
@ -0,0 +1,74 @@ |
|||
{ |
|||
"$schema": "https://json-schema.org/draft/2020-12/schema", |
|||
"$id": "dashboard-chart-descriptor.schema.json", |
|||
"title": "DashboardChartDescriptor", |
|||
"description": "Configuration for a chart visualization", |
|||
"type": "object", |
|||
"properties": { |
|||
"chartType": { |
|||
"$ref": "dashboard-chart-type.schema.json" |
|||
}, |
|||
"xAxis": { |
|||
"type": "object", |
|||
"properties": { |
|||
"property": { |
|||
"type": "string", |
|||
"description": "Property name to group by on the X-axis" |
|||
}, |
|||
"useForeignDisplay": { |
|||
"type": "boolean", |
|||
"description": "Show the FK display property instead of the raw ID", |
|||
"default": false |
|||
}, |
|||
"dateGrouping": { |
|||
"type": "string", |
|||
"enum": ["day", "week", "month", "quarter", "year"], |
|||
"description": "Grouping interval for DateTime properties" |
|||
} |
|||
}, |
|||
"required": ["property"], |
|||
"additionalProperties": false |
|||
}, |
|||
"yAxis": { |
|||
"type": "array", |
|||
"items": { |
|||
"type": "object", |
|||
"properties": { |
|||
"aggregation": { |
|||
"$ref": "dashboard-aggregation-type.schema.json" |
|||
}, |
|||
"property": { |
|||
"type": "string", |
|||
"description": "Property name for sum/average/min/max" |
|||
}, |
|||
"label": { |
|||
"type": "string", |
|||
"description": "Display label for this series" |
|||
}, |
|||
"color": { |
|||
"type": "string" |
|||
} |
|||
}, |
|||
"required": ["aggregation"], |
|||
"additionalProperties": false |
|||
}, |
|||
"minItems": 1 |
|||
}, |
|||
"size": { |
|||
"type": "string", |
|||
"enum": ["small", "medium", "large"], |
|||
"default": "medium" |
|||
}, |
|||
"barOrientation": { |
|||
"type": "string", |
|||
"enum": ["vertical", "horizontal"], |
|||
"default": "vertical" |
|||
}, |
|||
"showRecordCount": { |
|||
"type": "boolean", |
|||
"default": false |
|||
} |
|||
}, |
|||
"required": ["chartType", "xAxis", "yAxis"], |
|||
"additionalProperties": false |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
{ |
|||
"$schema": "https://json-schema.org/draft/2020-12/schema", |
|||
"$id": "dashboard-chart-type.schema.json", |
|||
"title": "DashboardChartType", |
|||
"description": "The type of chart", |
|||
"type": "string", |
|||
"enum": ["bar", "line", "pie", "donut"] |
|||
} |
|||
@ -0,0 +1,23 @@ |
|||
{ |
|||
"$schema": "https://json-schema.org/draft/2020-12/schema", |
|||
"$id": "dashboard-descriptor.schema.json", |
|||
"title": "DashboardDescriptor", |
|||
"description": "Describes a dashboard configuration with groups and visualizations", |
|||
"type": "object", |
|||
"properties": { |
|||
"description": { |
|||
"type": "string", |
|||
"description": "Description text shown below the dashboard title" |
|||
}, |
|||
"groups": { |
|||
"type": "array", |
|||
"description": "Dashboard groups, each bound to a single entity", |
|||
"items": { |
|||
"$ref": "dashboard-group-descriptor.schema.json" |
|||
}, |
|||
"minItems": 1 |
|||
} |
|||
}, |
|||
"required": ["groups"], |
|||
"additionalProperties": false |
|||
} |
|||
@ -0,0 +1,38 @@ |
|||
{ |
|||
"$schema": "https://json-schema.org/draft/2020-12/schema", |
|||
"$id": "dashboard-filter-descriptor.schema.json", |
|||
"title": "DashboardFilterDescriptor", |
|||
"description": "Static filter applied to a dashboard group or visualization", |
|||
"type": "object", |
|||
"properties": { |
|||
"operator": { |
|||
"type": "string", |
|||
"enum": ["and", "or"], |
|||
"default": "and" |
|||
}, |
|||
"conditions": { |
|||
"type": "array", |
|||
"items": { |
|||
"type": "object", |
|||
"properties": { |
|||
"property": { |
|||
"type": "string", |
|||
"description": "Property name to filter on" |
|||
}, |
|||
"filterType": { |
|||
"type": "string", |
|||
"enum": ["equal", "notEqual", "contains", "greaterThan", "lessThan", "isNull", "isNotNull"], |
|||
"default": "equal" |
|||
}, |
|||
"value": { |
|||
"description": "Filter value" |
|||
} |
|||
}, |
|||
"required": ["property", "filterType"], |
|||
"additionalProperties": false |
|||
} |
|||
} |
|||
}, |
|||
"required": ["conditions"], |
|||
"additionalProperties": false |
|||
} |
|||
@ -0,0 +1,54 @@ |
|||
{ |
|||
"$schema": "https://json-schema.org/draft/2020-12/schema", |
|||
"$id": "dashboard-group-descriptor.schema.json", |
|||
"title": "DashboardGroupDescriptor", |
|||
"description": "A dashboard group bound to a single entity, containing visualizations", |
|||
"type": "object", |
|||
"properties": { |
|||
"name": { |
|||
"type": "string", |
|||
"description": "Unique identifier for this group within the dashboard", |
|||
"minLength": 1 |
|||
}, |
|||
"title": { |
|||
"type": "string", |
|||
"description": "Display title for the group section" |
|||
}, |
|||
"entityName": { |
|||
"type": "string", |
|||
"description": "Full entity name this group sources data from", |
|||
"minLength": 1 |
|||
}, |
|||
"filter": { |
|||
"$ref": "dashboard-filter-descriptor.schema.json" |
|||
}, |
|||
"userFilters": { |
|||
"type": "array", |
|||
"description": "Properties exposed as dynamic filters for end users", |
|||
"items": { |
|||
"$ref": "dashboard-user-filter-descriptor.schema.json" |
|||
} |
|||
}, |
|||
"appearance": { |
|||
"type": "object", |
|||
"properties": { |
|||
"useBackground": { |
|||
"type": "boolean", |
|||
"description": "Show light background color for this group", |
|||
"default": false |
|||
} |
|||
}, |
|||
"additionalProperties": false |
|||
}, |
|||
"visualizations": { |
|||
"type": "array", |
|||
"description": "Visualizations within this group", |
|||
"items": { |
|||
"$ref": "dashboard-visualization-descriptor.schema.json" |
|||
}, |
|||
"minItems": 1 |
|||
} |
|||
}, |
|||
"required": ["name", "entityName", "visualizations"], |
|||
"additionalProperties": false |
|||
} |
|||
@ -0,0 +1,55 @@ |
|||
{ |
|||
"$schema": "https://json-schema.org/draft/2020-12/schema", |
|||
"$id": "dashboard-list-descriptor.schema.json", |
|||
"title": "DashboardListDescriptor", |
|||
"description": "Configuration for a list/table visualization", |
|||
"type": "object", |
|||
"properties": { |
|||
"fields": { |
|||
"type": "array", |
|||
"items": { "type": "string" }, |
|||
"description": "Property names to display as columns" |
|||
}, |
|||
"sortBy": { |
|||
"type": "object", |
|||
"properties": { |
|||
"property": { "type": "string" }, |
|||
"direction": { |
|||
"type": "string", |
|||
"enum": ["asc", "desc"], |
|||
"default": "asc" |
|||
} |
|||
}, |
|||
"required": ["property"], |
|||
"additionalProperties": false |
|||
}, |
|||
"maxRows": { |
|||
"type": "integer", |
|||
"minimum": 1, |
|||
"maximum": 50, |
|||
"default": 10 |
|||
}, |
|||
"rowHeight": { |
|||
"type": "string", |
|||
"enum": ["compact", "normal", "tall"], |
|||
"default": "compact" |
|||
}, |
|||
"colorBy": { |
|||
"type": "object", |
|||
"properties": { |
|||
"type": { |
|||
"type": "string", |
|||
"enum": ["property", "conditions"] |
|||
}, |
|||
"property": { |
|||
"type": "string", |
|||
"description": "Enum property name for automatic coloring" |
|||
} |
|||
}, |
|||
"required": ["type"], |
|||
"additionalProperties": false |
|||
} |
|||
}, |
|||
"required": ["fields"], |
|||
"additionalProperties": false |
|||
} |
|||
@ -0,0 +1,48 @@ |
|||
{ |
|||
"$schema": "https://json-schema.org/draft/2020-12/schema", |
|||
"$id": "dashboard-number-descriptor.schema.json", |
|||
"title": "DashboardNumberDescriptor", |
|||
"description": "Configuration for a number/KPI visualization", |
|||
"type": "object", |
|||
"properties": { |
|||
"aggregation": { |
|||
"$ref": "dashboard-aggregation-type.schema.json" |
|||
}, |
|||
"aggregationProperty": { |
|||
"type": "string", |
|||
"description": "Property name for sum/average/min/max aggregations" |
|||
}, |
|||
"format": { |
|||
"type": "string", |
|||
"enum": ["number", "currency", "percentage"], |
|||
"default": "number" |
|||
}, |
|||
"color": { |
|||
"type": "string", |
|||
"description": "Display color name (blue, green, red, purple, orange, indigo, amber, teal)" |
|||
}, |
|||
"useBackgroundColor": { |
|||
"type": "boolean", |
|||
"default": false |
|||
}, |
|||
"conditionalColors": { |
|||
"type": "array", |
|||
"items": { |
|||
"type": "object", |
|||
"properties": { |
|||
"operator": { |
|||
"type": "string", |
|||
"enum": ["greaterThan", "lessThan", "equals", "between"] |
|||
}, |
|||
"value": { "type": "number" }, |
|||
"valueTo": { "type": "number" }, |
|||
"color": { "type": "string" } |
|||
}, |
|||
"required": ["operator", "value", "color"], |
|||
"additionalProperties": false |
|||
} |
|||
} |
|||
}, |
|||
"required": ["aggregation"], |
|||
"additionalProperties": false |
|||
} |
|||
@ -0,0 +1,29 @@ |
|||
{ |
|||
"$schema": "https://json-schema.org/draft/2020-12/schema", |
|||
"$id": "dashboard-position-descriptor.schema.json", |
|||
"title": "DashboardPositionDescriptor", |
|||
"description": "Grid position for a visualization (4-column grid)", |
|||
"type": "object", |
|||
"properties": { |
|||
"row": { |
|||
"type": "integer", |
|||
"minimum": 0, |
|||
"description": "Row index (0-based)" |
|||
}, |
|||
"col": { |
|||
"type": "integer", |
|||
"minimum": 0, |
|||
"maximum": 3, |
|||
"description": "Column index (0-based, max 3)" |
|||
}, |
|||
"colSpan": { |
|||
"type": "integer", |
|||
"minimum": 1, |
|||
"maximum": 4, |
|||
"default": 1, |
|||
"description": "Number of columns this visualization spans" |
|||
} |
|||
}, |
|||
"required": ["row", "col", "colSpan"], |
|||
"additionalProperties": false |
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
{ |
|||
"$schema": "https://json-schema.org/draft/2020-12/schema", |
|||
"$id": "dashboard-user-filter-descriptor.schema.json", |
|||
"title": "DashboardUserFilterDescriptor", |
|||
"description": "An interactive filter exposed to end users as a dropdown or input", |
|||
"type": "object", |
|||
"properties": { |
|||
"property": { |
|||
"type": "string", |
|||
"description": "Property name to filter on", |
|||
"minLength": 1 |
|||
}, |
|||
"displayType": { |
|||
"type": "string", |
|||
"enum": ["dropdown", "dateRange", "text", "range"], |
|||
"default": "dropdown" |
|||
} |
|||
}, |
|||
"required": ["property"], |
|||
"additionalProperties": false |
|||
} |
|||
@ -0,0 +1,65 @@ |
|||
{ |
|||
"$schema": "https://json-schema.org/draft/2020-12/schema", |
|||
"$id": "dashboard-visualization-descriptor.schema.json", |
|||
"title": "DashboardVisualizationDescriptor", |
|||
"description": "A single visualization element (number, chart, or list) within a dashboard group", |
|||
"type": "object", |
|||
"properties": { |
|||
"name": { |
|||
"type": "string", |
|||
"description": "Unique identifier within the group", |
|||
"minLength": 1 |
|||
}, |
|||
"type": { |
|||
"$ref": "dashboard-visualization-type.schema.json" |
|||
}, |
|||
"title": { |
|||
"type": "string", |
|||
"description": "Display title for the visualization" |
|||
}, |
|||
"description": { |
|||
"type": "string", |
|||
"description": "Optional description text" |
|||
}, |
|||
"position": { |
|||
"$ref": "dashboard-position-descriptor.schema.json" |
|||
}, |
|||
"filter": { |
|||
"$ref": "dashboard-filter-descriptor.schema.json" |
|||
}, |
|||
"showDescriptionAsTooltip": { |
|||
"type": "boolean", |
|||
"default": false |
|||
}, |
|||
"clickToSeeRecords": { |
|||
"type": "boolean", |
|||
"description": "Allow users to click to see underlying records", |
|||
"default": false |
|||
}, |
|||
"number": { |
|||
"$ref": "dashboard-number-descriptor.schema.json" |
|||
}, |
|||
"chart": { |
|||
"$ref": "dashboard-chart-descriptor.schema.json" |
|||
}, |
|||
"list": { |
|||
"$ref": "dashboard-list-descriptor.schema.json" |
|||
} |
|||
}, |
|||
"required": ["name", "type", "title", "position"], |
|||
"allOf": [ |
|||
{ |
|||
"if": { "properties": { "type": { "const": "number" } } }, |
|||
"then": { "required": ["number"] } |
|||
}, |
|||
{ |
|||
"if": { "properties": { "type": { "const": "chart" } } }, |
|||
"then": { "required": ["chart"] } |
|||
}, |
|||
{ |
|||
"if": { "properties": { "type": { "const": "list" } } }, |
|||
"then": { "required": ["list"] } |
|||
} |
|||
], |
|||
"additionalProperties": false |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
{ |
|||
"$schema": "https://json-schema.org/draft/2020-12/schema", |
|||
"$id": "dashboard-visualization-type.schema.json", |
|||
"title": "DashboardVisualizationType", |
|||
"description": "The type of dashboard visualization", |
|||
"type": "string", |
|||
"enum": ["number", "chart", "list"] |
|||
} |
|||
Loading…
Reference in new issue