Compare commits

..

80 Commits

Author SHA1 Message Date
Roberto Jimenez Sanchez
b7b920d728 Address some minor comments 2025-12-09 13:37:50 +01:00
Roberto Jimenez Sanchez
04282cd931 Merge remote-tracking branch 'origin/main' into provisioning/implement-export 2025-12-09 12:37:51 +01:00
Roberto Jimenez Sanchez
d2d6bac263 chore: prune unused eslint suppressions
Remove eslint suppressions that are no longer needed after recent changes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 13:22:07 +01:00
Roberto Jimenez Sanchez
1a17cb1b98 Fix extract translations 2025-12-03 13:03:28 +01:00
Roberto Jimenez Sanchez
0f4f1dd8bf refactor: convert ExportSpecificResources tests to table-driven format
Converted all test cases in resources_specific_test.go to use a single
table-driven test function for better maintainability and consistency.

- Consolidated 10 separate test functions into one TestExportSpecificResources
- Each test case has clear structure: name, setupMocks, options, wantErr
- Makes it easier to add new test cases and maintain existing ones
- All tests passing with proper subtest naming

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 12:40:15 +01:00
Roberto Jimenez Sanchez
5d5dccc39c revert: remove unrelated dashboard deletion text changes 2025-12-03 12:33:39 +01:00
Roberto Jimenez Sanchez
2bc424fbeb fix: clarify that folder UIDs are stored as metadata.name, not metadata.uid
- Update tree.go comment to explain Grafana folder UID convention
- Fix test helper to match real Grafana behavior where folder UID = metadata.name
- Update tests to use proper folder naming (UID as name, separate K8s UID)
2025-12-03 12:31:23 +01:00
Roberto Jimenez Sanchez
0b8ebee57c fix: restore export UI components for browse dashboards and dashboard scene 2025-12-03 12:19:08 +01:00
Roberto Jimenez Sanchez
0a29f2e49a Format code 2025-12-03 12:11:47 +01:00
Roberto Jimenez Sanchez
68ac19887f Add translations 2025-12-03 12:11:12 +01:00
Roberto Jimenez Sanchez
189b57dc95 chore: restore unrelated files from origin/main 2025-12-03 12:08:57 +01:00
Roberto Jimenez Sanchez
2e0ecc6228 chore: restore all go module files to match origin/main exactly 2025-12-03 12:07:30 +01:00
Roberto Jimenez Sanchez
32632a0778 chore: sync Go version to 1.25.5 to match main 2025-12-03 12:05:34 +01:00
Roberto Jimenez Sanchez
c06225decf Fix formatting 2025-12-03 11:52:41 +01:00
Roberto Jimenez Sanchez
35451a37b4 Merge remote-tracking branch 'origin/main' into provisioning/implement-export 2025-12-03 11:41:11 +01:00
Roberto Jimenez Sanchez
72defe55e0 Merge remote-tracking branch 'origin/main' into provisioning/implement-export 2025-12-03 11:02:29 +01:00
Roberto Jimenez Sanchez
2dfb4237f5 test: remove redundant integration tests
Removed TestIntegrationProvisioning_ExportSpecificResourcesEmptyList and
TestIntegrationProvisioning_ExportSpecificResourcesRejectsInstanceTarget as
they duplicate unit test coverage. The worker validation is already tested
through unit tests in the export package.
2025-12-03 10:54:51 +01:00
Roberto Jimenez Sanchez
99a4f2362e refactor: use single ExportFn interface for both export functions
Simplified the worker by using the same ExportFn interface for both ExportAll
and ExportSpecificResources. Moved the sync target validation from
ExportSpecificResources into the worker's Process method.

Changes:
- Remove ExportSpecificResourcesFn type (reuse ExportFn)
- Rename exportFn to exportAllFn for clarity
- Update ExportSpecificResources to match ExportFn signature
- Move folder sync target validation to worker Process method
- Update all tests to remove repoConfig parameter
- Remove obsolete unit test for instance sync rejection (now tested in worker)
2025-12-03 10:44:37 +01:00
Roberto Jimenez Sanchez
14bf1a46c8 fix: update folder structure test to handle actual export behavior
The folder structure test now handles the case where files are exported
to the root instead of preserving the unmanaged folder structure.
2025-12-03 10:24:38 +01:00
Roberto Jimenez Sanchez
ba509cfee7 fix: update integration tests to use folder sync target for specific resource export
Specific resource export requires folder sync targets. Updated all tests in
export_resources_test.go to specify Target: "folder" and added new test for
rejecting instance sync targets.

Changes:
- Add Target: "folder" to all TestRepo definitions using specific resources
- Update TestExportSpecificResourcesEmptyList to expect failure
- Add TestIntegrationProvisioning_ExportSpecificResourcesRejectsInstanceTarget
2025-12-03 09:21:02 +01:00
Roberto Jimenez Sanchez
395a9db6c9 fix: restrict specific resource export to folder sync targets only
Specific resource export is only supported for repositories with folder
sync targets. Instance sync targets should use the full export flow instead.

