Skip to content

Commit

Permalink
[Canvas] Remove sample data (#197733)
Browse files Browse the repository at this point in the history
## Summary

Removes the Canvas sample data from `main` (9.0).

Some async feedback
[here](#197733 (comment))

### For maintainers

- [x] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#_add_your_labels)
  • Loading branch information
thomasneirynck authored Oct 31, 2024
1 parent 92430b5 commit 0ad421b
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 2,607 deletions.
26 changes: 1 addition & 25 deletions test/api_integration/apis/home/sample_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@ export default function ({ getService }: FtrProviderContext) {
* @see {@link src/plugins/home/server/services/sample_data/data_sets/flights/index.ts}
*/
const FLIGHTS_OVERVIEW_DASHBOARD_ID = '7adfa750-4c81-11e8-b3d7-01146121b73d';
const FLIGHTS_CANVAS_APPLINK_PATH =
'/app/canvas#/workpad/workpad-a474e74b-aedc-47c3-894a-db77e62c41e0'; // includes default ID of the flights canvas applink path

const includesPathInAppLinks = (appLinks: Array<{ path: string }>, path: string): boolean => {
return appLinks.some((item) => item.path === path);
};

describe('sample data apis', () => {
before(async () => {
Expand All @@ -52,12 +46,7 @@ export default function ({ getService }: FtrProviderContext) {

const flightsData = findFlightsData(resp);
expect(flightsData.status).to.be('not_installed');
// Check and make sure the sample dataset reflects the default object IDs, because no sample data objects exist.
// Instead of checking each object ID, we check the dashboard and canvas app link as representatives.
expect(flightsData.overviewDashboard).to.be(FLIGHTS_OVERVIEW_DASHBOARD_ID);
expect(includesPathInAppLinks(flightsData.appLinks, FLIGHTS_CANVAS_APPLINK_PATH)).to.be(
true
);
});
});

Expand All @@ -79,7 +68,7 @@ export default function ({ getService }: FtrProviderContext) {

expect(resp.body).to.eql({
elasticsearchIndicesCreated: { kibana_sample_data_flights: 13014 },
kibanaSavedObjectsLoaded: 8,
kibanaSavedObjectsLoaded: 7,
});
});

Expand Down Expand Up @@ -136,19 +125,11 @@ export default function ({ getService }: FtrProviderContext) {

const flightsData = findFlightsData(resp);
expect(flightsData.status).to.be('installed');
// Check and make sure the sample dataset reflects the existing object IDs in each space.
// Instead of checking each object ID, we check the dashboard and canvas app link as representatives.
if (space === 'default') {
expect(flightsData.overviewDashboard).to.be(FLIGHTS_OVERVIEW_DASHBOARD_ID);
expect(includesPathInAppLinks(flightsData.appLinks, FLIGHTS_CANVAS_APPLINK_PATH)).to.be(
true
);
} else {
// the sample data objects installed in the 'other' space had their IDs regenerated upon import
expect(flightsData.overviewDashboard).not.to.be(FLIGHTS_OVERVIEW_DASHBOARD_ID);
expect(includesPathInAppLinks(flightsData.appLinks, FLIGHTS_CANVAS_APPLINK_PATH)).to.be(
false
);
}
});
});
Expand Down Expand Up @@ -186,12 +167,7 @@ export default function ({ getService }: FtrProviderContext) {

const flightsData = findFlightsData(resp);
expect(flightsData.status).to.be('not_installed');
// Check and make sure the sample dataset reflects the default object IDs, because no sample data objects exist.
// Instead of checking each object ID, we check the dashboard and canvas app link as representatives.
expect(flightsData.overviewDashboard).to.be(FLIGHTS_OVERVIEW_DASHBOARD_ID);
expect(includesPathInAppLinks(flightsData.appLinks, FLIGHTS_CANVAS_APPLINK_PATH)).to.be(
true
);
});
});
}
Expand Down
6 changes: 0 additions & 6 deletions x-pack/plugins/canvas/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import { ReportingServerPluginSetup } from '@kbn/reporting-server';
import { getCanvasFeature } from './feature';
import { initRoutes } from './routes';
import { registerCanvasUsageCollector } from './collectors';
import { loadSampleData } from './sample_data';
import { setupInterpreter } from './setup_interpreter';
import { customElementType, workpadTypeFactory, workpadTemplateType } from './saved_objects';
import type { CanvasSavedObjectTypeMigrationsDeps } from './saved_objects/migrations';
Expand Down Expand Up @@ -82,11 +81,6 @@ export class CanvasPlugin implements Plugin {
logger: this.logger,
});

loadSampleData(
plugins.home.sampleData.addSavedObjectsToSampleDataset,
plugins.home.sampleData.addAppLinksToSampleDataset
);

const getIndexForType = (type: string) =>
coreSetup
.getStartServices()
Expand Down
Loading

0 comments on commit 0ad421b

Please sign in to comment.