Skip to content

Commit 422fb18

Browse files
committed
Update to define breaking changes in yml
Signed-off-by: Andre Kurait <[email protected]>
1 parent 8810d0f commit 422fb18

File tree

6 files changed

+74
-196
lines changed

6 files changed

+74
-196
lines changed

_data/migration-assistant/breaking-changes.yml

+6-22
Original file line numberDiff line numberDiff line change
@@ -42,30 +42,14 @@ breaking_changes:
4242
comp: []
4343
transformation:
4444
title: "Type Mapping Deprecation"
45-
url: "/migration-assistant/migration-phases/planning-your-migration/handling-type-mapping-deprecation/"
46-
- title: "Elasticsearch 6.0 Breaking Changes"
47-
url: "https://www.elastic.co/guide/en/elasticsearch/reference/6.8/breaking-changes-6.0.html"
48-
introducedIn: "Elasticsearch 6.8"
49-
comp: []
50-
- title: "Elasticsearch 6.2 Breaking Changes"
51-
url: "https://wwwhttps://www.elastic.co/guide/en/elasticsearch/reference/6.8/breaking-changes-6.2.html"
52-
introducedIn: "Elasticsearch 6.8"
53-
comp: []
54-
- title: "Elasticsearch 6.3 Breaking Changes"
55-
url: "https://www.elastic.co/guide/en/elasticsearch/reference/6.8/breaking-changes-6.3.html"
56-
introducedIn: "Elasticsearch 6.8"
57-
comp: []
58-
- title: "Elasticsearch 6.4 Breaking Changes"
59-
url: "https://www.elastic.co/guide/en/elasticsearch/reference/6.8/breaking-changes-6.4.html"
60-
introducedIn: "Elasticsearch 6.8"
61-
comp: []
62-
- title: "Elasticsearch 6.6 Breaking Changes"
63-
url: "https://www.elastic.co/guide/en/elasticsearch/reference/6.8/breaking-changes-6.6.html"
45+
url: "/docs/latest/migration-assistant/migration-phases/planning-your-migration/handling-type-mapping-deprecation/"
46+
- title: "Elasticsearch 6.0 - 6.6 Breaking Changes"
47+
url: "https://www.elastic.co/guide/en/elasticsearch/reference/6.8/breaking-changes.html"
6448
introducedIn: "Elasticsearch 6.8"
6549
comp: []
66-
- title: "Elasticsearch 6.7 Breaking Changes"
67-
url: "https://www.elastic.co/guide/en/elasticsearch/reference/6.8/breaking-changes-6.7.html"
68-
introducedIn: "Elasticsearch 6.8"
50+
- title: "Elasticsearch 7.0 - 7.10 Breaking Changes"
51+
url: "https://www.elastic.co/guide/en/elasticsearch/reference/7.10/breaking-changes.html"
52+
introducedIn: "Elasticsearch 7.10"
6953
comp: []
7054
- title: "Kibana 6 Breaking Changes"
7155
url: "https://www.elastic.co/guide/en/kibana/6.8/breaking-changes.html"

_migration-assistant/assets/js/breaking-changes-data.js

+21-15
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@
88
* - title: Display name of the breaking change
99
* - url: Link to documentation
1010
* - introducedIn: Version where the breaking change was introduced
11-
* - affects: Object with minSource and maxTarget versions
11+
* - affects (optional): Object with minSource and maxTarget versions
12+
* - minSource: Minimum source version affected
13+
* - maxTarget: Maximum target version affected
1214
* - comp: Array of components affected
13-
* - transformation: Optional object with transformation information
15+
* - transformation (optional): Optional object with transformation information
1416
*/
1517