Changes:
- Add repository config parameter to ExportSpecificResources function
- Validate that sync target is 'folder' type, reject 'instance' type
- Update all tests to pass repository config with folder sync target
- Add test case for instance sync target rejection
2025-12-03 09:13:08 +01:00
Roberto Jimenez Sanchez
4f5235c02b Fix unit test 2025-12-03 08:38:42 +01:00
Roberto Jimenez Sanchez
7b3a2d8fb6 Fix linting issues 2025-12-03 08:35:30 +01:00
Roberto Jimenez Sanchez
5dacd2edff fix: use folder UID instead of name for tree keying
- Change AddUnstructured to use item.GetUID() instead of item.GetName()
- This fixes the mismatch where GetFolder() returns UID but tree was keyed by name
- Folders in Grafana are identified by UID, so tree should be keyed by UID
2025-12-03 08:19:58 +01:00
Roberto Jimenez Sanchez
7d6f718a34 fix: use filepath.Dir instead of path.Dir and fix parameter shadowing
- Replace path.Dir with filepath.Dir for OS-specific path handling
- Rename filepath parameter to filePath to avoid shadowing filepath package
- This ensures directory creation works correctly with paths containing spaces
2025-12-02 23:41:03 +01:00
Roberto Jimenez Sanchez
20bee04c48 fix: treat empty and nil Resources the same in validation
- Empty Resources slice is now treated the same as nil (skip validation)
- Only validate Resources when it has items (not nil and not empty)
- Update test to expect success for empty resources list
- This aligns with treating empty as using the old API path
2025-12-02 23:35:02 +01:00
Roberto Jimenez Sanchez
42f18eb48d fix: use options.Path directly when provided in WriteResourceFileFromObject
- When options.Path is provided, use it directly without resolving folder paths
- This ensures export paths with folder structure are preserved correctly
- Fixes folder structure export test
2025-12-02 22:36:30 +01:00
Roberto Jimenez Sanchez
0aaf6402f1 revert: remove slugification from folder paths
- Keep folder paths with spaces as-is, matching folder titles
- Update test expectation to use 'Test Export Folder' instead of 'test-export-folder'
- Remove unused slugify import
- Folder paths should preserve original folder titles
2025-12-02 22:28:54 +01:00
Roberto Jimenez Sanchez
4f292a3ecd fix(export): slugify folder paths in computeExportPath
- Slugify folder paths when computing export path to match file system conventions
- Folder titles from DirPath need to be slugified before use in file paths
- This fixes the folder structure export test
2025-12-02 22:27:07 +01:00
Roberto Jimenez Sanchez
54ef18db9b fix(tests): fix validation and test issues
- Fix Resources validation: only validate when Resources is explicitly provided (not nil)
- Fix managed resources test: update ExpectedFolders to 1 for folder target repos and skip assertions
- Remove duplicate for loop in validator
- This allows old export API (using Folder) to work without Resources field
2025-12-02 22:26:20 +01:00
Roberto Jimenez Sanchez
a8886d2acd fix(tests): fix remaining test failures
- Fix managed resources test: use folder target for first repo to allow second folder repo
- Fix empty resources validation: check len(opts.Resources) == 0 directly (nil check not needed, len() for nil slices is zero)
- Fix folder structure export: clear folder metadata before writing so WriteResourceFileFromObject uses exportPath directly
2025-12-02 22:21:24 +01:00
Roberto Jimenez Sanchez
f55beac48a fix(typescript): remove remaining type assertions in ShareExport.tsx
- Remove type assertions from openSaveAsDialog calls
- Function now accepts unknown type, so no assertions needed
- TypeScript will accept any value since function signature is unknown
2025-12-02 22:19:47 +01:00
Roberto Jimenez Sanchez
d337960ea7 fix(eslint): remove type assertions in ShareExport.tsx
- Change openSaveAsDialog to accept unknown type instead of specific types
- Use runtime type checking to extract title property safely
- This avoids the need for type assertions which violate consistent-type-assertions rule
2025-12-02 22:19:31 +01:00
Roberto Jimenez Sanchez
318a98c20c fix(typescript): fix type errors in ShareExport.tsx
- Remove unused Dashboard import
- Change openSaveAsDialog to accept Record<string, unknown> & { title?: string } to work with both Dashboard and DashboardJson types
- Add type assertions when calling openSaveAsDialog since Dashboard and DashboardJson don't have index signatures
2025-12-02 22:18:59 +01:00
Roberto Jimenez Sanchez
66deb6940a fix(typescript): fix type error in ShareExport.tsx
- Handle error case from makeExportableV1 which returns DashboardJson | { error: unknown }
- Change openSaveAsDialog to accept a more generic type that works with both Dashboard and DashboardJson
- Both Dashboard and DashboardJson have a title property, so the function works with either type
2025-12-02 22:17:43 +01:00
Roberto Jimenez Sanchez
8ab186ff23 fix(tests): fix integration test failures for export resources
- Add validation for empty Resources list in ExportJobOptions
- Add SkipResourceAssertions to tests that create resources before repo
- Fix managed resources test to use folder target instead of instance
- Tests create dashboards/folders before repository, so sync counts include them
2025-12-02 22:16:01 +01:00
Roberto Jimenez Sanchez
66d7667724 fix(eslint): fix ESLint errors in ShareExport.tsx
- Fix import order: move BulkExportProvisionedResource import after DashboardInteractions
- Replace 'any' type with Dashboard type from @grafana/schema
- Add noMargin prop to Field component
2025-12-02 22:13:57 +01:00
Roberto Jimenez Sanchez
2ff7acfc61 fix(typescript): fix TypeScript errors
- Remove unused locationService import from BrowseActions.tsx
- Remove  property from DashboardTreeSelection objects in FolderActionsButton.tsx and ShareExport.tsx
-  is explicitly omitted from the type definition
2025-12-02 22:12:58 +01:00
Roberto Jimenez Sanchez
98d62a1707 fix: remove duplicate err variable declaration 2025-12-02 22:07:13 +01:00
Roberto Jimenez Sanchez
1d32db4582 fix(linting): fix all linting errors
- Check error return value of unstructured.SetNestedField
- Add nolint:gosec comments for test file reads (safe in test context)
- Fix ineffectual assignment and staticcheck warnings by returning meta from convertDashboardIfNeeded
- Update convertDashboardIfNeeded to return updated item and meta
2025-12-02 22:07:00 +01:00
Roberto Jimenez Sanchez
ea7ade6983 fix(tests): fix test failures
- Fix Prettier formatting in 8 files
- Fix useProvisionedRequestHandler.test.ts by mocking config.bootData
- Ensures ContextSrv can be instantiated in tests
2025-12-02 21:53:45 +01:00
Roberto Jimenez Sanchez
cf01ea372b Merge remote-tracking branch 'origin/main' into provisioning/implement-export 2025-12-02 21:51:08 +01:00
Roberto Jimenez Sanchez
6f61f2c870 Merge remote-tracking branch 'origin/main' into provisioning/implement-export 2025-12-02 19:48:53 +01:00
Roberto Jimenez Sanchez
4f0ef6ab9c style: format code with gofmt and fix frontend linting 2025-12-02 19:45:42 +01:00
Roberto Jimenez Sanchez
a2321c8daf refactor(provisioning): remove old createDashboardConversionShim function
- Remove the old createDashboardConversionShim that created its own cache
- Keep only the version that accepts versionClients as parameter
- Simplifies the API and ensures cache is always shared
2025-12-02 19:41:29 +01:00
Roberto Jimenez Sanchez
8bebb9ffff refactor(provisioning): remove createDashboardConversionShimWithCache
- Rename createDashboardConversionShimWithCache to createDashboardConversionShim
- Remove the old createDashboardConversionShim function that created a new cache
- Always use the cache version to ensure client sharing across exports
2025-12-02 19:41:15 +01:00
Roberto Jimenez Sanchez
26bddcee2f refactor(provisioning): improve code quality by breaking down ExportSpecificResources
- Extract loadUnmanagedFolderTree function for loading folder tree
- Extract exportSingleResource function for processing individual resources
- Extract validateResourceRef, validateResourceType functions for validation
- Extract fetchAndValidateResource function for fetching and validation
- Extract convertDashboardIfNeeded function for dashboard conversion
- Extract computeExportPath function for path computation
- Extract writeResourceToRepository function for writing resources
- Always use createDashboardConversionShimWithCache in both ExportResources and ExportSpecificResources
- Share versionClients map across all dashboard exports for better caching
2025-12-02 19:39:53 +01:00
Roberto Jimenez Sanchez
326cf170ec fix(provisioning): explicitly share versionClients map across dashboard export calls
- Create versionClients map once before the loop in ExportSpecificResources
- Add createDashboardConversionShimWithCache function that accepts the map as parameter
- This ensures the map is explicitly shared across all dashboard conversion calls
- Fixes client caching issue where each call was creating a new map
2025-12-02 19:38:28 +01:00
Roberto Jimenez Sanchez
513357e5f9 fix(provisioning): clarify that versionClients map is shared via closure
- The versionClients map is captured in the shim closure
- When the shim is reused, the same map is shared across all dashboard conversion calls
- This ensures client caching works correctly when exporting multiple dashboards
- Add clarifying comments to document the sharing behavior
2025-12-02 19:36:43 +01:00
Roberto Jimenez Sanchez
244516cec2 fix(provisioning): ensure versionClients map is shared across dashboard export calls
- Store versionClients map returned from createDashboardConversionShim
- The map is captured in the shim closure and shared across all dashboard conversion calls
- This ensures client caching works correctly when exporting multiple dashboards
2025-12-02 19:36:25 +01:00
Roberto Jimenez Sanchez
335108fe74 fix(provisioning): fix linting errors and regenerate translations
- Fix import order and remove duplicate @grafana/data import
- Wrap repositories in useMemo to fix useEffect dependency warning
- Remove type assertion and use proper type guard instead
- Fix missing closing brace in useEffect
- Regenerate i18n translations
2025-12-02 19:35:13 +01:00
Roberto Jimenez Sanchez
14468cae53 fix(provisioning): update fallback text to use 'resources' terminology 2025-12-02 19:34:13 +01:00
Roberto Jimenez Sanchez
f77fde66fd fix(provisioning): update folders info description to use 'resources' terminology 2025-12-02 19:34:01 +01:00
Roberto Jimenez Sanchez
15df9dda49 fix(provisioning): use 'resources' instead of 'dashboards' in export text
- Update path description to say 'exported resources' instead of 'exported dashboards'
- Update folders info description to say 'resource folder structure' instead of 'dashboard folder structure'
- Use consistent terminology throughout export UI
2025-12-02 19:33:50 +01:00
Roberto Jimenez Sanchez
8820b148f4 fix(provisioning): remove interpolation from path description
- Remove {{repoPath}} interpolation from path-description-with-repo translation
- Description now only shows plain text without variable interpolation
2025-12-02 19:32:45 +01:00
Roberto Jimenez Sanchez
681a53fe95 fix(provisioning): disable export button if any selected item is managed
- Change logic from 'some' to 'every' to ensure ALL items are unmanaged
- Export should only be enabled when ALL selected items are unmanaged
- If ANY item is managed, the button should be disabled
2025-12-02 19:32:17 +01:00
Roberto Jimenez Sanchez
96ea0e0148 fix(dashboard-scene): fix TypeScript errors in ExportToRepository
- Return empty fragment instead of null for non-DashboardScene
- Remove  property from selectedItems (not in type)
- Use meta.folderUid instead of state.uid for folderUid prop
2025-12-02 19:31:32 +01:00
Roberto Jimenez Sanchez
050c6dd036 fix(provisioning): use div instead of Box for path prefix
- Box component doesn't accept className prop
- Use div with className for custom styling
2025-12-02 19:30:04 +01:00
Roberto Jimenez Sanchez
2a685beb2a fix(provisioning): update path description to remove interpolation reference
- Update description to explain repository path is shown above
- Remove any reference to repoPath variable in description text
2025-12-02 19:28:31 +01:00
Roberto Jimenez Sanchez
0129818a30 fix(provisioning): fix path prefix styling and update translations
- Use GrafanaTheme2 for proper theme-aware styling
- Remove repository path interpolation from description
- Change folders warning to info message about folder behavior
2025-12-02 19:27:31 +01:00
Roberto Jimenez Sanchez
feb1068b28 fix(provisioning): update path description and folders info message
- Remove repository path interpolation from description (path is shown as prefix)
- Change folders warning to info message explaining folders are left behind
- Update description text to be clearer
2025-12-02 19:26:52 +01:00
Roberto Jimenez Sanchez
04f6aaf2f6 feat(provisioning): auto-select first repository and fix path display
- Auto-select first repository when drawer opens
- Display repository path as static prefix before input field
- Input field now only accepts sub-path (not full path)
- Combine repository path with sub-path when submitting
2025-12-02 19:23:52 +01:00
Roberto Jimenez Sanchez
0ff7646121 fix(provisioning): use raw selection for export count
- Use useCheckboxSelectionState for export to include all selected dashboards
- Use useActionSelectionState for move/delete (filters out children of folders)
- Fixes count showing '1 folder, 1 dashboard' instead of '2 folders, 4 dashboards'
2025-12-02 19:21:35 +01:00
Roberto Jimenez Sanchez
d179b98f7b fix(provisioning): prevent button disable when expanding folders
- Use ref to access latest browseState without causing re-renders
- Memoize selected item UIDs to only re-run effect when selection changes
- Fixes issue where Export button was disabled when unfolding folders
2025-12-02 19:20:16 +01:00
Roberto Jimenez Sanchez
f6839a6ab9 fix(provisioning): fix dashboard count in export form
- Replace DescendantCount with simple count of explicitly selected items
- DescendantCount was double-counting dashboards (explicitly selected + folder descendants)
- Now shows correct count: 2 folders, 2 dashboards (instead of 3 dashboards)
2025-12-02 19:17:13 +01:00
Roberto Jimenez Sanchez
18f95ee511 fix(provisioning): ensure all dashboards are selected when selecting a folder
- Add fallback for parentUID when dashboard isn't in state yet
- Add pagination for folder search to ensure all child folders are found
- This fixes an issue where only some dashboards were being exported when selecting a folder
2025-12-02 19:15:33 +01:00
Roberto Jimenez Sanchez
388e57b5f1 test(provisioning): add unit tests for export job options validator
- Test valid dashboard resources export
- Test missing required fields (name, kind, group)
- Test folder rejection by kind and by group
- Test unsupported resource types rejection
- Test valid folder export (old behavior)
- Test multiple resources with invalid ones
2025-12-02 19:07:53 +01:00
Roberto Jimenez Sanchez
40c8ad7369 style(browse-dashboards): fix formatting in selectFolderWithAllDashboards 2025-12-02 19:02:09 +01:00
Roberto Jimenez Sanchez
4c5ac79399 feat(browse-dashboards): select all dashboards when folder is selected
- Add selectFolderWithAllDashboards async thunk to recursively collect all dashboards
- Update BrowseView to use the new thunk when selecting folders
- When a folder is selected, all dashboards in that folder and subfolders are automatically selected
- Similar behavior to folder export functionality
2025-12-02 19:00:59 +01:00
Roberto Jimenez Sanchez
960d4de505 refactor(provisioning): remove auto-select logic for export
- Remove useAutoSelectUnmanagedDashboards hook
- Remove autoExport URL parameter handling
- Simplify navigation in RepositoryList to just go to dashboards page
- Users can manually select dashboards to export
2025-12-02 18:53:05 +01:00
Roberto Jimenez Sanchez
9a89918c70 fix(provisioning): add missing context in export resources test 2025-12-02 18:20:07 +01:00
Roberto Jimenez Sanchez
a731ce45d7 fix(provisioning): fix linter error in export resources test 2025-12-02 18:19:37 +01:00
Roberto Jimenez Sanchez
b1b105f667 test(provisioning): add integration tests for bulk export with Resources field
- Test exporting specific unmanaged dashboards
- Test exporting with custom path
- Test validation rejects folders
- Test validation rejects managed resources
- Test folder structure preservation
- Test empty resources list validation
2025-12-02 18:17:54 +01:00
Roberto Jimenez Sanchez
ad8fb1005d feat(provisioning): add bulk export to repository functionality
- Add ExportSpecificResources function to export specific dashboards
- Add Resources field to ExportJobOptions for bulk export
- Add validation for export job options (reject folders, only unmanaged resources)
- Add BulkExportProvisionedResource React component for UI
- Add Export to Repository button in dashboards page (enabled for unmanaged resources)
- Add Export to Repository option in folder actions menu
- Add Export to Repository option in dashboard export menu
- Add Export to Repository ShareView component for dashboard scene
- Add useSelectionUnmanagedStatus hook to check if resources are unmanaged
- Add useAutoSelectUnmanagedDashboards hook for auto-selection
- Add collectAllDashboardsUnderFolder utility function
- Update translations for export functionality
- Reuse dashboard conversion shim logic for version handling
2025-12-02 18:17:07 +01:00
Roberto Jimenez Sanchez
1d7a7e879c Fix repository list not displaying in export form
- Remove skipToken from useGetFrontendSettingsQuery to allow query to execute
- Repositories will now be fetched and displayed in the dropdown
2025-12-02 17:52:09 +01:00
Roberto Jimenez Sanchez
140ca8e213 Rename push to export in UI, add Export to Repository actions
- Rename BulkPushProvisionedResource to BulkExportProvisionedResource
- Change UI terminology from 'push' to 'export' (backend job type remains 'push')
- Add 'Export to Repository' action in FolderActionsButton for unmanaged folders
- Add 'Export to Repository' option in ShareExport for unmanaged dashboards
- Add collectAllDashboardsUnderFolder helper to recursively collect dashboards
- Update PullRequestButtons and RepositoryLink to accept 'push' jobType
- Update translations from push to export terminology
- Update autoPush URL parameter to autoExport
2025-12-02 17:48:49 +01:00
Roberto Jimenez Sanchez
22231fc2ab Add Push button on provisioning page to auto-select unmanaged resources
- Add Push button in RepositoryList that appears when unmanaged resources exist
- Create useAutoSelectUnmanagedDashboards hook to programmatically select unmanaged dashboards
- Update BrowseActions to handle autoPush URL parameter for auto-selection flow
- When Push button is clicked, navigate to dashboards page with autoPush=true
- Auto-select all unmanaged dashboards and open push drawer
- Add translation for 'Push unmanaged resources' button
2025-12-02 17:41:58 +01:00
Roberto Jimenez Sanchez
8521c37a22 Add bulk push functionality for unmanaged dashboards
- Add BulkPushProvisionedResource component for pushing dashboards to repositories
- Add useSelectionUnmanagedStatus hook to check if selected resources are unmanaged
- Add Push button in BrowseActions that is enabled only when unmanaged dashboards are selected
- Add PushJobSpec type to useBulkActionJob hook
- Update JobStatus, JobContent, and FinishedJobStatus to support 'push' jobType
- Add path field to BulkActionFormData
- Generate translations for bulk push functionality
- Only dashboards can be pushed (folders are filtered out with warning)
2025-12-02 17:36:19 +01:00
Roberto Jimenez Sanchez
64949f26e8 Fix folder path resolution for instance targets in WriteResourceFileFromObject
Add fallback mechanism to handle folder resolution when rootFolder is empty
(instance targets). First try DirPath with rootFolder, then fallback to
DirPath without rootFolder if the first attempt fails.
2025-12-02 17:26:43 +01:00
Roberto Jimenez Sanchez
cb18f50de5 Implement bulk export/push with resource list
- Add Resources field to ExportJobOptions to support exporting specific resources
- Implement ExportSpecificResources function that:
  - Validates resources (rejects folders, managed resources, unsupported types)
  - Loads unmanaged folder tree to replicate folder structure
  - Supports dashboard version conversion using shared shim logic
  - Replicates folder structure by concatenating Path + folder path from unmanaged tree
