Dashboards: Avoid adding unused revision property (#64362)

This commit is contained in:
Ryan McKinley 2023-03-08 08:26:38 -08:00 committed by GitHub
parent a186f036dd
commit 5f2fecfda7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 7 additions and 14 deletions

View File

@ -1629,7 +1629,6 @@
}
],
"refresh": false,
"revision": 8,
"schemaVersion": 16,
"style": "dark",
"tags": ["gdev", "panel-tests"],

View File

@ -1629,7 +1629,6 @@
}
],
"refresh": false,
"revision": 8,
"schemaVersion": 16,
"style": "dark",
"tags": ["gdev", "panel-tests", "graph"],

View File

@ -305,7 +305,6 @@
"type": "heatmap"
}
],
"revision": 1,
"schemaVersion": 37,
"style": "dark",
"tags": [],

View File

@ -748,7 +748,6 @@
"type": "histogram"
}
],
"revision": 1,
"schemaVersion": 37,
"style": "dark",
"tags": [

View File

@ -430,7 +430,6 @@
}
],
"refresh": false,
"revision": 8,
"schemaVersion": 16,
"style": "dark",
"tags": ["gdev", "panel-tests"],

View File

@ -736,7 +736,6 @@
}
],
"refresh": false,
"revision": 1,
"schemaVersion": 38,
"style": "dark",
"tags": [

View File

@ -1343,7 +1343,6 @@
}
],
"refresh": "",
"revision": 1,
"schemaVersion": 38,
"style": "dark",
"tags": [

View File

@ -40,8 +40,8 @@ type ImportDashboardResponse struct {
DashboardId int64 `json:"dashboardId"`
FolderId int64 `json:"folderId"`
FolderUID string `json:"folderUid"`
ImportedRevision int64 `json:"importedRevision"`
Revision int64 `json:"revision"`
ImportedRevision int64 `json:"importedRevision,omitempty"` // Only used for plugin imports
Revision int64 `json:"revision,omitempty"` // Only used for plugin imports
Description string `json:"description"`
Path string `json:"path"`
Removed bool `json:"removed"`

View File

@ -136,17 +136,18 @@ func (s *ImportDashboardService) ImportDashboard(ctx context.Context, req *dashb
return nil, err
}
revision := savedDashboard.Data.Get("revision").MustInt64(0)
return &dashboardimport.ImportDashboardResponse{
UID: savedDashboard.UID,
PluginId: req.PluginId,
Title: savedDashboard.Title,
Path: req.Path,
Revision: savedDashboard.Data.Get("revision").MustInt64(1),
Revision: revision, // only used for plugin version tracking
FolderId: savedDashboard.FolderID,
FolderUID: req.FolderUid,
ImportedUri: "db/" + savedDashboard.Slug,
ImportedUrl: savedDashboard.GetURL(),
ImportedRevision: savedDashboard.Data.Get("revision").MustInt64(1),
ImportedRevision: revision,
Imported: true,
DashboardId: savedDashboard.ID,
Slug: savedDashboard.Slug,

View File

@ -90,7 +90,7 @@ export class DashboardModel implements TimeModel {
snapshot: any;
schemaVersion: number;
version: number;
revision: number;
revision?: number; // Only used for dashboards managed by plugins
links: DashboardLink[];
gnetId: any;
panels: PanelModel[];
@ -131,7 +131,7 @@ export class DashboardModel implements TimeModel {
this.id = data.id || null;
// UID is not there for newly created dashboards
this.uid = data.uid || null;
this.revision = data.revision || 1;
this.revision = data.revision ?? undefined;
this.title = data.title ?? 'No Title';
this.description = data.description;
this.tags = data.tags ?? [];

View File

@ -22,7 +22,6 @@ export function createDashboardModelFixture(
editable: true,
graphTooltip: defaultDashboardCursorSync,
schemaVersion: 1,
revision: 1,
style: 'dark',
timezone: '',
...dashboardInput,