Add Dashboards (#41)

This commit is contained in:
Jonas Plum
2022-03-14 00:23:29 +01:00
committed by GitHub
parent 18a4dc54e7
commit 02c7da91da
30 changed files with 2824 additions and 279 deletions

View File

@@ -141,6 +141,33 @@ definitions:
ticket:
$ref: '#/definitions/TicketResponse'
type: object
Dashboard:
properties:
name:
type: string
widgets:
items:
$ref: '#/definitions/Widget'
type: array
required:
- name
- widgets
type: object
DashboardResponse:
properties:
id:
type: string
name:
type: string
widgets:
items:
$ref: '#/definitions/Widget'
type: array
required:
- id
- name
- widgets
type: object
Enrichment:
properties:
created:
@@ -1216,6 +1243,30 @@ definitions:
- roles
- apikey
type: object
Widget:
properties:
aggregation:
type: string
filter:
type: string
name:
type: string
type:
enum:
- bar
- line
- pie
type: string
width:
maximum: 12
minimum: 1
type: integer
required:
- name
- type
- aggregation
- width
type: object
host: .
info:
description: API for the catalyst incident response platform.
@@ -1457,6 +1508,7 @@ paths:
roles:
- admin:backup:read
- admin:backup:restore
- admin:dashboard:write
- admin:group:write
- admin:job:read
- admin:job:write
@@ -1470,6 +1522,7 @@ paths:
- analyst:currentsettings:write
- analyst:currentuser:read
- analyst:currentuserdata:read
- analyst:dashboard:read
- analyst:file
- analyst:group:read
- analyst:playbook:read
@@ -1540,6 +1593,183 @@ paths:
summary: Update current user data
tags:
- userdata
/dashboard/data:
get:
operationId: dashboardData
parameters:
- description: Aggregation
in: query
name: aggregation
required: true
type: string
x-example: type
- description: Filter
in: query
name: filter
type: string
x-example: status == "closed"
responses:
"200":
description: successful operation
examples:
test:
alert: 2
incident: 1
schema:
type: object
security:
- roles:
- dashboard:read
summary: Get widget data
tags:
- dashboards
/dashboards:
get:
operationId: listDashboards
responses:
"200":
description: successful operation
examples:
test:
- id: simple
name: Simple
widgets:
- aggregation: owner
filter: status == "open"
name: open_tickets_per_user
type: bar
width: 4
- aggregation: 'CONCAT(DATE_YEAR(created), "-", DATE_ISOWEEK(created)
< 10 ? "0" : "", DATE_ISOWEEK(created))'
name: tickets_per_week
type: line
width: 8
schema:
items:
$ref: '#/definitions/DashboardResponse'
type: array
security:
- roles:
- dashboard:read
summary: List dashboards
tags:
- dashboards
post:
operationId: createDashboard
parameters:
- description: New template
in: body
name: template
required: true
schema:
$ref: '#/definitions/Dashboard'
x-example:
name: My Dashboard
widgets: []
responses:
"200":
description: successful operation
examples:
test:
id: my-dashboard
name: My Dashboard
widgets: []
schema:
$ref: '#/definitions/DashboardResponse'
security:
- roles:
- dashboard:write
summary: Create a new dashboard
tags:
- dashboards
/dashboards/{id}:
delete:
operationId: deleteDashboard
parameters:
- description: Dashboard ID
in: path
name: id
required: true
type: string
x-example: simple
responses:
"204":
description: successful operation
security:
- roles:
- dashboard:write
summary: Delete a dashboard
tags:
- dashboards
get:
operationId: getDashboard
parameters:
- description: Dashboard ID
in: path
name: id
required: true
type: string
x-example: simple
responses:
"200":
description: successful operation
examples:
test:
id: simple
name: Simple
widgets:
- aggregation: owner
filter: status == "open"
name: open_tickets_per_user
type: bar
width: 4
- aggregation: 'CONCAT(DATE_YEAR(created), "-", DATE_ISOWEEK(created)
< 10 ? "0" : "", DATE_ISOWEEK(created))'
name: tickets_per_week
type: line
width: 8
schema:
$ref: '#/definitions/DashboardResponse'
security:
- roles:
- dashboard:read
summary: Get a single dashboard
tags:
- dashboards
put:
operationId: updateDashboard
parameters:
- description: Dashboard ID
in: path
name: id
required: true
type: string
x-example: simple
- description: Dashboard object that needs to be added
in: body
name: dashboard
required: true
schema:
$ref: '#/definitions/Dashboard'
x-example:
name: Simple
widgets: []
responses:
"200":
description: successful operation
examples:
test:
id: simple
name: Simple
widgets: []
schema:
$ref: '#/definitions/DashboardResponse'
security:
- roles:
- dashboard:write
summary: Update an existing dashboard
tags:
- dashboards
/jobs:
get:
operationId: listJobs
@@ -2189,6 +2419,7 @@ paths:
roles:
- admin:backup:read
- admin:backup:restore
- admin:dashboard:write
- admin:group:write
- admin:job:read
- admin:job:write
@@ -2202,6 +2433,7 @@ paths:
- analyst:currentsettings:write
- analyst:currentuser:read
- analyst:currentuserdata:read
- analyst:dashboard:read
- analyst:file
- analyst:group:read
- analyst:playbook:read
@@ -2308,6 +2540,7 @@ paths:
roles:
- admin:backup:read
- admin:backup:restore
- admin:dashboard:write
- admin:group:write
- admin:job:read
- admin:job:write
@@ -2321,6 +2554,7 @@ paths:
- analyst:currentsettings:write
- analyst:currentuser:read
- analyst:currentuserdata:read
- analyst:dashboard:read
- analyst:file
- analyst:group:read
- analyst:playbook:read
@@ -6710,6 +6944,7 @@ paths:
roles:
- admin:backup:read
- admin:backup:restore
- admin:dashboard:write
- admin:group:write
- admin:job:read
- admin:job:write
@@ -6723,6 +6958,7 @@ paths:
- analyst:currentsettings:write
- analyst:currentuser:read
- analyst:currentuserdata:read
- analyst:dashboard:read
- analyst:file
- analyst:group:read
- analyst:playbook:read
@@ -6746,6 +6982,7 @@ paths:
- analyst:currentsettings:write
- analyst:currentuser:read
- analyst:currentuserdata:read
- analyst:dashboard:read
- analyst:file
- analyst:group:read
- analyst:playbook:read
@@ -6798,6 +7035,7 @@ paths:
- analyst:currentsettings:write
- analyst:currentuser:read
- analyst:currentuserdata:read
- analyst:dashboard:read
- analyst:file
- analyst:group:read
- analyst:playbook:read
@@ -6858,6 +7096,7 @@ paths:
- analyst:currentsettings:write
- analyst:currentuser:read
- analyst:currentuserdata:read
- analyst:dashboard:read
- analyst:file
- analyst:group:read
- analyst:playbook:read
@@ -6914,6 +7153,7 @@ paths:
roles:
- admin:backup:read
- admin:backup:restore
- admin:dashboard:write
- admin:group:write
- admin:job:read
- admin:job:write
@@ -6927,6 +7167,7 @@ paths:
- analyst:currentsettings:write
- analyst:currentuser:read
- analyst:currentuserdata:read
- analyst:dashboard:read
- analyst:file
- analyst:group:read
- analyst:playbook:read