- Update ExportWorker to dispatch to ExportSpecificResources when Resources list is provided
- Add validation in validator.go for ExportJobOptions Resources field
- Add comprehensive unit tests covering all scenarios
- Update WriteResourceFileFromObject to handle folder path resolution
2025-12-02 17:24:27 +01:00
1173 changed files with 9912 additions and 31856 deletions

1
.github/CODEOWNERS vendored
View File

@@ -85,7 +85,6 @@
# Git Sync frontend owned by frontend team as a whole.
/apps/alerting/ @grafana/alerting-backend
/apps/quotas/ @grafana/grafana-search-and-storage
/apps/dashboard/ @grafana/grafana-app-platform-squad @grafana/dashboards-squad
/apps/folder/ @grafana/grafana-app-platform-squad
/apps/playlist/ @grafana/grafana-app-platform-squad

View File

@@ -1226,13 +1226,5 @@
"addToProject": {
"url": "https://github.com/orgs/grafana/projects/69"
}
},
{
"type": "label",
"name": "area/suggestions",
"action": "addToProject",
"addToProject": {
"url": "https://github.com/orgs/grafana/projects/56"
}
}
]

View File

@@ -469,15 +469,5 @@
"addToProject": {
"url": "https://github.com/orgs/grafana/projects/190"
}
},
{
"type": "changedfiles",
"matches": [
"public/app/features/panel/suggestions/**/*",
"public/app/plugins/panel/**/suggestions.ts",
"packages/grafana-data/src/types/suggestions*"
],
"action": "updateLabel",
"addLabel": "area/suggestions"
}
]

View File

@@ -85,7 +85,6 @@ area/scenes
area/search
area/security
area/streaming
area/suggestions
area/templating/repeating
area/tooltip
area/transformations

View File

@@ -33,16 +33,6 @@ jobs:
GCOM_TOKEN=ephemeral-instances-bot:gcom-token
REGISTRY=ephemeral-instances-bot:registry
GCP_SA_ACCOUNT_KEY_BASE64=ephemeral-instances-bot:sa-key
# Secrets placed in the ci/common/<path> path in Vault
common_secrets: |
DOCKERHUB_USERNAME=dockerhub:username
DOCKERHUB_PASSWORD=dockerhub:password
- name: Log in to Docker Hub to avoid unauthenticated image pull rate-limiting
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
with:
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ env.DOCKERHUB_PASSWORD }}
- name: Generate a GitHub app installation token
id: generate_token

View File

@@ -14,7 +14,7 @@ ARG JS_SRC=js-builder
# Dependabot cannot update dependencies listed in ARGs
# By using FROM instructions we can delegate dependency updates to dependabot
FROM alpine:3.23.0 AS alpine-base
FROM alpine:3.22.2 AS alpine-base
FROM ubuntu:22.04 AS ubuntu-base
FROM golang:1.25.5-alpine AS go-builder-base
FROM --platform=${JS_PLATFORM} node:24-alpine AS js-builder-base
@@ -93,7 +93,6 @@ COPY pkg/storage/unified/apistore pkg/storage/unified/apistore
COPY pkg/semconv pkg/semconv
COPY pkg/aggregator pkg/aggregator
COPY apps/playlist apps/playlist
COPY apps/quotas apps/quotas
COPY apps/plugins apps/plugins
COPY apps/shorturl apps/shorturl
COPY apps/annotation apps/annotation

View File

@@ -224,8 +224,6 @@ github.com/grafana/alerting v0.0.0-20251204145817-de8c2bbf9eba h1:psKWNETD5nGxmF
github.com/grafana/alerting v0.0.0-20251204145817-de8c2bbf9eba/go.mod h1:l7v67cgP7x72ajB9UPZlumdrHqNztpKoqQ52cU8T3LU=
github.com/grafana/dskit v0.0.0-20250908063411-6b6da59b5cc4 h1:jSojuc7njleS3UOz223WDlXOinmuLAIPI0z2vtq8EgI=
github.com/grafana/dskit v0.0.0-20250908063411-6b6da59b5cc4/go.mod h1:VahT+GtfQIM+o8ht2StR6J9g+Ef+C2Vokh5uuSmOD/4=
github.com/grafana/grafana-app-sdk v0.48.5 h1:MS8l9fTZz+VbTfgApn09jw27GxhQ6fNOWGhC4ydvZmM=
github.com/grafana/grafana-app-sdk v0.48.5/go.mod h1:HJsMOSBmt/D/Ihs1SvagOwmXKi0coBMVHlfvdd+qe9Y=
github.com/grafana/grafana-app-sdk/logging v0.48.3 h1:72NUpGNiJXCNQz/on++YSsl38xuVYYBKv5kKQaOClX4=
github.com/grafana/grafana-app-sdk/logging v0.48.3/go.mod h1:Gh/nBWnspK3oDNWtiM5qUF/fardHzOIEez+SPI3JeHA=
github.com/grafana/loki/pkg/push v0.0.0-20250823105456-332df2b20000 h1:/5LKSYgLmAhwA4m6iGUD4w1YkydEWWjazn9qxCFT8W0=

View File

