From 1fbb3537b3952c7e15c4091821e76dc2f3f0710e Mon Sep 17 00:00:00 2001 From: Drew Tate Date: Fri, 22 Sep 2023 15:37:23 -0600 Subject: [PATCH 01/23] detect legacy visualization in dashboards --- ...alidate_kibana_no_legacy_visualizations.go | 52 + code/go/internal/validator/spec.go | 1 + code/go/pkg/validator/validator_test.go | 1 + go.mod | 3 + .../changelog.yml | 5 + .../docs/README.md | 1 + ...-c36e9b90-596c-11ee-adef-4fe896364076.json | 1017 +++++++++++++++++ ...-d729eb20-596d-11ee-adef-4fe896364076.json | 457 ++++++++ ...-f4c4ce70-596d-11ee-adef-4fe896364076.json | 126 ++ ...-04a682c0-596e-11ee-adef-4fe896364076.json | 89 ++ ...-8f2e0810-596d-11ee-adef-4fe896364076.json | 45 + ...-0c94ff70-596e-11ee-adef-4fe896364076.json | 35 + ...-1740c760-596e-11ee-adef-4fe896364076.json | 74 ++ ...-1ef680d0-596e-11ee-adef-4fe896364076.json | 91 ++ ...-23f94f40-596e-11ee-adef-4fe896364076.json | 83 ++ ...-29c51300-596e-11ee-adef-4fe896364076.json | 52 + ...-2e364fd0-596e-11ee-adef-4fe896364076.json | 76 ++ ...-331b3600-596e-11ee-adef-4fe896364076.json | 81 ++ ...-38222320-596e-11ee-adef-4fe896364076.json | 28 + ...-e6e022a0-596d-11ee-adef-4fe896364076.json | 58 + ...-ee3370c0-596d-11ee-adef-4fe896364076.json | 35 + ...-f9920df0-596d-11ee-adef-4fe896364076.json | 27 + .../kibana_legacy_visualizations/manifest.yml | 9 + 23 files changed, 2446 insertions(+) create mode 100644 code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go create mode 100644 test/packages/kibana_legacy_visualizations/changelog.yml create mode 100644 test/packages/kibana_legacy_visualizations/docs/README.md create mode 100644 test/packages/kibana_legacy_visualizations/kibana/dashboard/kibana_legacy_visualizations-c36e9b90-596c-11ee-adef-4fe896364076.json create mode 100644 test/packages/kibana_legacy_visualizations/kibana/dashboard/kibana_legacy_visualizations-d729eb20-596d-11ee-adef-4fe896364076.json create mode 100644 test/packages/kibana_legacy_visualizations/kibana/lens/kibana_legacy_visualizations-f4c4ce70-596d-11ee-adef-4fe896364076.json create mode 100644 test/packages/kibana_legacy_visualizations/kibana/map/kibana_legacy_visualizations-04a682c0-596e-11ee-adef-4fe896364076.json create mode 100644 test/packages/kibana_legacy_visualizations/kibana/search/kibana_legacy_visualizations-8f2e0810-596d-11ee-adef-4fe896364076.json create mode 100644 test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-0c94ff70-596e-11ee-adef-4fe896364076.json create mode 100644 test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-1740c760-596e-11ee-adef-4fe896364076.json create mode 100644 test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-1ef680d0-596e-11ee-adef-4fe896364076.json create mode 100644 test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-23f94f40-596e-11ee-adef-4fe896364076.json create mode 100644 test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-29c51300-596e-11ee-adef-4fe896364076.json create mode 100644 test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-2e364fd0-596e-11ee-adef-4fe896364076.json create mode 100644 test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-331b3600-596e-11ee-adef-4fe896364076.json create mode 100644 test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-38222320-596e-11ee-adef-4fe896364076.json create mode 100644 test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-e6e022a0-596d-11ee-adef-4fe896364076.json create mode 100644 test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-ee3370c0-596d-11ee-adef-4fe896364076.json create mode 100644 test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-f9920df0-596d-11ee-adef-4fe896364076.json create mode 100644 test/packages/kibana_legacy_visualizations/manifest.yml diff --git a/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go b/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go new file mode 100644 index 000000000..f09b5bc7c --- /dev/null +++ b/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go @@ -0,0 +1,52 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package semantic + +import ( + "fmt" + "path" + "text/tabwriter" + "strings" + + "github.com/elastic/kbncontent" + ve "github.com/elastic/package-spec/v2/code/go/internal/errors" + "github.com/elastic/package-spec/v2/code/go/internal/fspath" + "github.com/elastic/package-spec/v2/code/go/internal/pkgpath" +) + +// Reports legacy Kibana visualizations in a package. +func ValidateKibanaNoLegacyVisualizations(fsys fspath.FS) ve.ValidationErrors { + var errs ve.ValidationErrors + + filePaths := path.Join("kibana", "dashboard", "*.json") + dashboardFiles, err := pkgpath.Files(fsys, filePaths) + if err != nil { + errs = append(errs, fmt.Errorf("error finding Kibana dashboard files: %w", err)) + return errs + } + for _, file := range dashboardFiles { + panelsJSON, _ := file.Values("$.attributes.panelsJSON") + visualizations, _ := kbncontent.DescribeByValueDashboardPanels(panelsJSON) + + var buf strings.Builder + fmt.Fprintf(&buf, "dashboard \"%s\" contains legacy visualizations:\n\n", fsys.Path(file.Path())) + tableWriter := tabwriter.NewWriter(&buf, 0, 0, 1, ' ', tabwriter.Debug) + fmt.Fprintln(tableWriter, "\tVisualization Title\tVisualization type\t") + hasLegacy := false + for _, vis := range visualizations { + if vis.IsLegacy { + hasLegacy = true + fmt.Fprintf(tableWriter, "\t\"%s\"\t%s\t\n", vis.Title, vis.Type) + } + } + tableWriter.Flush() + + if hasLegacy { + errs = append(errs, fmt.Errorf("%s", buf.String())) + } + } + + return errs +} diff --git a/code/go/internal/validator/spec.go b/code/go/internal/validator/spec.go index 143337dbd..4bf4b4f69 100644 --- a/code/go/internal/validator/spec.go +++ b/code/go/internal/validator/spec.go @@ -136,6 +136,7 @@ func (s Spec) rules(pkgType string, rootSpec spectypes.ItemSpec) validationRules {fn: semantic.ValidateRoutingRulesAndDataset, types: []string{"integration"}, since: semver.MustParse("2.9.0")}, {fn: semantic.ValidateKibanaNoDanglingObjectIDs, since: semver.MustParse("3.0.0")}, {fn: semantic.ValidateKibanaFilterPresent, since: semver.MustParse("3.0.0")}, + {fn: semantic.ValidateKibanaNoLegacyVisualizations, types: []string{"integration"}, since: semver.MustParse("3.0.0")}, } var validationRules validationRules diff --git a/code/go/pkg/validator/validator_test.go b/code/go/pkg/validator/validator_test.go index 52d2ed6ec..88a3b5626 100644 --- a/code/go/pkg/validator/validator_test.go +++ b/code/go/pkg/validator/validator_test.go @@ -227,6 +227,7 @@ func TestValidateFile(t *testing.T) { `dangling reference found: bad_dangling_object_ids-8287a5d5-1576-4f3a-83c4-444e9058439c (search)`, }, }, + "kibana_legacy_visualizations": {}, } for pkgName, test := range tests { diff --git a/go.mod b/go.mod index 220fd0ff7..9d00a5334 100644 --- a/go.mod +++ b/go.mod @@ -18,6 +18,7 @@ require ( golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 gopkg.in/yaml.v3 v3.0.1 gotest.tools/gotestsum v1.11.0 + github.com/elastic/kbncontent v0.0.0 ) require ( @@ -42,3 +43,5 @@ require ( golang.org/x/tools v0.13.0 // indirect gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect ) + +replace github.com/elastic/kbncontent v0.0.0 => ../kbncontent diff --git a/test/packages/kibana_legacy_visualizations/changelog.yml b/test/packages/kibana_legacy_visualizations/changelog.yml new file mode 100644 index 000000000..04688a4cb --- /dev/null +++ b/test/packages/kibana_legacy_visualizations/changelog.yml @@ -0,0 +1,5 @@ +- version: 0.1.2 + changes: + - description: initial release + type: enhancement + link: https://github.com/elastic/package-spec/pull/160 \ No newline at end of file diff --git a/test/packages/kibana_legacy_visualizations/docs/README.md b/test/packages/kibana_legacy_visualizations/docs/README.md new file mode 100644 index 000000000..1c9bf4968 --- /dev/null +++ b/test/packages/kibana_legacy_visualizations/docs/README.md @@ -0,0 +1 @@ +Main \ No newline at end of file diff --git a/test/packages/kibana_legacy_visualizations/kibana/dashboard/kibana_legacy_visualizations-c36e9b90-596c-11ee-adef-4fe896364076.json b/test/packages/kibana_legacy_visualizations/kibana/dashboard/kibana_legacy_visualizations-c36e9b90-596c-11ee-adef-4fe896364076.json new file mode 100644 index 000000000..9e93e8f1d --- /dev/null +++ b/test/packages/kibana_legacy_visualizations/kibana/dashboard/kibana_legacy_visualizations-c36e9b90-596c-11ee-adef-4fe896364076.json @@ -0,0 +1,1017 @@ +{ + "attributes": { + "controlGroupInput": { + "chainingSystem": "HIERARCHICAL", + "controlStyle": "oneLine", + "ignoreParentSettingsJSON": "{\"ignoreFilters\":false,\"ignoreQuery\":false,\"ignoreTimerange\":false,\"ignoreValidations\":false}", + "panelsJSON": "{\"332c44e9-b2a2-4d26-96c4-49562da1ba93\":{\"type\":\"optionsListControl\",\"order\":0,\"grow\":true,\"width\":\"medium\",\"explicitInput\":{\"id\":\"332c44e9-b2a2-4d26-96c4-49562da1ba93\",\"fieldName\":\"agent.id\",\"title\":\"agent.id\",\"enhancements\":{}}}}" + }, + "description": "", + "kibanaSavedObjectMeta": { + "searchSourceJSON": { + "filter": [ + { + "$state": { + "store": "appState" + }, + "meta": { + "alias": null, + "disabled": false, + "field": "agent.type", + "indexRefName": "kibanaSavedObjectMeta.searchSourceJSON.filter[0].meta.index", + "key": "agent.type", + "negate": false, + "params": { + "query": "filebeat" + }, + "type": "phrase" + }, + "query": { + "match_phrase": { + "agent.type": "filebeat" + } + } + } + ], + "query": { + "language": "kuery", + "query": "" + } + } + }, + "optionsJSON": { + "hidePanelTitles": false, + "syncColors": false, + "syncCursor": true, + "syncTooltips": false, + "useMargins": true + }, + "panelsJSON": [ + { + "embeddableConfig": { + "enhancements": {}, + "hidePanelTitles": false, + "savedVis": { + "data": { + "aggs": [], + "searchSource": { + "filter": [], + "query": { + "language": "kuery", + "query": "" + } + } + }, + "description": "", + "id": "", + "params": { + "controls": [ + { + "fieldName": "agent.id", + "id": "1695403260945", + "indexPatternRefName": "control_9d6acabf-1b0a-4b36-99c4-eb3a2f1f4673_0_index_pattern", + "label": "I'm a control", + "options": { + "dynamicOptions": true, + "multiselect": true, + "order": "desc", + "size": 5, + "type": "terms" + }, + "parent": "", + "type": "list" + } + ], + "pinFilters": false, + "updateFiltersOnChange": true, + "useTimeFilter": false + }, + "title": "", + "type": "input_control_vis", + "uiState": {} + } + }, + "gridData": { + "h": 5, + "i": "9d6acabf-1b0a-4b36-99c4-eb3a2f1f4673", + "w": 12, + "x": 0, + "y": 0 + }, + "panelIndex": "9d6acabf-1b0a-4b36-99c4-eb3a2f1f4673", + "title": "Legacy input control vis", + "type": "visualization", + "version": "8.7.1" + }, + { + "embeddableConfig": { + "enhancements": {}, + "savedVis": { + "data": { + "aggs": [], + "searchSource": { + "filter": [], + "query": { + "language": "kuery", + "query": "" + } + } + }, + "description": "", + "id": "", + "params": { + "fontSize": 12, + "markdown": "# The Good", + "openLinksInNewTab": false + }, + "title": "", + "type": "markdown", + "uiState": {} + } + }, + "gridData": { + "h": 3, + "i": "e9f4b7cd-8f6b-498f-9934-16e187139a9e", + "w": 48, + "x": 0, + "y": 5 + }, + "panelIndex": "e9f4b7cd-8f6b-498f-9934-16e187139a9e", + "type": "visualization", + "version": "8.7.1" + }, + { + "embeddableConfig": { + "attributes": { + "references": [ + { + "id": "logs-*", + "name": "indexpattern-datasource-layer-85c9c01e-13df-42a2-b33d-8441fb83afaf", + "type": "index-pattern" + } + ], + "state": { + "adHocDataViews": {}, + "datasourceStates": { + "formBased": { + "layers": { + "85c9c01e-13df-42a2-b33d-8441fb83afaf": { + "columnOrder": [ + "e88818c5-d9ff-467e-b231-2e97d611a9a7", + "17c707aa-0ede-444e-81ed-9816983d6479" + ], + "columns": { + "17c707aa-0ede-444e-81ed-9816983d6479": { + "dataType": "number", + "isBucketed": false, + "label": "Count of records", + "operationType": "count", + "params": { + "emptyAsNull": true + }, + "scale": "ratio", + "sourceField": "___records___" + }, + "e88818c5-d9ff-467e-b231-2e97d611a9a7": { + "dataType": "string", + "isBucketed": true, + "label": "Top 5 values of agent.id", + "operationType": "terms", + "params": { + "exclude": [], + "excludeIsRegex": false, + "include": [], + "includeIsRegex": false, + "missingBucket": false, + "orderBy": { + "columnId": "17c707aa-0ede-444e-81ed-9816983d6479", + "type": "column" + }, + "orderDirection": "desc", + "otherBucket": true, + "parentFormat": { + "id": "terms" + }, + "size": 5 + }, + "scale": "ordinal", + "sourceField": "agent.id" + } + }, + "incompleteColumns": {}, + "sampling": 1 + } + } + }, + "textBased": { + "layers": {} + } + }, + "filters": [], + "internalReferences": [], + "query": { + "language": "kuery", + "query": "" + }, + "visualization": { + "axisTitlesVisibilitySettings": { + "x": true, + "yLeft": true, + "yRight": true + }, + "fittingFunction": "None", + "gridlinesVisibilitySettings": { + "x": true, + "yLeft": true, + "yRight": true + }, + "labelsOrientation": { + "x": 0, + "yLeft": 0, + "yRight": 0 + }, + "layers": [ + { + "accessors": [ + "17c707aa-0ede-444e-81ed-9816983d6479" + ], + "layerId": "85c9c01e-13df-42a2-b33d-8441fb83afaf", + "layerType": "data", + "position": "top", + "seriesType": "bar_stacked", + "showGridlines": false, + "xAccessor": "e88818c5-d9ff-467e-b231-2e97d611a9a7" + } + ], + "legend": { + "isVisible": true, + "position": "right" + }, + "preferredSeriesType": "bar_stacked", + "tickLabelsVisibilitySettings": { + "x": true, + "yLeft": true, + "yRight": true + }, + "valueLabels": "hide" + } + }, + "title": "", + "type": "lens", + "visualizationType": "lnsXY" + }, + "enhancements": {}, + "hidePanelTitles": false + }, + "gridData": { + "h": 15, + "i": "46426c7d-7683-400c-b625-49d0114f41a0", + "w": 24, + "x": 0, + "y": 8 + }, + "panelIndex": "46426c7d-7683-400c-b625-49d0114f41a0", + "title": "Lens bar", + "type": "lens", + "version": "8.7.1" + }, + { + "embeddableConfig": { + "enhancements": {}, + "hidePanelTitles": false, + "savedVis": { + "data": { + "aggs": [], + "searchSource": {} + }, + "description": "", + "id": "", + "params": { + "spec": "{\n/*\n\nWelcome to Vega visualizations. Here you can design your own dataviz from scratch using a declarative language called Vega, or its simpler form Vega-Lite. In Vega, you have the full control of what data is loaded, even from multiple sources, how that data is transformed, and what visual elements are used to show it. Use help icon to view Vega examples, tutorials, and other docs. Use the wrench icon to reformat this text, or to remove comments.\n\nThis example graph shows the document count in all indexes in the current time range. You might need to adjust the time filter in the upper right corner.\n*/\n\n $schema: https://vega.github.io/schema/vega-lite/v5.json\n title: Event counts from all indexes\n\n // Define the data source\n data: {\n url: {\n/*\nAn object instead of a string for the \"url\" param is treated as an Elasticsearch query. Anything inside this object is not part of the Vega language, but only understood by Kibana and Elasticsearch server. This query counts the number of documents per time interval, assuming you have a @timestamp field in your data.\n\nKibana has a special handling for the fields surrounded by \"%\". They are processed before the the query is sent to Elasticsearch. This way the query becomes context aware, and can use the time range and the dashboard filters.\n*/\n\n // Apply dashboard context filters when set\n %context%: true\n // Filter the time picker (upper right corner) with this field\n %timefield%: @timestamp\n\n/*\nSee .search() documentation for : https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-search\n*/\n\n // Which index to search\n index: _all\n // Aggregate data by the time field into time buckets, counting the number of documents in each bucket.\n body: {\n aggs: {\n time_buckets: {\n date_histogram: {\n // Use date histogram aggregation on @timestamp field\n field: @timestamp\n // The interval value will depend on the daterange picker (true), or use an integer to set an approximate bucket count\n interval: {%autointerval%: true}\n // Make sure we get an entire range, even if it has no data\n extended_bounds: {\n // Use the current time range's start and end\n min: {%timefilter%: \"min\"}\n max: {%timefilter%: \"max\"}\n }\n // Use this for linear (e.g. line, area) graphs. Without it, empty buckets will not show up\n min_doc_count: 0\n }\n }\n }\n // Speed up the response by only including aggregation results\n size: 0\n }\n }\n/*\nElasticsearch will return results in this format:\n\naggregations: {\n time_buckets: {\n buckets: [\n {\n key_as_string: 2015-11-30T22:00:00.000Z\n key: 1448920800000\n doc_count: 0\n },\n {\n key_as_string: 2015-11-30T23:00:00.000Z\n key: 1448924400000\n doc_count: 0\n }\n ...\n ]\n }\n}\n\nFor our graph, we only need the list of bucket values. Use the format.property to discard everything else.\n*/\n format: {property: \"aggregations.time_buckets.buckets\"}\n }\n\n // \"mark\" is the graphics element used to show our data. Other mark values are: area, bar, circle, line, point, rect, rule, square, text, and tick. See https://vega.github.io/vega-lite/docs/mark.html\n mark: line\n\n // \"encoding\" tells the \"mark\" what data to use and in what way. See https://vega.github.io/vega-lite/docs/encoding.html\n encoding: {\n x: {\n // The \"key\" value is the timestamp in milliseconds. Use it for X axis.\n field: key\n type: temporal\n axis: {title: false} // Customize X axis format\n }\n y: {\n // The \"doc_count\" is the count per bucket. Use it for Y axis.\n field: doc_count\n type: quantitative\n axis: {title: \"Document count\"}\n }\n }\n}\n" + }, + "title": "", + "type": "vega", + "uiState": {} + } + }, + "gridData": { + "h": 15, + "i": "12316c43-e92e-415b-9b6f-7a1a1c0a0f07", + "w": 24, + "x": 24, + "y": 8 + }, + "panelIndex": "12316c43-e92e-415b-9b6f-7a1a1c0a0f07", + "title": "Vega time series", + "type": "visualization", + "version": "8.7.1" + }, + { + "embeddableConfig": { + "attributes": { + "description": "", + "layerListJSON": "[{\"locale\":\"autoselect\",\"sourceDescriptor\":{\"type\":\"EMS_TMS\",\"isAutoSelect\":true,\"lightModeDefault\":\"road_map_desaturated\"},\"id\":\"909a0001-15f6-40b7-8be5-fadddcc358c1\",\"label\":null,\"minZoom\":0,\"maxZoom\":24,\"alpha\":1,\"visible\":true,\"style\":{\"type\":\"EMS_VECTOR_TILE\",\"color\":\"\"},\"includeInFitToBounds\":true,\"type\":\"EMS_VECTOR_TILE\"}]", + "mapStateJSON": "{\"adHocDataViews\":[],\"zoom\":1.6,\"center\":{\"lon\":0,\"lat\":19.94277},\"timeFilters\":{\"from\":\"now-15m\",\"to\":\"now\"},\"refreshConfig\":{\"isPaused\":true,\"interval\":60000},\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filters\":[],\"settings\":{\"autoFitToDataBounds\":false,\"backgroundColor\":\"#ffffff\",\"customIcons\":[],\"disableInteractive\":false,\"disableTooltipControl\":false,\"hideToolbarOverlay\":false,\"hideLayerControl\":false,\"hideViewControl\":false,\"initialLocation\":\"LAST_SAVED_LOCATION\",\"fixedLocation\":{\"lat\":0,\"lon\":0,\"zoom\":2},\"browserLocation\":{\"zoom\":2},\"keydownScrollZoom\":false,\"maxZoom\":24,\"minZoom\":0,\"showScaleControl\":false,\"showSpatialFilters\":true,\"showTimesliderToggleButton\":true,\"spatialFiltersAlpa\":0.3,\"spatialFiltersFillColor\":\"#DA8B45\",\"spatialFiltersLineColor\":\"#DA8B45\"}}", + "title": "", + "uiStateJSON": "{\"isLayerTOCOpen\":true,\"openTOCDetails\":[]}" + }, + "enhancements": {}, + "hiddenLayers": [], + "isLayerTOCOpen": true, + "mapBuffer": { + "maxLat": 66.51326, + "maxLon": 180, + "minLat": -66.51326, + "minLon": -180 + }, + "mapCenter": { + "lat": 19.94277, + "lon": 0, + "zoom": 1.6 + }, + "openTOCDetails": [] + }, + "gridData": { + "h": 15, + "i": "9d948dba-ebb0-4b9e-aa1c-de56ada1d9fb", + "w": 24, + "x": 0, + "y": 23 + }, + "panelIndex": "9d948dba-ebb0-4b9e-aa1c-de56ada1d9fb", + "type": "map", + "version": "8.7.1" + }, + { + "embeddableConfig": { + "enhancements": {}, + "hidePanelTitles": false, + "savedVis": { + "data": { + "aggs": [], + "searchSource": { + "filter": [], + "query": { + "language": "kuery", + "query": "" + } + } + }, + "description": "", + "id": "", + "params": { + "axis_formatter": "number", + "axis_position": "left", + "axis_scale": "normal", + "drop_last_bucket": 0, + "id": "269c9bd6-6d39-43ee-a736-ca2d3bc8c86d", + "index_pattern_ref_name": "metrics_aa45e28a-56ef-49a9-bf7b-57e7adbe74e9_0_index_pattern", + "interval": "", + "markdown": "# Hai {{ count.last.raw }}", + "max_lines_legend": 1, + "series": [ + { + "axis_position": "right", + "chart_type": "line", + "color": "#68BC00", + "fill": 0.5, + "formatter": "default", + "id": "a9130cea-528c-40ce-b67d-d5a1d650a9f3", + "line_width": 1, + "metrics": [ + { + "id": "1e09d941-507c-4621-8431-69582d7f1f52", + "type": "count" + } + ], + "override_index_pattern": 0, + "palette": { + "name": "default", + "type": "palette" + }, + "point_size": 1, + "separate_axis": 0, + "series_drop_last_bucket": 0, + "split_mode": "everything", + "stacked": "none", + "time_range_mode": "entire_time_range" + } + ], + "show_grid": 1, + "show_legend": 1, + "time_field": "", + "time_range_mode": "entire_time_range", + "tooltip_mode": "show_all", + "truncate_legend": 1, + "type": "markdown", + "use_kibana_indexes": true + }, + "title": "", + "type": "metrics", + "uiState": {} + } + }, + "gridData": { + "h": 15, + "i": "aa45e28a-56ef-49a9-bf7b-57e7adbe74e9", + "w": 24, + "x": 0, + "y": 59 + }, + "panelIndex": "aa45e28a-56ef-49a9-bf7b-57e7adbe74e9", + "title": "TSVB Markdown", + "type": "visualization", + "version": "8.7.1" + }, + { + "embeddableConfig": { + "enhancements": {}, + "savedVis": { + "data": { + "aggs": [], + "searchSource": { + "filter": [], + "query": { + "language": "kuery", + "query": "" + } + } + }, + "description": "", + "params": { + "fontSize": 12, + "markdown": "# The Bad", + "openLinksInNewTab": false + }, + "title": "", + "type": "markdown", + "uiState": {} + } + }, + "gridData": { + "h": 3, + "i": "1aa4828f-cac5-406c-8dcc-cc91c4b23564", + "w": 48, + "x": 0, + "y": 38 + }, + "panelIndex": "1aa4828f-cac5-406c-8dcc-cc91c4b23564", + "title": "", + "type": "visualization", + "version": "8.7.1" + }, + { + "embeddableConfig": { + "enhancements": {}, + "savedVis": { + "data": { + "aggs": [], + "searchSource": { + "filter": [], + "query": { + "language": "kuery", + "query": "" + } + } + }, + "description": "", + "params": { + "fontSize": 12, + "markdown": "## TSVB", + "openLinksInNewTab": false + }, + "title": "", + "type": "markdown", + "uiState": {} + } + }, + "gridData": { + "h": 3, + "i": "20be122a-5169-4551-b519-f346ca91ce93", + "w": 48, + "x": 0, + "y": 41 + }, + "panelIndex": "20be122a-5169-4551-b519-f346ca91ce93", + "title": "", + "type": "visualization", + "version": "8.7.1" + }, + { + "embeddableConfig": { + "enhancements": {}, + "hidePanelTitles": false, + "savedVis": { + "data": { + "aggs": [], + "searchSource": {} + }, + "description": "", + "id": "", + "params": { + "axis_formatter": "number", + "axis_position": "left", + "axis_scale": "normal", + "drop_last_bucket": 0, + "id": "2151dff1-0ac0-4364-bd3b-1b2dc6ad4a9d", + "index_pattern_ref_name": "metrics_fc613301-637a-4fb8-a9c1-408041b534eb_0_index_pattern", + "interval": "", + "max_lines_legend": 1, + "series": [ + { + "axis_position": "right", + "chart_type": "line", + "color": "#68BC00", + "fill": 0.5, + "formatter": "default", + "id": "9d2312fc-5cd1-4704-bed6-c90a189fdc3c", + "line_width": 1, + "metrics": [ + { + "id": "ff45b058-0b35-43e9-b5cc-86cf6bb59a2f", + "type": "count" + } + ], + "override_index_pattern": 0, + "palette": { + "name": "default", + "type": "palette" + }, + "point_size": 1, + "separate_axis": 0, + "series_drop_last_bucket": 0, + "split_mode": "everything", + "stacked": "none" + } + ], + "show_grid": 1, + "show_legend": 1, + "time_field": "", + "tooltip_mode": "show_all", + "truncate_legend": 1, + "type": "timeseries", + "use_kibana_indexes": true + }, + "title": "", + "type": "metrics", + "uiState": {} + } + }, + "gridData": { + "h": 15, + "i": "fc613301-637a-4fb8-a9c1-408041b534eb", + "w": 24, + "x": 0, + "y": 44 + }, + "panelIndex": "fc613301-637a-4fb8-a9c1-408041b534eb", + "title": "TSVB time series", + "type": "visualization", + "version": "8.7.1" + }, + { + "embeddableConfig": { + "enhancements": {}, + "hidePanelTitles": false, + "savedVis": { + "data": { + "aggs": [], + "searchSource": { + "filter": [], + "query": { + "language": "kuery", + "query": "" + } + } + }, + "description": "", + "id": "", + "params": { + "axis_formatter": "number", + "axis_position": "left", + "axis_scale": "normal", + "drop_last_bucket": 0, + "gauge_color_rules": [ + { + "id": "9ad81810-596b-11ee-9f91-cf341ef7bf75" + } + ], + "gauge_inner_width": 10, + "gauge_style": "half", + "gauge_width": 10, + "id": "6be570b5-d3f4-41d3-8b67-b01c235bd94d", + "index_pattern_ref_name": "metrics_57c0c87b-3c99-4d2a-8eab-c0f6be5100df_0_index_pattern", + "interval": "", + "isModelInvalid": false, + "max_lines_legend": 1, + "series": [ + { + "axis_position": "right", + "chart_type": "line", + "color": "#68BC00", + "fill": 0.5, + "formatter": "default", + "id": "ba95c76c-afd7-4cd5-9632-459a6678bc13", + "line_width": 1, + "metrics": [ + { + "id": "4ec74301-3205-4f85-9c8d-a11f44638603", + "type": "count" + } + ], + "override_index_pattern": 0, + "palette": { + "name": "default", + "type": "palette" + }, + "point_size": 1, + "separate_axis": 0, + "series_drop_last_bucket": 0, + "split_mode": "everything", + "stacked": "none", + "time_range_mode": "entire_time_range" + } + ], + "show_grid": 1, + "show_legend": 1, + "time_field": "", + "time_range_mode": "last_value", + "tooltip_mode": "show_all", + "truncate_legend": 1, + "type": "gauge", + "use_kibana_indexes": true + }, + "title": "", + "type": "metrics", + "uiState": {} + } + }, + "gridData": { + "h": 15, + "i": "57c0c87b-3c99-4d2a-8eab-c0f6be5100df", + "w": 24, + "x": 24, + "y": 44 + }, + "panelIndex": "57c0c87b-3c99-4d2a-8eab-c0f6be5100df", + "title": "TSVB gauge", + "type": "visualization", + "version": "8.7.1" + }, + { + "embeddableConfig": { + "enhancements": {}, + "savedVis": { + "data": { + "aggs": [], + "searchSource": { + "filter": [], + "query": { + "language": "kuery", + "query": "" + } + } + }, + "description": "", + "params": { + "fontSize": 12, + "markdown": "## Aggs-based", + "openLinksInNewTab": false + }, + "title": "", + "type": "markdown", + "uiState": {} + } + }, + "gridData": { + "h": 3, + "i": "24272e20-9101-47b0-914f-13bd0a75c34f", + "w": 48, + "x": 0, + "y": 74 + }, + "panelIndex": "24272e20-9101-47b0-914f-13bd0a75c34f", + "title": "", + "type": "visualization", + "version": "8.7.1" + }, + { + "embeddableConfig": { + "enhancements": {}, + "hidePanelTitles": false, + "savedVis": { + "data": { + "aggs": [ + { + "enabled": true, + "id": "1", + "params": { + "emptyAsNull": false + }, + "schema": "metric", + "type": "count" + } + ], + "searchSource": { + "indexRefName": "kibanaSavedObjectMeta.searchSourceJSON.index" + } + }, + "description": "", + "id": "", + "params": { + "autoFitRowToContent": false, + "perPage": 10, + "percentageCol": "", + "showMetricsAtAllLevels": false, + "showPartialRows": false, + "showToolbar": false, + "showTotal": false, + "totalFunc": "sum" + }, + "title": "", + "type": "table", + "uiState": {} + } + }, + "gridData": { + "h": 15, + "i": "c8a5f48d-411a-49cf-bfc2-2647eb4354e3", + "w": 24, + "x": 0, + "y": 77 + }, + "panelIndex": "c8a5f48d-411a-49cf-bfc2-2647eb4354e3", + "title": "Aggs-based table", + "type": "visualization", + "version": "8.7.1" + }, + { + "embeddableConfig": { + "enhancements": {}, + "hidePanelTitles": false, + "savedVis": { + "data": { + "aggs": [ + { + "enabled": true, + "id": "1", + "params": { + "emptyAsNull": false + }, + "schema": "metric", + "type": "count" + }, + { + "enabled": true, + "id": "2", + "params": { + "excludeIsRegex": true, + "field": "host.ip", + "includeIsRegex": true, + "missingBucket": false, + "missingBucketLabel": "Missing", + "order": "desc", + "orderBy": "1", + "otherBucket": false, + "otherBucketLabel": "Other", + "size": 5 + }, + "schema": "segment", + "type": "terms" + } + ], + "searchSource": { + "filter": [], + "indexRefName": "kibanaSavedObjectMeta.searchSourceJSON.index", + "query": { + "language": "kuery", + "query": "" + } + } + }, + "description": "", + "id": "", + "params": { + "maxFontSize": 72, + "minFontSize": 18, + "orientation": "single", + "palette": { + "name": "default", + "type": "palette" + }, + "scale": "linear", + "showLabel": true + }, + "title": "", + "type": "tagcloud", + "uiState": {} + } + }, + "gridData": { + "h": 15, + "i": "faf4e2b9-c4b7-4f7f-9688-124fc99d9c0c", + "w": 24, + "x": 24, + "y": 77 + }, + "panelIndex": "faf4e2b9-c4b7-4f7f-9688-124fc99d9c0c", + "title": "Aggs-based tag cloud", + "type": "visualization", + "version": "8.7.1" + }, + { + "embeddableConfig": { + "enhancements": {}, + "savedVis": { + "data": { + "aggs": [ + { + "enabled": true, + "id": "1", + "params": { + "emptyAsNull": false + }, + "schema": "metric", + "type": "count" + } + ], + "searchSource": { + "indexRefName": "kibanaSavedObjectMeta.searchSourceJSON.index" + } + }, + "description": "", + "id": "", + "params": { + "addLegend": true, + "addTooltip": true, + "colorSchema": "Green to Red", + "colorsNumber": 4, + "colorsRange": [], + "enableHover": false, + "invertColors": false, + "legendPosition": "right", + "percentageMode": false, + "setColorRange": false, + "type": "heatmap", + "valueAxes": [ + { + "id": "ValueAxis-1", + "labels": { + "color": "black", + "overwriteColor": false, + "rotate": 0, + "show": false + }, + "scale": { + "defaultYExtents": false, + "type": "linear" + }, + "show": false, + "type": "value" + } + ] + }, + "title": "", + "type": "heatmap", + "uiState": { + "vis": { + "defaultColors": { + "0 - 600": "rgb(0,104,55)", + "1,200 - 1,800": "rgb(254,254,189)", + "1,800 - 2,400": "rgb(248,141,82)", + "600 - 1,200": "rgb(134,203,102)" + } + } + } + }, + "vis": null + }, + "gridData": { + "h": 15, + "i": "f630e819-7606-456a-a722-325e4c88716c", + "w": 24, + "x": 0, + "y": 92 + }, + "panelIndex": "f630e819-7606-456a-a722-325e4c88716c", + "type": "visualization", + "version": "8.7.1" + }, + { + "embeddableConfig": { + "enhancements": {}, + "hidePanelTitles": false, + "savedVis": { + "data": { + "aggs": [], + "searchSource": {} + }, + "description": "", + "id": "", + "params": { + "expression": ".es(*)", + "interval": "auto" + }, + "title": "", + "type": "timelion", + "uiState": {} + } + }, + "gridData": { + "h": 15, + "i": "56cffae7-57b2-4c9b-b186-15741c6b20b6", + "w": 24, + "x": 24, + "y": 92 + }, + "panelIndex": "56cffae7-57b2-4c9b-b186-15741c6b20b6", + "title": "Timelion time series", + "type": "visualization", + "version": "8.7.1" + }, + { + "embeddableConfig": { + "enhancements": {} + }, + "gridData": { + "h": 15, + "i": "6cc10baa-1976-4288-ba3a-9b8b8d5a5373", + "w": 24, + "x": 24, + "y": 23 + }, + "panelIndex": "6cc10baa-1976-4288-ba3a-9b8b8d5a5373", + "panelRefName": "panel_6cc10baa-1976-4288-ba3a-9b8b8d5a5373", + "type": "search", + "version": "8.7.1" + } + ], + "timeRestore": false, + "title": "Dashboard with mixed by-value visualizations", + "version": 1 + }, + "coreMigrationVersion": "8.7.1", + "created_at": "2023-09-22T20:06:49.801Z", + "id": "kibana_legacy_visualizations-c36e9b90-596c-11ee-adef-4fe896364076", + "migrationVersion": { + "dashboard": "8.7.0" + }, + "references": [ + { + "id": "logs-*", + "name": "kibanaSavedObjectMeta.searchSourceJSON.filter[0].meta.index", + "type": "index-pattern" + }, + { + "id": "logs-*", + "name": "9d6acabf-1b0a-4b36-99c4-eb3a2f1f4673:control_9d6acabf-1b0a-4b36-99c4-eb3a2f1f4673_0_index_pattern", + "type": "index-pattern" + }, + { + "id": "logs-*", + "name": "46426c7d-7683-400c-b625-49d0114f41a0:indexpattern-datasource-layer-85c9c01e-13df-42a2-b33d-8441fb83afaf", + "type": "index-pattern" + }, + { + "id": "logs-*", + "name": "aa45e28a-56ef-49a9-bf7b-57e7adbe74e9:metrics_aa45e28a-56ef-49a9-bf7b-57e7adbe74e9_0_index_pattern", + "type": "index-pattern" + }, + { + "id": "logs-*", + "name": "fc613301-637a-4fb8-a9c1-408041b534eb:metrics_fc613301-637a-4fb8-a9c1-408041b534eb_0_index_pattern", + "type": "index-pattern" + }, + { + "id": "logs-*", + "name": "57c0c87b-3c99-4d2a-8eab-c0f6be5100df:metrics_57c0c87b-3c99-4d2a-8eab-c0f6be5100df_0_index_pattern", + "type": "index-pattern" + }, + { + "id": "logs-*", + "name": "c8a5f48d-411a-49cf-bfc2-2647eb4354e3:kibanaSavedObjectMeta.searchSourceJSON.index", + "type": "index-pattern" + }, + { + "id": "logs-*", + "name": "faf4e2b9-c4b7-4f7f-9688-124fc99d9c0c:kibanaSavedObjectMeta.searchSourceJSON.index", + "type": "index-pattern" + }, + { + "id": "logs-*", + "name": "f630e819-7606-456a-a722-325e4c88716c:kibanaSavedObjectMeta.searchSourceJSON.index", + "type": "index-pattern" + }, + { + "id": "kibana_legacy_visualizations-8f2e0810-596d-11ee-adef-4fe896364076", + "name": "6cc10baa-1976-4288-ba3a-9b8b8d5a5373:panel_6cc10baa-1976-4288-ba3a-9b8b8d5a5373", + "type": "search" + }, + { + "id": "logs-*", + "name": "controlGroup_332c44e9-b2a2-4d26-96c4-49562da1ba93:optionsListDataView", + "type": "index-pattern" + } + ], + "type": "dashboard" +} \ No newline at end of file diff --git a/test/packages/kibana_legacy_visualizations/kibana/dashboard/kibana_legacy_visualizations-d729eb20-596d-11ee-adef-4fe896364076.json b/test/packages/kibana_legacy_visualizations/kibana/dashboard/kibana_legacy_visualizations-d729eb20-596d-11ee-adef-4fe896364076.json new file mode 100644 index 000000000..4b016a4f5 --- /dev/null +++ b/test/packages/kibana_legacy_visualizations/kibana/dashboard/kibana_legacy_visualizations-d729eb20-596d-11ee-adef-4fe896364076.json @@ -0,0 +1,457 @@ +{ + "attributes": { + "controlGroupInput": { + "chainingSystem": "HIERARCHICAL", + "controlStyle": "oneLine", + "ignoreParentSettingsJSON": "{\"ignoreFilters\":false,\"ignoreQuery\":false,\"ignoreTimerange\":false,\"ignoreValidations\":false}", + "panelsJSON": "{\"332c44e9-b2a2-4d26-96c4-49562da1ba93\":{\"type\":\"optionsListControl\",\"order\":0,\"grow\":true,\"width\":\"medium\",\"explicitInput\":{\"id\":\"332c44e9-b2a2-4d26-96c4-49562da1ba93\",\"fieldName\":\"agent.id\",\"title\":\"agent.id\",\"enhancements\":{}}}}" + }, + "description": "", + "kibanaSavedObjectMeta": { + "searchSourceJSON": { + "filter": [ + { + "$state": { + "store": "appState" + }, + "meta": { + "alias": null, + "disabled": false, + "field": "agent.type", + "indexRefName": "kibanaSavedObjectMeta.searchSourceJSON.filter[0].meta.index", + "key": "agent.type", + "negate": false, + "params": { + "query": "filebeat" + }, + "type": "phrase" + }, + "query": { + "match_phrase": { + "agent.type": "filebeat" + } + } + } + ], + "query": { + "language": "kuery", + "query": "" + } + } + }, + "optionsJSON": { + "hidePanelTitles": false, + "syncColors": false, + "syncCursor": true, + "syncTooltips": false, + "useMargins": true + }, + "panelsJSON": [ + { + "embeddableConfig": { + "enhancements": {}, + "savedVis": { + "data": { + "aggs": [], + "searchSource": { + "filter": [], + "query": { + "language": "kuery", + "query": "" + } + } + }, + "description": "", + "params": { + "fontSize": 12, + "markdown": "## TSVB", + "openLinksInNewTab": false + }, + "title": "", + "type": "markdown", + "uiState": {} + } + }, + "gridData": { + "h": 3, + "i": "20be122a-5169-4551-b519-f346ca91ce93", + "w": 48, + "x": 0, + "y": 41 + }, + "panelIndex": "20be122a-5169-4551-b519-f346ca91ce93", + "title": "", + "type": "visualization", + "version": "8.7.1" + }, + { + "embeddableConfig": { + "enhancements": {}, + "savedVis": { + "data": { + "aggs": [], + "searchSource": { + "filter": [], + "query": { + "language": "kuery", + "query": "" + } + } + }, + "description": "", + "params": { + "fontSize": 12, + "markdown": "## Aggs-based", + "openLinksInNewTab": false + }, + "title": "", + "type": "markdown", + "uiState": {} + } + }, + "gridData": { + "h": 3, + "i": "24272e20-9101-47b0-914f-13bd0a75c34f", + "w": 48, + "x": 0, + "y": 74 + }, + "panelIndex": "24272e20-9101-47b0-914f-13bd0a75c34f", + "title": "", + "type": "visualization", + "version": "8.7.1" + }, + { + "embeddableConfig": { + "enhancements": {} + }, + "gridData": { + "h": 15, + "i": "6cc10baa-1976-4288-ba3a-9b8b8d5a5373", + "w": 24, + "x": 24, + "y": 23 + }, + "panelIndex": "6cc10baa-1976-4288-ba3a-9b8b8d5a5373", + "panelRefName": "panel_6cc10baa-1976-4288-ba3a-9b8b8d5a5373", + "type": "search", + "version": "8.7.1" + }, + { + "embeddableConfig": { + "enhancements": {} + }, + "gridData": { + "h": 5, + "i": "9af89785-ce3b-4589-9bbc-5c3391559e1c", + "w": 12, + "x": 0, + "y": 0 + }, + "panelIndex": "9af89785-ce3b-4589-9bbc-5c3391559e1c", + "panelRefName": "panel_9af89785-ce3b-4589-9bbc-5c3391559e1c", + "type": "visualization", + "version": "8.7.1" + }, + { + "embeddableConfig": { + "enhancements": {} + }, + "gridData": { + "h": 3, + "i": "c6c8041f-b274-4df6-9856-6ebebc2854ec", + "w": 48, + "x": 0, + "y": 5 + }, + "panelIndex": "c6c8041f-b274-4df6-9856-6ebebc2854ec", + "panelRefName": "panel_c6c8041f-b274-4df6-9856-6ebebc2854ec", + "type": "visualization", + "version": "8.7.1" + }, + { + "embeddableConfig": { + "enhancements": {}, + "hidePanelTitles": false + }, + "gridData": { + "h": 15, + "i": "a600fde1-d278-4de2-b978-67a178cf227b", + "w": 24, + "x": 0, + "y": 8 + }, + "panelIndex": "a600fde1-d278-4de2-b978-67a178cf227b", + "panelRefName": "panel_a600fde1-d278-4de2-b978-67a178cf227b", + "type": "lens", + "version": "8.7.1" + }, + { + "embeddableConfig": { + "enhancements": {} + }, + "gridData": { + "h": 15, + "i": "efb4f9f9-4315-4fb0-a78b-b9c55c6082bc", + "w": 24, + "x": 24, + "y": 8 + }, + "panelIndex": "efb4f9f9-4315-4fb0-a78b-b9c55c6082bc", + "panelRefName": "panel_efb4f9f9-4315-4fb0-a78b-b9c55c6082bc", + "type": "visualization", + "version": "8.7.1" + }, + { + "embeddableConfig": { + "enhancements": {}, + "hiddenLayers": [], + "isLayerTOCOpen": true, + "mapBuffer": { + "maxLat": 66.51326, + "maxLon": 180, + "minLat": -66.51326, + "minLon": -180 + }, + "mapCenter": { + "lat": 19.94277, + "lon": 0, + "zoom": 1.6 + }, + "openTOCDetails": [] + }, + "gridData": { + "h": 15, + "i": "36f3a6ca-170e-4171-aef6-d627915d6ddb", + "w": 24, + "x": 0, + "y": 23 + }, + "panelIndex": "36f3a6ca-170e-4171-aef6-d627915d6ddb", + "panelRefName": "panel_36f3a6ca-170e-4171-aef6-d627915d6ddb", + "type": "map", + "version": "8.7.1" + }, + { + "embeddableConfig": { + "enhancements": {} + }, + "gridData": { + "h": 3, + "i": "99db9795-7bde-45df-a634-4eda6c0ad078", + "w": 48, + "x": 0, + "y": 38 + }, + "panelIndex": "99db9795-7bde-45df-a634-4eda6c0ad078", + "panelRefName": "panel_99db9795-7bde-45df-a634-4eda6c0ad078", + "type": "visualization", + "version": "8.7.1" + }, + { + "embeddableConfig": { + "enhancements": {} + }, + "gridData": { + "h": 15, + "i": "da91b8b8-568d-4575-aa5b-22f1eb757002", + "w": 24, + "x": 0, + "y": 44 + }, + "panelIndex": "da91b8b8-568d-4575-aa5b-22f1eb757002", + "panelRefName": "panel_da91b8b8-568d-4575-aa5b-22f1eb757002", + "type": "visualization", + "version": "8.7.1" + }, + { + "embeddableConfig": { + "enhancements": {} + }, + "gridData": { + "h": 15, + "i": "77a3da6f-6524-4d35-a980-fe61be99c080", + "w": 24, + "x": 24, + "y": 44 + }, + "panelIndex": "77a3da6f-6524-4d35-a980-fe61be99c080", + "panelRefName": "panel_77a3da6f-6524-4d35-a980-fe61be99c080", + "type": "visualization", + "version": "8.7.1" + }, + { + "embeddableConfig": { + "enhancements": {} + }, + "gridData": { + "h": 15, + "i": "4774aa9e-76dd-4b04-9f18-986689a8c052", + "w": 24, + "x": 0, + "y": 59 + }, + "panelIndex": "4774aa9e-76dd-4b04-9f18-986689a8c052", + "panelRefName": "panel_4774aa9e-76dd-4b04-9f18-986689a8c052", + "type": "visualization", + "version": "8.7.1" + }, + { + "embeddableConfig": { + "enhancements": {} + }, + "gridData": { + "h": 15, + "i": "1bee7866-45cf-4f8a-a246-2d89668efee7", + "w": 24, + "x": 0, + "y": 77 + }, + "panelIndex": "1bee7866-45cf-4f8a-a246-2d89668efee7", + "panelRefName": "panel_1bee7866-45cf-4f8a-a246-2d89668efee7", + "type": "visualization", + "version": "8.7.1" + }, + { + "embeddableConfig": { + "enhancements": {} + }, + "gridData": { + "h": 15, + "i": "0dd8056c-b004-4e8b-a184-6ae980171d89", + "w": 24, + "x": 24, + "y": 77 + }, + "panelIndex": "0dd8056c-b004-4e8b-a184-6ae980171d89", + "panelRefName": "panel_0dd8056c-b004-4e8b-a184-6ae980171d89", + "type": "visualization", + "version": "8.7.1" + }, + { + "embeddableConfig": { + "enhancements": {} + }, + "gridData": { + "h": 15, + "i": "febe9d0e-a6e5-46ab-bd3b-0e5fdffb6c4f", + "w": 24, + "x": 0, + "y": 92 + }, + "panelIndex": "febe9d0e-a6e5-46ab-bd3b-0e5fdffb6c4f", + "panelRefName": "panel_febe9d0e-a6e5-46ab-bd3b-0e5fdffb6c4f", + "type": "visualization", + "version": "8.7.1" + }, + { + "embeddableConfig": { + "enhancements": {} + }, + "gridData": { + "h": 15, + "i": "0fda78af-c2d3-4e13-be3f-d45784cfd460", + "w": 24, + "x": 24, + "y": 92 + }, + "panelIndex": "0fda78af-c2d3-4e13-be3f-d45784cfd460", + "panelRefName": "panel_0fda78af-c2d3-4e13-be3f-d45784cfd460", + "type": "visualization", + "version": "8.7.1" + } + ], + "timeRestore": false, + "title": "Dashboard with mixed by-reference visualizations", + "version": 1 + }, + "coreMigrationVersion": "8.7.1", + "created_at": "2023-09-22T20:05:17.522Z", + "id": "kibana_legacy_visualizations-d729eb20-596d-11ee-adef-4fe896364076", + "migrationVersion": { + "dashboard": "8.7.0" + }, + "references": [ + { + "id": "logs-*", + "name": "kibanaSavedObjectMeta.searchSourceJSON.filter[0].meta.index", + "type": "index-pattern" + }, + { + "id": "kibana_legacy_visualizations-8f2e0810-596d-11ee-adef-4fe896364076", + "name": "6cc10baa-1976-4288-ba3a-9b8b8d5a5373:panel_6cc10baa-1976-4288-ba3a-9b8b8d5a5373", + "type": "search" + }, + { + "id": "kibana_legacy_visualizations-e6e022a0-596d-11ee-adef-4fe896364076", + "name": "9af89785-ce3b-4589-9bbc-5c3391559e1c:panel_9af89785-ce3b-4589-9bbc-5c3391559e1c", + "type": "visualization" + }, + { + "id": "kibana_legacy_visualizations-ee3370c0-596d-11ee-adef-4fe896364076", + "name": "c6c8041f-b274-4df6-9856-6ebebc2854ec:panel_c6c8041f-b274-4df6-9856-6ebebc2854ec", + "type": "visualization" + }, + { + "id": "kibana_legacy_visualizations-f4c4ce70-596d-11ee-adef-4fe896364076", + "name": "a600fde1-d278-4de2-b978-67a178cf227b:panel_a600fde1-d278-4de2-b978-67a178cf227b", + "type": "lens" + }, + { + "id": "kibana_legacy_visualizations-f9920df0-596d-11ee-adef-4fe896364076", + "name": "efb4f9f9-4315-4fb0-a78b-b9c55c6082bc:panel_efb4f9f9-4315-4fb0-a78b-b9c55c6082bc", + "type": "visualization" + }, + { + "id": "kibana_legacy_visualizations-04a682c0-596e-11ee-adef-4fe896364076", + "name": "36f3a6ca-170e-4171-aef6-d627915d6ddb:panel_36f3a6ca-170e-4171-aef6-d627915d6ddb", + "type": "map" + }, + { + "id": "kibana_legacy_visualizations-0c94ff70-596e-11ee-adef-4fe896364076", + "name": "99db9795-7bde-45df-a634-4eda6c0ad078:panel_99db9795-7bde-45df-a634-4eda6c0ad078", + "type": "visualization" + }, + { + "id": "kibana_legacy_visualizations-1740c760-596e-11ee-adef-4fe896364076", + "name": "da91b8b8-568d-4575-aa5b-22f1eb757002:panel_da91b8b8-568d-4575-aa5b-22f1eb757002", + "type": "visualization" + }, + { + "id": "kibana_legacy_visualizations-1ef680d0-596e-11ee-adef-4fe896364076", + "name": "77a3da6f-6524-4d35-a980-fe61be99c080:panel_77a3da6f-6524-4d35-a980-fe61be99c080", + "type": "visualization" + }, + { + "id": "kibana_legacy_visualizations-23f94f40-596e-11ee-adef-4fe896364076", + "name": "4774aa9e-76dd-4b04-9f18-986689a8c052:panel_4774aa9e-76dd-4b04-9f18-986689a8c052", + "type": "visualization" + }, + { + "id": "kibana_legacy_visualizations-29c51300-596e-11ee-adef-4fe896364076", + "name": "1bee7866-45cf-4f8a-a246-2d89668efee7:panel_1bee7866-45cf-4f8a-a246-2d89668efee7", + "type": "visualization" + }, + { + "id": "kibana_legacy_visualizations-2e364fd0-596e-11ee-adef-4fe896364076", + "name": "0dd8056c-b004-4e8b-a184-6ae980171d89:panel_0dd8056c-b004-4e8b-a184-6ae980171d89", + "type": "visualization" + }, + { + "id": "kibana_legacy_visualizations-331b3600-596e-11ee-adef-4fe896364076", + "name": "febe9d0e-a6e5-46ab-bd3b-0e5fdffb6c4f:panel_febe9d0e-a6e5-46ab-bd3b-0e5fdffb6c4f", + "type": "visualization" + }, + { + "id": "kibana_legacy_visualizations-38222320-596e-11ee-adef-4fe896364076", + "name": "0fda78af-c2d3-4e13-be3f-d45784cfd460:panel_0fda78af-c2d3-4e13-be3f-d45784cfd460", + "type": "visualization" + }, + { + "id": "logs-*", + "name": "controlGroup_332c44e9-b2a2-4d26-96c4-49562da1ba93:optionsListDataView", + "type": "index-pattern" + } + ], + "type": "dashboard" +} \ No newline at end of file diff --git a/test/packages/kibana_legacy_visualizations/kibana/lens/kibana_legacy_visualizations-f4c4ce70-596d-11ee-adef-4fe896364076.json b/test/packages/kibana_legacy_visualizations/kibana/lens/kibana_legacy_visualizations-f4c4ce70-596d-11ee-adef-4fe896364076.json new file mode 100644 index 000000000..a18b842da --- /dev/null +++ b/test/packages/kibana_legacy_visualizations/kibana/lens/kibana_legacy_visualizations-f4c4ce70-596d-11ee-adef-4fe896364076.json @@ -0,0 +1,126 @@ +{ + "attributes": { + "state": { + "adHocDataViews": {}, + "datasourceStates": { + "formBased": { + "layers": { + "85c9c01e-13df-42a2-b33d-8441fb83afaf": { + "columnOrder": [ + "e88818c5-d9ff-467e-b231-2e97d611a9a7", + "17c707aa-0ede-444e-81ed-9816983d6479" + ], + "columns": { + "17c707aa-0ede-444e-81ed-9816983d6479": { + "dataType": "number", + "isBucketed": false, + "label": "Count of records", + "operationType": "count", + "params": { + "emptyAsNull": true + }, + "scale": "ratio", + "sourceField": "___records___" + }, + "e88818c5-d9ff-467e-b231-2e97d611a9a7": { + "dataType": "string", + "isBucketed": true, + "label": "Top 5 values of agent.id", + "operationType": "terms", + "params": { + "exclude": [], + "excludeIsRegex": false, + "include": [], + "includeIsRegex": false, + "missingBucket": false, + "orderBy": { + "columnId": "17c707aa-0ede-444e-81ed-9816983d6479", + "type": "column" + }, + "orderDirection": "desc", + "otherBucket": true, + "parentFormat": { + "id": "terms" + }, + "size": 5 + }, + "scale": "ordinal", + "sourceField": "agent.id" + } + }, + "incompleteColumns": {}, + "sampling": 1 + } + } + }, + "textBased": { + "layers": {} + } + }, + "filters": [], + "internalReferences": [], + "query": { + "language": "kuery", + "query": "" + }, + "visualization": { + "axisTitlesVisibilitySettings": { + "x": true, + "yLeft": true, + "yRight": true + }, + "fittingFunction": "None", + "gridlinesVisibilitySettings": { + "x": true, + "yLeft": true, + "yRight": true + }, + "labelsOrientation": { + "x": 0, + "yLeft": 0, + "yRight": 0 + }, + "layers": [ + { + "accessors": [ + "17c707aa-0ede-444e-81ed-9816983d6479" + ], + "layerId": "85c9c01e-13df-42a2-b33d-8441fb83afaf", + "layerType": "data", + "position": "top", + "seriesType": "bar_stacked", + "showGridlines": false, + "xAccessor": "e88818c5-d9ff-467e-b231-2e97d611a9a7" + } + ], + "legend": { + "isVisible": true, + "position": "right" + }, + "preferredSeriesType": "bar_stacked", + "tickLabelsVisibilitySettings": { + "x": true, + "yLeft": true, + "yRight": true + }, + "valueLabels": "hide" + } + }, + "title": "Lens bar", + "visualizationType": "lnsXY" + }, + "coreMigrationVersion": "8.7.1", + "created_at": "2023-09-22T17:32:08.791Z", + "id": "kibana_legacy_visualizations-f4c4ce70-596d-11ee-adef-4fe896364076", + "migrationVersion": { + "lens": "8.6.0" + }, + "references": [ + { + "id": "logs-*", + "name": "indexpattern-datasource-layer-85c9c01e-13df-42a2-b33d-8441fb83afaf", + "type": "index-pattern" + } + ], + "type": "lens" +} \ No newline at end of file diff --git a/test/packages/kibana_legacy_visualizations/kibana/map/kibana_legacy_visualizations-04a682c0-596e-11ee-adef-4fe896364076.json b/test/packages/kibana_legacy_visualizations/kibana/map/kibana_legacy_visualizations-04a682c0-596e-11ee-adef-4fe896364076.json new file mode 100644 index 000000000..3ecc0a27b --- /dev/null +++ b/test/packages/kibana_legacy_visualizations/kibana/map/kibana_legacy_visualizations-04a682c0-596e-11ee-adef-4fe896364076.json @@ -0,0 +1,89 @@ +{ + "attributes": { + "description": "", + "layerListJSON": [ + { + "alpha": 1, + "id": "909a0001-15f6-40b7-8be5-fadddcc358c1", + "includeInFitToBounds": true, + "label": null, + "locale": "autoselect", + "maxZoom": 24, + "minZoom": 0, + "sourceDescriptor": { + "isAutoSelect": true, + "lightModeDefault": "road_map_desaturated", + "type": "EMS_TMS" + }, + "style": { + "color": "", + "type": "EMS_VECTOR_TILE" + }, + "type": "EMS_VECTOR_TILE", + "visible": true + } + ], + "mapStateJSON": { + "adHocDataViews": [], + "center": { + "lat": 19.94277, + "lon": 0 + }, + "filters": [], + "query": { + "language": "kuery", + "query": "" + }, + "refreshConfig": { + "interval": 60000, + "isPaused": true + }, + "settings": { + "autoFitToDataBounds": false, + "backgroundColor": "#ffffff", + "browserLocation": { + "zoom": 2 + }, + "customIcons": [], + "disableInteractive": false, + "disableTooltipControl": false, + "fixedLocation": { + "lat": 0, + "lon": 0, + "zoom": 2 + }, + "hideLayerControl": false, + "hideToolbarOverlay": false, + "hideViewControl": false, + "initialLocation": "LAST_SAVED_LOCATION", + "keydownScrollZoom": false, + "maxZoom": 24, + "minZoom": 0, + "showScaleControl": false, + "showSpatialFilters": true, + "showTimesliderToggleButton": true, + "spatialFiltersAlpa": 0.3, + "spatialFiltersFillColor": "#DA8B45", + "spatialFiltersLineColor": "#DA8B45" + }, + "timeFilters": { + "from": "now-15m", + "to": "now" + }, + "zoom": 1.6 + }, + "title": "I'm a MAP", + "uiStateJSON": { + "isLayerTOCOpen": true, + "openTOCDetails": [] + } + }, + "coreMigrationVersion": "8.7.1", + "created_at": "2023-09-22T17:32:35.436Z", + "id": "kibana_legacy_visualizations-04a682c0-596e-11ee-adef-4fe896364076", + "migrationVersion": { + "map": "8.4.0" + }, + "references": [], + "type": "map" +} \ No newline at end of file diff --git a/test/packages/kibana_legacy_visualizations/kibana/search/kibana_legacy_visualizations-8f2e0810-596d-11ee-adef-4fe896364076.json b/test/packages/kibana_legacy_visualizations/kibana/search/kibana_legacy_visualizations-8f2e0810-596d-11ee-adef-4fe896364076.json new file mode 100644 index 000000000..619721e98 --- /dev/null +++ b/test/packages/kibana_legacy_visualizations/kibana/search/kibana_legacy_visualizations-8f2e0810-596d-11ee-adef-4fe896364076.json @@ -0,0 +1,45 @@ +{ + "attributes": { + "columns": [ + "agent.id", + "agent.name" + ], + "description": "", + "grid": {}, + "hideChart": false, + "isTextBasedQuery": false, + "kibanaSavedObjectMeta": { + "searchSourceJSON": { + "filter": [], + "indexRefName": "kibanaSavedObjectMeta.searchSourceJSON.index", + "query": { + "language": "kuery", + "query": "agent.name : \"docker-fleet-server\" " + } + } + }, + "sort": [ + [ + "@timestamp", + "desc" + ] + ], + "timeRestore": false, + "title": "My saved search", + "usesAdHocDataView": false + }, + "coreMigrationVersion": "8.7.1", + "created_at": "2023-09-22T17:29:18.353Z", + "id": "kibana_legacy_visualizations-8f2e0810-596d-11ee-adef-4fe896364076", + "migrationVersion": { + "search": "8.0.0" + }, + "references": [ + { + "id": "logs-*", + "name": "kibanaSavedObjectMeta.searchSourceJSON.index", + "type": "index-pattern" + } + ], + "type": "search" +} \ No newline at end of file diff --git a/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-0c94ff70-596e-11ee-adef-4fe896364076.json b/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-0c94ff70-596e-11ee-adef-4fe896364076.json new file mode 100644 index 000000000..d50a1d501 --- /dev/null +++ b/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-0c94ff70-596e-11ee-adef-4fe896364076.json @@ -0,0 +1,35 @@ +{ + "attributes": { + "description": "", + "kibanaSavedObjectMeta": { + "searchSourceJSON": { + "filter": [], + "query": { + "language": "kuery", + "query": "" + } + } + }, + "title": "Placeholder Title", + "uiStateJSON": {}, + "version": 1, + "visState": { + "aggs": [], + "params": { + "fontSize": 12, + "markdown": "# The Bad", + "openLinksInNewTab": false + }, + "title": "Placeholder Title", + "type": "markdown" + } + }, + "coreMigrationVersion": "8.7.1", + "created_at": "2023-09-22T17:32:48.743Z", + "id": "kibana_legacy_visualizations-0c94ff70-596e-11ee-adef-4fe896364076", + "migrationVersion": { + "visualization": "8.5.0" + }, + "references": [], + "type": "visualization" +} \ No newline at end of file diff --git a/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-1740c760-596e-11ee-adef-4fe896364076.json b/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-1740c760-596e-11ee-adef-4fe896364076.json new file mode 100644 index 000000000..73b1b17fe --- /dev/null +++ b/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-1740c760-596e-11ee-adef-4fe896364076.json @@ -0,0 +1,74 @@ +{ + "attributes": { + "description": "", + "kibanaSavedObjectMeta": { + "searchSourceJSON": {} + }, + "title": "TSVB time series", + "uiStateJSON": {}, + "version": 1, + "visState": { + "aggs": [], + "params": { + "axis_formatter": "number", + "axis_position": "left", + "axis_scale": "normal", + "drop_last_bucket": 0, + "id": "2151dff1-0ac0-4364-bd3b-1b2dc6ad4a9d", + "index_pattern_ref_name": "metrics_0_index_pattern", + "interval": "", + "max_lines_legend": 1, + "series": [ + { + "axis_position": "right", + "chart_type": "line", + "color": "#68BC00", + "fill": 0.5, + "formatter": "default", + "id": "9d2312fc-5cd1-4704-bed6-c90a189fdc3c", + "line_width": 1, + "metrics": [ + { + "id": "ff45b058-0b35-43e9-b5cc-86cf6bb59a2f", + "type": "count" + } + ], + "override_index_pattern": 0, + "palette": { + "name": "default", + "type": "palette" + }, + "point_size": 1, + "separate_axis": 0, + "series_drop_last_bucket": 0, + "split_mode": "everything", + "stacked": "none" + } + ], + "show_grid": 1, + "show_legend": 1, + "time_field": "", + "tooltip_mode": "show_all", + "truncate_legend": 1, + "type": "timeseries", + "use_kibana_indexes": true + }, + "title": "TSVB time series", + "type": "metrics" + } + }, + "coreMigrationVersion": "8.7.1", + "created_at": "2023-09-22T17:33:06.646Z", + "id": "kibana_legacy_visualizations-1740c760-596e-11ee-adef-4fe896364076", + "migrationVersion": { + "visualization": "8.5.0" + }, + "references": [ + { + "id": "logs-*", + "name": "metrics_0_index_pattern", + "type": "index-pattern" + } + ], + "type": "visualization" +} \ No newline at end of file diff --git a/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-1ef680d0-596e-11ee-adef-4fe896364076.json b/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-1ef680d0-596e-11ee-adef-4fe896364076.json new file mode 100644 index 000000000..17e16a6a4 --- /dev/null +++ b/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-1ef680d0-596e-11ee-adef-4fe896364076.json @@ -0,0 +1,91 @@ +{ + "attributes": { + "description": "", + "kibanaSavedObjectMeta": { + "searchSourceJSON": { + "filter": [], + "query": { + "language": "kuery", + "query": "" + } + } + }, + "title": "TSVB gauge", + "uiStateJSON": {}, + "version": 1, + "visState": { + "aggs": [], + "params": { + "axis_formatter": "number", + "axis_position": "left", + "axis_scale": "normal", + "drop_last_bucket": 0, + "gauge_color_rules": [ + { + "id": "9ad81810-596b-11ee-9f91-cf341ef7bf75" + } + ], + "gauge_inner_width": 10, + "gauge_style": "half", + "gauge_width": 10, + "id": "6be570b5-d3f4-41d3-8b67-b01c235bd94d", + "index_pattern_ref_name": "metrics_0_index_pattern", + "interval": "", + "isModelInvalid": false, + "max_lines_legend": 1, + "series": [ + { + "axis_position": "right", + "chart_type": "line", + "color": "#68BC00", + "fill": 0.5, + "formatter": "default", + "id": "ba95c76c-afd7-4cd5-9632-459a6678bc13", + "line_width": 1, + "metrics": [ + { + "id": "4ec74301-3205-4f85-9c8d-a11f44638603", + "type": "count" + } + ], + "override_index_pattern": 0, + "palette": { + "name": "default", + "type": "palette" + }, + "point_size": 1, + "separate_axis": 0, + "series_drop_last_bucket": 0, + "split_mode": "everything", + "stacked": "none", + "time_range_mode": "entire_time_range" + } + ], + "show_grid": 1, + "show_legend": 1, + "time_field": "", + "time_range_mode": "last_value", + "tooltip_mode": "show_all", + "truncate_legend": 1, + "type": "gauge", + "use_kibana_indexes": true + }, + "title": "TSVB gauge", + "type": "metrics" + } + }, + "coreMigrationVersion": "8.7.1", + "created_at": "2023-09-22T17:33:19.581Z", + "id": "kibana_legacy_visualizations-1ef680d0-596e-11ee-adef-4fe896364076", + "migrationVersion": { + "visualization": "8.5.0" + }, + "references": [ + { + "id": "logs-*", + "name": "metrics_0_index_pattern", + "type": "index-pattern" + } + ], + "type": "visualization" +} \ No newline at end of file diff --git a/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-23f94f40-596e-11ee-adef-4fe896364076.json b/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-23f94f40-596e-11ee-adef-4fe896364076.json new file mode 100644 index 000000000..7eac04fab --- /dev/null +++ b/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-23f94f40-596e-11ee-adef-4fe896364076.json @@ -0,0 +1,83 @@ +{ + "attributes": { + "description": "", + "kibanaSavedObjectMeta": { + "searchSourceJSON": { + "filter": [], + "query": { + "language": "kuery", + "query": "" + } + } + }, + "title": "TSVB Markdown", + "uiStateJSON": {}, + "version": 1, + "visState": { + "aggs": [], + "params": { + "axis_formatter": "number", + "axis_position": "left", + "axis_scale": "normal", + "drop_last_bucket": 0, + "id": "269c9bd6-6d39-43ee-a736-ca2d3bc8c86d", + "index_pattern_ref_name": "metrics_0_index_pattern", + "interval": "", + "markdown": "# Hai {{ count.last.raw }}", + "max_lines_legend": 1, + "series": [ + { + "axis_position": "right", + "chart_type": "line", + "color": "#68BC00", + "fill": 0.5, + "formatter": "default", + "id": "a9130cea-528c-40ce-b67d-d5a1d650a9f3", + "line_width": 1, + "metrics": [ + { + "id": "1e09d941-507c-4621-8431-69582d7f1f52", + "type": "count" + } + ], + "override_index_pattern": 0, + "palette": { + "name": "default", + "type": "palette" + }, + "point_size": 1, + "separate_axis": 0, + "series_drop_last_bucket": 0, + "split_mode": "everything", + "stacked": "none", + "time_range_mode": "entire_time_range" + } + ], + "show_grid": 1, + "show_legend": 1, + "time_field": "", + "time_range_mode": "entire_time_range", + "tooltip_mode": "show_all", + "truncate_legend": 1, + "type": "markdown", + "use_kibana_indexes": true + }, + "title": "TSVB Markdown", + "type": "metrics" + } + }, + "coreMigrationVersion": "8.7.1", + "created_at": "2023-09-22T17:33:27.988Z", + "id": "kibana_legacy_visualizations-23f94f40-596e-11ee-adef-4fe896364076", + "migrationVersion": { + "visualization": "8.5.0" + }, + "references": [ + { + "id": "logs-*", + "name": "metrics_0_index_pattern", + "type": "index-pattern" + } + ], + "type": "visualization" +} \ No newline at end of file diff --git a/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-29c51300-596e-11ee-adef-4fe896364076.json b/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-29c51300-596e-11ee-adef-4fe896364076.json new file mode 100644 index 000000000..f32a0376e --- /dev/null +++ b/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-29c51300-596e-11ee-adef-4fe896364076.json @@ -0,0 +1,52 @@ +{ + "attributes": { + "description": "", + "kibanaSavedObjectMeta": { + "searchSourceJSON": { + "indexRefName": "kibanaSavedObjectMeta.searchSourceJSON.index" + } + }, + "title": "Aggs-based table", + "uiStateJSON": {}, + "version": 1, + "visState": { + "aggs": [ + { + "enabled": true, + "id": "1", + "params": { + "emptyAsNull": false + }, + "schema": "metric", + "type": "count" + } + ], + "params": { + "autoFitRowToContent": false, + "perPage": 10, + "percentageCol": "", + "showMetricsAtAllLevels": false, + "showPartialRows": false, + "showToolbar": false, + "showTotal": false, + "totalFunc": "sum" + }, + "title": "Aggs-based table", + "type": "table" + } + }, + "coreMigrationVersion": "8.7.1", + "created_at": "2023-09-22T17:33:37.712Z", + "id": "kibana_legacy_visualizations-29c51300-596e-11ee-adef-4fe896364076", + "migrationVersion": { + "visualization": "8.5.0" + }, + "references": [ + { + "id": "logs-*", + "name": "kibanaSavedObjectMeta.searchSourceJSON.index", + "type": "index-pattern" + } + ], + "type": "visualization" +} \ No newline at end of file diff --git a/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-2e364fd0-596e-11ee-adef-4fe896364076.json b/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-2e364fd0-596e-11ee-adef-4fe896364076.json new file mode 100644 index 000000000..650dd7450 --- /dev/null +++ b/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-2e364fd0-596e-11ee-adef-4fe896364076.json @@ -0,0 +1,76 @@ +{ + "attributes": { + "description": "", + "kibanaSavedObjectMeta": { + "searchSourceJSON": { + "filter": [], + "indexRefName": "kibanaSavedObjectMeta.searchSourceJSON.index", + "query": { + "language": "kuery", + "query": "" + } + } + }, + "title": "Aggs-based tag cloud", + "uiStateJSON": {}, + "version": 1, + "visState": { + "aggs": [ + { + "enabled": true, + "id": "1", + "params": { + "emptyAsNull": false + }, + "schema": "metric", + "type": "count" + }, + { + "enabled": true, + "id": "2", + "params": { + "excludeIsRegex": true, + "field": "host.ip", + "includeIsRegex": true, + "missingBucket": false, + "missingBucketLabel": "Missing", + "order": "desc", + "orderBy": "1", + "otherBucket": false, + "otherBucketLabel": "Other", + "size": 5 + }, + "schema": "segment", + "type": "terms" + } + ], + "params": { + "maxFontSize": 72, + "minFontSize": 18, + "orientation": "single", + "palette": { + "name": "default", + "type": "palette" + }, + "scale": "linear", + "showLabel": true + }, + "title": "Aggs-based tag cloud", + "type": "tagcloud" + } + }, + "coreMigrationVersion": "8.7.1", + "created_at": "2023-09-22T17:33:45.165Z", + "id": "kibana_legacy_visualizations-2e364fd0-596e-11ee-adef-4fe896364076", + "migrationVersion": { + "visualization": "8.5.0" + }, + "references": [ + { + "id": "logs-*", + "name": "kibanaSavedObjectMeta.searchSourceJSON.index", + "type": "index-pattern" + } + ], + "type": "visualization" +} \ No newline at end of file diff --git a/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-331b3600-596e-11ee-adef-4fe896364076.json b/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-331b3600-596e-11ee-adef-4fe896364076.json new file mode 100644 index 000000000..a74d93e89 --- /dev/null +++ b/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-331b3600-596e-11ee-adef-4fe896364076.json @@ -0,0 +1,81 @@ +{ + "attributes": { + "description": "", + "kibanaSavedObjectMeta": { + "searchSourceJSON": { + "indexRefName": "kibanaSavedObjectMeta.searchSourceJSON.index" + } + }, + "title": "Placeholder Title", + "uiStateJSON": { + "vis": { + "defaultColors": { + "0 - 65": "rgb(0,104,55)", + "130 - 195": "rgb(254,254,189)", + "195 - 260": "rgb(248,141,82)", + "65 - 130": "rgb(134,203,102)" + } + } + }, + "version": 1, + "visState": { + "aggs": [ + { + "enabled": true, + "id": "1", + "params": { + "emptyAsNull": false + }, + "schema": "metric", + "type": "count" + } + ], + "params": { + "addLegend": true, + "addTooltip": true, + "colorSchema": "Green to Red", + "colorsNumber": 4, + "colorsRange": [], + "enableHover": false, + "invertColors": false, + "legendPosition": "right", + "percentageMode": false, + "setColorRange": false, + "type": "heatmap", + "valueAxes": [ + { + "id": "ValueAxis-1", + "labels": { + "color": "black", + "overwriteColor": false, + "rotate": 0, + "show": false + }, + "scale": { + "defaultYExtents": false, + "type": "linear" + }, + "show": false, + "type": "value" + } + ] + }, + "title": "Placeholder Title", + "type": "heatmap" + } + }, + "coreMigrationVersion": "8.7.1", + "created_at": "2023-09-22T17:33:53.376Z", + "id": "kibana_legacy_visualizations-331b3600-596e-11ee-adef-4fe896364076", + "migrationVersion": { + "visualization": "8.5.0" + }, + "references": [ + { + "id": "logs-*", + "name": "kibanaSavedObjectMeta.searchSourceJSON.index", + "type": "index-pattern" + } + ], + "type": "visualization" +} \ No newline at end of file diff --git a/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-38222320-596e-11ee-adef-4fe896364076.json b/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-38222320-596e-11ee-adef-4fe896364076.json new file mode 100644 index 000000000..f794b0e36 --- /dev/null +++ b/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-38222320-596e-11ee-adef-4fe896364076.json @@ -0,0 +1,28 @@ +{ + "attributes": { + "description": "", + "kibanaSavedObjectMeta": { + "searchSourceJSON": {} + }, + "title": "Timelion time series", + "uiStateJSON": {}, + "version": 1, + "visState": { + "aggs": [], + "params": { + "expression": ".es(*)", + "interval": "auto" + }, + "title": "Timelion time series", + "type": "timelion" + } + }, + "coreMigrationVersion": "8.7.1", + "created_at": "2023-09-22T17:34:01.811Z", + "id": "kibana_legacy_visualizations-38222320-596e-11ee-adef-4fe896364076", + "migrationVersion": { + "visualization": "8.5.0" + }, + "references": [], + "type": "visualization" +} \ No newline at end of file diff --git a/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-e6e022a0-596d-11ee-adef-4fe896364076.json b/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-e6e022a0-596d-11ee-adef-4fe896364076.json new file mode 100644 index 000000000..fcb3d02ea --- /dev/null +++ b/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-e6e022a0-596d-11ee-adef-4fe896364076.json @@ -0,0 +1,58 @@ +{ + "attributes": { + "description": "", + "kibanaSavedObjectMeta": { + "searchSourceJSON": { + "filter": [], + "query": { + "language": "kuery", + "query": "" + } + } + }, + "title": "Legacy input control vis", + "uiStateJSON": {}, + "version": 1, + "visState": { + "aggs": [], + "params": { + "controls": [ + { + "fieldName": "agent.id", + "id": "1695403260945", + "indexPatternRefName": "control_0_index_pattern", + "label": "I'm a control", + "options": { + "dynamicOptions": true, + "multiselect": true, + "order": "desc", + "size": 5, + "type": "terms" + }, + "parent": "", + "type": "list" + } + ], + "pinFilters": false, + "updateFiltersOnChange": true, + "useTimeFilter": false + }, + "title": "Legacy input control vis", + "type": "input_control_vis" + } + }, + "coreMigrationVersion": "8.7.1", + "created_at": "2023-09-22T17:31:45.482Z", + "id": "kibana_legacy_visualizations-e6e022a0-596d-11ee-adef-4fe896364076", + "migrationVersion": { + "visualization": "8.5.0" + }, + "references": [ + { + "id": "logs-*", + "name": "control_0_index_pattern", + "type": "index-pattern" + } + ], + "type": "visualization" +} \ No newline at end of file diff --git a/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-ee3370c0-596d-11ee-adef-4fe896364076.json b/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-ee3370c0-596d-11ee-adef-4fe896364076.json new file mode 100644 index 000000000..6ecd80f41 --- /dev/null +++ b/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-ee3370c0-596d-11ee-adef-4fe896364076.json @@ -0,0 +1,35 @@ +{ + "attributes": { + "description": "", + "kibanaSavedObjectMeta": { + "searchSourceJSON": { + "filter": [], + "query": { + "language": "kuery", + "query": "" + } + } + }, + "title": "Placeholder Title", + "uiStateJSON": {}, + "version": 1, + "visState": { + "aggs": [], + "params": { + "fontSize": 12, + "markdown": "# The Good", + "openLinksInNewTab": false + }, + "title": "Placeholder Title", + "type": "markdown" + } + }, + "coreMigrationVersion": "8.7.1", + "created_at": "2023-09-22T17:31:57.772Z", + "id": "kibana_legacy_visualizations-ee3370c0-596d-11ee-adef-4fe896364076", + "migrationVersion": { + "visualization": "8.5.0" + }, + "references": [], + "type": "visualization" +} \ No newline at end of file diff --git a/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-f9920df0-596d-11ee-adef-4fe896364076.json b/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-f9920df0-596d-11ee-adef-4fe896364076.json new file mode 100644 index 000000000..1031f5e91 --- /dev/null +++ b/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-f9920df0-596d-11ee-adef-4fe896364076.json @@ -0,0 +1,27 @@ +{ + "attributes": { + "description": "", + "kibanaSavedObjectMeta": { + "searchSourceJSON": {} + }, + "title": "Vega time series", + "uiStateJSON": {}, + "version": 1, + "visState": { + "aggs": [], + "params": { + "spec": "{\n/*\n\nWelcome to Vega visualizations. Here you can design your own dataviz from scratch using a declarative language called Vega, or its simpler form Vega-Lite. In Vega, you have the full control of what data is loaded, even from multiple sources, how that data is transformed, and what visual elements are used to show it. Use help icon to view Vega examples, tutorials, and other docs. Use the wrench icon to reformat this text, or to remove comments.\n\nThis example graph shows the document count in all indexes in the current time range. You might need to adjust the time filter in the upper right corner.\n*/\n\n $schema: https://vega.github.io/schema/vega-lite/v5.json\n title: Event counts from all indexes\n\n // Define the data source\n data: {\n url: {\n/*\nAn object instead of a string for the \"url\" param is treated as an Elasticsearch query. Anything inside this object is not part of the Vega language, but only understood by Kibana and Elasticsearch server. This query counts the number of documents per time interval, assuming you have a @timestamp field in your data.\n\nKibana has a special handling for the fields surrounded by \"%\". They are processed before the the query is sent to Elasticsearch. This way the query becomes context aware, and can use the time range and the dashboard filters.\n*/\n\n // Apply dashboard context filters when set\n %context%: true\n // Filter the time picker (upper right corner) with this field\n %timefield%: @timestamp\n\n/*\nSee .search() documentation for : https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-search\n*/\n\n // Which index to search\n index: _all\n // Aggregate data by the time field into time buckets, counting the number of documents in each bucket.\n body: {\n aggs: {\n time_buckets: {\n date_histogram: {\n // Use date histogram aggregation on @timestamp field\n field: @timestamp\n // The interval value will depend on the daterange picker (true), or use an integer to set an approximate bucket count\n interval: {%autointerval%: true}\n // Make sure we get an entire range, even if it has no data\n extended_bounds: {\n // Use the current time range's start and end\n min: {%timefilter%: \"min\"}\n max: {%timefilter%: \"max\"}\n }\n // Use this for linear (e.g. line, area) graphs. Without it, empty buckets will not show up\n min_doc_count: 0\n }\n }\n }\n // Speed up the response by only including aggregation results\n size: 0\n }\n }\n/*\nElasticsearch will return results in this format:\n\naggregations: {\n time_buckets: {\n buckets: [\n {\n key_as_string: 2015-11-30T22:00:00.000Z\n key: 1448920800000\n doc_count: 0\n },\n {\n key_as_string: 2015-11-30T23:00:00.000Z\n key: 1448924400000\n doc_count: 0\n }\n ...\n ]\n }\n}\n\nFor our graph, we only need the list of bucket values. Use the format.property to discard everything else.\n*/\n format: {property: \"aggregations.time_buckets.buckets\"}\n }\n\n // \"mark\" is the graphics element used to show our data. Other mark values are: area, bar, circle, line, point, rect, rule, square, text, and tick. See https://vega.github.io/vega-lite/docs/mark.html\n mark: line\n\n // \"encoding\" tells the \"mark\" what data to use and in what way. See https://vega.github.io/vega-lite/docs/encoding.html\n encoding: {\n x: {\n // The \"key\" value is the timestamp in milliseconds. Use it for X axis.\n field: key\n type: temporal\n axis: {title: false} // Customize X axis format\n }\n y: {\n // The \"doc_count\" is the count per bucket. Use it for Y axis.\n field: doc_count\n type: quantitative\n axis: {title: \"Document count\"}\n }\n }\n}\n" + }, + "title": "Vega time series", + "type": "vega" + } + }, + "coreMigrationVersion": "8.7.1", + "created_at": "2023-09-22T17:32:16.847Z", + "id": "kibana_legacy_visualizations-f9920df0-596d-11ee-adef-4fe896364076", + "migrationVersion": { + "visualization": "8.5.0" + }, + "references": [], + "type": "visualization" +} \ No newline at end of file diff --git a/test/packages/kibana_legacy_visualizations/manifest.yml b/test/packages/kibana_legacy_visualizations/manifest.yml new file mode 100644 index 000000000..5a4718fb0 --- /dev/null +++ b/test/packages/kibana_legacy_visualizations/manifest.yml @@ -0,0 +1,9 @@ +format_version: 3.0.0 +name: kibana_legacy_visualizations +title: Kibana Legacy Visualizations +description: This package contains a set of legacy and non-legacy Kibana assets +version: 0.1.2 +type: integration +owner: + github: elastic/foobar + type: elastic From db7319cd513c812e05d4342daa9aae62c7b708fd Mon Sep 17 00:00:00 2001 From: Drew Tate Date: Sat, 23 Sep 2023 12:12:49 -0600 Subject: [PATCH 02/23] report semantic vis version and dashboard title --- .../semantic/validate_kibana_no_legacy_visualizations.go | 9 ++++++--- go.mod | 3 ++- go.sum | 7 +++++++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go b/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go index f09b5bc7c..e8e8b721d 100644 --- a/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go +++ b/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go @@ -27,18 +27,21 @@ func ValidateKibanaNoLegacyVisualizations(fsys fspath.FS) ve.ValidationErrors { return errs } for _, file := range dashboardFiles { + dashboardJSON, _ := file.Values("$") + dashboardTitle, _ := kbncontent.GetDashboardTitle(dashboardJSON) panelsJSON, _ := file.Values("$.attributes.panelsJSON") visualizations, _ := kbncontent.DescribeByValueDashboardPanels(panelsJSON) var buf strings.Builder - fmt.Fprintf(&buf, "dashboard \"%s\" contains legacy visualizations:\n\n", fsys.Path(file.Path())) + fmt.Fprint(&buf, "your package contains legacy visualizations:\n\n") tableWriter := tabwriter.NewWriter(&buf, 0, 0, 1, ' ', tabwriter.Debug) - fmt.Fprintln(tableWriter, "\tVisualization Title\tVisualization type\t") + fmt.Fprintln(tableWriter, "\tVisualization title\tVisualization type\tDashboard title\t") + fmt.Fprintln(tableWriter, "\t\t\t\t") hasLegacy := false for _, vis := range visualizations { if vis.IsLegacy { hasLegacy = true - fmt.Fprintf(tableWriter, "\t\"%s\"\t%s\t\n", vis.Title, vis.Type) + fmt.Fprintf(tableWriter, "\t\"%s\"\t\"%s\"\t%s\t\n", vis.Title, vis.SemanticType, dashboardTitle) } } tableWriter.Flush() diff --git a/go.mod b/go.mod index 9d00a5334..dd1348818 100644 --- a/go.mod +++ b/go.mod @@ -9,6 +9,7 @@ require ( github.com/creasty/defaults v1.7.0 github.com/elastic/go-licenser v0.4.1 github.com/elastic/gojsonschema v1.2.1 + github.com/elastic/kbncontent v0.0.0 github.com/evanphx/json-patch/v5 v5.7.0 github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901 github.com/mitchellh/mapstructure v1.5.0 @@ -18,7 +19,6 @@ require ( golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 gopkg.in/yaml.v3 v3.0.1 gotest.tools/gotestsum v1.11.0 - github.com/elastic/kbncontent v0.0.0 ) require ( @@ -34,6 +34,7 @@ require ( github.com/mattn/go-isatty v0.0.19 // indirect github.com/pkg/errors v0.8.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/stretchr/objx v0.5.1 // indirect github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect golang.org/x/mod v0.12.0 // indirect golang.org/x/sync v0.3.0 // indirect diff --git a/go.sum b/go.sum index 49f544086..29eb1d48e 100644 --- a/go.sum +++ b/go.sum @@ -58,8 +58,15 @@ github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDN github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.1 h1:4VhoImhV/Bm0ToFkXFi8hXNXwpDRZ/ynw3amt82mzq0= +github.com/stretchr/objx v0.5.1/go.mod h1:/iHQpkQwBD6DLUmQ4pE+s1TXdob1mORJ4/UFdrifcy0= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c= From 26bb84cae4f0f97ab6abb578e7c4ac57cfbc580d Mon Sep 17 00:00:00 2001 From: Drew Tate Date: Mon, 25 Sep 2023 06:31:37 -0600 Subject: [PATCH 03/23] Add visualization editor --- .../semantic/validate_kibana_no_legacy_visualizations.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go b/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go index e8e8b721d..3b1a1a1af 100644 --- a/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go +++ b/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go @@ -35,13 +35,13 @@ func ValidateKibanaNoLegacyVisualizations(fsys fspath.FS) ve.ValidationErrors { var buf strings.Builder fmt.Fprint(&buf, "your package contains legacy visualizations:\n\n") tableWriter := tabwriter.NewWriter(&buf, 0, 0, 1, ' ', tabwriter.Debug) - fmt.Fprintln(tableWriter, "\tVisualization title\tVisualization type\tDashboard title\t") - fmt.Fprintln(tableWriter, "\t\t\t\t") + fmt.Fprintln(tableWriter, "\tDashboard title\tVisualization title\tVisualization editor\tVisualization type\t") + fmt.Fprintln(tableWriter, "\t\t\t\t\t") hasLegacy := false for _, vis := range visualizations { if vis.IsLegacy { hasLegacy = true - fmt.Fprintf(tableWriter, "\t\"%s\"\t\"%s\"\t%s\t\n", vis.Title, vis.SemanticType, dashboardTitle) + fmt.Fprintf(tableWriter, "\t\"%s\"\t\"%s\"\t%s\t%s\t\n", dashboardTitle, vis.Title, vis.Editor, vis.SemanticType) } } tableWriter.Flush() From 06854fef97e8783e7345edb8a3e2c918cd28fee3 Mon Sep 17 00:00:00 2001 From: Drew Tate Date: Mon, 25 Sep 2023 08:28:14 -0600 Subject: [PATCH 04/23] support by-reference visualizations --- ...alidate_kibana_no_legacy_visualizations.go | 60 ++++++++++++++----- 1 file changed, 45 insertions(+), 15 deletions(-) diff --git a/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go b/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go index 3b1a1a1af..dcbeb392d 100644 --- a/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go +++ b/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go @@ -20,33 +20,63 @@ import ( func ValidateKibanaNoLegacyVisualizations(fsys fspath.FS) ve.ValidationErrors { var errs ve.ValidationErrors - filePaths := path.Join("kibana", "dashboard", "*.json") - dashboardFiles, err := pkgpath.Files(fsys, filePaths) + // Collect by-reference visualizations for reference later. + // Note: this does not include Lens, Maps, or Discover. That's okay for this rule because none of those are legacy + visFilePaths := path.Join("kibana", "visualization", "*.json") + visFiles, _ := pkgpath.Files(fsys, visFilePaths) + pkgByRefVisualizations := make(map[string]kbncontent.VisDesc) + + for _, file := range visFiles { + if visJSON, err := file.Values("$"); err == nil { + if desc, err := kbncontent.DescribeVisualizationSavedObject(visJSON.(map[string]interface{})); err == nil { + pkgByRefVisualizations[strings.TrimSuffix(file.Name(), ".json")] = desc + } + } + } + + dashboardFilePaths := path.Join("kibana", "dashboard", "*.json") + dashboardFiles, err := pkgpath.Files(fsys, dashboardFilePaths) if err != nil { errs = append(errs, fmt.Errorf("error finding Kibana dashboard files: %w", err)) return errs } + for _, file := range dashboardFiles { dashboardJSON, _ := file.Values("$") - dashboardTitle, _ := kbncontent.GetDashboardTitle(dashboardJSON) panelsJSON, _ := file.Values("$.attributes.panelsJSON") visualizations, _ := kbncontent.DescribeByValueDashboardPanels(panelsJSON) - var buf strings.Builder - fmt.Fprint(&buf, "your package contains legacy visualizations:\n\n") - tableWriter := tabwriter.NewWriter(&buf, 0, 0, 1, ' ', tabwriter.Debug) - fmt.Fprintln(tableWriter, "\tDashboard title\tVisualization title\tVisualization editor\tVisualization type\t") - fmt.Fprintln(tableWriter, "\t\t\t\t\t") - hasLegacy := false - for _, vis := range visualizations { - if vis.IsLegacy { - hasLegacy = true - fmt.Fprintf(tableWriter, "\t\"%s\"\t\"%s\"\t%s\t%s\t\n", dashboardTitle, vis.Title, vis.Editor, vis.SemanticType) + var byRefVisualizations []kbncontent.VisDesc + ids, _ := kbncontent.GetByReferencePanelIDs(dashboardJSON) + for _, id := range ids { + if vis, ok := pkgByRefVisualizations[id]; ok { + byRefVisualizations = append(byRefVisualizations, vis) + } + } + + visualizations = append(visualizations, byRefVisualizations...) + + var legacyVisualizations []kbncontent.VisDesc + for _, desc := range visualizations { + if desc.IsLegacy { + legacyVisualizations = append(legacyVisualizations, desc) } } - tableWriter.Flush() - if hasLegacy { + if len(legacyVisualizations) > 0 { + dashboardTitle, _ := kbncontent.GetDashboardTitle(dashboardJSON) + var buf strings.Builder + fmt.Fprint(&buf, "your package contains legacy visualizations:\n\n") + + tableWriter := tabwriter.NewWriter(&buf, 0, 0, 1, ' ', tabwriter.Debug) + fmt.Fprintln(tableWriter, "\tDashboard title\tVisualization title\tVisualization editor\tVisualization type\t") + fmt.Fprintln(tableWriter, "\t\t\t\t\t") + + for _, vis := range legacyVisualizations { + fmt.Fprintf(tableWriter, "\t\"%s\"\t\"%s\"\t%s\t%s\t\n", dashboardTitle, vis.Title, vis.Editor, vis.SemanticType) + } + tableWriter.Flush() + errs = append(errs, fmt.Errorf("%s", buf.String())) } } From fd16db88c8a420b0be3d748f3be4c2f407b286f0 Mon Sep 17 00:00:00 2001 From: Drew Tate Date: Mon, 25 Sep 2023 08:33:15 -0600 Subject: [PATCH 05/23] improve error message --- .../semantic/validate_kibana_no_legacy_visualizations.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go b/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go index dcbeb392d..bc0f11537 100644 --- a/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go +++ b/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go @@ -66,14 +66,14 @@ func ValidateKibanaNoLegacyVisualizations(fsys fspath.FS) ve.ValidationErrors { if len(legacyVisualizations) > 0 { dashboardTitle, _ := kbncontent.GetDashboardTitle(dashboardJSON) var buf strings.Builder - fmt.Fprint(&buf, "your package contains legacy visualizations:\n\n") + fmt.Fprintf(&buf, "Dashboard \"%s\" contains legacy visualizations:\n\n", dashboardTitle) tableWriter := tabwriter.NewWriter(&buf, 0, 0, 1, ' ', tabwriter.Debug) - fmt.Fprintln(tableWriter, "\tDashboard title\tVisualization title\tVisualization editor\tVisualization type\t") - fmt.Fprintln(tableWriter, "\t\t\t\t\t") + fmt.Fprintln(tableWriter, "\tTitle\tEditor\tType\t") + fmt.Fprintln(tableWriter, "\t\t\t\t") for _, vis := range legacyVisualizations { - fmt.Fprintf(tableWriter, "\t\"%s\"\t\"%s\"\t%s\t%s\t\n", dashboardTitle, vis.Title, vis.Editor, vis.SemanticType) + fmt.Fprintf(tableWriter, "\t\"%s\"\t%s\t%s\t\n", vis.Title, vis.Editor, vis.SemanticType) } tableWriter.Flush() From ee649040d7d4866b1a20b7b54eeda215d32b5401 Mon Sep 17 00:00:00 2001 From: Drew Tate Date: Mon, 25 Sep 2023 10:39:51 -0600 Subject: [PATCH 06/23] update struct name --- .../semantic/validate_kibana_no_legacy_visualizations.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go b/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go index bc0f11537..9e5759aa4 100644 --- a/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go +++ b/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go @@ -24,7 +24,7 @@ func ValidateKibanaNoLegacyVisualizations(fsys fspath.FS) ve.ValidationErrors { // Note: this does not include Lens, Maps, or Discover. That's okay for this rule because none of those are legacy visFilePaths := path.Join("kibana", "visualization", "*.json") visFiles, _ := pkgpath.Files(fsys, visFilePaths) - pkgByRefVisualizations := make(map[string]kbncontent.VisDesc) + pkgByRefVisualizations := make(map[string]kbncontent.VisualizationDescriptor) for _, file := range visFiles { if visJSON, err := file.Values("$"); err == nil { @@ -46,7 +46,7 @@ func ValidateKibanaNoLegacyVisualizations(fsys fspath.FS) ve.ValidationErrors { panelsJSON, _ := file.Values("$.attributes.panelsJSON") visualizations, _ := kbncontent.DescribeByValueDashboardPanels(panelsJSON) - var byRefVisualizations []kbncontent.VisDesc + var byRefVisualizations []kbncontent.VisualizationDescriptor ids, _ := kbncontent.GetByReferencePanelIDs(dashboardJSON) for _, id := range ids { if vis, ok := pkgByRefVisualizations[id]; ok { @@ -56,7 +56,7 @@ func ValidateKibanaNoLegacyVisualizations(fsys fspath.FS) ve.ValidationErrors { visualizations = append(visualizations, byRefVisualizations...) - var legacyVisualizations []kbncontent.VisDesc + var legacyVisualizations []kbncontent.VisualizationDescriptor for _, desc := range visualizations { if desc.IsLegacy { legacyVisualizations = append(legacyVisualizations, desc) From 009dc42a61af3f16e8f2d47ded3112de0aaa26ef Mon Sep 17 00:00:00 2001 From: Drew Tate Date: Tue, 26 Sep 2023 10:29:14 -0600 Subject: [PATCH 07/23] update to use new API --- .../semantic/validate_kibana_no_legacy_visualizations.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go b/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go index 9e5759aa4..af802c20d 100644 --- a/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go +++ b/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go @@ -43,8 +43,7 @@ func ValidateKibanaNoLegacyVisualizations(fsys fspath.FS) ve.ValidationErrors { for _, file := range dashboardFiles { dashboardJSON, _ := file.Values("$") - panelsJSON, _ := file.Values("$.attributes.panelsJSON") - visualizations, _ := kbncontent.DescribeByValueDashboardPanels(panelsJSON) + visualizations, _ := kbncontent.DescribeByValueDashboardPanels(dashboardJSON) var byRefVisualizations []kbncontent.VisualizationDescriptor ids, _ := kbncontent.GetByReferencePanelIDs(dashboardJSON) @@ -58,7 +57,7 @@ func ValidateKibanaNoLegacyVisualizations(fsys fspath.FS) ve.ValidationErrors { var legacyVisualizations []kbncontent.VisualizationDescriptor for _, desc := range visualizations { - if desc.IsLegacy { + if desc.IsLegacy() { legacyVisualizations = append(legacyVisualizations, desc) } } @@ -73,7 +72,7 @@ func ValidateKibanaNoLegacyVisualizations(fsys fspath.FS) ve.ValidationErrors { fmt.Fprintln(tableWriter, "\t\t\t\t") for _, vis := range legacyVisualizations { - fmt.Fprintf(tableWriter, "\t\"%s\"\t%s\t%s\t\n", vis.Title, vis.Editor, vis.SemanticType) + fmt.Fprintf(tableWriter, "\t\"%s\"\t%s\t%s\t\n", vis.Title(), vis.Editor(), vis.SemanticType()) } tableWriter.Flush() From 9f14a4c4d4718bf0e4253cd1d4ee7eac22d41dbd Mon Sep 17 00:00:00 2001 From: Drew Tate Date: Wed, 27 Sep 2023 08:26:14 -0600 Subject: [PATCH 08/23] update error message --- .../validate_kibana_no_legacy_visualizations.go | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go b/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go index af802c20d..597bc947f 100644 --- a/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go +++ b/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go @@ -9,6 +9,7 @@ import ( "path" "text/tabwriter" "strings" + "errors" "github.com/elastic/kbncontent" ve "github.com/elastic/package-spec/v2/code/go/internal/errors" @@ -63,20 +64,28 @@ func ValidateKibanaNoLegacyVisualizations(fsys fspath.FS) ve.ValidationErrors { } if len(legacyVisualizations) > 0 { - dashboardTitle, _ := kbncontent.GetDashboardTitle(dashboardJSON) + dashboardTitle, err := kbncontent.GetDashboardTitle(dashboardJSON) + if err != nil { + errs = append(errs, fmt.Errorf("error fetching dashboard title: %w", err)) + } + var buf strings.Builder - fmt.Fprintf(&buf, "Dashboard \"%s\" contains legacy visualizations:\n\n", dashboardTitle) + fmt.Fprintf(&buf, "file \"%s\" is invalid: \"%s\" contains legacy visualizations:\n\n", fsys.Path(file.Path()), dashboardTitle) tableWriter := tabwriter.NewWriter(&buf, 0, 0, 1, ' ', tabwriter.Debug) fmt.Fprintln(tableWriter, "\tTitle\tEditor\tType\t") fmt.Fprintln(tableWriter, "\t\t\t\t") for _, vis := range legacyVisualizations { - fmt.Fprintf(tableWriter, "\t\"%s\"\t%s\t%s\t\n", vis.Title(), vis.Editor(), vis.SemanticType()) + var editor string + if result, err := vis.Editor(); err == nil { + editor = result + } + fmt.Fprintf(tableWriter, "\t\"%s\"\t%s\t%s\t\n", vis.Title(), editor, vis.SemanticType()) } tableWriter.Flush() - errs = append(errs, fmt.Errorf("%s", buf.String())) + errs = append(errs, errors.New(buf.String())) } } From 4dada49f2ce5ca92b07c22d4a15b052fafcba57c Mon Sep 17 00:00:00 2001 From: Drew Tate Date: Wed, 27 Sep 2023 09:03:34 -0600 Subject: [PATCH 09/23] better structure and basic test --- ...alidate_kibana_no_legacy_visualizations.go | 42 ++++++++++++------- code/go/pkg/validator/validator_test.go | 7 +++- .../dashboard/good_v3-dashboard-abc-1.json | 1 + 3 files changed, 35 insertions(+), 15 deletions(-) diff --git a/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go b/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go index 597bc947f..b2e391029 100644 --- a/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go +++ b/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go @@ -25,13 +25,27 @@ func ValidateKibanaNoLegacyVisualizations(fsys fspath.FS) ve.ValidationErrors { // Note: this does not include Lens, Maps, or Discover. That's okay for this rule because none of those are legacy visFilePaths := path.Join("kibana", "visualization", "*.json") visFiles, _ := pkgpath.Files(fsys, visFilePaths) - pkgByRefVisualizations := make(map[string]kbncontent.VisualizationDescriptor) for _, file := range visFiles { - if visJSON, err := file.Values("$"); err == nil { - if desc, err := kbncontent.DescribeVisualizationSavedObject(visJSON.(map[string]interface{})); err == nil { - pkgByRefVisualizations[strings.TrimSuffix(file.Name(), ".json")] = desc + visJSON, err := file.Values("$") + + if err != nil { + errs = append(errs, fmt.Errorf("error getting JSON: %w", err)) + return errs + } + + + desc, err := kbncontent.DescribeVisualizationSavedObject(visJSON.(map[string]interface{})) + if err != nil { + errs = append(errs, fmt.Errorf("error describing visualization saved object: %w", err)) + } + + if desc.IsLegacy() { + var editor string + if result, err := desc.Editor(); err == nil { + editor = result } + errs = append(errs, fmt.Errorf("file \"%s\" is invalid: found legacy visualization \"%s\" (%s, %s)", fsys.Path(file.Path()), desc.Title(), desc.SemanticType(), editor)) } } @@ -43,18 +57,17 @@ func ValidateKibanaNoLegacyVisualizations(fsys fspath.FS) ve.ValidationErrors { } for _, file := range dashboardFiles { - dashboardJSON, _ := file.Values("$") - visualizations, _ := kbncontent.DescribeByValueDashboardPanels(dashboardJSON) - - var byRefVisualizations []kbncontent.VisualizationDescriptor - ids, _ := kbncontent.GetByReferencePanelIDs(dashboardJSON) - for _, id := range ids { - if vis, ok := pkgByRefVisualizations[id]; ok { - byRefVisualizations = append(byRefVisualizations, vis) - } + dashboardJSON, err := file.Values("$") + if err != nil { + errs = append(errs, fmt.Errorf("error getting dashboard JSON: %w", err)) + return errs } - visualizations = append(visualizations, byRefVisualizations...) + visualizations, err := kbncontent.DescribeByValueDashboardPanels(dashboardJSON) + if err != nil { + errs = append(errs, fmt.Errorf("error describing dashboard panels for %s: %w", fsys.Path(file.Path()), err)) + return errs + } var legacyVisualizations []kbncontent.VisualizationDescriptor for _, desc := range visualizations { @@ -67,6 +80,7 @@ func ValidateKibanaNoLegacyVisualizations(fsys fspath.FS) ve.ValidationErrors { dashboardTitle, err := kbncontent.GetDashboardTitle(dashboardJSON) if err != nil { errs = append(errs, fmt.Errorf("error fetching dashboard title: %w", err)) + return errs } var buf strings.Builder diff --git a/code/go/pkg/validator/validator_test.go b/code/go/pkg/validator/validator_test.go index 88a3b5626..247ad3c8a 100644 --- a/code/go/pkg/validator/validator_test.go +++ b/code/go/pkg/validator/validator_test.go @@ -227,7 +227,12 @@ func TestValidateFile(t *testing.T) { `dangling reference found: bad_dangling_object_ids-8287a5d5-1576-4f3a-83c4-444e9058439c (search)`, }, }, - "kibana_legacy_visualizations": {}, + "kibana_legacy_visualizations": { + "kibana/visualization/kibana_legacy_visualizations-1740c760-596e-11ee-adef-4fe896364076.json", + []string{ + `found legacy visualization "TSVB time series" (timeseries, TSVB)`, + }, + }, } for pkgName, test := range tests { diff --git a/test/packages/good_v3/kibana/dashboard/good_v3-dashboard-abc-1.json b/test/packages/good_v3/kibana/dashboard/good_v3-dashboard-abc-1.json index c65e0a345..1c357cf52 100644 --- a/test/packages/good_v3/kibana/dashboard/good_v3-dashboard-abc-1.json +++ b/test/packages/good_v3/kibana/dashboard/good_v3-dashboard-abc-1.json @@ -4,6 +4,7 @@ "attributes": { "description": "", "hits": 0, + "panelsJSON": "[]", "kibanaSavedObjectMeta": { "searchSourceJSON": { "filter": [ From 735bb3e4e6ffe84ab67d58fdaa974fa29ce4ef03 Mon Sep 17 00:00:00 2001 From: Drew Tate Date: Wed, 27 Sep 2023 09:09:04 -0600 Subject: [PATCH 10/23] remove replace --- go.mod | 4 +--- go.sum | 2 ++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index dd1348818..0a650c71d 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/creasty/defaults v1.7.0 github.com/elastic/go-licenser v0.4.1 github.com/elastic/gojsonschema v1.2.1 - github.com/elastic/kbncontent v0.0.0 + github.com/elastic/kbncontent v0.0.0-20230927141331-65da83fb5c8e github.com/evanphx/json-patch/v5 v5.7.0 github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901 github.com/mitchellh/mapstructure v1.5.0 @@ -44,5 +44,3 @@ require ( golang.org/x/tools v0.13.0 // indirect gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect ) - -replace github.com/elastic/kbncontent v0.0.0 => ../kbncontent diff --git a/go.sum b/go.sum index 29eb1d48e..e9ff5e512 100644 --- a/go.sum +++ b/go.sum @@ -20,6 +20,8 @@ github.com/elastic/go-licenser v0.4.1 h1:1xDURsc8pL5zYT9R29425J3vkHdt4RT5TNEMeRN github.com/elastic/go-licenser v0.4.1/go.mod h1:V56wHMpmdURfibNBggaSBfqgPxyT1Tldns1i87iTEvU= github.com/elastic/gojsonschema v1.2.1 h1:cUMbgsz0wyEB4x7xf3zUEvUVDl6WCz2RKcQPul8OsQc= github.com/elastic/gojsonschema v1.2.1/go.mod h1:biw5eBS2Z4T02wjATMRSfecfjCmwaDPvuaqf844gLrg= +github.com/elastic/kbncontent v0.0.0-20230927141331-65da83fb5c8e h1:hTfmX6MKoim6LXMFdFOVni/QPymTATMHNVLD9XLrU5U= +github.com/elastic/kbncontent v0.0.0-20230927141331-65da83fb5c8e/go.mod h1:kOPREITK9gSJsiw/WKe7QWSO+PRiZMyEFQCw+CMLAHI= github.com/evanphx/json-patch/v5 v5.7.0 h1:nJqP7uwL84RJInrohHfW0Fx3awjbm8qZeFv0nW9SYGc= github.com/evanphx/json-patch/v5 v5.7.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ= github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= From 692d3b00b3de13543fad70b9e833466d7dfb513b Mon Sep 17 00:00:00 2001 From: Drew Tate Date: Wed, 27 Sep 2023 11:05:30 -0600 Subject: [PATCH 11/23] add test cases --- ...alidate_kibana_no_legacy_visualizations.go | 37 +++++-------------- code/go/pkg/validator/validator_test.go | 28 +++++++++++++- 2 files changed, 36 insertions(+), 29 deletions(-) diff --git a/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go b/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go index b2e391029..756203569 100644 --- a/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go +++ b/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go @@ -7,9 +7,6 @@ package semantic import ( "fmt" "path" - "text/tabwriter" - "strings" - "errors" "github.com/elastic/kbncontent" ve "github.com/elastic/package-spec/v2/code/go/internal/errors" @@ -63,43 +60,27 @@ func ValidateKibanaNoLegacyVisualizations(fsys fspath.FS) ve.ValidationErrors { return errs } + dashboardTitle, err := kbncontent.GetDashboardTitle(dashboardJSON) + if err != nil { + errs = append(errs, fmt.Errorf("error fetching dashboard title: %w", err)) + return errs + } + visualizations, err := kbncontent.DescribeByValueDashboardPanels(dashboardJSON) if err != nil { errs = append(errs, fmt.Errorf("error describing dashboard panels for %s: %w", fsys.Path(file.Path()), err)) return errs } - var legacyVisualizations []kbncontent.VisualizationDescriptor for _, desc := range visualizations { if desc.IsLegacy() { - legacyVisualizations = append(legacyVisualizations, desc) - } - } - - if len(legacyVisualizations) > 0 { - dashboardTitle, err := kbncontent.GetDashboardTitle(dashboardJSON) - if err != nil { - errs = append(errs, fmt.Errorf("error fetching dashboard title: %w", err)) - return errs - } - - var buf strings.Builder - fmt.Fprintf(&buf, "file \"%s\" is invalid: \"%s\" contains legacy visualizations:\n\n", fsys.Path(file.Path()), dashboardTitle) - - tableWriter := tabwriter.NewWriter(&buf, 0, 0, 1, ' ', tabwriter.Debug) - fmt.Fprintln(tableWriter, "\tTitle\tEditor\tType\t") - fmt.Fprintln(tableWriter, "\t\t\t\t") - - for _, vis := range legacyVisualizations { var editor string - if result, err := vis.Editor(); err == nil { + if result, err := desc.Editor(); err == nil { editor = result } - fmt.Fprintf(tableWriter, "\t\"%s\"\t%s\t%s\t\n", vis.Title(), editor, vis.SemanticType()) + err := fmt.Errorf("file \"%s\" is invalid: \"%s\" contains legacy visualization: \"%s\" (%s, %s)", fsys.Path(file.Path()), dashboardTitle, desc.Title(), desc.SemanticType(), editor) + errs = append(errs, err) } - tableWriter.Flush() - - errs = append(errs, errors.New(buf.String())) } } diff --git a/code/go/pkg/validator/validator_test.go b/code/go/pkg/validator/validator_test.go index 247ad3c8a..a7beb0d2d 100644 --- a/code/go/pkg/validator/validator_test.go +++ b/code/go/pkg/validator/validator_test.go @@ -229,8 +229,34 @@ func TestValidateFile(t *testing.T) { }, "kibana_legacy_visualizations": { "kibana/visualization/kibana_legacy_visualizations-1740c760-596e-11ee-adef-4fe896364076.json", + "kibana/visualization/kibana_legacy_visualizations-1ef680d0-596e-11ee-adef-4fe896364076.json", + "kibana/visualization/kibana_legacy_visualizations-29c51300-596e-11ee-adef-4fe896364076.json", + "kibana/visualization/kibana_legacy_visualizations-2e364fd0-596e-11ee-adef-4fe896364076.json", + "kibana/visualization/kibana_legacy_visualizations-331b3600-596e-11ee-adef-4fe896364076.json", + "kibana/visualization/kibana_legacy_visualizations-38222320-596e-11ee-adef-4fe896364076.json", + "kibana/visualization/kibana_legacy_visualizations-e6e022a0-596d-11ee-adef-4fe896364076.json", + "kibana/dashboard/kibana_legacy_visualizations-c36e9b90-596c-11ee-adef-4fe896364076.json", + "kibana/dashboard/kibana_legacy_visualizations-c36e9b90-596c-11ee-adef-4fe896364076.json", + "kibana/dashboard/kibana_legacy_visualizations-c36e9b90-596c-11ee-adef-4fe896364076.json", + "kibana/dashboard/kibana_legacy_visualizations-c36e9b90-596c-11ee-adef-4fe896364076.json", + "kibana/dashboard/kibana_legacy_visualizations-c36e9b90-596c-11ee-adef-4fe896364076.json", + "kibana/dashboard/kibana_legacy_visualizations-c36e9b90-596c-11ee-adef-4fe896364076.json", + "kibana/dashboard/kibana_legacy_visualizations-c36e9b90-596c-11ee-adef-4fe896364076.json", []string{ - `found legacy visualization "TSVB time series" (timeseries, TSVB)`, + "found legacy visualization \"TSVB time series\" (timeseries, TSVB)", + "found legacy visualization \"TSVB gauge\" (gauge, TSVB)", + "found legacy visualization \"Aggs-based table\" (table, Aggs-based)", + "found legacy visualization \"Aggs-based tag cloud\" (tagcloud, Aggs-based)", + "found legacy visualization \"Placeholder Title\" (heatmap, Aggs-based)", + "found legacy visualization \"Timelion time series\" (timelion, Timelion)", + "found legacy visualization \"Legacy input control vis\" (input_control_vis, Aggs-based)", + "\"Dashboard with mixed by-value visualizations\" contains legacy visualization: \"Legacy input control vis\" (input_control_vis, Aggs-based)", + "\"Dashboard with mixed by-value visualizations\" contains legacy visualization: \"TSVB time series\" (timeseries, TSVB)", + "\"Dashboard with mixed by-value visualizations\" contains legacy visualization: \"TSVB gauge\" (gauge, TSVB)", + "\"Dashboard with mixed by-value visualizations\" contains legacy visualization: \"Aggs-based table\" (table, Aggs-based)", + "\"Dashboard with mixed by-value visualizations\" contains legacy visualization: \"Aggs-based tag cloud\" (tagcloud, Aggs-based)", + "\"Dashboard with mixed by-value visualizations\" contains legacy visualization: \"\" (heatmap, Aggs-based)", + "\"Dashboard with mixed by-value visualizations\" contains legacy visualization: \"Timelion time series\" (timelion, Timelion)", }, }, } From 80f3376f1bd45274aa8d13a52ae6c19d9e7352d6 Mon Sep 17 00:00:00 2001 From: Drew Tate Date: Wed, 27 Sep 2023 11:50:04 -0600 Subject: [PATCH 12/23] just test a single dashboard --- code/go/pkg/validator/validator_test.go | 20 - ...-d729eb20-596d-11ee-adef-4fe896364076.json | 457 ------------------ ...-f4c4ce70-596d-11ee-adef-4fe896364076.json | 126 ----- ...-04a682c0-596e-11ee-adef-4fe896364076.json | 89 ---- ...-0c94ff70-596e-11ee-adef-4fe896364076.json | 35 -- ...-1740c760-596e-11ee-adef-4fe896364076.json | 74 --- ...-1ef680d0-596e-11ee-adef-4fe896364076.json | 91 ---- ...-23f94f40-596e-11ee-adef-4fe896364076.json | 83 ---- ...-29c51300-596e-11ee-adef-4fe896364076.json | 52 -- ...-2e364fd0-596e-11ee-adef-4fe896364076.json | 76 --- ...-331b3600-596e-11ee-adef-4fe896364076.json | 81 ---- ...-38222320-596e-11ee-adef-4fe896364076.json | 28 -- ...-e6e022a0-596d-11ee-adef-4fe896364076.json | 58 --- ...-ee3370c0-596d-11ee-adef-4fe896364076.json | 35 -- ...-f9920df0-596d-11ee-adef-4fe896364076.json | 27 -- 15 files changed, 1332 deletions(-) delete mode 100644 test/packages/kibana_legacy_visualizations/kibana/dashboard/kibana_legacy_visualizations-d729eb20-596d-11ee-adef-4fe896364076.json delete mode 100644 test/packages/kibana_legacy_visualizations/kibana/lens/kibana_legacy_visualizations-f4c4ce70-596d-11ee-adef-4fe896364076.json delete mode 100644 test/packages/kibana_legacy_visualizations/kibana/map/kibana_legacy_visualizations-04a682c0-596e-11ee-adef-4fe896364076.json delete mode 100644 test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-0c94ff70-596e-11ee-adef-4fe896364076.json delete mode 100644 test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-1740c760-596e-11ee-adef-4fe896364076.json delete mode 100644 test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-1ef680d0-596e-11ee-adef-4fe896364076.json delete mode 100644 test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-23f94f40-596e-11ee-adef-4fe896364076.json delete mode 100644 test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-29c51300-596e-11ee-adef-4fe896364076.json delete mode 100644 test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-2e364fd0-596e-11ee-adef-4fe896364076.json delete mode 100644 test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-331b3600-596e-11ee-adef-4fe896364076.json delete mode 100644 test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-38222320-596e-11ee-adef-4fe896364076.json delete mode 100644 test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-e6e022a0-596d-11ee-adef-4fe896364076.json delete mode 100644 test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-ee3370c0-596d-11ee-adef-4fe896364076.json delete mode 100644 test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-f9920df0-596d-11ee-adef-4fe896364076.json diff --git a/code/go/pkg/validator/validator_test.go b/code/go/pkg/validator/validator_test.go index a7beb0d2d..682465343 100644 --- a/code/go/pkg/validator/validator_test.go +++ b/code/go/pkg/validator/validator_test.go @@ -228,28 +228,8 @@ func TestValidateFile(t *testing.T) { }, }, "kibana_legacy_visualizations": { - "kibana/visualization/kibana_legacy_visualizations-1740c760-596e-11ee-adef-4fe896364076.json", - "kibana/visualization/kibana_legacy_visualizations-1ef680d0-596e-11ee-adef-4fe896364076.json", - "kibana/visualization/kibana_legacy_visualizations-29c51300-596e-11ee-adef-4fe896364076.json", - "kibana/visualization/kibana_legacy_visualizations-2e364fd0-596e-11ee-adef-4fe896364076.json", - "kibana/visualization/kibana_legacy_visualizations-331b3600-596e-11ee-adef-4fe896364076.json", - "kibana/visualization/kibana_legacy_visualizations-38222320-596e-11ee-adef-4fe896364076.json", - "kibana/visualization/kibana_legacy_visualizations-e6e022a0-596d-11ee-adef-4fe896364076.json", - "kibana/dashboard/kibana_legacy_visualizations-c36e9b90-596c-11ee-adef-4fe896364076.json", - "kibana/dashboard/kibana_legacy_visualizations-c36e9b90-596c-11ee-adef-4fe896364076.json", - "kibana/dashboard/kibana_legacy_visualizations-c36e9b90-596c-11ee-adef-4fe896364076.json", - "kibana/dashboard/kibana_legacy_visualizations-c36e9b90-596c-11ee-adef-4fe896364076.json", - "kibana/dashboard/kibana_legacy_visualizations-c36e9b90-596c-11ee-adef-4fe896364076.json", - "kibana/dashboard/kibana_legacy_visualizations-c36e9b90-596c-11ee-adef-4fe896364076.json", "kibana/dashboard/kibana_legacy_visualizations-c36e9b90-596c-11ee-adef-4fe896364076.json", []string{ - "found legacy visualization \"TSVB time series\" (timeseries, TSVB)", - "found legacy visualization \"TSVB gauge\" (gauge, TSVB)", - "found legacy visualization \"Aggs-based table\" (table, Aggs-based)", - "found legacy visualization \"Aggs-based tag cloud\" (tagcloud, Aggs-based)", - "found legacy visualization \"Placeholder Title\" (heatmap, Aggs-based)", - "found legacy visualization \"Timelion time series\" (timelion, Timelion)", - "found legacy visualization \"Legacy input control vis\" (input_control_vis, Aggs-based)", "\"Dashboard with mixed by-value visualizations\" contains legacy visualization: \"Legacy input control vis\" (input_control_vis, Aggs-based)", "\"Dashboard with mixed by-value visualizations\" contains legacy visualization: \"TSVB time series\" (timeseries, TSVB)", "\"Dashboard with mixed by-value visualizations\" contains legacy visualization: \"TSVB gauge\" (gauge, TSVB)", diff --git a/test/packages/kibana_legacy_visualizations/kibana/dashboard/kibana_legacy_visualizations-d729eb20-596d-11ee-adef-4fe896364076.json b/test/packages/kibana_legacy_visualizations/kibana/dashboard/kibana_legacy_visualizations-d729eb20-596d-11ee-adef-4fe896364076.json deleted file mode 100644 index 4b016a4f5..000000000 --- a/test/packages/kibana_legacy_visualizations/kibana/dashboard/kibana_legacy_visualizations-d729eb20-596d-11ee-adef-4fe896364076.json +++ /dev/null @@ -1,457 +0,0 @@ -{ - "attributes": { - "controlGroupInput": { - "chainingSystem": "HIERARCHICAL", - "controlStyle": "oneLine", - "ignoreParentSettingsJSON": "{\"ignoreFilters\":false,\"ignoreQuery\":false,\"ignoreTimerange\":false,\"ignoreValidations\":false}", - "panelsJSON": "{\"332c44e9-b2a2-4d26-96c4-49562da1ba93\":{\"type\":\"optionsListControl\",\"order\":0,\"grow\":true,\"width\":\"medium\",\"explicitInput\":{\"id\":\"332c44e9-b2a2-4d26-96c4-49562da1ba93\",\"fieldName\":\"agent.id\",\"title\":\"agent.id\",\"enhancements\":{}}}}" - }, - "description": "", - "kibanaSavedObjectMeta": { - "searchSourceJSON": { - "filter": [ - { - "$state": { - "store": "appState" - }, - "meta": { - "alias": null, - "disabled": false, - "field": "agent.type", - "indexRefName": "kibanaSavedObjectMeta.searchSourceJSON.filter[0].meta.index", - "key": "agent.type", - "negate": false, - "params": { - "query": "filebeat" - }, - "type": "phrase" - }, - "query": { - "match_phrase": { - "agent.type": "filebeat" - } - } - } - ], - "query": { - "language": "kuery", - "query": "" - } - } - }, - "optionsJSON": { - "hidePanelTitles": false, - "syncColors": false, - "syncCursor": true, - "syncTooltips": false, - "useMargins": true - }, - "panelsJSON": [ - { - "embeddableConfig": { - "enhancements": {}, - "savedVis": { - "data": { - "aggs": [], - "searchSource": { - "filter": [], - "query": { - "language": "kuery", - "query": "" - } - } - }, - "description": "", - "params": { - "fontSize": 12, - "markdown": "## TSVB", - "openLinksInNewTab": false - }, - "title": "", - "type": "markdown", - "uiState": {} - } - }, - "gridData": { - "h": 3, - "i": "20be122a-5169-4551-b519-f346ca91ce93", - "w": 48, - "x": 0, - "y": 41 - }, - "panelIndex": "20be122a-5169-4551-b519-f346ca91ce93", - "title": "", - "type": "visualization", - "version": "8.7.1" - }, - { - "embeddableConfig": { - "enhancements": {}, - "savedVis": { - "data": { - "aggs": [], - "searchSource": { - "filter": [], - "query": { - "language": "kuery", - "query": "" - } - } - }, - "description": "", - "params": { - "fontSize": 12, - "markdown": "## Aggs-based", - "openLinksInNewTab": false - }, - "title": "", - "type": "markdown", - "uiState": {} - } - }, - "gridData": { - "h": 3, - "i": "24272e20-9101-47b0-914f-13bd0a75c34f", - "w": 48, - "x": 0, - "y": 74 - }, - "panelIndex": "24272e20-9101-47b0-914f-13bd0a75c34f", - "title": "", - "type": "visualization", - "version": "8.7.1" - }, - { - "embeddableConfig": { - "enhancements": {} - }, - "gridData": { - "h": 15, - "i": "6cc10baa-1976-4288-ba3a-9b8b8d5a5373", - "w": 24, - "x": 24, - "y": 23 - }, - "panelIndex": "6cc10baa-1976-4288-ba3a-9b8b8d5a5373", - "panelRefName": "panel_6cc10baa-1976-4288-ba3a-9b8b8d5a5373", - "type": "search", - "version": "8.7.1" - }, - { - "embeddableConfig": { - "enhancements": {} - }, - "gridData": { - "h": 5, - "i": "9af89785-ce3b-4589-9bbc-5c3391559e1c", - "w": 12, - "x": 0, - "y": 0 - }, - "panelIndex": "9af89785-ce3b-4589-9bbc-5c3391559e1c", - "panelRefName": "panel_9af89785-ce3b-4589-9bbc-5c3391559e1c", - "type": "visualization", - "version": "8.7.1" - }, - { - "embeddableConfig": { - "enhancements": {} - }, - "gridData": { - "h": 3, - "i": "c6c8041f-b274-4df6-9856-6ebebc2854ec", - "w": 48, - "x": 0, - "y": 5 - }, - "panelIndex": "c6c8041f-b274-4df6-9856-6ebebc2854ec", - "panelRefName": "panel_c6c8041f-b274-4df6-9856-6ebebc2854ec", - "type": "visualization", - "version": "8.7.1" - }, - { - "embeddableConfig": { - "enhancements": {}, - "hidePanelTitles": false - }, - "gridData": { - "h": 15, - "i": "a600fde1-d278-4de2-b978-67a178cf227b", - "w": 24, - "x": 0, - "y": 8 - }, - "panelIndex": "a600fde1-d278-4de2-b978-67a178cf227b", - "panelRefName": "panel_a600fde1-d278-4de2-b978-67a178cf227b", - "type": "lens", - "version": "8.7.1" - }, - { - "embeddableConfig": { - "enhancements": {} - }, - "gridData": { - "h": 15, - "i": "efb4f9f9-4315-4fb0-a78b-b9c55c6082bc", - "w": 24, - "x": 24, - "y": 8 - }, - "panelIndex": "efb4f9f9-4315-4fb0-a78b-b9c55c6082bc", - "panelRefName": "panel_efb4f9f9-4315-4fb0-a78b-b9c55c6082bc", - "type": "visualization", - "version": "8.7.1" - }, - { - "embeddableConfig": { - "enhancements": {}, - "hiddenLayers": [], - "isLayerTOCOpen": true, - "mapBuffer": { - "maxLat": 66.51326, - "maxLon": 180, - "minLat": -66.51326, - "minLon": -180 - }, - "mapCenter": { - "lat": 19.94277, - "lon": 0, - "zoom": 1.6 - }, - "openTOCDetails": [] - }, - "gridData": { - "h": 15, - "i": "36f3a6ca-170e-4171-aef6-d627915d6ddb", - "w": 24, - "x": 0, - "y": 23 - }, - "panelIndex": "36f3a6ca-170e-4171-aef6-d627915d6ddb", - "panelRefName": "panel_36f3a6ca-170e-4171-aef6-d627915d6ddb", - "type": "map", - "version": "8.7.1" - }, - { - "embeddableConfig": { - "enhancements": {} - }, - "gridData": { - "h": 3, - "i": "99db9795-7bde-45df-a634-4eda6c0ad078", - "w": 48, - "x": 0, - "y": 38 - }, - "panelIndex": "99db9795-7bde-45df-a634-4eda6c0ad078", - "panelRefName": "panel_99db9795-7bde-45df-a634-4eda6c0ad078", - "type": "visualization", - "version": "8.7.1" - }, - { - "embeddableConfig": { - "enhancements": {} - }, - "gridData": { - "h": 15, - "i": "da91b8b8-568d-4575-aa5b-22f1eb757002", - "w": 24, - "x": 0, - "y": 44 - }, - "panelIndex": "da91b8b8-568d-4575-aa5b-22f1eb757002", - "panelRefName": "panel_da91b8b8-568d-4575-aa5b-22f1eb757002", - "type": "visualization", - "version": "8.7.1" - }, - { - "embeddableConfig": { - "enhancements": {} - }, - "gridData": { - "h": 15, - "i": "77a3da6f-6524-4d35-a980-fe61be99c080", - "w": 24, - "x": 24, - "y": 44 - }, - "panelIndex": "77a3da6f-6524-4d35-a980-fe61be99c080", - "panelRefName": "panel_77a3da6f-6524-4d35-a980-fe61be99c080", - "type": "visualization", - "version": "8.7.1" - }, - { - "embeddableConfig": { - "enhancements": {} - }, - "gridData": { - "h": 15, - "i": "4774aa9e-76dd-4b04-9f18-986689a8c052", - "w": 24, - "x": 0, - "y": 59 - }, - "panelIndex": "4774aa9e-76dd-4b04-9f18-986689a8c052", - "panelRefName": "panel_4774aa9e-76dd-4b04-9f18-986689a8c052", - "type": "visualization", - "version": "8.7.1" - }, - { - "embeddableConfig": { - "enhancements": {} - }, - "gridData": { - "h": 15, - "i": "1bee7866-45cf-4f8a-a246-2d89668efee7", - "w": 24, - "x": 0, - "y": 77 - }, - "panelIndex": "1bee7866-45cf-4f8a-a246-2d89668efee7", - "panelRefName": "panel_1bee7866-45cf-4f8a-a246-2d89668efee7", - "type": "visualization", - "version": "8.7.1" - }, - { - "embeddableConfig": { - "enhancements": {} - }, - "gridData": { - "h": 15, - "i": "0dd8056c-b004-4e8b-a184-6ae980171d89", - "w": 24, - "x": 24, - "y": 77 - }, - "panelIndex": "0dd8056c-b004-4e8b-a184-6ae980171d89", - "panelRefName": "panel_0dd8056c-b004-4e8b-a184-6ae980171d89", - "type": "visualization", - "version": "8.7.1" - }, - { - "embeddableConfig": { - "enhancements": {} - }, - "gridData": { - "h": 15, - "i": "febe9d0e-a6e5-46ab-bd3b-0e5fdffb6c4f", - "w": 24, - "x": 0, - "y": 92 - }, - "panelIndex": "febe9d0e-a6e5-46ab-bd3b-0e5fdffb6c4f", - "panelRefName": "panel_febe9d0e-a6e5-46ab-bd3b-0e5fdffb6c4f", - "type": "visualization", - "version": "8.7.1" - }, - { - "embeddableConfig": { - "enhancements": {} - }, - "gridData": { - "h": 15, - "i": "0fda78af-c2d3-4e13-be3f-d45784cfd460", - "w": 24, - "x": 24, - "y": 92 - }, - "panelIndex": "0fda78af-c2d3-4e13-be3f-d45784cfd460", - "panelRefName": "panel_0fda78af-c2d3-4e13-be3f-d45784cfd460", - "type": "visualization", - "version": "8.7.1" - } - ], - "timeRestore": false, - "title": "Dashboard with mixed by-reference visualizations", - "version": 1 - }, - "coreMigrationVersion": "8.7.1", - "created_at": "2023-09-22T20:05:17.522Z", - "id": "kibana_legacy_visualizations-d729eb20-596d-11ee-adef-4fe896364076", - "migrationVersion": { - "dashboard": "8.7.0" - }, - "references": [ - { - "id": "logs-*", - "name": "kibanaSavedObjectMeta.searchSourceJSON.filter[0].meta.index", - "type": "index-pattern" - }, - { - "id": "kibana_legacy_visualizations-8f2e0810-596d-11ee-adef-4fe896364076", - "name": "6cc10baa-1976-4288-ba3a-9b8b8d5a5373:panel_6cc10baa-1976-4288-ba3a-9b8b8d5a5373", - "type": "search" - }, - { - "id": "kibana_legacy_visualizations-e6e022a0-596d-11ee-adef-4fe896364076", - "name": "9af89785-ce3b-4589-9bbc-5c3391559e1c:panel_9af89785-ce3b-4589-9bbc-5c3391559e1c", - "type": "visualization" - }, - { - "id": "kibana_legacy_visualizations-ee3370c0-596d-11ee-adef-4fe896364076", - "name": "c6c8041f-b274-4df6-9856-6ebebc2854ec:panel_c6c8041f-b274-4df6-9856-6ebebc2854ec", - "type": "visualization" - }, - { - "id": "kibana_legacy_visualizations-f4c4ce70-596d-11ee-adef-4fe896364076", - "name": "a600fde1-d278-4de2-b978-67a178cf227b:panel_a600fde1-d278-4de2-b978-67a178cf227b", - "type": "lens" - }, - { - "id": "kibana_legacy_visualizations-f9920df0-596d-11ee-adef-4fe896364076", - "name": "efb4f9f9-4315-4fb0-a78b-b9c55c6082bc:panel_efb4f9f9-4315-4fb0-a78b-b9c55c6082bc", - "type": "visualization" - }, - { - "id": "kibana_legacy_visualizations-04a682c0-596e-11ee-adef-4fe896364076", - "name": "36f3a6ca-170e-4171-aef6-d627915d6ddb:panel_36f3a6ca-170e-4171-aef6-d627915d6ddb", - "type": "map" - }, - { - "id": "kibana_legacy_visualizations-0c94ff70-596e-11ee-adef-4fe896364076", - "name": "99db9795-7bde-45df-a634-4eda6c0ad078:panel_99db9795-7bde-45df-a634-4eda6c0ad078", - "type": "visualization" - }, - { - "id": "kibana_legacy_visualizations-1740c760-596e-11ee-adef-4fe896364076", - "name": "da91b8b8-568d-4575-aa5b-22f1eb757002:panel_da91b8b8-568d-4575-aa5b-22f1eb757002", - "type": "visualization" - }, - { - "id": "kibana_legacy_visualizations-1ef680d0-596e-11ee-adef-4fe896364076", - "name": "77a3da6f-6524-4d35-a980-fe61be99c080:panel_77a3da6f-6524-4d35-a980-fe61be99c080", - "type": "visualization" - }, - { - "id": "kibana_legacy_visualizations-23f94f40-596e-11ee-adef-4fe896364076", - "name": "4774aa9e-76dd-4b04-9f18-986689a8c052:panel_4774aa9e-76dd-4b04-9f18-986689a8c052", - "type": "visualization" - }, - { - "id": "kibana_legacy_visualizations-29c51300-596e-11ee-adef-4fe896364076", - "name": "1bee7866-45cf-4f8a-a246-2d89668efee7:panel_1bee7866-45cf-4f8a-a246-2d89668efee7", - "type": "visualization" - }, - { - "id": "kibana_legacy_visualizations-2e364fd0-596e-11ee-adef-4fe896364076", - "name": "0dd8056c-b004-4e8b-a184-6ae980171d89:panel_0dd8056c-b004-4e8b-a184-6ae980171d89", - "type": "visualization" - }, - { - "id": "kibana_legacy_visualizations-331b3600-596e-11ee-adef-4fe896364076", - "name": "febe9d0e-a6e5-46ab-bd3b-0e5fdffb6c4f:panel_febe9d0e-a6e5-46ab-bd3b-0e5fdffb6c4f", - "type": "visualization" - }, - { - "id": "kibana_legacy_visualizations-38222320-596e-11ee-adef-4fe896364076", - "name": "0fda78af-c2d3-4e13-be3f-d45784cfd460:panel_0fda78af-c2d3-4e13-be3f-d45784cfd460", - "type": "visualization" - }, - { - "id": "logs-*", - "name": "controlGroup_332c44e9-b2a2-4d26-96c4-49562da1ba93:optionsListDataView", - "type": "index-pattern" - } - ], - "type": "dashboard" -} \ No newline at end of file diff --git a/test/packages/kibana_legacy_visualizations/kibana/lens/kibana_legacy_visualizations-f4c4ce70-596d-11ee-adef-4fe896364076.json b/test/packages/kibana_legacy_visualizations/kibana/lens/kibana_legacy_visualizations-f4c4ce70-596d-11ee-adef-4fe896364076.json deleted file mode 100644 index a18b842da..000000000 --- a/test/packages/kibana_legacy_visualizations/kibana/lens/kibana_legacy_visualizations-f4c4ce70-596d-11ee-adef-4fe896364076.json +++ /dev/null @@ -1,126 +0,0 @@ -{ - "attributes": { - "state": { - "adHocDataViews": {}, - "datasourceStates": { - "formBased": { - "layers": { - "85c9c01e-13df-42a2-b33d-8441fb83afaf": { - "columnOrder": [ - "e88818c5-d9ff-467e-b231-2e97d611a9a7", - "17c707aa-0ede-444e-81ed-9816983d6479" - ], - "columns": { - "17c707aa-0ede-444e-81ed-9816983d6479": { - "dataType": "number", - "isBucketed": false, - "label": "Count of records", - "operationType": "count", - "params": { - "emptyAsNull": true - }, - "scale": "ratio", - "sourceField": "___records___" - }, - "e88818c5-d9ff-467e-b231-2e97d611a9a7": { - "dataType": "string", - "isBucketed": true, - "label": "Top 5 values of agent.id", - "operationType": "terms", - "params": { - "exclude": [], - "excludeIsRegex": false, - "include": [], - "includeIsRegex": false, - "missingBucket": false, - "orderBy": { - "columnId": "17c707aa-0ede-444e-81ed-9816983d6479", - "type": "column" - }, - "orderDirection": "desc", - "otherBucket": true, - "parentFormat": { - "id": "terms" - }, - "size": 5 - }, - "scale": "ordinal", - "sourceField": "agent.id" - } - }, - "incompleteColumns": {}, - "sampling": 1 - } - } - }, - "textBased": { - "layers": {} - } - }, - "filters": [], - "internalReferences": [], - "query": { - "language": "kuery", - "query": "" - }, - "visualization": { - "axisTitlesVisibilitySettings": { - "x": true, - "yLeft": true, - "yRight": true - }, - "fittingFunction": "None", - "gridlinesVisibilitySettings": { - "x": true, - "yLeft": true, - "yRight": true - }, - "labelsOrientation": { - "x": 0, - "yLeft": 0, - "yRight": 0 - }, - "layers": [ - { - "accessors": [ - "17c707aa-0ede-444e-81ed-9816983d6479" - ], - "layerId": "85c9c01e-13df-42a2-b33d-8441fb83afaf", - "layerType": "data", - "position": "top", - "seriesType": "bar_stacked", - "showGridlines": false, - "xAccessor": "e88818c5-d9ff-467e-b231-2e97d611a9a7" - } - ], - "legend": { - "isVisible": true, - "position": "right" - }, - "preferredSeriesType": "bar_stacked", - "tickLabelsVisibilitySettings": { - "x": true, - "yLeft": true, - "yRight": true - }, - "valueLabels": "hide" - } - }, - "title": "Lens bar", - "visualizationType": "lnsXY" - }, - "coreMigrationVersion": "8.7.1", - "created_at": "2023-09-22T17:32:08.791Z", - "id": "kibana_legacy_visualizations-f4c4ce70-596d-11ee-adef-4fe896364076", - "migrationVersion": { - "lens": "8.6.0" - }, - "references": [ - { - "id": "logs-*", - "name": "indexpattern-datasource-layer-85c9c01e-13df-42a2-b33d-8441fb83afaf", - "type": "index-pattern" - } - ], - "type": "lens" -} \ No newline at end of file diff --git a/test/packages/kibana_legacy_visualizations/kibana/map/kibana_legacy_visualizations-04a682c0-596e-11ee-adef-4fe896364076.json b/test/packages/kibana_legacy_visualizations/kibana/map/kibana_legacy_visualizations-04a682c0-596e-11ee-adef-4fe896364076.json deleted file mode 100644 index 3ecc0a27b..000000000 --- a/test/packages/kibana_legacy_visualizations/kibana/map/kibana_legacy_visualizations-04a682c0-596e-11ee-adef-4fe896364076.json +++ /dev/null @@ -1,89 +0,0 @@ -{ - "attributes": { - "description": "", - "layerListJSON": [ - { - "alpha": 1, - "id": "909a0001-15f6-40b7-8be5-fadddcc358c1", - "includeInFitToBounds": true, - "label": null, - "locale": "autoselect", - "maxZoom": 24, - "minZoom": 0, - "sourceDescriptor": { - "isAutoSelect": true, - "lightModeDefault": "road_map_desaturated", - "type": "EMS_TMS" - }, - "style": { - "color": "", - "type": "EMS_VECTOR_TILE" - }, - "type": "EMS_VECTOR_TILE", - "visible": true - } - ], - "mapStateJSON": { - "adHocDataViews": [], - "center": { - "lat": 19.94277, - "lon": 0 - }, - "filters": [], - "query": { - "language": "kuery", - "query": "" - }, - "refreshConfig": { - "interval": 60000, - "isPaused": true - }, - "settings": { - "autoFitToDataBounds": false, - "backgroundColor": "#ffffff", - "browserLocation": { - "zoom": 2 - }, - "customIcons": [], - "disableInteractive": false, - "disableTooltipControl": false, - "fixedLocation": { - "lat": 0, - "lon": 0, - "zoom": 2 - }, - "hideLayerControl": false, - "hideToolbarOverlay": false, - "hideViewControl": false, - "initialLocation": "LAST_SAVED_LOCATION", - "keydownScrollZoom": false, - "maxZoom": 24, - "minZoom": 0, - "showScaleControl": false, - "showSpatialFilters": true, - "showTimesliderToggleButton": true, - "spatialFiltersAlpa": 0.3, - "spatialFiltersFillColor": "#DA8B45", - "spatialFiltersLineColor": "#DA8B45" - }, - "timeFilters": { - "from": "now-15m", - "to": "now" - }, - "zoom": 1.6 - }, - "title": "I'm a MAP", - "uiStateJSON": { - "isLayerTOCOpen": true, - "openTOCDetails": [] - } - }, - "coreMigrationVersion": "8.7.1", - "created_at": "2023-09-22T17:32:35.436Z", - "id": "kibana_legacy_visualizations-04a682c0-596e-11ee-adef-4fe896364076", - "migrationVersion": { - "map": "8.4.0" - }, - "references": [], - "type": "map" -} \ No newline at end of file diff --git a/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-0c94ff70-596e-11ee-adef-4fe896364076.json b/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-0c94ff70-596e-11ee-adef-4fe896364076.json deleted file mode 100644 index d50a1d501..000000000 --- a/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-0c94ff70-596e-11ee-adef-4fe896364076.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "attributes": { - "description": "", - "kibanaSavedObjectMeta": { - "searchSourceJSON": { - "filter": [], - "query": { - "language": "kuery", - "query": "" - } - } - }, - "title": "Placeholder Title", - "uiStateJSON": {}, - "version": 1, - "visState": { - "aggs": [], - "params": { - "fontSize": 12, - "markdown": "# The Bad", - "openLinksInNewTab": false - }, - "title": "Placeholder Title", - "type": "markdown" - } - }, - "coreMigrationVersion": "8.7.1", - "created_at": "2023-09-22T17:32:48.743Z", - "id": "kibana_legacy_visualizations-0c94ff70-596e-11ee-adef-4fe896364076", - "migrationVersion": { - "visualization": "8.5.0" - }, - "references": [], - "type": "visualization" -} \ No newline at end of file diff --git a/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-1740c760-596e-11ee-adef-4fe896364076.json b/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-1740c760-596e-11ee-adef-4fe896364076.json deleted file mode 100644 index 73b1b17fe..000000000 --- a/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-1740c760-596e-11ee-adef-4fe896364076.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "attributes": { - "description": "", - "kibanaSavedObjectMeta": { - "searchSourceJSON": {} - }, - "title": "TSVB time series", - "uiStateJSON": {}, - "version": 1, - "visState": { - "aggs": [], - "params": { - "axis_formatter": "number", - "axis_position": "left", - "axis_scale": "normal", - "drop_last_bucket": 0, - "id": "2151dff1-0ac0-4364-bd3b-1b2dc6ad4a9d", - "index_pattern_ref_name": "metrics_0_index_pattern", - "interval": "", - "max_lines_legend": 1, - "series": [ - { - "axis_position": "right", - "chart_type": "line", - "color": "#68BC00", - "fill": 0.5, - "formatter": "default", - "id": "9d2312fc-5cd1-4704-bed6-c90a189fdc3c", - "line_width": 1, - "metrics": [ - { - "id": "ff45b058-0b35-43e9-b5cc-86cf6bb59a2f", - "type": "count" - } - ], - "override_index_pattern": 0, - "palette": { - "name": "default", - "type": "palette" - }, - "point_size": 1, - "separate_axis": 0, - "series_drop_last_bucket": 0, - "split_mode": "everything", - "stacked": "none" - } - ], - "show_grid": 1, - "show_legend": 1, - "time_field": "", - "tooltip_mode": "show_all", - "truncate_legend": 1, - "type": "timeseries", - "use_kibana_indexes": true - }, - "title": "TSVB time series", - "type": "metrics" - } - }, - "coreMigrationVersion": "8.7.1", - "created_at": "2023-09-22T17:33:06.646Z", - "id": "kibana_legacy_visualizations-1740c760-596e-11ee-adef-4fe896364076", - "migrationVersion": { - "visualization": "8.5.0" - }, - "references": [ - { - "id": "logs-*", - "name": "metrics_0_index_pattern", - "type": "index-pattern" - } - ], - "type": "visualization" -} \ No newline at end of file diff --git a/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-1ef680d0-596e-11ee-adef-4fe896364076.json b/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-1ef680d0-596e-11ee-adef-4fe896364076.json deleted file mode 100644 index 17e16a6a4..000000000 --- a/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-1ef680d0-596e-11ee-adef-4fe896364076.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "attributes": { - "description": "", - "kibanaSavedObjectMeta": { - "searchSourceJSON": { - "filter": [], - "query": { - "language": "kuery", - "query": "" - } - } - }, - "title": "TSVB gauge", - "uiStateJSON": {}, - "version": 1, - "visState": { - "aggs": [], - "params": { - "axis_formatter": "number", - "axis_position": "left", - "axis_scale": "normal", - "drop_last_bucket": 0, - "gauge_color_rules": [ - { - "id": "9ad81810-596b-11ee-9f91-cf341ef7bf75" - } - ], - "gauge_inner_width": 10, - "gauge_style": "half", - "gauge_width": 10, - "id": "6be570b5-d3f4-41d3-8b67-b01c235bd94d", - "index_pattern_ref_name": "metrics_0_index_pattern", - "interval": "", - "isModelInvalid": false, - "max_lines_legend": 1, - "series": [ - { - "axis_position": "right", - "chart_type": "line", - "color": "#68BC00", - "fill": 0.5, - "formatter": "default", - "id": "ba95c76c-afd7-4cd5-9632-459a6678bc13", - "line_width": 1, - "metrics": [ - { - "id": "4ec74301-3205-4f85-9c8d-a11f44638603", - "type": "count" - } - ], - "override_index_pattern": 0, - "palette": { - "name": "default", - "type": "palette" - }, - "point_size": 1, - "separate_axis": 0, - "series_drop_last_bucket": 0, - "split_mode": "everything", - "stacked": "none", - "time_range_mode": "entire_time_range" - } - ], - "show_grid": 1, - "show_legend": 1, - "time_field": "", - "time_range_mode": "last_value", - "tooltip_mode": "show_all", - "truncate_legend": 1, - "type": "gauge", - "use_kibana_indexes": true - }, - "title": "TSVB gauge", - "type": "metrics" - } - }, - "coreMigrationVersion": "8.7.1", - "created_at": "2023-09-22T17:33:19.581Z", - "id": "kibana_legacy_visualizations-1ef680d0-596e-11ee-adef-4fe896364076", - "migrationVersion": { - "visualization": "8.5.0" - }, - "references": [ - { - "id": "logs-*", - "name": "metrics_0_index_pattern", - "type": "index-pattern" - } - ], - "type": "visualization" -} \ No newline at end of file diff --git a/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-23f94f40-596e-11ee-adef-4fe896364076.json b/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-23f94f40-596e-11ee-adef-4fe896364076.json deleted file mode 100644 index 7eac04fab..000000000 --- a/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-23f94f40-596e-11ee-adef-4fe896364076.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "attributes": { - "description": "", - "kibanaSavedObjectMeta": { - "searchSourceJSON": { - "filter": [], - "query": { - "language": "kuery", - "query": "" - } - } - }, - "title": "TSVB Markdown", - "uiStateJSON": {}, - "version": 1, - "visState": { - "aggs": [], - "params": { - "axis_formatter": "number", - "axis_position": "left", - "axis_scale": "normal", - "drop_last_bucket": 0, - "id": "269c9bd6-6d39-43ee-a736-ca2d3bc8c86d", - "index_pattern_ref_name": "metrics_0_index_pattern", - "interval": "", - "markdown": "# Hai {{ count.last.raw }}", - "max_lines_legend": 1, - "series": [ - { - "axis_position": "right", - "chart_type": "line", - "color": "#68BC00", - "fill": 0.5, - "formatter": "default", - "id": "a9130cea-528c-40ce-b67d-d5a1d650a9f3", - "line_width": 1, - "metrics": [ - { - "id": "1e09d941-507c-4621-8431-69582d7f1f52", - "type": "count" - } - ], - "override_index_pattern": 0, - "palette": { - "name": "default", - "type": "palette" - }, - "point_size": 1, - "separate_axis": 0, - "series_drop_last_bucket": 0, - "split_mode": "everything", - "stacked": "none", - "time_range_mode": "entire_time_range" - } - ], - "show_grid": 1, - "show_legend": 1, - "time_field": "", - "time_range_mode": "entire_time_range", - "tooltip_mode": "show_all", - "truncate_legend": 1, - "type": "markdown", - "use_kibana_indexes": true - }, - "title": "TSVB Markdown", - "type": "metrics" - } - }, - "coreMigrationVersion": "8.7.1", - "created_at": "2023-09-22T17:33:27.988Z", - "id": "kibana_legacy_visualizations-23f94f40-596e-11ee-adef-4fe896364076", - "migrationVersion": { - "visualization": "8.5.0" - }, - "references": [ - { - "id": "logs-*", - "name": "metrics_0_index_pattern", - "type": "index-pattern" - } - ], - "type": "visualization" -} \ No newline at end of file diff --git a/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-29c51300-596e-11ee-adef-4fe896364076.json b/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-29c51300-596e-11ee-adef-4fe896364076.json deleted file mode 100644 index f32a0376e..000000000 --- a/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-29c51300-596e-11ee-adef-4fe896364076.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "attributes": { - "description": "", - "kibanaSavedObjectMeta": { - "searchSourceJSON": { - "indexRefName": "kibanaSavedObjectMeta.searchSourceJSON.index" - } - }, - "title": "Aggs-based table", - "uiStateJSON": {}, - "version": 1, - "visState": { - "aggs": [ - { - "enabled": true, - "id": "1", - "params": { - "emptyAsNull": false - }, - "schema": "metric", - "type": "count" - } - ], - "params": { - "autoFitRowToContent": false, - "perPage": 10, - "percentageCol": "", - "showMetricsAtAllLevels": false, - "showPartialRows": false, - "showToolbar": false, - "showTotal": false, - "totalFunc": "sum" - }, - "title": "Aggs-based table", - "type": "table" - } - }, - "coreMigrationVersion": "8.7.1", - "created_at": "2023-09-22T17:33:37.712Z", - "id": "kibana_legacy_visualizations-29c51300-596e-11ee-adef-4fe896364076", - "migrationVersion": { - "visualization": "8.5.0" - }, - "references": [ - { - "id": "logs-*", - "name": "kibanaSavedObjectMeta.searchSourceJSON.index", - "type": "index-pattern" - } - ], - "type": "visualization" -} \ No newline at end of file diff --git a/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-2e364fd0-596e-11ee-adef-4fe896364076.json b/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-2e364fd0-596e-11ee-adef-4fe896364076.json deleted file mode 100644 index 650dd7450..000000000 --- a/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-2e364fd0-596e-11ee-adef-4fe896364076.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "attributes": { - "description": "", - "kibanaSavedObjectMeta": { - "searchSourceJSON": { - "filter": [], - "indexRefName": "kibanaSavedObjectMeta.searchSourceJSON.index", - "query": { - "language": "kuery", - "query": "" - } - } - }, - "title": "Aggs-based tag cloud", - "uiStateJSON": {}, - "version": 1, - "visState": { - "aggs": [ - { - "enabled": true, - "id": "1", - "params": { - "emptyAsNull": false - }, - "schema": "metric", - "type": "count" - }, - { - "enabled": true, - "id": "2", - "params": { - "excludeIsRegex": true, - "field": "host.ip", - "includeIsRegex": true, - "missingBucket": false, - "missingBucketLabel": "Missing", - "order": "desc", - "orderBy": "1", - "otherBucket": false, - "otherBucketLabel": "Other", - "size": 5 - }, - "schema": "segment", - "type": "terms" - } - ], - "params": { - "maxFontSize": 72, - "minFontSize": 18, - "orientation": "single", - "palette": { - "name": "default", - "type": "palette" - }, - "scale": "linear", - "showLabel": true - }, - "title": "Aggs-based tag cloud", - "type": "tagcloud" - } - }, - "coreMigrationVersion": "8.7.1", - "created_at": "2023-09-22T17:33:45.165Z", - "id": "kibana_legacy_visualizations-2e364fd0-596e-11ee-adef-4fe896364076", - "migrationVersion": { - "visualization": "8.5.0" - }, - "references": [ - { - "id": "logs-*", - "name": "kibanaSavedObjectMeta.searchSourceJSON.index", - "type": "index-pattern" - } - ], - "type": "visualization" -} \ No newline at end of file diff --git a/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-331b3600-596e-11ee-adef-4fe896364076.json b/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-331b3600-596e-11ee-adef-4fe896364076.json deleted file mode 100644 index a74d93e89..000000000 --- a/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-331b3600-596e-11ee-adef-4fe896364076.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "attributes": { - "description": "", - "kibanaSavedObjectMeta": { - "searchSourceJSON": { - "indexRefName": "kibanaSavedObjectMeta.searchSourceJSON.index" - } - }, - "title": "Placeholder Title", - "uiStateJSON": { - "vis": { - "defaultColors": { - "0 - 65": "rgb(0,104,55)", - "130 - 195": "rgb(254,254,189)", - "195 - 260": "rgb(248,141,82)", - "65 - 130": "rgb(134,203,102)" - } - } - }, - "version": 1, - "visState": { - "aggs": [ - { - "enabled": true, - "id": "1", - "params": { - "emptyAsNull": false - }, - "schema": "metric", - "type": "count" - } - ], - "params": { - "addLegend": true, - "addTooltip": true, - "colorSchema": "Green to Red", - "colorsNumber": 4, - "colorsRange": [], - "enableHover": false, - "invertColors": false, - "legendPosition": "right", - "percentageMode": false, - "setColorRange": false, - "type": "heatmap", - "valueAxes": [ - { - "id": "ValueAxis-1", - "labels": { - "color": "black", - "overwriteColor": false, - "rotate": 0, - "show": false - }, - "scale": { - "defaultYExtents": false, - "type": "linear" - }, - "show": false, - "type": "value" - } - ] - }, - "title": "Placeholder Title", - "type": "heatmap" - } - }, - "coreMigrationVersion": "8.7.1", - "created_at": "2023-09-22T17:33:53.376Z", - "id": "kibana_legacy_visualizations-331b3600-596e-11ee-adef-4fe896364076", - "migrationVersion": { - "visualization": "8.5.0" - }, - "references": [ - { - "id": "logs-*", - "name": "kibanaSavedObjectMeta.searchSourceJSON.index", - "type": "index-pattern" - } - ], - "type": "visualization" -} \ No newline at end of file diff --git a/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-38222320-596e-11ee-adef-4fe896364076.json b/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-38222320-596e-11ee-adef-4fe896364076.json deleted file mode 100644 index f794b0e36..000000000 --- a/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-38222320-596e-11ee-adef-4fe896364076.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "attributes": { - "description": "", - "kibanaSavedObjectMeta": { - "searchSourceJSON": {} - }, - "title": "Timelion time series", - "uiStateJSON": {}, - "version": 1, - "visState": { - "aggs": [], - "params": { - "expression": ".es(*)", - "interval": "auto" - }, - "title": "Timelion time series", - "type": "timelion" - } - }, - "coreMigrationVersion": "8.7.1", - "created_at": "2023-09-22T17:34:01.811Z", - "id": "kibana_legacy_visualizations-38222320-596e-11ee-adef-4fe896364076", - "migrationVersion": { - "visualization": "8.5.0" - }, - "references": [], - "type": "visualization" -} \ No newline at end of file diff --git a/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-e6e022a0-596d-11ee-adef-4fe896364076.json b/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-e6e022a0-596d-11ee-adef-4fe896364076.json deleted file mode 100644 index fcb3d02ea..000000000 --- a/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-e6e022a0-596d-11ee-adef-4fe896364076.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "attributes": { - "description": "", - "kibanaSavedObjectMeta": { - "searchSourceJSON": { - "filter": [], - "query": { - "language": "kuery", - "query": "" - } - } - }, - "title": "Legacy input control vis", - "uiStateJSON": {}, - "version": 1, - "visState": { - "aggs": [], - "params": { - "controls": [ - { - "fieldName": "agent.id", - "id": "1695403260945", - "indexPatternRefName": "control_0_index_pattern", - "label": "I'm a control", - "options": { - "dynamicOptions": true, - "multiselect": true, - "order": "desc", - "size": 5, - "type": "terms" - }, - "parent": "", - "type": "list" - } - ], - "pinFilters": false, - "updateFiltersOnChange": true, - "useTimeFilter": false - }, - "title": "Legacy input control vis", - "type": "input_control_vis" - } - }, - "coreMigrationVersion": "8.7.1", - "created_at": "2023-09-22T17:31:45.482Z", - "id": "kibana_legacy_visualizations-e6e022a0-596d-11ee-adef-4fe896364076", - "migrationVersion": { - "visualization": "8.5.0" - }, - "references": [ - { - "id": "logs-*", - "name": "control_0_index_pattern", - "type": "index-pattern" - } - ], - "type": "visualization" -} \ No newline at end of file diff --git a/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-ee3370c0-596d-11ee-adef-4fe896364076.json b/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-ee3370c0-596d-11ee-adef-4fe896364076.json deleted file mode 100644 index 6ecd80f41..000000000 --- a/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-ee3370c0-596d-11ee-adef-4fe896364076.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "attributes": { - "description": "", - "kibanaSavedObjectMeta": { - "searchSourceJSON": { - "filter": [], - "query": { - "language": "kuery", - "query": "" - } - } - }, - "title": "Placeholder Title", - "uiStateJSON": {}, - "version": 1, - "visState": { - "aggs": [], - "params": { - "fontSize": 12, - "markdown": "# The Good", - "openLinksInNewTab": false - }, - "title": "Placeholder Title", - "type": "markdown" - } - }, - "coreMigrationVersion": "8.7.1", - "created_at": "2023-09-22T17:31:57.772Z", - "id": "kibana_legacy_visualizations-ee3370c0-596d-11ee-adef-4fe896364076", - "migrationVersion": { - "visualization": "8.5.0" - }, - "references": [], - "type": "visualization" -} \ No newline at end of file diff --git a/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-f9920df0-596d-11ee-adef-4fe896364076.json b/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-f9920df0-596d-11ee-adef-4fe896364076.json deleted file mode 100644 index 1031f5e91..000000000 --- a/test/packages/kibana_legacy_visualizations/kibana/visualization/kibana_legacy_visualizations-f9920df0-596d-11ee-adef-4fe896364076.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "attributes": { - "description": "", - "kibanaSavedObjectMeta": { - "searchSourceJSON": {} - }, - "title": "Vega time series", - "uiStateJSON": {}, - "version": 1, - "visState": { - "aggs": [], - "params": { - "spec": "{\n/*\n\nWelcome to Vega visualizations. Here you can design your own dataviz from scratch using a declarative language called Vega, or its simpler form Vega-Lite. In Vega, you have the full control of what data is loaded, even from multiple sources, how that data is transformed, and what visual elements are used to show it. Use help icon to view Vega examples, tutorials, and other docs. Use the wrench icon to reformat this text, or to remove comments.\n\nThis example graph shows the document count in all indexes in the current time range. You might need to adjust the time filter in the upper right corner.\n*/\n\n $schema: https://vega.github.io/schema/vega-lite/v5.json\n title: Event counts from all indexes\n\n // Define the data source\n data: {\n url: {\n/*\nAn object instead of a string for the \"url\" param is treated as an Elasticsearch query. Anything inside this object is not part of the Vega language, but only understood by Kibana and Elasticsearch server. This query counts the number of documents per time interval, assuming you have a @timestamp field in your data.\n\nKibana has a special handling for the fields surrounded by \"%\". They are processed before the the query is sent to Elasticsearch. This way the query becomes context aware, and can use the time range and the dashboard filters.\n*/\n\n // Apply dashboard context filters when set\n %context%: true\n // Filter the time picker (upper right corner) with this field\n %timefield%: @timestamp\n\n/*\nSee .search() documentation for : https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-search\n*/\n\n // Which index to search\n index: _all\n // Aggregate data by the time field into time buckets, counting the number of documents in each bucket.\n body: {\n aggs: {\n time_buckets: {\n date_histogram: {\n // Use date histogram aggregation on @timestamp field\n field: @timestamp\n // The interval value will depend on the daterange picker (true), or use an integer to set an approximate bucket count\n interval: {%autointerval%: true}\n // Make sure we get an entire range, even if it has no data\n extended_bounds: {\n // Use the current time range's start and end\n min: {%timefilter%: \"min\"}\n max: {%timefilter%: \"max\"}\n }\n // Use this for linear (e.g. line, area) graphs. Without it, empty buckets will not show up\n min_doc_count: 0\n }\n }\n }\n // Speed up the response by only including aggregation results\n size: 0\n }\n }\n/*\nElasticsearch will return results in this format:\n\naggregations: {\n time_buckets: {\n buckets: [\n {\n key_as_string: 2015-11-30T22:00:00.000Z\n key: 1448920800000\n doc_count: 0\n },\n {\n key_as_string: 2015-11-30T23:00:00.000Z\n key: 1448924400000\n doc_count: 0\n }\n ...\n ]\n }\n}\n\nFor our graph, we only need the list of bucket values. Use the format.property to discard everything else.\n*/\n format: {property: \"aggregations.time_buckets.buckets\"}\n }\n\n // \"mark\" is the graphics element used to show our data. Other mark values are: area, bar, circle, line, point, rect, rule, square, text, and tick. See https://vega.github.io/vega-lite/docs/mark.html\n mark: line\n\n // \"encoding\" tells the \"mark\" what data to use and in what way. See https://vega.github.io/vega-lite/docs/encoding.html\n encoding: {\n x: {\n // The \"key\" value is the timestamp in milliseconds. Use it for X axis.\n field: key\n type: temporal\n axis: {title: false} // Customize X axis format\n }\n y: {\n // The \"doc_count\" is the count per bucket. Use it for Y axis.\n field: doc_count\n type: quantitative\n axis: {title: \"Document count\"}\n }\n }\n}\n" - }, - "title": "Vega time series", - "type": "vega" - } - }, - "coreMigrationVersion": "8.7.1", - "created_at": "2023-09-22T17:32:16.847Z", - "id": "kibana_legacy_visualizations-f9920df0-596d-11ee-adef-4fe896364076", - "migrationVersion": { - "visualization": "8.5.0" - }, - "references": [], - "type": "visualization" -} \ No newline at end of file From 2bed6ec10b973ab1b0941a061ad72fee9b9db024 Mon Sep 17 00:00:00 2001 From: Drew Tate Date: Wed, 27 Sep 2023 11:57:11 -0600 Subject: [PATCH 13/23] add a non-legacy visualization to good_v3 --- .../good_v3-visualization-abc-1.json | 35 +++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/test/packages/good_v3/kibana/visualization/good_v3-visualization-abc-1.json b/test/packages/good_v3/kibana/visualization/good_v3-visualization-abc-1.json index 9effeb8e9..46ae15cb6 100644 --- a/test/packages/good_v3/kibana/visualization/good_v3-visualization-abc-1.json +++ b/test/packages/good_v3/kibana/visualization/good_v3-visualization-abc-1.json @@ -1,4 +1,35 @@ { + "type": "visualization", "id": "good_v3-visualization-abc-1", - "type": "visualization" -} \ No newline at end of file + "attributes": { + "description": "", + "kibanaSavedObjectMeta": { + "searchSourceJSON": { + "filter": [], + "query": { + "language": "kuery", + "query": "" + } + } + }, + "title": "Placeholder Title", + "uiStateJSON": {}, + "version": 1, + "visState": { + "aggs": [], + "params": { + "fontSize": 12, + "markdown": "# A title", + "openLinksInNewTab": false + }, + "title": "Placeholder Title", + "type": "markdown" + } + }, + "coreMigrationVersion": "8.7.1", + "created_at": "2023-09-22T17:32:48.743Z", + "migrationVersion": { + "visualization": "8.5.0" + }, + "references": [] +} From 743c1f0088ed8345f691a8b8b3608b42ddbdec51 Mon Sep 17 00:00:00 2001 From: Drew Tate Date: Wed, 27 Sep 2023 13:26:50 -0600 Subject: [PATCH 14/23] migrate to specerrors --- ...alidate_kibana_no_legacy_visualizations.go | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go b/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go index 756203569..3cd3932bc 100644 --- a/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go +++ b/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go @@ -5,18 +5,17 @@ package semantic import ( - "fmt" "path" "github.com/elastic/kbncontent" - ve "github.com/elastic/package-spec/v2/code/go/internal/errors" "github.com/elastic/package-spec/v2/code/go/internal/fspath" "github.com/elastic/package-spec/v2/code/go/internal/pkgpath" + se "github.com/elastic/package-spec/v2/code/go/pkg/specerrors" ) // Reports legacy Kibana visualizations in a package. -func ValidateKibanaNoLegacyVisualizations(fsys fspath.FS) ve.ValidationErrors { - var errs ve.ValidationErrors +func ValidateKibanaNoLegacyVisualizations(fsys fspath.FS) se.ValidationErrors { + var errs se.ValidationErrors // Collect by-reference visualizations for reference later. // Note: this does not include Lens, Maps, or Discover. That's okay for this rule because none of those are legacy @@ -27,14 +26,14 @@ func ValidateKibanaNoLegacyVisualizations(fsys fspath.FS) ve.ValidationErrors { visJSON, err := file.Values("$") if err != nil { - errs = append(errs, fmt.Errorf("error getting JSON: %w", err)) + errs = append(errs, se.NewStructuredErrorf("error getting JSON: %w", err)) return errs } desc, err := kbncontent.DescribeVisualizationSavedObject(visJSON.(map[string]interface{})) if err != nil { - errs = append(errs, fmt.Errorf("error describing visualization saved object: %w", err)) + errs = append(errs, se.NewStructuredErrorf("error describing visualization saved object: %w", err)) } if desc.IsLegacy() { @@ -42,33 +41,33 @@ func ValidateKibanaNoLegacyVisualizations(fsys fspath.FS) ve.ValidationErrors { if result, err := desc.Editor(); err == nil { editor = result } - errs = append(errs, fmt.Errorf("file \"%s\" is invalid: found legacy visualization \"%s\" (%s, %s)", fsys.Path(file.Path()), desc.Title(), desc.SemanticType(), editor)) + errs = append(errs, se.NewStructuredErrorf("file \"%s\" is invalid: found legacy visualization \"%s\" (%s, %s)", fsys.Path(file.Path()), desc.Title(), desc.SemanticType(), editor)) } } dashboardFilePaths := path.Join("kibana", "dashboard", "*.json") dashboardFiles, err := pkgpath.Files(fsys, dashboardFilePaths) if err != nil { - errs = append(errs, fmt.Errorf("error finding Kibana dashboard files: %w", err)) + errs = append(errs, se.NewStructuredErrorf("error finding Kibana dashboard files: %w", err)) return errs } for _, file := range dashboardFiles { dashboardJSON, err := file.Values("$") if err != nil { - errs = append(errs, fmt.Errorf("error getting dashboard JSON: %w", err)) + errs = append(errs, se.NewStructuredErrorf("error getting dashboard JSON: %w", err)) return errs } dashboardTitle, err := kbncontent.GetDashboardTitle(dashboardJSON) if err != nil { - errs = append(errs, fmt.Errorf("error fetching dashboard title: %w", err)) + errs = append(errs, se.NewStructuredErrorf("error fetching dashboard title: %w", err)) return errs } visualizations, err := kbncontent.DescribeByValueDashboardPanels(dashboardJSON) if err != nil { - errs = append(errs, fmt.Errorf("error describing dashboard panels for %s: %w", fsys.Path(file.Path()), err)) + errs = append(errs, se.NewStructuredErrorf("error describing dashboard panels for %s: %w", fsys.Path(file.Path()), err)) return errs } @@ -78,7 +77,7 @@ func ValidateKibanaNoLegacyVisualizations(fsys fspath.FS) ve.ValidationErrors { if result, err := desc.Editor(); err == nil { editor = result } - err := fmt.Errorf("file \"%s\" is invalid: \"%s\" contains legacy visualization: \"%s\" (%s, %s)", fsys.Path(file.Path()), dashboardTitle, desc.Title(), desc.SemanticType(), editor) + err := se.NewStructuredErrorf("file \"%s\" is invalid: \"%s\" contains legacy visualization: \"%s\" (%s, %s)", fsys.Path(file.Path()), dashboardTitle, desc.Title(), desc.SemanticType(), editor) errs = append(errs, err) } } From 79c9f9b7456c557e275fea52d95f3335775dff4f Mon Sep 17 00:00:00 2001 From: Drew Tate Date: Wed, 27 Sep 2023 13:41:27 -0600 Subject: [PATCH 15/23] use tagged version of kbncontent --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 0a650c71d..815a69c2c 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/creasty/defaults v1.7.0 github.com/elastic/go-licenser v0.4.1 github.com/elastic/gojsonschema v1.2.1 - github.com/elastic/kbncontent v0.0.0-20230927141331-65da83fb5c8e + github.com/elastic/kbncontent v0.1.0 github.com/evanphx/json-patch/v5 v5.7.0 github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901 github.com/mitchellh/mapstructure v1.5.0 diff --git a/go.sum b/go.sum index e9ff5e512..94e139211 100644 --- a/go.sum +++ b/go.sum @@ -20,8 +20,8 @@ github.com/elastic/go-licenser v0.4.1 h1:1xDURsc8pL5zYT9R29425J3vkHdt4RT5TNEMeRN github.com/elastic/go-licenser v0.4.1/go.mod h1:V56wHMpmdURfibNBggaSBfqgPxyT1Tldns1i87iTEvU= github.com/elastic/gojsonschema v1.2.1 h1:cUMbgsz0wyEB4x7xf3zUEvUVDl6WCz2RKcQPul8OsQc= github.com/elastic/gojsonschema v1.2.1/go.mod h1:biw5eBS2Z4T02wjATMRSfecfjCmwaDPvuaqf844gLrg= -github.com/elastic/kbncontent v0.0.0-20230927141331-65da83fb5c8e h1:hTfmX6MKoim6LXMFdFOVni/QPymTATMHNVLD9XLrU5U= -github.com/elastic/kbncontent v0.0.0-20230927141331-65da83fb5c8e/go.mod h1:kOPREITK9gSJsiw/WKe7QWSO+PRiZMyEFQCw+CMLAHI= +github.com/elastic/kbncontent v0.1.0 h1:JTeGDaENizxq8PAmIHvSYVLdmfIYLz0zpUvKGau7go0= +github.com/elastic/kbncontent v0.1.0/go.mod h1:kOPREITK9gSJsiw/WKe7QWSO+PRiZMyEFQCw+CMLAHI= github.com/evanphx/json-patch/v5 v5.7.0 h1:nJqP7uwL84RJInrohHfW0Fx3awjbm8qZeFv0nW9SYGc= github.com/evanphx/json-patch/v5 v5.7.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ= github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= From e22beb9cc4533e0760563561a75a6c3b066f16b6 Mon Sep 17 00:00:00 2001 From: Drew Tate Date: Wed, 27 Sep 2023 13:47:24 -0600 Subject: [PATCH 16/23] changelog --- spec/changelog.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spec/changelog.yml b/spec/changelog.yml index 02c3fb9c7..48684d20b 100644 --- a/spec/changelog.yml +++ b/spec/changelog.yml @@ -4,6 +4,9 @@ ## - version: 3.0.0-next changes: + - description: Disallow legacy visualizations + type: breaking-change + link: https://github.com/elastic/package-spec/pull/610 - description: Validate processors used in ingest pipelines type: breaking-change link: https://github.com/elastic/package-spec/pull/586 From d05945234f44b1894be650586388c3f1d679a455 Mon Sep 17 00:00:00 2001 From: Drew Tate Date: Wed, 27 Sep 2023 13:51:55 -0600 Subject: [PATCH 17/23] update compliance module --- compliance/go.mod | 2 ++ compliance/go.sum | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/compliance/go.mod b/compliance/go.mod index 2f1c844e1..0527981db 100644 --- a/compliance/go.mod +++ b/compliance/go.mod @@ -47,6 +47,7 @@ require ( github.com/elastic/go-resource v0.1.1 // indirect github.com/elastic/go-ucfg v0.8.6 // indirect github.com/elastic/gojsonschema v1.2.1 // indirect + github.com/elastic/kbncontent v0.1.0 // indirect github.com/emicklei/go-restful/v3 v3.10.1 // indirect github.com/evanphx/json-patch v5.6.0+incompatible // indirect github.com/evanphx/json-patch/v5 v5.7.0 // indirect @@ -125,6 +126,7 @@ require ( github.com/spf13/cast v1.5.0 // indirect github.com/spf13/cobra v1.7.0 // indirect github.com/spf13/pflag v1.0.5 // indirect + github.com/stretchr/objx v0.5.1 // indirect github.com/tklauser/go-sysconf v0.3.12 // indirect github.com/tklauser/numcpus v0.6.1 // indirect github.com/ulikunitz/xz v0.5.11 // indirect diff --git a/compliance/go.sum b/compliance/go.sum index 0663eed8c..9c24fa3cc 100644 --- a/compliance/go.sum +++ b/compliance/go.sum @@ -97,6 +97,8 @@ github.com/elastic/go-ucfg v0.8.6 h1:stUeyh2goTgGX+/wb9gzKvTv0YB0231LTpKUgCKj4U0 github.com/elastic/go-ucfg v0.8.6/go.mod h1:4E8mPOLSUV9hQ7sgLEJ4bvt0KhMuDJa8joDT2QGAEKA= github.com/elastic/gojsonschema v1.2.1 h1:cUMbgsz0wyEB4x7xf3zUEvUVDl6WCz2RKcQPul8OsQc= github.com/elastic/gojsonschema v1.2.1/go.mod h1:biw5eBS2Z4T02wjATMRSfecfjCmwaDPvuaqf844gLrg= +github.com/elastic/kbncontent v0.1.0 h1:JTeGDaENizxq8PAmIHvSYVLdmfIYLz0zpUvKGau7go0= +github.com/elastic/kbncontent v0.1.0/go.mod h1:kOPREITK9gSJsiw/WKe7QWSO+PRiZMyEFQCw+CMLAHI= github.com/emicklei/go-restful/v3 v3.10.1 h1:rc42Y5YTp7Am7CS630D7JmhRjq4UlEUuEKfrDac4bSQ= github.com/emicklei/go-restful/v3 v3.10.1/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -351,8 +353,9 @@ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.1 h1:4VhoImhV/Bm0ToFkXFi8hXNXwpDRZ/ynw3amt82mzq0= +github.com/stretchr/objx v0.5.1/go.mod h1:/iHQpkQwBD6DLUmQ4pE+s1TXdob1mORJ4/UFdrifcy0= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= From 8f6cfe5718bf0265934921625ae8190eaca9fce8 Mon Sep 17 00:00:00 2001 From: Drew Tate Date: Wed, 27 Sep 2023 13:53:06 -0600 Subject: [PATCH 18/23] fix godoc --- .../semantic/validate_kibana_no_legacy_visualizations.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go b/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go index 3cd3932bc..672d08f5e 100644 --- a/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go +++ b/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go @@ -13,7 +13,7 @@ import ( se "github.com/elastic/package-spec/v2/code/go/pkg/specerrors" ) -// Reports legacy Kibana visualizations in a package. +// ValidateKibanaNoLegacyVisualizations reports legacy Kibana visualizations in a package. func ValidateKibanaNoLegacyVisualizations(fsys fspath.FS) se.ValidationErrors { var errs se.ValidationErrors From a45afc4f516e7854956446e9f143fd0a2eaf29b0 Mon Sep 17 00:00:00 2001 From: Drew Tate Date: Wed, 27 Sep 2023 14:10:14 -0600 Subject: [PATCH 19/23] remove unsafe type assertion, replace return with continue --- .../validate_kibana_no_legacy_visualizations.go | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go b/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go index 672d08f5e..5b0fd463d 100644 --- a/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go +++ b/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go @@ -27,13 +27,20 @@ func ValidateKibanaNoLegacyVisualizations(fsys fspath.FS) se.ValidationErrors { if err != nil { errs = append(errs, se.NewStructuredErrorf("error getting JSON: %w", err)) - return errs + continue } - desc, err := kbncontent.DescribeVisualizationSavedObject(visJSON.(map[string]interface{})) + visMap, ok := visJSON.(map[string]interface{}) + if !ok { + errs = append(errs, se.NewStructuredErrorf("JSON of unexpected type %T in file %s", visJSON, file.Name())) + continue + } + + desc, err := kbncontent.DescribeVisualizationSavedObject(visMap) if err != nil { errs = append(errs, se.NewStructuredErrorf("error describing visualization saved object: %w", err)) + continue } if desc.IsLegacy() { @@ -56,19 +63,19 @@ func ValidateKibanaNoLegacyVisualizations(fsys fspath.FS) se.ValidationErrors { dashboardJSON, err := file.Values("$") if err != nil { errs = append(errs, se.NewStructuredErrorf("error getting dashboard JSON: %w", err)) - return errs + continue } dashboardTitle, err := kbncontent.GetDashboardTitle(dashboardJSON) if err != nil { errs = append(errs, se.NewStructuredErrorf("error fetching dashboard title: %w", err)) - return errs + continue } visualizations, err := kbncontent.DescribeByValueDashboardPanels(dashboardJSON) if err != nil { errs = append(errs, se.NewStructuredErrorf("error describing dashboard panels for %s: %w", fsys.Path(file.Path()), err)) - return errs + continue } for _, desc := range visualizations { From 2d5adf8651ac06e89761883e4d83eb97c5924a47 Mon Sep 17 00:00:00 2001 From: Drew Tate Date: Wed, 27 Sep 2023 15:28:24 -0600 Subject: [PATCH 20/23] remove abbreviation --- ...alidate_kibana_no_legacy_visualizations.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go b/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go index 5b0fd463d..a5d8c8d4b 100644 --- a/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go +++ b/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go @@ -10,12 +10,12 @@ import ( "github.com/elastic/kbncontent" "github.com/elastic/package-spec/v2/code/go/internal/fspath" "github.com/elastic/package-spec/v2/code/go/internal/pkgpath" - se "github.com/elastic/package-spec/v2/code/go/pkg/specerrors" + "github.com/elastic/package-spec/v2/code/go/pkg/specerrors" ) // ValidateKibanaNoLegacyVisualizations reports legacy Kibana visualizations in a package. -func ValidateKibanaNoLegacyVisualizations(fsys fspath.FS) se.ValidationErrors { - var errs se.ValidationErrors +func ValidateKibanaNoLegacyVisualizations(fsys fspath.FS) specerrors.ValidationErrors { + var errs specerrors.ValidationErrors // Collect by-reference visualizations for reference later. // Note: this does not include Lens, Maps, or Discover. That's okay for this rule because none of those are legacy @@ -26,20 +26,20 @@ func ValidateKibanaNoLegacyVisualizations(fsys fspath.FS) se.ValidationErrors { visJSON, err := file.Values("$") if err != nil { - errs = append(errs, se.NewStructuredErrorf("error getting JSON: %w", err)) + errs = append(errs, specerrors.NewStructuredErrorf("error getting JSON: %w", err)) continue } visMap, ok := visJSON.(map[string]interface{}) if !ok { - errs = append(errs, se.NewStructuredErrorf("JSON of unexpected type %T in file %s", visJSON, file.Name())) + errs = append(errs, specerrors.NewStructuredErrorf("JSON of unexpected type %T in file %s", visJSON, file.Name())) continue } desc, err := kbncontent.DescribeVisualizationSavedObject(visMap) if err != nil { - errs = append(errs, se.NewStructuredErrorf("error describing visualization saved object: %w", err)) + errs = append(errs, specerrors.NewStructuredErrorf("error describing visualization saved object: %w", err)) continue } @@ -48,33 +48,33 @@ func ValidateKibanaNoLegacyVisualizations(fsys fspath.FS) se.ValidationErrors { if result, err := desc.Editor(); err == nil { editor = result } - errs = append(errs, se.NewStructuredErrorf("file \"%s\" is invalid: found legacy visualization \"%s\" (%s, %s)", fsys.Path(file.Path()), desc.Title(), desc.SemanticType(), editor)) + errs = append(errs, specerrors.NewStructuredErrorf("file \"%s\" is invalid: found legacy visualization \"%s\" (%s, %s)", fsys.Path(file.Path()), desc.Title(), desc.SemanticType(), editor)) } } dashboardFilePaths := path.Join("kibana", "dashboard", "*.json") dashboardFiles, err := pkgpath.Files(fsys, dashboardFilePaths) if err != nil { - errs = append(errs, se.NewStructuredErrorf("error finding Kibana dashboard files: %w", err)) + errs = append(errs, specerrors.NewStructuredErrorf("error finding Kibana dashboard files: %w", err)) return errs } for _, file := range dashboardFiles { dashboardJSON, err := file.Values("$") if err != nil { - errs = append(errs, se.NewStructuredErrorf("error getting dashboard JSON: %w", err)) + errs = append(errs, specerrors.NewStructuredErrorf("error getting dashboard JSON: %w", err)) continue } dashboardTitle, err := kbncontent.GetDashboardTitle(dashboardJSON) if err != nil { - errs = append(errs, se.NewStructuredErrorf("error fetching dashboard title: %w", err)) + errs = append(errs, specerrors.NewStructuredErrorf("error fetching dashboard title: %w", err)) continue } visualizations, err := kbncontent.DescribeByValueDashboardPanels(dashboardJSON) if err != nil { - errs = append(errs, se.NewStructuredErrorf("error describing dashboard panels for %s: %w", fsys.Path(file.Path()), err)) + errs = append(errs, specerrors.NewStructuredErrorf("error describing dashboard panels for %s: %w", fsys.Path(file.Path()), err)) continue } @@ -84,7 +84,7 @@ func ValidateKibanaNoLegacyVisualizations(fsys fspath.FS) se.ValidationErrors { if result, err := desc.Editor(); err == nil { editor = result } - err := se.NewStructuredErrorf("file \"%s\" is invalid: \"%s\" contains legacy visualization: \"%s\" (%s, %s)", fsys.Path(file.Path()), dashboardTitle, desc.Title(), desc.SemanticType(), editor) + err := specerrors.NewStructuredErrorf("file \"%s\" is invalid: \"%s\" contains legacy visualization: \"%s\" (%s, %s)", fsys.Path(file.Path()), dashboardTitle, desc.Title(), desc.SemanticType(), editor) errs = append(errs, err) } } From 19fe6ad526d5593b6ef3483709bb7f898e6fea83 Mon Sep 17 00:00:00 2001 From: Drew Tate Date: Wed, 27 Sep 2023 15:31:48 -0600 Subject: [PATCH 21/23] move changelog message --- spec/changelog.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/changelog.yml b/spec/changelog.yml index 48684d20b..f1f212330 100644 --- a/spec/changelog.yml +++ b/spec/changelog.yml @@ -4,9 +4,6 @@ ## - version: 3.0.0-next changes: - - description: Disallow legacy visualizations - type: breaking-change - link: https://github.com/elastic/package-spec/pull/610 - description: Validate processors used in ingest pipelines type: breaking-change link: https://github.com/elastic/package-spec/pull/586 @@ -25,7 +22,10 @@ - description: Require filter in dashboards to limit scope of queries type: breaking-change link: https://github.com/elastic/package-spec/pull/607 -- version: 2.12.1-next + - description: Disallow legacy visualizations + type: breaking-change + link: https://github.com/elastic/package-spec/pull/610 + version: 2.12.1-next changes: - description: Allow to define expected values in fields definitions. type: enhancement From db2d7583d9222199d1b956bb06ac055caa8c096b Mon Sep 17 00:00:00 2001 From: Drew Tate Date: Wed, 27 Sep 2023 17:08:56 -0600 Subject: [PATCH 22/23] print file paths --- ...alidate_kibana_no_legacy_visualizations.go | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go b/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go index a5d8c8d4b..7e1d40ea6 100644 --- a/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go +++ b/code/go/internal/validator/semantic/validate_kibana_no_legacy_visualizations.go @@ -23,23 +23,24 @@ func ValidateKibanaNoLegacyVisualizations(fsys fspath.FS) specerrors.ValidationE visFiles, _ := pkgpath.Files(fsys, visFilePaths) for _, file := range visFiles { - visJSON, err := file.Values("$") + filePath := fsys.Path(file.Path()) + visJSON, err := file.Values("$") if err != nil { - errs = append(errs, specerrors.NewStructuredErrorf("error getting JSON: %w", err)) + errs = append(errs, specerrors.NewStructuredErrorf("file \"%s\" is invalid: error getting JSON: %w", filePath, err)) continue } visMap, ok := visJSON.(map[string]interface{}) if !ok { - errs = append(errs, specerrors.NewStructuredErrorf("JSON of unexpected type %T in file %s", visJSON, file.Name())) + errs = append(errs, specerrors.NewStructuredErrorf("file \"%s\" is invalid: JSON of unexpected type %T", filePath, visJSON)) continue } desc, err := kbncontent.DescribeVisualizationSavedObject(visMap) if err != nil { - errs = append(errs, specerrors.NewStructuredErrorf("error describing visualization saved object: %w", err)) + errs = append(errs, specerrors.NewStructuredErrorf("file \"%s\" is invalid: error describing visualization saved object: %w", filePath, err)) continue } @@ -48,7 +49,7 @@ func ValidateKibanaNoLegacyVisualizations(fsys fspath.FS) specerrors.ValidationE if result, err := desc.Editor(); err == nil { editor = result } - errs = append(errs, specerrors.NewStructuredErrorf("file \"%s\" is invalid: found legacy visualization \"%s\" (%s, %s)", fsys.Path(file.Path()), desc.Title(), desc.SemanticType(), editor)) + errs = append(errs, specerrors.NewStructuredErrorf("file \"%s\" is invalid: found legacy visualization \"%s\" (%s, %s)", filePath, desc.Title(), desc.SemanticType(), editor)) } } @@ -60,21 +61,23 @@ func ValidateKibanaNoLegacyVisualizations(fsys fspath.FS) specerrors.ValidationE } for _, file := range dashboardFiles { + filePath := fsys.Path(file.Path()) + dashboardJSON, err := file.Values("$") if err != nil { - errs = append(errs, specerrors.NewStructuredErrorf("error getting dashboard JSON: %w", err)) + errs = append(errs, specerrors.NewStructuredErrorf("file \"%s\" is invalid: error getting dashboard JSON: %w", filePath, err)) continue } dashboardTitle, err := kbncontent.GetDashboardTitle(dashboardJSON) if err != nil { - errs = append(errs, specerrors.NewStructuredErrorf("error fetching dashboard title: %w", err)) + errs = append(errs, specerrors.NewStructuredErrorf("file \"%s\" is invalid: error fetching dashboard title: %w", filePath, err)) continue } visualizations, err := kbncontent.DescribeByValueDashboardPanels(dashboardJSON) if err != nil { - errs = append(errs, specerrors.NewStructuredErrorf("error describing dashboard panels for %s: %w", fsys.Path(file.Path()), err)) + errs = append(errs, specerrors.NewStructuredErrorf("file \"%s\" is invalid: error describing dashboard panels: %w", filePath, err)) continue } @@ -84,7 +87,7 @@ func ValidateKibanaNoLegacyVisualizations(fsys fspath.FS) specerrors.ValidationE if result, err := desc.Editor(); err == nil { editor = result } - err := specerrors.NewStructuredErrorf("file \"%s\" is invalid: \"%s\" contains legacy visualization: \"%s\" (%s, %s)", fsys.Path(file.Path()), dashboardTitle, desc.Title(), desc.SemanticType(), editor) + err := specerrors.NewStructuredErrorf("file \"%s\" is invalid: \"%s\" contains legacy visualization: \"%s\" (%s, %s)", filePath, dashboardTitle, desc.Title(), desc.SemanticType(), editor) errs = append(errs, err) } } From c7c951d53a4d4699d1cbf7292d417c3623f5d5d4 Mon Sep 17 00:00:00 2001 From: Drew Tate Date: Wed, 27 Sep 2023 17:14:10 -0600 Subject: [PATCH 23/23] fix changelog --- spec/changelog.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/changelog.yml b/spec/changelog.yml index f1f212330..8dde6a233 100644 --- a/spec/changelog.yml +++ b/spec/changelog.yml @@ -25,7 +25,7 @@ - description: Disallow legacy visualizations type: breaking-change link: https://github.com/elastic/package-spec/pull/610 - version: 2.12.1-next +- version: 2.12.1-next changes: - description: Allow to define expected values in fields definitions. type: enhancement