Chore: Deprecate experimental restore dashboard API (#116256)
This commit is contained in:
@@ -171,146 +171,3 @@ Status Codes:
|
||||
- **200** - Ok
|
||||
- **401** - Unauthorized
|
||||
- **404** - Dashboard version not found
|
||||
|
||||
## Restore dashboard by dashboard UID
|
||||
|
||||
`POST /api/dashboards/uid/:uid/restore`
|
||||
|
||||
Restores a dashboard to a given dashboard version using `uid`.
|
||||
|
||||
**Example request for restoring a dashboard version**:
|
||||
|
||||
```http
|
||||
POST /api/dashboards/uid/QA7wKklGz/restore
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
|
||||
{
|
||||
"version": 1
|
||||
}
|
||||
```
|
||||
|
||||
JSON body schema:
|
||||
|
||||
- **version** - The dashboard version to restore to
|
||||
|
||||
**Example response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200 OK
|
||||
Content-Type: application/json; charset=UTF-8
|
||||
Content-Length: 67
|
||||
|
||||
{
|
||||
"id": 70,
|
||||
"slug": "my-dashboard",
|
||||
"status": "success",
|
||||
"uid": "QA7wKklGz",
|
||||
"url": "/d/QA7wKklGz/my-dashboard",
|
||||
"version": 3
|
||||
}
|
||||
```
|
||||
|
||||
JSON response body schema:
|
||||
|
||||
- **slug** - the URL friendly slug of the dashboard's title
|
||||
- **status** - whether the restoration was successful or not
|
||||
- **version** - the new dashboard version, following the restoration
|
||||
|
||||
Status codes:
|
||||
|
||||
- **200** - OK
|
||||
- **400** - Bad request (specified version has the same content as the current dashboard)
|
||||
- **401** - Unauthorized
|
||||
- **404** - Not found (dashboard not found or dashboard version not found)
|
||||
- **500** - Internal server error (indicates issue retrieving dashboard tags from database)
|
||||
|
||||
**Example error response**
|
||||
|
||||
```http
|
||||
HTTP/1.1 404 Not Found
|
||||
Content-Type: application/json; charset=UTF-8
|
||||
Content-Length: 46
|
||||
|
||||
{
|
||||
"message": "Dashboard version not found"
|
||||
}
|
||||
```
|
||||
|
||||
JSON response body schema:
|
||||
|
||||
- **message** - Message explaining the reason for the request failure.
|
||||
|
||||
## Compare dashboard versions
|
||||
|
||||
`POST /api/dashboards/calculate-diff`
|
||||
|
||||
Compares two dashboard versions by calculating the JSON diff of them.
|
||||
|
||||
**Example request**:
|
||||
|
||||
```http
|
||||
POST /api/dashboards/calculate-diff HTTP/1.1
|
||||
Accept: text/html
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
|
||||
{
|
||||
"base": {
|
||||
"dashboardId": 1,
|
||||
"version": 1
|
||||
},
|
||||
"new": {
|
||||
"dashboardId": 1,
|
||||
"version": 2
|
||||
},
|
||||
"diffType": "json"
|
||||
}
|
||||
```
|
||||
|
||||
JSON body schema:
|
||||
|
||||
- **base** - an object representing the base dashboard version
|
||||
- **new** - an object representing the new dashboard version
|
||||
- **diffType** - the type of diff to return. Can be "json" or "basic".
|
||||
|
||||
**Example response (JSON diff)**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200 OK
|
||||
Content-Type: text/html; charset=UTF-8
|
||||
|
||||
<p id="l1" class="diff-line diff-json-same">
|
||||
<!-- Diff omitted -->
|
||||
</p>
|
||||
```
|
||||
|
||||
The response is a textual representation of the diff, with the dashboard values being in JSON, similar to the diffs seen on sites like GitHub or GitLab.
|
||||
|
||||
Status Codes:
|
||||
|
||||
- **200** - Ok
|
||||
- **400** - Bad request (invalid JSON sent)
|
||||
- **401** - Unauthorized
|
||||
- **404** - Not found
|
||||
|
||||
**Example response (basic diff)**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200 OK
|
||||
Content-Type: text/html; charset=UTF-8
|
||||
|
||||
<div class="diff-group">
|
||||
<!-- Diff omitted -->
|
||||
</div>
|
||||
```
|
||||
|
||||
The response here is a summary of the changes, derived from the diff between the two JSON objects.
|
||||
|
||||
Status Codes:
|
||||
|
||||
- **200** - OK
|
||||
- **400** - Bad request (invalid JSON sent)
|
||||
- **401** - Unauthorized
|
||||
- **404** - Not found
|
||||
|
||||
@@ -727,17 +727,6 @@ const injectedRtkApi = api
|
||||
}),
|
||||
invalidatesTags: ['dashboards', 'permissions'],
|
||||
}),
|
||||
restoreDashboardVersionByUid: build.mutation<
|
||||
RestoreDashboardVersionByUidApiResponse,
|
||||
RestoreDashboardVersionByUidApiArg
|
||||
>({
|
||||
query: (queryArg) => ({
|
||||
url: `/dashboards/uid/${queryArg.uid}/restore`,
|
||||
method: 'POST',
|
||||
body: queryArg.restoreDashboardVersionCommand,
|
||||
}),
|
||||
invalidatesTags: ['dashboards', 'versions'],
|
||||
}),
|
||||
getDashboardVersionsByUid: build.query<GetDashboardVersionsByUidApiResponse, GetDashboardVersionsByUidApiArg>({
|
||||
query: (queryArg) => ({
|
||||
url: `/dashboards/uid/${queryArg.uid}/versions`,
|
||||
@@ -2628,26 +2617,6 @@ export type UpdateDashboardPermissionsByUidApiArg = {
|
||||
uid: string;
|
||||
updateDashboardAclCommand: UpdateDashboardAclCommand;
|
||||
};
|
||||
export type RestoreDashboardVersionByUidApiResponse = /** status 200 (empty) */ {
|
||||
/** FolderUID The unique identifier (uid) of the folder the dashboard belongs to. */
|
||||
folderUid?: string;
|
||||
/** ID The unique identifier (id) of the created/updated dashboard. */
|
||||
id: number;
|
||||
/** Status status of the response. */
|
||||
status: string;
|
||||
/** Slug The slug of the dashboard. */
|
||||
title: string;
|
||||
/** UID The unique identifier (uid) of the created/updated dashboard. */
|
||||
uid: string;
|
||||
/** URL The relative URL for accessing the created/updated dashboard. */
|
||||
url: string;
|
||||
/** Version The version of the dashboard. */
|
||||
version: number;
|
||||
};
|
||||
export type RestoreDashboardVersionByUidApiArg = {
|
||||
uid: string;
|
||||
restoreDashboardVersionCommand: RestoreDashboardVersionCommand;
|
||||
};
|
||||
export type GetDashboardVersionsByUidApiResponse = /** status 200 (empty) */ DashboardVersionResponseMeta;
|
||||
export type GetDashboardVersionsByUidApiArg = {
|
||||
uid: string;
|
||||
@@ -4568,9 +4537,6 @@ export type DashboardAclUpdateItem = {
|
||||
export type UpdateDashboardAclCommand = {
|
||||
items?: DashboardAclUpdateItem[];
|
||||
};
|
||||
export type RestoreDashboardVersionCommand = {
|
||||
version?: number;
|
||||
};
|
||||
export type DashboardVersionMeta = {
|
||||
created?: string;
|
||||
createdBy?: string;
|
||||
@@ -6633,7 +6599,6 @@ export const {
|
||||
useGetDashboardPermissionsListByUidQuery,
|
||||
useLazyGetDashboardPermissionsListByUidQuery,
|
||||
useUpdateDashboardPermissionsByUidMutation,
|
||||
useRestoreDashboardVersionByUidMutation,
|
||||
useGetDashboardVersionsByUidQuery,
|
||||
useLazyGetDashboardVersionsByUidQuery,
|
||||
useGetDashboardVersionByUidQuery,
|
||||
|
||||
@@ -795,6 +795,10 @@ func (hs *HTTPServer) GetDashboardVersion(c *contextmodel.ReqContext) response.R
|
||||
// swagger:route POST /dashboards/uid/{uid}/restore dashboards versions restoreDashboardVersionByUID
|
||||
//
|
||||
// Restore a dashboard to a given dashboard version using UID.
|
||||
// This API will be removed when /apis/dashboards.grafana.app/v1 is released.
|
||||
// You can restore a dashboard by reading it from history, then creating it again.
|
||||
//
|
||||
// Deprecated: true
|
||||
//
|
||||
// Responses:
|
||||
// 200: postDashboardResponse
|
||||
|
||||
Generated
+2
@@ -4024,12 +4024,14 @@
|
||||
},
|
||||
"/dashboards/uid/{uid}/restore": {
|
||||
"post": {
|
||||
"description": "This API will be removed when /apis/dashboards.grafana.app/v1 is released.\nYou can restore a dashboard by reading it from history, then creating it again.",
|
||||
"tags": [
|
||||
"dashboards",
|
||||
"versions"
|
||||
],
|
||||
"summary": "Restore a dashboard to a given dashboard version using UID.",
|
||||
"operationId": "restoreDashboardVersionByUID",
|
||||
"deprecated": true,
|
||||
"parameters": [
|
||||
{
|
||||
"name": "Body",
|
||||
|
||||
Generated
+2
@@ -18377,6 +18377,8 @@
|
||||
},
|
||||
"/dashboards/uid/{uid}/restore": {
|
||||
"post": {
|
||||
"deprecated": true,
|
||||
"description": "This API will be removed when /apis/dashboards.grafana.app/v1 is released.\nYou can restore a dashboard by reading it from history, then creating it again.",
|
||||
"operationId": "restoreDashboardVersionByUID",
|
||||
"parameters": [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user