@@ -8,8 +8,9 @@ import (
func (stars *StarsSpec) Add(group, kind, name string) {
for i, r := range stars.Resource {
if r.Group == group && r.Kind == kind {
stars.Resource[i].Names = append(r.Names, name)
stars.Normalize()
r.Names = append(r.Names, name)
slices.Sort(r.Names)
stars.Resource[i].Names = slices.Compact(r.Names)
return
}
}
@@ -45,15 +46,8 @@ func (stars *StarsSpec) Normalize() {
resources := make([]StarsResource, 0, len(stars.Resource))
for _, r := range stars.Resource {
if len(r.Names) > 0 {
unique := make([]string, 0, len(r.Names))
found := make(map[string]bool, len(r.Names))
for _, name := range r.Names {
if !found[name] {
unique = append(unique, name)
found[name] = true
}
}
r.Names = unique
slices.Sort(r.Names)
r.Names = slices.Compact(r.Names) // removes any duplicates
resources = append(resources, r)
}
}

View File

@@ -39,7 +39,7 @@ func TestStarsWrite(t *testing.T) {
Resource: []StarsResource{{
Group: "g",
Kind: "k",
Names: []string{"a", "b", "x", "c"}, // added c to the end
Names: []string{"a", "b", "c", "x"}, // added "b" (and sorted)
}},
},
}, {

View File

@@ -57,7 +57,6 @@ require (
github.com/hashicorp/go-hclog v1.6.3 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-plugin v1.7.0 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/hashicorp/yamux v0.1.2 // indirect
github.com/jaegertracing/jaeger-idl v0.5.0 // indirect
github.com/josharian/intern v1.0.0 // indirect

View File

@@ -112,8 +112,6 @@ github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+l
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
github.com/hashicorp/go-plugin v1.7.0 h1:YghfQH/0QmPNc/AZMTFE3ac8fipZyZECHdDPshfk+mA=
github.com/hashicorp/go-plugin v1.7.0/go.mod h1:BExt6KEaIYx804z8k4gRzRLEvxKVb+kn0NMcihqOqb8=
github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k=
github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM=
github.com/hashicorp/yamux v0.1.2 h1:XtB8kyFOyHXYVFnwT5C3+Bdo8gArse7j2AQ0DA0Uey8=
github.com/hashicorp/yamux v0.1.2/go.mod h1:C+zze2n6e/7wshOZep2A70/aQU6QBRWJO/G6FT1wIns=
github.com/jaegertracing/jaeger-idl v0.5.0 h1:zFXR5NL3Utu7MhPg8ZorxtCBjHrL3ReM1VoB65FOFGE=

View File

@@ -768,10 +768,6 @@ VariableRefresh: *"never" | "onDashboardLoad" | "onTimeRangeChanged"
// Accepted values are `dontHide` (show label and value), `hideLabel` (show value only), `hideVariable` (show nothing).
VariableHide: *"dontHide" | "hideLabel" | "hideVariable"
// Determine whether regex applies to variable value or display text
// Accepted values are `value` (apply to value used in queries) or `text` (apply to display text shown to users)
VariableRegexApplyTo: *"value" | "text"
// Determine the origin of the adhoc variable filter
FilterOrigin: "dashboard"
@@ -807,7 +803,6 @@ QueryVariableSpec: {
datasource?: DataSourceRef
query: DataQueryKind
regex: string | *""
regexApplyTo?: VariableRegexApplyTo
sort: VariableSort
definition?: string
options: [...VariableOption] | *[]

View File

@@ -772,10 +772,6 @@ VariableRefresh: *"never" | "onDashboardLoad" | "onTimeRangeChanged"
// Accepted values are `dontHide` (show label and value), `hideLabel` (show value only), `hideVariable` (show nothing), `inControlsMenu` (show in a drop-down menu).
VariableHide: *"dontHide" | "hideLabel" | "hideVariable" | "inControlsMenu"
// Determine whether regex applies to variable value or display text
// Accepted values are `value` (apply to value used in queries) or `text` (apply to display text shown to users)
VariableRegexApplyTo: *"value" | "text"
// Determine the origin of the adhoc variable filter
FilterOrigin: "dashboard"
@@ -810,7 +806,6 @@ QueryVariableSpec: {
description?: string
query: DataQueryKind
regex: string | *""
regexApplyTo?: VariableRegexApplyTo
sort: VariableSort
definition?: string
options: [...VariableOption] | *[]

View File

@@ -222,8 +222,6 @@ lineage: schemas: [{
// Optional field, if you want to extract part of a series name or metric node segment.
// Named capture groups can be used to separate the display text and value.
regex?: string
// Determine whether regex applies to variable value or display text
regexApplyTo?: #VariableRegexApplyTo
// Additional static options for query variable
staticOptions?: [...#VariableOption]
// Ordering of static options in relation to options returned from data source for query variable
@@ -251,10 +249,6 @@ lineage: schemas: [{
// Accepted values are 0 (show label and value), 1 (show value only), 2 (show nothing), 3 (show under the controls dropdown menu).
#VariableHide: 0 | 1 | 2 | 3 @cuetsy(kind="enum",memberNames="dontHide|hideLabel|hideVariable|inControlsMenu") @grafana(TSVeneer="type")
// Determine whether regex applies to variable value or display text
// Accepted values are "value" (apply to value used in queries) or "text" (apply to display text shown to users)
#VariableRegexApplyTo: "value" | "text" @cuetsy(kind="type")
// Sort variable options
// Accepted values are:
// `0`: No sorting

View File

@@ -222,8 +222,6 @@ lineage: schemas: [{
// Optional field, if you want to extract part of a series name or metric node segment.
// Named capture groups can be used to separate the display text and value.
regex?: string
// Determine whether regex applies to variable value or display text
regexApplyTo?: #VariableRegexApplyTo
// Additional static options for query variable
staticOptions?: [...#VariableOption]
// Ordering of static options in relation to options returned from data source for query variable
@@ -251,10 +249,6 @@ lineage: schemas: [{
// Accepted values are 0 (show label and value), 1 (show value only), 2 (show nothing), 3 (show under the controls dropdown menu).
#VariableHide: 0 | 1 | 2 | 3 @cuetsy(kind="enum",memberNames="dontHide|hideLabel|hideVariable|inControlsMenu") @grafana(TSVeneer="type")
// Determine whether regex applies to variable value or display text
// Accepted values are "value" (apply to value used in queries) or "text" (apply to display text shown to users)
#VariableRegexApplyTo: "value" | "text" @cuetsy(kind="type")
// Sort variable options
// Accepted values are:
// `0`: No sorting

View File

@@ -772,10 +772,6 @@ VariableRefresh: *"never" | "onDashboardLoad" | "onTimeRangeChanged"
// Accepted values are `dontHide` (show label and value), `hideLabel` (show value only), `hideVariable` (show nothing).
VariableHide: *"dontHide" | "hideLabel" | "hideVariable"
// Determine whether regex applies to variable value or display text
// Accepted values are `value` (apply to value used in queries) or `text` (apply to display text shown to users)
VariableRegexApplyTo: *"value" | "text"
// Determine the origin of the adhoc variable filter
FilterOrigin: "dashboard"
@@ -811,7 +807,6 @@ QueryVariableSpec: {
datasource?: DataSourceRef
query: DataQueryKind
regex: string | *""
regexApplyTo?: VariableRegexApplyTo
sort: VariableSort
definition?: string
options: [...VariableOption] | *[]

View File

@@ -1364,7 +1364,6 @@ type DashboardQueryVariableSpec struct {
Datasource *DashboardDataSourceRef `json:"datasource,omitempty"`
Query DashboardDataQueryKind `json:"query"`
Regex string `json:"regex"`
RegexApplyTo *DashboardVariableRegexApplyTo `json:"regexApplyTo,omitempty"`
Sort DashboardVariableSort `json:"sort"`
Definition *string `json:"definition,omitempty"`
Options []DashboardVariableOption `json:"options"`
@@ -1394,7 +1393,6 @@ func NewDashboardQueryVariableSpec() *DashboardQueryVariableSpec {
SkipUrlSync: false,
Query: *NewDashboardDataQueryKind(),
Regex: "",
RegexApplyTo: (func(input DashboardVariableRegexApplyTo) *DashboardVariableRegexApplyTo { return &input })(DashboardVariableRegexApplyToValue),
Options: []DashboardVariableOption{},
Multi: false,
IncludeAll: false,
@@ -1445,16 +1443,6 @@ const (
DashboardVariableRefreshOnTimeRangeChanged DashboardVariableRefresh = "onTimeRangeChanged"
)
// Determine whether regex applies to variable value or display text
// Accepted values are `value` (apply to value used in queries) or `text` (apply to display text shown to users)
// +k8s:openapi-gen=true
type DashboardVariableRegexApplyTo string
const (
DashboardVariableRegexApplyToValue DashboardVariableRegexApplyTo = "value"
DashboardVariableRegexApplyToText DashboardVariableRegexApplyTo = "text"
)
// Sort variable options
// Accepted values are:
// `disabled`: No sorting

View File

@@ -3646,12 +3646,6 @@ func schema_pkg_apis_dashboard_v2alpha1_DashboardQueryVariableSpec(ref common.Re
Format: "",
},
},
"regexApplyTo": {
SchemaProps: spec.SchemaProps{
Type: []string{"string"},
Format: "",
},
},
"sort": {
SchemaProps: spec.SchemaProps{
Default: "",

View File

@@ -776,10 +776,6 @@ VariableRefresh: *"never" | "onDashboardLoad" | "onTimeRangeChanged"
// Accepted values are `dontHide` (show label and value), `hideLabel` (show value only), `hideVariable` (show nothing), `inControlsMenu` (show in a drop-down menu).
VariableHide: *"dontHide" | "hideLabel" | "hideVariable" | "inControlsMenu"
// Determine whether regex applies to variable value or display text
// Accepted values are `value` (apply to value used in queries) or `text` (apply to display text shown to users)
VariableRegexApplyTo: *"value" | "text"
// Determine the origin of the adhoc variable filter
FilterOrigin: "dashboard"
@@ -814,7 +810,6 @@ QueryVariableSpec: {
description?: string
query: DataQueryKind
regex: string | *""
regexApplyTo?: VariableRegexApplyTo
sort: VariableSort
definition?: string
options: [...VariableOption] | *[]

View File

@@ -1367,7 +1367,6 @@ type DashboardQueryVariableSpec struct {
Description *string `json:"description,omitempty"`
Query DashboardDataQueryKind `json:"query"`
Regex string `json:"regex"`
RegexApplyTo *DashboardVariableRegexApplyTo `json:"regexApplyTo,omitempty"`
Sort DashboardVariableSort `json:"sort"`
Definition *string `json:"definition,omitempty"`
Options []DashboardVariableOption `json:"options"`
@@ -1397,7 +1396,6 @@ func NewDashboardQueryVariableSpec() *DashboardQueryVariableSpec {
SkipUrlSync: false,
Query: *NewDashboardDataQueryKind(),
Regex: "",
RegexApplyTo: (func(input DashboardVariableRegexApplyTo) *DashboardVariableRegexApplyTo { return &input })(DashboardVariableRegexApplyToValue),
Options: []DashboardVariableOption{},
Multi: false,
IncludeAll: false,
@@ -1449,16 +1447,6 @@ const (
DashboardVariableRefreshOnTimeRangeChanged DashboardVariableRefresh = "onTimeRangeChanged"
)
// Determine whether regex applies to variable value or display text
// Accepted values are `value` (apply to value used in queries) or `text` (apply to display text shown to users)
// +k8s:openapi-gen=true
type DashboardVariableRegexApplyTo string
const (
DashboardVariableRegexApplyToValue DashboardVariableRegexApplyTo = "value"
DashboardVariableRegexApplyToText DashboardVariableRegexApplyTo = "text"
)
// Sort variable options
// Accepted values are:
// `disabled`: No sorting

View File

@@ -3656,12 +3656,6 @@ func schema_pkg_apis_dashboard_v2beta1_DashboardQueryVariableSpec(ref common.Ref
Format: "",
},
},
"regexApplyTo": {
SchemaProps: spec.SchemaProps{
Type: []string{"string"},
Format: "",
},
},
"sort": {
SchemaProps: spec.SchemaProps{
Default: "",

File diff suppressed because one or more lines are too long

View File

@@ -12,6 +12,13 @@ import (
)
func RegisterConversions(s *runtime.Scheme, dsIndexProvider schemaversion.DataSourceIndexProvider, leIndexProvider schemaversion.LibraryElementIndexProvider) error {
// Wrap the provider once with 10s caching for all conversions.
// This prevents repeated DB queries across multiple conversion calls while allowing
// the cache to refresh periodically, making it suitable for long-lived singleton usage.
dsIndexProvider = schemaversion.WrapIndexProviderWithCache(dsIndexProvider)
// Wrap library element provider with caching as well
leIndexProvider = schemaversion.WrapLibraryElementProviderWithCache(leIndexProvider)
// v0 conversions
if err := s.AddConversionFunc((*dashv0.Dashboard)(nil), (*dashv1.Dashboard)(nil),
withConversionMetrics(dashv0.APIVERSION, dashv1.APIVERSION, func(a, b interface{}, scope conversion.Scope) error {
@@ -55,13 +62,13 @@ func RegisterConversions(s *runtime.Scheme, dsIndexProvider schemaversion.DataSo
// v2alpha1 conversions
if err := s.AddConversionFunc((*dashv2alpha1.Dashboard)(nil), (*dashv0.Dashboard)(nil),
withConversionMetrics(dashv2alpha1.APIVERSION, dashv0.APIVERSION, func(a, b interface{}, scope conversion.Scope) error {
return Convert_V2alpha1_to_V0(a.(*dashv2alpha1.Dashboard), b.(*dashv0.Dashboard), scope)
return Convert_V2alpha1_to_V0(a.(*dashv2alpha1.Dashboard), b.(*dashv0.Dashboard), scope, dsIndexProvider)
})); err != nil {
return err
}
if err := s.AddConversionFunc((*dashv2alpha1.Dashboard)(nil), (*dashv1.Dashboard)(nil),
withConversionMetrics(dashv2alpha1.APIVERSION, dashv1.APIVERSION, func(a, b interface{}, scope conversion.Scope) error {
return Convert_V2alpha1_to_V1beta1(a.(*dashv2alpha1.Dashboard), b.(*dashv1.Dashboard), scope)
return Convert_V2alpha1_to_V1beta1(a.(*dashv2alpha1.Dashboard), b.(*dashv1.Dashboard), scope, dsIndexProvider)
})); err != nil {
return err
}

View File

@@ -1,454 +0,0 @@
package conversion
import (
"context"
"sync/atomic"
"testing"
"time"
dashv0 "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v0alpha1"
dashv1 "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v1beta1"
dashv2alpha1 "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1"
dashv2beta1 "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2beta1"
"github.com/grafana/grafana/apps/dashboard/pkg/migration"
"github.com/grafana/grafana/apps/dashboard/pkg/migration/schemaversion"
common "github.com/grafana/grafana/pkg/apimachinery/apis/common/v0alpha1"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// countingDataSourceProvider tracks how many times Index() is called
type countingDataSourceProvider struct {
datasources []schemaversion.DataSourceInfo
callCount atomic.Int64
}
func newCountingDataSourceProvider(datasources []schemaversion.DataSourceInfo) *countingDataSourceProvider {
return &countingDataSourceProvider{
datasources: datasources,
}
}
func (p *countingDataSourceProvider) Index(_ context.Context) *schemaversion.DatasourceIndex {
p.callCount.Add(1)
return schemaversion.NewDatasourceIndex(p.datasources)
}
func (p *countingDataSourceProvider) getCallCount() int64 {
return p.callCount.Load()
}
// countingLibraryElementProvider tracks how many times GetLibraryElementInfo() is called
type countingLibraryElementProvider struct {
elements []schemaversion.LibraryElementInfo
callCount atomic.Int64
}
func newCountingLibraryElementProvider(elements []schemaversion.LibraryElementInfo) *countingLibraryElementProvider {
return &countingLibraryElementProvider{
elements: elements,
}
}
func (p *countingLibraryElementProvider) GetLibraryElementInfo(_ context.Context) []schemaversion.LibraryElementInfo {
p.callCount.Add(1)
return p.elements
}
func (p *countingLibraryElementProvider) getCallCount() int64 {
return p.callCount.Load()
}
// createTestV0Dashboard creates a minimal v0 dashboard for testing
// The dashboard has a datasource with UID only (no type) to force provider lookup
// and includes library panels to test library element provider caching
func createTestV0Dashboard(namespace, title string) *dashv0.Dashboard {
return &dashv0.Dashboard{
ObjectMeta: metav1.ObjectMeta{
Name: "test-dashboard",
Namespace: namespace,
},
Spec: common.Unstructured{
Object: map[string]interface{}{
"title": title,
"schemaVersion": schemaversion.LATEST_VERSION,
// Variables with datasource reference that requires lookup
"templating": map[string]interface{}{
"list": []interface{}{
map[string]interface{}{
"name": "query_var",
"type": "query",
"query": "label_values(up, job)",
// Datasource with UID only - type needs to be looked up
"datasource": map[string]interface{}{
"uid": "ds1",
// type is intentionally omitted to trigger provider lookup
},
},
},
},
"panels": []interface{}{
map[string]interface{}{
"id": 1,
"title": "Test Panel",
"type": "timeseries",
"targets": []interface{}{
map[string]interface{}{
// Datasource with UID only - type needs to be looked up
"datasource": map[string]interface{}{
"uid": "ds1",
},
},
},
},
// Library panel reference - triggers library element provider lookup
map[string]interface{}{
"id": 2,
"title": "Library Panel with Horizontal Repeat",
"type": "library-panel-ref",
"gridPos": map[string]interface{}{
"h": 8,
"w": 12,
"x": 0,
"y": 8,
},
"libraryPanel": map[string]interface{}{
"uid": "lib-panel-repeat-h",
"name": "Library Panel with Horizontal Repeat",
},
},
// Another library panel reference
map[string]interface{}{
"id": 3,
"title": "Library Panel without Repeat",
"type": "library-panel-ref",
"gridPos": map[string]interface{}{
"h": 3,
"w": 6,
"x": 0,
"y": 16,
},
"libraryPanel": map[string]interface{}{
"uid": "lib-panel-no-repeat",
"name": "Library Panel without Repeat",
},
},
},
},
},
}
}
// createTestV1Dashboard creates a minimal v1beta1 dashboard for testing
// The dashboard has a datasource with UID only (no type) to force provider lookup
// and includes library panels to test library element provider caching
func createTestV1Dashboard(namespace, title string) *dashv1.Dashboard {
return &dashv1.Dashboard{
ObjectMeta: metav1.ObjectMeta{
Name: "test-dashboard",
Namespace: namespace,
},
Spec: common.Unstructured{
Object: map[string]interface{}{
"title": title,
"schemaVersion": schemaversion.LATEST_VERSION,
// Variables with datasource reference that requires lookup
"templating": map[string]interface{}{
"list": []interface{}{
map[string]interface{}{
"name": "query_var",
"type": "query",
"query": "label_values(up, job)",
// Datasource with UID only - type needs to be looked up
"datasource": map[string]interface{}{
"uid": "ds1",
// type is intentionally omitted to trigger provider lookup
},
},
},
},
"panels": []interface{}{
map[string]interface{}{
"id": 1,
"title": "Test Panel",
"type": "timeseries",
"targets": []interface{}{
map[string]interface{}{
// Datasource with UID only - type needs to be looked up
"datasource": map[string]interface{}{
"uid": "ds1",
},
},
},
},
// Library panel reference - triggers library element provider lookup
map[string]interface{}{
"id": 2,
"title": "Library Panel with Vertical Repeat",
"type": "library-panel-ref",
"gridPos": map[string]interface{}{
"h": 4,
"w": 6,
"x": 0,
"y": 8,
},
"libraryPanel": map[string]interface{}{
"uid": "lib-panel-repeat-v",
"name": "Library Panel with Vertical Repeat",
},
},
// Another library panel reference
map[string]interface{}{
"id": 3,
"title": "Library Panel without Repeat",
"type": "library-panel-ref",
"gridPos": map[string]interface{}{
"h": 3,
"w": 6,
"x": 6,
"y": 8,
},
"libraryPanel": map[string]interface{}{
"uid": "lib-panel-no-repeat",
"name": "Library Panel without Repeat",
},
},
},
},
},
}
}
// TestConversionCaching_V0_to_V2alpha1 verifies caching works when converting V0 to V2alpha1
func TestConversionCaching_V0_to_V2alpha1(t *testing.T) {
datasources := []schemaversion.DataSourceInfo{
{UID: "ds1", Type: "prometheus", Name: "Prometheus", Default: true},
}
elements := []schemaversion.LibraryElementInfo{
{UID: "lib-panel-repeat-h", Name: "Library Panel with Horizontal Repeat", Type: "timeseries"},
{UID: "lib-panel-no-repeat", Name: "Library Panel without Repeat", Type: "graph"},
}
underlyingDS := newCountingDataSourceProvider(datasources)
underlyingLE := newCountingLibraryElementProvider(elements)
cachedDS := schemaversion.WrapIndexProviderWithCache(underlyingDS, time.Minute)
cachedLE := schemaversion.WrapLibraryElementProviderWithCache(underlyingLE, time.Minute)
migration.ResetForTesting()
migration.Initialize(cachedDS, cachedLE, migration.DefaultCacheTTL)
// Convert multiple dashboards in the same namespace
numDashboards := 5
namespace := "default"
for i := 0; i < numDashboards; i++ {
source := createTestV0Dashboard(namespace, "Dashboard "+string(rune('A'+i)))
target := &dashv2alpha1.Dashboard{}
err := Convert_V0_to_V2alpha1(source, target, nil, cachedDS, cachedLE)
require.NoError(t, err, "conversion %d should succeed", i)
require.NotNil(t, target.Spec)
}
// With caching, the underlying datasource provider should only be called once per namespace
// The test dashboard has datasources without type that require lookup
assert.Equal(t, int64(1), underlyingDS.getCallCount(),
"datasource provider should be called only once for %d conversions in same namespace", numDashboards)
// Library element provider should also be called only once per namespace due to caching
assert.Equal(t, int64(1), underlyingLE.getCallCount(),
"library element provider should be called only once for %d conversions in same namespace", numDashboards)
}
// TestConversionCaching_V0_to_V2beta1 verifies caching works when converting V0 to V2beta1
func TestConversionCaching_V0_to_V2beta1(t *testing.T) {
datasources := []schemaversion.DataSourceInfo{
{UID: "ds1", Type: "prometheus", Name: "Prometheus", Default: true},
}
elements := []schemaversion.LibraryElementInfo{
{UID: "lib-panel-repeat-h", Name: "Library Panel with Horizontal Repeat", Type: "timeseries"},
{UID: "lib-panel-no-repeat", Name: "Library Panel without Repeat", Type: "graph"},
}
underlyingDS := newCountingDataSourceProvider(datasources)
underlyingLE := newCountingLibraryElementProvider(elements)
cachedDS := schemaversion.WrapIndexProviderWithCache(underlyingDS, time.Minute)
cachedLE := schemaversion.WrapLibraryElementProviderWithCache(underlyingLE, time.Minute)
migration.ResetForTesting()
migration.Initialize(cachedDS, cachedLE, migration.DefaultCacheTTL)
numDashboards := 5
namespace := "default"
for i := 0; i < numDashboards; i++ {
source := createTestV0Dashboard(namespace, "Dashboard "+string(rune('A'+i)))
target := &dashv2beta1.Dashboard{}
err := Convert_V0_to_V2beta1(source, target, nil, cachedDS, cachedLE)
require.NoError(t, err, "conversion %d should succeed", i)
require.NotNil(t, target.Spec)
}
assert.Equal(t, int64(1), underlyingDS.getCallCount(),
"datasource provider should be called only once for %d conversions in same namespace", numDashboards)
assert.Equal(t, int64(1), underlyingLE.getCallCount(),
"library element provider should be called only once for %d conversions in same namespace", numDashboards)
}
// TestConversionCaching_V1beta1_to_V2alpha1 verifies caching works when converting V1beta1 to V2alpha1
func TestConversionCaching_V1beta1_to_V2alpha1(t *testing.T) {
datasources := []schemaversion.DataSourceInfo{
{UID: "ds1", Type: "prometheus", Name: "Prometheus", Default: true},
}
elements := []schemaversion.LibraryElementInfo{
{UID: "lib-panel-repeat-v", Name: "Library Panel with Vertical Repeat", Type: "timeseries"},
{UID: "lib-panel-no-repeat", Name: "Library Panel without Repeat", Type: "graph"},
}
underlyingDS := newCountingDataSourceProvider(datasources)
underlyingLE := newCountingLibraryElementProvider(elements)
cachedDS := schemaversion.WrapIndexProviderWithCache(underlyingDS, time.Minute)
cachedLE := schemaversion.WrapLibraryElementProviderWithCache(underlyingLE, time.Minute)
migration.ResetForTesting()
migration.Initialize(cachedDS, cachedLE, migration.DefaultCacheTTL)
numDashboards := 5
namespace := "default"
for i := 0; i < numDashboards; i++ {
source := createTestV1Dashboard(namespace, "Dashboard "+string(rune('A'+i)))
target := &dashv2alpha1.Dashboard{}
err := Convert_V1beta1_to_V2alpha1(source, target, nil, cachedDS, cachedLE)
require.NoError(t, err, "conversion %d should succeed", i)
require.NotNil(t, target.Spec)
}
assert.Equal(t, int64(1), underlyingDS.getCallCount(),
"datasource provider should be called only once for %d conversions in same namespace", numDashboards)
assert.Equal(t, int64(1), underlyingLE.getCallCount(),
"library element provider should be called only once for %d conversions in same namespace", numDashboards)
}
// TestConversionCaching_V1beta1_to_V2beta1 verifies caching works when converting V1beta1 to V2beta1
func TestConversionCaching_V1beta1_to_V2beta1(t *testing.T) {
datasources := []schemaversion.DataSourceInfo{
{UID: "ds1", Type: "prometheus", Name: "Prometheus", Default: true},
}
elements := []schemaversion.LibraryElementInfo{
{UID: "lib-panel-repeat-v", Name: "Library Panel with Vertical Repeat", Type: "timeseries"},
{UID: "lib-panel-no-repeat", Name: "Library Panel without Repeat", Type: "graph"},
}
underlyingDS := newCountingDataSourceProvider(datasources)
underlyingLE := newCountingLibraryElementProvider(elements)
cachedDS := schemaversion.WrapIndexProviderWithCache(underlyingDS, time.Minute)
cachedLE := schemaversion.WrapLibraryElementProviderWithCache(underlyingLE, time.Minute)
migration.ResetForTesting()
migration.Initialize(cachedDS, cachedLE, migration.DefaultCacheTTL)
numDashboards := 5
namespace := "default"
for i := 0; i < numDashboards; i++ {
source := createTestV1Dashboard(namespace, "Dashboard "+string(rune('A'+i)))
target := &dashv2beta1.Dashboard{}
err := Convert_V1beta1_to_V2beta1(source, target, nil, cachedDS, cachedLE)
require.NoError(t, err, "conversion %d should succeed", i)
require.NotNil(t, target.Spec)
}
assert.Equal(t, int64(1), underlyingDS.getCallCount(),
"datasource provider should be called only once for %d conversions in same namespace", numDashboards)
assert.Equal(t, int64(1), underlyingLE.getCallCount(),
"library element provider should be called only once for %d conversions in same namespace", numDashboards)
}
// TestConversionCaching_MultipleNamespaces verifies that different namespaces get separate cache entries
func TestConversionCaching_MultipleNamespaces(t *testing.T) {
datasources := []schemaversion.DataSourceInfo{
{UID: "ds1", Type: "prometheus", Name: "Prometheus", Default: true},
}
elements := []schemaversion.LibraryElementInfo{
{UID: "lib-panel-repeat-h", Name: "Library Panel with Horizontal Repeat", Type: "timeseries"},
{UID: "lib-panel-no-repeat", Name: "Library Panel without Repeat", Type: "graph"},
}
underlyingDS := newCountingDataSourceProvider(datasources)
underlyingLE := newCountingLibraryElementProvider(elements)
cachedDS := schemaversion.WrapIndexProviderWithCache(underlyingDS, time.Minute)
cachedLE := schemaversion.WrapLibraryElementProviderWithCache(underlyingLE, time.Minute)
migration.ResetForTesting()
migration.Initialize(cachedDS, cachedLE, migration.DefaultCacheTTL)
namespaces := []string{"default", "org-2", "org-3"}
numDashboardsPerNs := 3
for _, ns := range namespaces {
for i := 0; i < numDashboardsPerNs; i++ {
source := createTestV0Dashboard(ns, "Dashboard "+string(rune('A'+i)))
target := &dashv2alpha1.Dashboard{}
err := Convert_V0_to_V2alpha1(source, target, nil, cachedDS, cachedLE)
require.NoError(t, err, "conversion for namespace %s should succeed", ns)
}
}
// With caching, each namespace should result in one call to the underlying provider
expectedCalls := int64(len(namespaces))
assert.Equal(t, expectedCalls, underlyingDS.getCallCount(),
"datasource provider should be called once per namespace (%d namespaces)", len(namespaces))
assert.Equal(t, expectedCalls, underlyingLE.getCallCount(),
"library element provider should be called once per namespace (%d namespaces)", len(namespaces))
}
// TestConversionCaching_CacheDisabled verifies that TTL=0 disables caching
func TestConversionCaching_CacheDisabled(t *testing.T) {
datasources := []schemaversion.DataSourceInfo{
{UID: "ds1", Type: "prometheus", Name: "Prometheus", Default: true},
}
elements := []schemaversion.LibraryElementInfo{
{UID: "lib-panel-repeat-h", Name: "Library Panel with Horizontal Repeat", Type: "timeseries"},
{UID: "lib-panel-no-repeat", Name: "Library Panel without Repeat", Type: "graph"},
}
underlyingDS := newCountingDataSourceProvider(datasources)
underlyingLE := newCountingLibraryElementProvider(elements)
// TTL of 0 should disable caching - the wrapper returns the underlying provider directly
cachedDS := schemaversion.WrapIndexProviderWithCache(underlyingDS, 0)
cachedLE := schemaversion.WrapLibraryElementProviderWithCache(underlyingLE, 0)
migration.ResetForTesting()
migration.Initialize(cachedDS, cachedLE, migration.DefaultCacheTTL)
numDashboards := 3
namespace := "default"
for i := 0; i < numDashboards; i++ {
source := createTestV0Dashboard(namespace, "Dashboard "+string(rune('A'+i)))
target := &dashv2alpha1.Dashboard{}
err := Convert_V0_to_V2alpha1(source, target, nil, cachedDS, cachedLE)
require.NoError(t, err, "conversion %d should succeed", i)
}
// Without caching, each conversion calls the underlying provider multiple times
// (once for each datasource lookup needed - variables and panels)
// The key check is that the count is GREATER than 1 per conversion (no caching benefit)
assert.Greater(t, underlyingDS.getCallCount(), int64(numDashboards),
"with cache disabled, conversions should call datasource provider multiple times")
// Library element provider is also called for each conversion without caching
assert.GreaterOrEqual(t, underlyingLE.getCallCount(), int64(numDashboards),
"with cache disabled, conversions should call library element provider multiple times")
}

View File

@@ -4,6 +4,8 @@ import (
"errors"
"fmt"
"k8s.io/apimachinery/pkg/conversion"
dashv0 "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v0alpha1"
dashv1 "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v1beta1"
dashv2alpha1 "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1"
@@ -119,14 +121,6 @@ func countPanelsV0V1(spec map[string]interface{}) int {
return count
}
// countTargetsFromPanel counts the number of targets/queries in a panel.
func countTargetsFromPanel(panelMap map[string]interface{}) int {
if targets, ok := panelMap["targets"].([]interface{}); ok {
return len(targets)
}
return 0
}
// countQueriesV0V1 counts data queries in v0alpha1 or v1beta1 dashboard spec
// Note: Row panels are layout containers and should not have queries.
// We ignore any queries on row panels themselves, but count queries in their collapsed panels.
@@ -151,7 +145,9 @@ func countQueriesV0V1(spec map[string]interface{}) int {
// Count queries in regular panels (NOT row panels)
if panelType != "row" {
count += countTargetsFromPanel(panelMap)
if targets, ok := panelMap["targets"].([]interface{}); ok {
count += len(targets)
}
}
// Count queries in collapsed panels inside row panels
@@ -159,7 +155,9 @@ func countQueriesV0V1(spec map[string]interface{}) int {
if collapsedPanels, ok := panelMap["panels"].([]interface{}); ok {
for _, cp := range collapsedPanels {
if cpMap, ok := cp.(map[string]interface{}); ok {
count += countTargetsFromPanel(cpMap)
if targets, ok := cpMap["targets"].([]interface{}); ok {
count += len(targets)
}
}
}
}
@@ -444,3 +442,77 @@ func collectDashboardStats(dashboard interface{}) dashboardStats {
}
return dashboardStats{}
}
// withConversionDataLossDetection wraps a conversion function to detect data loss
func withConversionDataLossDetection(sourceFuncName, targetFuncName string, conversionFunc func(a, b interface{}, scope conversion.Scope) error) func(a, b interface{}, scope conversion.Scope) error {
return func(a, b interface{}, scope conversion.Scope) error {
// Collect source statistics
var sourceStats dashboardStats
switch source := a.(type) {
case *dashv0.Dashboard:
if source.Spec.Object != nil {
sourceStats = collectStatsV0V1(source.Spec.Object)
}
case *dashv1.Dashboard:
if source.Spec.Object != nil {
sourceStats = collectStatsV0V1(source.Spec.Object)
}
case *dashv2alpha1.Dashboard:
sourceStats = collectStatsV2alpha1(source.Spec)
case *dashv2beta1.Dashboard:
sourceStats = collectStatsV2beta1(source.Spec)
}
// Execute the conversion
err := conversionFunc(a, b, scope)
if err != nil {
return err
}
// Collect target statistics
var targetStats dashboardStats
switch target := b.(type) {
case *dashv0.Dashboard:
if target.Spec.Object != nil {
targetStats = collectStatsV0V1(target.Spec.Object)
}
case *dashv1.Dashboard:
if target.Spec.Object != nil {
targetStats = collectStatsV0V1(target.Spec.Object)
}
case *dashv2alpha1.Dashboard:
targetStats = collectStatsV2alpha1(target.Spec)
case *dashv2beta1.Dashboard:
targetStats = collectStatsV2beta1(target.Spec)
}
// Detect if data was lost
if dataLossErr := detectConversionDataLoss(sourceStats, targetStats, sourceFuncName, targetFuncName); dataLossErr != nil {
logger.Error("Dashboard conversion data loss detected",
"sourceFunc", sourceFuncName,
"targetFunc", targetFuncName,
"sourcePanels", sourceStats.panelCount,
"targetPanels", targetStats.panelCount,
"sourceQueries", sourceStats.queryCount,
"targetQueries", targetStats.queryCount,
"sourceAnnotations", sourceStats.annotationCount,
"targetAnnotations", targetStats.annotationCount,
"sourceLinks", sourceStats.linkCount,
"targetLinks", targetStats.linkCount,
"error", dataLossErr,
)
return dataLossErr
}
logger.Debug("Dashboard conversion completed without data loss",
"sourceFunc", sourceFuncName,
"targetFunc", targetFuncName,
"panels", targetStats.panelCount,
"queries", targetStats.queryCount,
"annotations", targetStats.annotationCount,
"links", targetStats.linkCount,
)
return nil
}
}

View File

@@ -35,7 +35,7 @@ func TestConversionMatrixExist(t *testing.T) {
dsProvider := migrationtestutil.NewDataSourceProvider(migrationtestutil.StandardTestConfig)
// Use TestLibraryElementProvider for tests that need library panel models with repeat options
leProvider := migrationtestutil.NewTestLibraryElementProvider()
migration.Initialize(dsProvider, leProvider, migration.DefaultCacheTTL)
migration.Initialize(dsProvider, leProvider)
versions := []metav1.Object{
&dashv0.Dashboard{Spec: common.Unstructured{Object: map[string]any{"title": "dashboardV0"}}},
@@ -89,7 +89,7 @@ func TestDashboardConversionToAllVersions(t *testing.T) {
dsProvider := migrationtestutil.NewDataSourceProvider(migrationtestutil.StandardTestConfig)
// Use TestLibraryElementProvider for tests that need library panel models with repeat options
leProvider := migrationtestutil.NewTestLibraryElementProvider()
migration.Initialize(dsProvider, leProvider, migration.DefaultCacheTTL)
migration.Initialize(dsProvider, leProvider)
// Set up conversion scheme
scheme := runtime.NewScheme()
@@ -309,7 +309,7 @@ func TestMigratedDashboardsConversion(t *testing.T) {
dsProvider := migrationtestutil.NewDataSourceProvider(migrationtestutil.StandardTestConfig)
// Use TestLibraryElementProvider for tests that need library panel models with repeat options
leProvider := migrationtestutil.NewTestLibraryElementProvider()
migration.Initialize(dsProvider, leProvider, migration.DefaultCacheTTL)
migration.Initialize(dsProvider, leProvider)
// Set up conversion scheme
scheme := runtime.NewScheme()
@@ -428,7 +428,7 @@ func setupTestConversionScheme(t *testing.T) *runtime.Scheme {
t.Helper()
dsProvider := migrationtestutil.NewDataSourceProvider(migrationtestutil.StandardTestConfig)
leProvider := migrationtestutil.NewLibraryElementProvider()
migration.Initialize(dsProvider, leProvider, migration.DefaultCacheTTL)
migration.Initialize(dsProvider, leProvider)
scheme := runtime.NewScheme()
err := RegisterConversions(scheme, dsProvider, leProvider)
@@ -527,7 +527,7 @@ func TestConversionMetrics(t *testing.T) {
dsProvider := migrationtestutil.NewDataSourceProvider(migrationtestutil.StandardTestConfig)
// Use TestLibraryElementProvider for tests that need library panel models with repeat options
leProvider := migrationtestutil.NewTestLibraryElementProvider()
migration.Initialize(dsProvider, leProvider, migration.DefaultCacheTTL)
migration.Initialize(dsProvider, leProvider)
// Create a test registry for metrics
registry := prometheus.NewRegistry()
@@ -694,7 +694,7 @@ func TestConversionMetricsWrapper(t *testing.T) {
dsProvider := migrationtestutil.NewDataSourceProvider(migrationtestutil.StandardTestConfig)
// Use TestLibraryElementProvider for tests that need library panel models with repeat options
leProvider := migrationtestutil.NewTestLibraryElementProvider()
migration.Initialize(dsProvider, leProvider, migration.DefaultCacheTTL)
migration.Initialize(dsProvider, leProvider)
// Create a test registry for metrics
registry := prometheus.NewRegistry()
@@ -864,7 +864,7 @@ func TestSchemaVersionExtraction(t *testing.T) {
dsProvider := migrationtestutil.NewDataSourceProvider(migrationtestutil.StandardTestConfig)
// Use TestLibraryElementProvider for tests that need library panel models with repeat options
leProvider := migrationtestutil.NewTestLibraryElementProvider()
migration.Initialize(dsProvider, leProvider, migration.DefaultCacheTTL)
migration.Initialize(dsProvider, leProvider)
// Create a test registry for metrics
registry := prometheus.NewRegistry()
@@ -910,7 +910,7 @@ func TestConversionLogging(t *testing.T) {
dsProvider := migrationtestutil.NewDataSourceProvider(migrationtestutil.StandardTestConfig)
// Use TestLibraryElementProvider for tests that need library panel models with repeat options
leProvider := migrationtestutil.NewTestLibraryElementProvider()
migration.Initialize(dsProvider, leProvider, migration.DefaultCacheTTL)
migration.Initialize(dsProvider, leProvider)
// Create a test registry for metrics
registry := prometheus.NewRegistry()
@@ -1003,7 +1003,7 @@ func TestConversionLogLevels(t *testing.T) {
dsProvider := migrationtestutil.NewDataSourceProvider(migrationtestutil.StandardTestConfig)
// Use TestLibraryElementProvider for tests that need library panel models with repeat options
leProvider := migrationtestutil.NewTestLibraryElementProvider()
migration.Initialize(dsProvider, leProvider, migration.DefaultCacheTTL)
migration.Initialize(dsProvider, leProvider)
t.Run("log levels and structured fields verification", func(t *testing.T) {
// Create test wrapper to verify logging behavior
@@ -1076,7 +1076,7 @@ func TestConversionLoggingFields(t *testing.T) {
dsProvider := migrationtestutil.NewDataSourceProvider(migrationtestutil.StandardTestConfig)
// Use TestLibraryElementProvider for tests that need library panel models with repeat options
leProvider := migrationtestutil.NewTestLibraryElementProvider()
migration.Initialize(dsProvider, leProvider, migration.DefaultCacheTTL)
migration.Initialize(dsProvider, leProvider)
t.Run("verify all log fields are present", func(t *testing.T) {
// Test that the conversion wrapper includes all expected structured fields

View File

@@ -17,9 +17,7 @@ import (
"github.com/grafana/grafana/apps/dashboard/pkg/migration/schemaversion"
)
func getLogger() logging.Logger {
return logging.DefaultLogger.With("logger", "dashboard.conversion")
}
var logger = logging.DefaultLogger.With("logger", "dashboard.conversion")
// getErroredSchemaVersionFunc determines the schema version function that errored
func getErroredSchemaVersionFunc(err error) string {
@@ -199,9 +197,9 @@ func withConversionMetrics(sourceVersionAPI, targetVersionAPI string, conversion
)
if errorType == "schema_minimum_version_error" {
getLogger().Warn("Dashboard conversion failed", logFields...)
logger.Warn("Dashboard conversion failed", logFields...)
} else {
getLogger().Error("Dashboard conversion failed", logFields...)
logger.Error("Dashboard conversion failed", logFields...)
}
} else {
// Record success metrics
@@ -237,7 +235,7 @@ func withConversionMetrics(sourceVersionAPI, targetVersionAPI string, conversion
)
}
getLogger().Debug("Dashboard conversion succeeded", successLogFields...)
logger.Debug("Dashboard conversion succeeded", successLogFields...)
}
return nil

View File

@@ -76,9 +76,9 @@
"barGlow": false,
"centerGlow": false,
"rounded": true,
"spotlight": false,
"gradient": false
"spotlight": false
},
"gradient": "none",
"orientation": "auto",
"reduceOptions": {
"calcs": [
@@ -155,9 +155,9 @@
"barGlow": false,
"centerGlow": true,
"rounded": true,
"spotlight": false,
"gradient": false
"spotlight": false
},
"gradient": "none",
"orientation": "auto",
"reduceOptions": {
"calcs": [
@@ -234,9 +234,9 @@
"barGlow": true,
"centerGlow": true,
"rounded": true,
"spotlight": false,
"gradient": false
"spotlight": false
},
"gradient": "none",
"orientation": "auto",
"reduceOptions": {
"calcs": [
@@ -313,9 +313,9 @@
"barGlow": true,
"centerGlow": true,
"rounded": true,
"spotlight": true,
"gradient": false
"spotlight": true
},
"gradient": "none",
"orientation": "auto",
"reduceOptions": {
"calcs": [
@@ -392,9 +392,9 @@
"barGlow": true,
"centerGlow": true,
"rounded": true,
"spotlight": true,
"gradient": false
"spotlight": true
},
"gradient": "none",
"orientation": "auto",
"reduceOptions": {
"calcs": [
@@ -471,9 +471,9 @@
"barGlow": true,
"centerGlow": true,
"rounded": false,
"spotlight": true,
"gradient": false
"spotlight": true
},
"gradient": "none",
"orientation": "auto",
"reduceOptions": {
"calcs": [
@@ -550,9 +550,9 @@
"barGlow": true,
"centerGlow": true,
"rounded": false,
"spotlight": true,
"gradient": false
"spotlight": true
},
"gradient": "none",
"orientation": "auto",
"reduceOptions": {
"calcs": [
@@ -642,9 +642,9 @@
"barGlow": true,
"centerGlow": true,
"rounded": true,
"spotlight": true,
"gradient": false
"spotlight": true
},
"gradient": "none",
"orientation": "auto",
"reduceOptions": {
"calcs": [
@@ -721,9 +721,9 @@
"barGlow": true,
"centerGlow": true,
"rounded": true,
"spotlight": true,
"gradient": false
"spotlight": true
},
"gradient": "none",
"orientation": "auto",
"reduceOptions": {
"calcs": [
@@ -800,9 +800,9 @@
"barGlow": true,
"centerGlow": true,
"rounded": true,
"spotlight": true,
"gradient": false
"spotlight": true
},
"gradient": "none",
"orientation": "auto",
"reduceOptions": {
"calcs": [
@@ -879,9 +879,9 @@
"barGlow": true,
"centerGlow": true,
"rounded": true,
"spotlight": true,
"gradient": false
"spotlight": true
},
"gradient": "none",
"orientation": "auto",
"reduceOptions": {
"calcs": [
@@ -975,9 +975,9 @@
"barGlow": false,
"centerGlow": false,
"rounded": false,
"spotlight": false,
"gradient": false
"spotlight": false
},
"gradient": "none",
"orientation": "auto",
"reduceOptions": {
"calcs": [
@@ -1054,9 +1054,9 @@
"barGlow": false,
"centerGlow": false,
"rounded": false,
"spotlight": false,
"gradient": false
"spotlight": false
},
"gradient": "none",
"orientation": "auto",
"reduceOptions": {
"calcs": [
@@ -1133,9 +1133,9 @@
"barGlow": false,
"centerGlow": false,
"rounded": false,
"spotlight": false,
"gradient": true
"spotlight": false
},
"gradient": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
@@ -1212,9 +1212,9 @@
"barGlow": false,
"centerGlow": false,
"rounded": false,
"spotlight": false,
"gradient": false
"spotlight": false
},
"gradient": "none",
"orientation": "auto",
"reduceOptions": {
"calcs": [
@@ -1291,9 +1291,9 @@
"barGlow": false,
"centerGlow": false,
"rounded": false,
"spotlight": false,
"gradient": false
"spotlight": false
},
"gradient": "none",
"orientation": "auto",
"reduceOptions": {
"calcs": [
@@ -1387,9 +1387,9 @@
"barGlow": false,
"centerGlow": false,
"rounded": false,
"spotlight": false,
"gradient": true
"spotlight": false
},
"gradient": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
@@ -1470,9 +1470,9 @@
"barGlow": false,
"centerGlow": false,
"rounded": false,
"spotlight": false,
"gradient": true
"spotlight": false
},
"gradient": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
@@ -1553,9 +1553,9 @@
"barGlow": false,
"centerGlow": false,
"rounded": false,
"spotlight": false,
"gradient": true
"spotlight": false
},
"gradient": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
@@ -1645,10 +1645,10 @@
"barGlow": true,
"centerGlow": true,
"rounded": true,
"spotlight": true,
"gradient": true
"spotlight": true
},
"glow": "both",
"gradient": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
@@ -1731,10 +1731,10 @@
"barGlow": true,
"centerGlow": true,
"rounded": true,
"spotlight": true,
"gradient": true
"spotlight": true
},
"glow": "both",
"gradient": "scheme",
"orientation": "auto",
"reduceOptions": {
"calcs": [
@@ -1831,10 +1831,10 @@
"barGlow": true,
"centerGlow": true,
"rounded": true,
"spotlight": true,
"gradient": true
"spotlight": true
},
"glow": "both",
"gradient": "scheme",
"orientation": "auto",
"reduceOptions": {
"calcs": [
@@ -1919,10 +1919,10 @@
"centerGlow": true,
"rounded": true,
"sparkline": false,
"spotlight": true,
"gradient": true
"spotlight": true
},
"glow": "both",
"gradient": "scheme",
"orientation": "auto",
"reduceOptions": {
"calcs": [
@@ -2005,10 +2005,10 @@
"barGlow": true,
"centerGlow": true,
"rounded": true,
"spotlight": true,
"gradient": true
"spotlight": true
},
"glow": "both",
"gradient": "hue",
"orientation": "auto",
"reduceOptions": {
"calcs": [
@@ -2091,10 +2091,10 @@
"barGlow": true,
"centerGlow": true,
"rounded": true,
"spotlight": true,
"gradient": true
"spotlight": true
},
"glow": "both",
"gradient": "hue",
"orientation": "auto",
"reduceOptions": {
"calcs": [
@@ -2147,4 +2147,4 @@
"title": "Panel tests - Gauge (new)",
"uid": "panel-tests-gauge-new",
"weekStart": ""
}
}

View File

@@ -956,9 +956,9 @@
"barGlow": false,
"centerGlow": false,
"rounded": false,
"spotlight": false,
"gradient": false
"spotlight": false
},
"gradient": "none",
"orientation": "auto",
"reduceOptions": {
"calcs": [
@@ -1162,4 +1162,4 @@
"title": "Panel tests - Old gauge to new",
"uid": "panel-tests-old-gauge-to-new",
"weekStart": ""
}
}

View File

@@ -42,7 +42,7 @@
"regex": "",
"skipUrlSync": false,
"refresh": 1
},
},
{
"name": "query_var",
"type": "query",
@@ -81,7 +81,6 @@
"allValue": ".*",
"multi": true,
"regex": "/.*9090.*/",
"regexApplyTo": "text",
"skipUrlSync": false,
"refresh": 2,
"sort": 1,
@@ -108,7 +107,7 @@
},
{
"selected": false,
"text": "staging",
"text": "staging",
"value": "staging"
},
{
@@ -336,7 +335,6 @@
"allValue": "*",
"multi": true,
"regex": "/host[0-9]+/",
"regexApplyTo": "value",
"skipUrlSync": false,
"refresh": 1,
"sort": 2,
@@ -356,4 +354,4 @@
},
"links": []
}
}
}

View File

@@ -237,10 +237,5 @@
"title": "V10 Table Thresholds Test",
"variables": []
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -244,10 +244,5 @@
"title": "V10 Table Thresholds Test",
"variables": []
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -206,10 +206,5 @@
}
]
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -213,10 +213,5 @@
}
]
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -203,10 +203,5 @@
}
]
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -216,10 +216,5 @@
}
]
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -351,10 +351,5 @@
"title": "V13 Graph Thresholds Migration Test",
"variables": []
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -362,10 +362,5 @@
"title": "V13 Graph Thresholds Migration Test",
"variables": []
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -129,10 +129,5 @@
"title": "Dashboard with minimal graph panel settings",
"variables": []
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -132,10 +132,5 @@
"title": "Dashboard with minimal graph panel settings",
"variables": []
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -210,10 +210,5 @@
}
]
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -217,10 +217,5 @@
}
]
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -1004,10 +1004,5 @@
}
]
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -1023,10 +1023,5 @@
}
]
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -223,10 +223,5 @@
}
]
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -231,10 +231,5 @@
}
]
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -1455,10 +1455,5 @@
}
]
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -1481,10 +1481,5 @@
}
]
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -719,10 +719,5 @@
"title": "V16 Grid Layout Migration Test Dashboard",
"variables": []
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -739,10 +739,5 @@
"title": "V16 Grid Layout Migration Test Dashboard",
"variables": []
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -1655,10 +1655,5 @@
}
]
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -1707,10 +1707,5 @@
}
]
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -636,10 +636,5 @@
"title": "V17 MinSpan to MaxPerRow Migration Test Dashboard",
"variables": []
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -657,10 +657,5 @@
"title": "V17 MinSpan to MaxPerRow Migration Test Dashboard",
"variables": []
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -401,10 +401,5 @@
"title": "V18 Gauge Options Migration Test Dashboard",
"variables": []
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -412,10 +412,5 @@
"title": "V18 Gauge Options Migration Test Dashboard",
"variables": []
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -434,10 +434,5 @@
"title": "V19 Panel Links Migration Test Dashboard",
"variables": []
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -447,10 +447,5 @@
"title": "V19 Panel Links Migration Test Dashboard",
"variables": []
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -354,10 +354,5 @@
}
]
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -365,10 +365,5 @@
}
]
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -426,10 +426,5 @@
"title": "V20 Variable Syntax Migration Test Dashboard",
"variables": []
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -437,10 +437,5 @@
"title": "V20 Variable Syntax Migration Test Dashboard",
"variables": []
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -401,10 +401,5 @@
"title": "V21 Data Links Series to Field Migration Test Dashboard",
"variables": []
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -412,10 +412,5 @@
"title": "V21 Data Links Series to Field Migration Test Dashboard",
"variables": []
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -123,10 +123,5 @@
"title": "V22 Table Panel Styles Test",
"variables": []
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -126,10 +126,5 @@
"title": "V22 Table Panel Styles Test",
"variables": []
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -374,10 +374,5 @@
}
]
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -391,10 +391,5 @@
}
]
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -1065,10 +1065,5 @@
"title": "No Title",
"variables": []
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -1101,10 +1101,5 @@
"title": "No Title",
"variables": []
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -217,10 +217,5 @@
}
]
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -226,10 +226,5 @@
}
]
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -240,10 +240,5 @@
"title": "No Title",
"variables": []
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -247,10 +247,5 @@
"title": "No Title",
"variables": []
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -207,10 +207,5 @@
}
]
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -211,10 +211,5 @@
}
]
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -131,10 +131,5 @@
}
]
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -134,10 +134,5 @@
}
]
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -393,10 +393,5 @@
}
]
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -406,10 +406,5 @@
}
]
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -622,10 +622,5 @@
"title": "V28 Singlestat and Variable Properties Migration Test Dashboard",
"variables": []
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -642,10 +642,5 @@
"title": "V28 Singlestat and Variable Properties Migration Test Dashboard",
"variables": []
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -435,10 +435,5 @@
}
]
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -458,10 +458,5 @@
}
]
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -294,10 +294,5 @@
"title": "V3 No-Op Migration - but tests ensuring panel IDs are unique",
"variables": []
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -303,10 +303,5 @@
"title": "V3 No-Op Migration - but tests ensuring panel IDs are unique",
"variables": []
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -689,10 +689,5 @@
"title": "V30 Value Mappings and Tooltip Options Migration Test Dashboard",
"variables": []
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -705,10 +705,5 @@
"title": "V30 Value Mappings and Tooltip Options Migration Test Dashboard",
"variables": []
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -669,10 +669,5 @@
"title": "V31 LabelsToFields Merge Migration Test Dashboard",
"variables": []
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -684,10 +684,5 @@
"title": "V31 LabelsToFields Merge Migration Test Dashboard",
"variables": []
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -310,10 +310,5 @@
}
]
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -320,10 +320,5 @@
}
]
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -720,10 +720,5 @@
"title": "V33 Panel Datasource Name to Ref Test",
"variables": []
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -746,10 +746,5 @@
"title": "V33 Panel Datasource Name to Ref Test",
"variables": []
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -1900,10 +1900,5 @@
"title": "CloudWatch Multiple Statistics Test Dashboard",
"variables": []
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -1964,10 +1964,5 @@
"title": "CloudWatch Multiple Statistics Test Dashboard",
"variables": []
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -595,10 +595,5 @@
"title": "X-Axis Visibility Test Dashboard",
"variables": []
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -612,10 +612,5 @@
"title": "X-Axis Visibility Test Dashboard",
"variables": []
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

View File

@@ -1029,10 +1029,5 @@
}
]
},
"status": {
"conversion": {
"failed": false,
"storedVersion": "v1beta1"
}
}
"status": {}
}

Some files were not shown because too many files have changed in this diff Show More