Endpoint for creating custom dashboard

What does this MR do and why?

This MR adds a new GraphQL mutation, createCustomDashboard, which allows organization owners to create custom analytics dashboards. It validates the input, persists the dashboard, and returns the created dashboard object. The MR also ensures the returned dashboard is authorized correctly by enforcing read_custom_dashboard permission, so only users with appropriate access can view the result.

The final config schema structure hasn’t been implemented yet. We’re tracking that work in issue #581090

References

Related #572348

Example Request

mutation CreateDashboard($input: CreateCustomDashboardInput!) {
  createCustomDashboard(input: $input) {
    dashboard {
      id
      name
      description
      config
      createdAt
      updatedAt
    }
    errors
  }
}

Example Response

{
    "data": {
        "createCustomDashboard": {
            "dashboard": {
                "id": "gid://gitlab/Analytics::CustomDashboards::Dashboard/1",
                "name": "Sales KPI Dashboard",
                "description": "Quarterly sales performance metrics.",
                "config": {
                    "version": "2",
                    "title": "Sales KPI Dashboard",
                    "description": "Track quarterly sales performance",
                    "panels": [
                        {
                            "title": "Total Sales",
                            "visualization": "number",
                            "gridAttributes": {
                                "width": 4,
                                "height": 2
                            }
                        },
                        {
                            "title": "Sales Trend",
                            "visualization": "chart",
                            "gridAttributes": {
                                "width": 8,
                                "height": 4
                            }
                        }
                    ]
                },
                "organization": {
                    "id": "gid://gitlab/Organizations::Organization/1"
                },
                "createdBy": {
                    "id": "gid://gitlab/User/1"
                },
                "createdAt": "2025-11-24T14:13:41Z",
                "updatedAt": "2025-11-24T14:13:41Z"
            },
            "errors": []
        }
    }
}

Screenshots or screen recordings

Before After

How to set up and validate locally

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Nnamdi Ogundu

Merge request reports

Loading