K8s: Rename origin.key to origin.hash (#89337)
This commit is contained in:
@@ -100,9 +100,6 @@ func (a *dashboardSqlAccess) getRows(ctx context.Context, query *DashboardQuery,
|
||||
if query.Requirements.ListDeleted {
|
||||
return nil, 0, fmt.Errorf("ListDeleted not yet supported")
|
||||
}
|
||||
if len(query.Requirements.ListOriginKeys) > 0 {
|
||||
return nil, 0, fmt.Errorf("ListOriginKeys not yet supported")
|
||||
}
|
||||
|
||||
token, err := readContinueToken(query)
|
||||
if err != nil {
|
||||
@@ -318,7 +315,7 @@ func (a *dashboardSqlAccess) scanRow(rows *sql.Rows) (*dashboardRow, error) {
|
||||
var origin_name sql.NullString
|
||||
var origin_path sql.NullString
|
||||
var origin_ts sql.NullInt64
|
||||
var origin_key sql.NullString
|
||||
var origin_hash sql.NullString
|
||||
var data []byte // the dashboard JSON
|
||||
var version int64
|
||||
|
||||
@@ -327,7 +324,7 @@ func (a *dashboardSqlAccess) scanRow(rows *sql.Rows) (*dashboardRow, error) {
|
||||
&created, &createdByID, &createdByName,
|
||||
&updated, &updatedByID, &updatedByName,
|
||||
&plugin_id,
|
||||
&origin_name, &origin_path, &origin_key, &origin_ts,
|
||||
&origin_name, &origin_path, &origin_hash, &origin_ts,
|
||||
&version,
|
||||
&row.Title, &data,
|
||||
)
|
||||
@@ -370,7 +367,7 @@ func (a *dashboardSqlAccess) scanRow(rows *sql.Rows) (*dashboardRow, error) {
|
||||
meta.SetOriginInfo(&utils.ResourceOriginInfo{
|
||||
Name: origin_name.String,
|
||||
Path: originPath,
|
||||
Key: origin_key.String,
|
||||
Hash: origin_hash.String,
|
||||
Timestamp: &ts,
|
||||
})
|
||||
} else if plugin_id != "" {
|
||||
|
||||
@@ -33,7 +33,7 @@ func convertToK8sResource(v *folder.Folder, namespacer request.NamespaceMapper)
|
||||
if v.ID > 0 { // nolint:staticcheck
|
||||
meta.SetOriginInfo(&utils.ResourceOriginInfo{
|
||||
Name: "SQL",
|
||||
Key: fmt.Sprintf("%d", v.ID), // nolint:staticcheck
|
||||
Path: fmt.Sprintf("%d", v.ID), // nolint:staticcheck
|
||||
})
|
||||
}
|
||||
if v.CreatedBy > 0 {
|
||||
|
||||
@@ -95,7 +95,7 @@ func convertToK8sResource(v *playlistsvc.PlaylistDTO, namespacer request.Namespa
|
||||
createdAt := time.UnixMilli(v.CreatedAt).UTC()
|
||||
meta.SetOriginInfo(&utils.ResourceOriginInfo{
|
||||
Name: "SQL",
|
||||
Key: fmt.Sprintf("%d", v.Id),
|
||||
Path: fmt.Sprintf("%d", v.Id),
|
||||
Timestamp: &createdAt,
|
||||
})
|
||||
}
|
||||
@@ -133,7 +133,7 @@ func getLegacyID(item *unstructured.Unstructured) int64 {
|
||||
}
|
||||
info, _ := meta.GetOriginInfo()
|
||||
if info != nil && info.Name == "SQL" {
|
||||
i, err := strconv.ParseInt(info.Key, 10, 64)
|
||||
i, err := strconv.ParseInt(info.Path, 10, 64)
|
||||
if err == nil {
|
||||
return i
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ func TestPlaylistConversion(t *testing.T) {
|
||||
"resourceVersion": "54321",
|
||||
"creationTimestamp": "1970-01-01T00:00:12Z",
|
||||
"annotations": {
|
||||
"grafana.app/originKey": "123",
|
||||
"grafana.app/originPath": "123",
|
||||
"grafana.app/originName": "SQL",
|
||||
"grafana.app/originTimestamp":"1970-01-01T00:00:12Z",
|
||||
"grafana.app/updatedTimestamp": "1970-01-01T00:00:54Z"
|
||||
|
||||
Reference in New Issue
Block a user