1618
// Variables to store version ordering
@@ -165,20 +167,21 @@ function initializeMigrationData() {
165167

166168
// Function to initialize the breaking changes data from the data attribute
167169
function initializeBreakingChangesData() {
168-
const breakingChangesElement = document.getElementById('breaking-changes-data');
170+
const migrationDataElement = document.getElementById('migration-data');
169171

170-
if (breakingChangesElement && breakingChangesElement.dataset.breakingChanges) {
171-
try {
172-
// Parse the JSON data from the data attribute
173-
breakingChanges = JSON.parse(breakingChangesElement.dataset.breakingChanges);
174-
console.log('Loaded breaking changes data:', breakingChanges.length);
175-
} catch (error) {
176-
console.error('Failed to parse breaking changes data:', error);
177-
// Fallback to empty array if parsing fails
178-
breakingChanges = [];
179-
}
180-
} else {
181-
console.error('Breaking changes data element not found or empty');
172+
if (!migrationDataElement || !migrationDataElement.dataset.breakingChanges) {
173+
console.error('Breaking changes data not found in migration-data element. Make sure to add data-breaking-changes attribute.');
174+
return;
175+
}
176+
177+
try {
178+
// Parse the JSON data from the data attribute
179+
breakingChanges = JSON.parse(migrationDataElement.dataset.breakingChanges);
180+
console.log('Loaded breaking changes data:', breakingChanges.length);
181+
} catch (error) {
182+
console.error('Failed to parse breaking changes data:', error);
183+
// Fallback to empty array if parsing fails
184+
breakingChanges = [];
182185
}
183186
}
184187

@@ -187,3 +190,6 @@ document.addEventListener('DOMContentLoaded', () => {
187190
initializeMigrationData();
188191
initializeBreakingChangesData();
189192
});
193+
194+
// Export the breaking changes array for use in other modules
195+
export { breakingChanges };

_migration-assistant/assets/js/breaking-changes-filter.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* - Displays results in a formatted list
99
* - Supports bidirectional filtering of source and target versions
1010
*/
11-
import { isVersionBetween, getVersionIndex } from './breaking-changes-data.js';
11+
import { getVersionIndex, breakingChanges } from './breaking-changes-data.js';
1212
document.addEventListener('DOMContentLoaded', () => {
1313
// Wait for migration data to be initialized
1414
if (typeof initializeMigrationData === 'function') {
@@ -157,11 +157,16 @@ document.addEventListener('DOMContentLoaded', () => {
157157
// 1. The breaking change was introduced in a version that is between source and target (inclusive of target)
158158
// 2. The source version is at or after the minimum source version affected
159159
// 3. The target version is at or before the maximum target version affected
160+
161+
// Handle optional affects field by using defaults if not present
162+
const minSource = change.affects && change.affects.minSource ? change.affects.minSource : VERSIONS[0]; // Default to oldest version
163+
const maxTarget = change.affects && change.affects.maxTarget ? change.affects.maxTarget : VERSIONS[VERSIONS.length - 1]; // Default to newest version
164+
160165
const versionMatch =
161166
introducedInIdx <= targetVersionIdx && // Breaking change was introduced at or before target
162167
sourceVersionIdx < targetVersionIdx && // Valid migration path (source before target)
163-
sourceVersionIdx >= getVersionIndex(change.affects.minSource) && // Source is affected
164-
targetVersionIdx <= getVersionIndex(change.affects.maxTarget); // Target is affected
168+
sourceVersionIdx >= getVersionIndex(minSource) && // Source is affected
169+
targetVersionIdx <= getVersionIndex(maxTarget); // Target is affected
165170

166171
// For component filtering:
167172
// - Always include changes with empty comp array (default/data components)

_migration-assistant/assets/js/breaking-changes-module.js

+30-153
Original file line numberDiff line numberDiff line change
@@ -32,157 +32,8 @@ const BreakingChangesModule = (function() {
3232
let versionOrder = [];
3333
let migrationMap = { sourceToTargets: {}, targetToSources: {} };
3434

35-
// Breaking changes data
36-
const breakingChangesData = [
37-
{
38-
title: "Amazon OpenSearch Service: Upgrade Guidance",
39-
url: "https://docs.aws.amazon.com/opensearch-service/latest/developerguide/version-migration.html",
40-
introducedIn: "OpenSearch 1.3",
41-
affects: {
42-
minSource: "Elasticsearch 5.6",
43-
maxTarget: "OpenSearch 2.19"
44-
},
45-
comp: []
46-
},
47-
{
48-
title: "Amazon OpenSearch Service: Rename - Summary of changes",
49-
url: "https://docs.aws.amazon.com/opensearch-service/latest/developerguide/rename.html",
50-
introducedIn: "OpenSearch 1.3",
51-
affects: {
52-
minSource: "Elasticsearch 5.6",
53-
maxTarget: "OpenSearch 2.19"
54-
},
55-
comp: []
56-
},
57-
{
58-
title: "OpenSearch 2.0: Remove mapping types parameter",
59-
url: "/docs/latest/breaking-changes/#remove-mapping-types-parameter",
60-
introducedIn: "OpenSearch 2.19",
61-
affects: {
62-
minSource: "Elasticsearch 5.6",
63-
maxTarget: "OpenSearch 2.19"
64-
},
65-
comp: [],
66-
transformation: {
67-
title: "Type Mapping Deprecation",
68-
url: "/migration-assistant/migration-phases/planning-your-migration/handling-type-mapping-deprecation/"
69-
}
70-
},
71-
{
72-
title: "OpenSearch Notifications Plugins",
73-
url: "/breaking-changes/#add-opensearch-notifications-plugins",
74-
introducedIn: "OpenSearch 2.19",
75-
affects: {
76-
minSource: "Elasticsearch 5.6",
77-
maxTarget: "OpenSearch 2.19"
78-
},
79-
comp: []
80-
},
81-
{
82-
title: "OpenSearch 2.0: Client JDK 8 Support Dropped",
83-
url: "/docs/latest/breaking-changes/#drop-support-for-jdk-8",
84-
introducedIn: "OpenSearch 2.19",
85-
affects: {
86-
minSource: "Elasticsearch 5.6",
87-
maxTarget: "OpenSearch 2.19"
88-
},
89-
comp: []
90-
},
91-
{
92-
title: "Removal of Types in Elasticsearch 7.x",
93-
url: "https://www.elastic.co/guide/en/elasticsearch/reference/7.10/removal-of-types.html",
94-
introducedIn: "Elasticsearch 7.10",
95-
affects: {
96-
minSource: "Elasticsearch 5.6",
97-
maxTarget: "OpenSearch 2.19"
98-
},
99-
comp: [],
100-
transformation: {
101-
title: "Type Mapping Deprecation",
102-
url: "/migration-assistant/migration-phases/planning-your-migration/handling-type-mapping-deprecation/"
103-
}
104-
},
105-
{
106-
title: "Elasticsearch 6.0 Breaking Changes",
107-
url: "https://www.elastic.co/guide/en/elasticsearch/reference/6.8/breaking-changes-6.0.html",
108-
introducedIn: "Elasticsearch 6.8",
109-
affects: {
110-
minSource: "Elasticsearch 5.6",
111-
maxTarget: "OpenSearch 2.19"
112-
},
113-
comp: []
114-
},
115-
{
116-
title: "Elasticsearch 6.7 Breaking Changes",
117-
url: "https://www.elastic.co/guide/en/elasticsearch/reference/6.8/breaking-changes-6.7.html",
118-
introducedIn: "Elasticsearch 6.8",
119-
affects: {
120-
minSource: "Elasticsearch 5.6",
121-
maxTarget: "OpenSearch 2.19"
122-
},
123-
comp: []
124-
},
125-
{
126-
title: "Kibana 6.0 Breaking Changes",
127-
url: "https://www.elastic.co/guide/en/kibana/6.8/breaking-changes-6.0.html",
128-
introducedIn: "Elasticsearch 6.8",
129-
affects: {
130-
minSource: "Elasticsearch 5.6",
131-
maxTarget: "OpenSearch 2.19"
132-
},
133-
comp: ["dashboards"]
134-
},
135-
{
136-
title: "Kibana 6.3 Breaking Changes",
137-
url: "https://www.elastic.co/guide/en/kibana/6.8/release-notes-6.3.0.html#breaking-6.3.0",
138-
introducedIn: "Elasticsearch 6.8",
139-
affects: {
140-
minSource: "Elasticsearch 5.6",
141-
maxTarget: "OpenSearch 2.19"
142-
},
143-
comp: ["dashboards"]
144-
},
145-
{
146-
title: "Kibana 6.4 Breaking Changes",
147-
url: "https://www.elastic.co/guide/en/kibana/6.8/release-notes-6.4.0.html#breaking-6.4.0",
148-
introducedIn: "Elasticsearch 6.8",
149-
affects: {
150-
minSource: "Elasticsearch 5.6",
151-
maxTarget: "OpenSearch 2.19"
152-
},
153-
comp: ["dashboards"]
154-
},
155-
{
156-
title: "Kibana 6.6 Breaking Changes",
157-
url: "https://www.elastic.co/guide/en/kibana/6.8/release-notes-6.6.0.html#breaking-6.6.0",
158-
introducedIn: "Elasticsearch 6.8",
159-
affects: {
160-
minSource: "Elasticsearch 5.6",
161-
maxTarget: "OpenSearch 2.19"
162-
},
163-
comp: ["dashboards"]
164-
},
165-
{
166-
title: "Kibana 6.7 Breaking Changes",
167-
url: "https://www.elastic.co/guide/en/kibana/6.8/release-notes-6.7.0.html#breaking-6.7.0",
168-
introducedIn: "Elasticsearch 6.8",
169-
affects: {
170-
minSource: "Elasticsearch 5.6",
171-
maxTarget: "OpenSearch 2.19"
172-
},
173-
comp: ["dashboards"]
174-
},
175-
{
176-
title: "Kibana 7.0 Breaking Changes",
177-
url: "https://www.elastic.co/guide/en/kibana/7.10/breaking-changes-7.0.html",
178-
introducedIn: "Elasticsearch 7.10",
179-
affects: {
180-
minSource: "Elasticsearch 6.8",
181-
maxTarget: "OpenSearch 2.19"
182-
},
183-
comp: ["dashboards"]
184-
}
185-
];
35+
// Breaking changes data - will be loaded from the data attribute
36+
let breakingChangesData = [];
18637

18738
/**
18839
* Version Manager - Handles all version-related operations
@@ -282,11 +133,16 @@ const BreakingChangesModule = (function() {
282133
// 1. The breaking change was introduced in a version that is between source and target (inclusive of target)
283134
// 2. The source version is at or after the minimum source version affected
284135
// 3. The target version is at or before the maximum target version affected
136+
137+
// Handle optional affects field by using defaults if not present
138+
const minSource = change.affects && change.affects.minSource ? change.affects.minSource : versions[0]; // Default to oldest version
139+
const maxTarget = change.affects && change.affects.maxTarget ? change.affects.maxTarget : versions[versions.length - 1]; // Default to newest version
140+
285141
const versionMatch =
286142
introducedInIdx <= targetVersionIdx && // Breaking change was introduced at or before target
287143
sourceVersionIdx < targetVersionIdx && // Valid migration path (source before target)
288-
sourceVersionIdx >= VersionManager.getVersionIndex(change.affects.minSource) && // Source is affected
289-
targetVersionIdx <= VersionManager.getVersionIndex(change.affects.maxTarget); // Target is affected
144+
sourceVersionIdx >= VersionManager.getVersionIndex(minSource) && // Source is affected
145+
targetVersionIdx <= VersionManager.getVersionIndex(maxTarget); // Target is affected
290146

291147
// For component filtering:
292148
// - Always include changes with empty comp array (default/data components)
@@ -317,6 +173,27 @@ const BreakingChangesModule = (function() {
317173
* @param {Array} migrationPaths - Array of migration paths from YAML
318174
*/
319175
function initialize(migrationPaths) {
176+
// Get the migration data element
177+
const migrationDataElement = document.getElementById('migration-data');
178+
179+
if (!migrationDataElement) {
180+
console.error('Migration data element not found');
181+
return;
182+
}
183+
184+
// Load breaking changes data if available
185+
if (migrationDataElement.dataset.breakingChanges) {
186+
try {
187+
breakingChangesData = JSON.parse(migrationDataElement.dataset.breakingChanges);
188+
console.log('Loaded breaking changes data:', breakingChangesData.length);
189+
} catch (error) {
190+
console.error('Failed to parse breaking changes data:', error);
191+
breakingChangesData = [];
192+
}
193+
} else {
194+
console.error('Breaking changes data not found in migration-data element');
195+
breakingChangesData = [];
196+
}
320197
try {
321198
// Transform the data structure from YAML format to the expected JavaScript object format
322199
const validMigrations = migrationPaths.reduce((acc, path) => {

_migration-assistant/assets/js/breaking-changes-ui.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -283,11 +283,16 @@ const BreakingChangesUI = (function() {
283283
// 1. The breaking change was introduced in a version that is between source and target (inclusive of target)
284284
// 2. The source version is at or after the minimum source version affected
285285
// 3. The target version is at or before the maximum target version affected
286+
287+
// Handle optional affects field by using defaults if not present
288+
const minSource = change.affects && change.affects.minSource ? change.affects.minSource : VERSIONS[0]; // Default to oldest version
289+
const maxTarget = change.affects && change.affects.maxTarget ? change.affects.maxTarget : VERSIONS[VERSIONS.length - 1]; // Default to newest version
290+
286291
const versionMatch =
287292
introducedInIdx <= targetVersionIdx && // Breaking change was introduced at or before target
288293
sourceVersionIdx < targetVersionIdx && // Valid migration path (source before target)
289-
sourceVersionIdx >= getVersionIndex(change.affects.minSource) && // Source is affected
290-
targetVersionIdx <= getVersionIndex(change.affects.maxTarget); // Target is affected
294+
sourceVersionIdx >= getVersionIndex(minSource) && // Source is affected
295+
targetVersionIdx <= getVersionIndex(maxTarget); // Target is affected
291296

292297
// For component filtering:
293298
// - Always include changes with empty comp array (default/data components)

_migration-assistant/migration-phases/planning-your-migration/assessing-your-cluster-for-migration.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ Before performing any upgrade or migration, you should review any documentation
4545
</div>
4646

4747
<div id="migration-data"
48-
data-migration-paths="{{ site.data.migration-assistant.valid_migrations.migration_paths | jsonify | escape }}"
48+
data-migration-paths="{{ site.data.migration-assistant.valid_migrations.migration_paths | jsonify | escape }}"
49+
data-breaking-changes="{{ site.data.migration-assistant.breaking-changes.breaking_changes | jsonify | escape }}"
4950
style="display:none;"></div>
5051

5152
<script type="module" src="{{site.url}}{{site.baseurl}}/migration-assistant/assets/js/breaking-changes-index.js"></script>

0 commit comments

Comments
 (0)