Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Discover] Remove Default Cluster #8778

Merged
merged 1 commit into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -119,19 +119,17 @@
type: 'data-source',
perPage: 10000,
});
const dataSources: DataStructure[] = [DEFAULT_DATA.STRUCTURES.LOCAL_DATASOURCE].concat(
response.savedObjects
.filter(
(savedObject) =>
typeof savedObject.attributes?.dataSourceEngineType === 'string' &&
!savedObject.attributes?.dataSourceEngineType?.includes('OpenSearch Serverless')
)
.map((savedObject) => ({
id: savedObject.id,
title: savedObject.attributes.title,
type: 'DATA_SOURCE',
}))
);
const dataSources: DataStructure[] = response.savedObjects

Check warning on line 122 in src/plugins/data/public/query/query_string/dataset_service/lib/index_type.ts

View check run for this annotation

Codecov / codecov/patch

src/plugins/data/public/query/query_string/dataset_service/lib/index_type.ts#L122

Added line #L122 was not covered by tests
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will need to fast follow on checking if local cluster is available

.filter(
(savedObject) =>
typeof savedObject.attributes?.dataSourceEngineType === 'string' &&
!savedObject.attributes?.dataSourceEngineType?.includes('OpenSearch Serverless')
)
.map((savedObject) => ({

Check warning on line 128 in src/plugins/data/public/query/query_string/dataset_service/lib/index_type.ts

View check run for this annotation

Codecov / codecov/patch

src/plugins/data/public/query/query_string/dataset_service/lib/index_type.ts#L128

Added line #L128 was not covered by tests
id: savedObject.id,
title: savedObject.attributes.title,
type: 'DATA_SOURCE',
}));

return injectMetaToDataStructures(dataSources);
};
Expand Down
10 changes: 5 additions & 5 deletions src/plugins/query_enhancements/public/datasets/s3_type.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ describe('s3TypeConfig', () => {
{ id: 'unknown', title: 'Unknown', type: 'UNKNOWN' },
]);

expect(result.children).toHaveLength(2); // Including DEFAULT_DATA.STRUCTURES.LOCAL_DATASOURCE
expect(result.children?.[1].title).toBe('DataSource 1');
expect(result.children).toHaveLength(1); // Including DEFAULT_DATA.STRUCTURES.LOCAL_DATASOURCE
expect(result.children?.[0].title).toBe('DataSource 1');
expect(result.hasNext).toBe(true);
});

Expand All @@ -171,9 +171,9 @@ describe('s3TypeConfig', () => {
{ id: 'unknown', title: 'Unknown', type: 'UNKNOWN' },
]);

expect(result.children).toHaveLength(3); // Including DEFAULT_DATA.STRUCTURES.LOCAL_DATASOURCE
expect(result.children?.[1].title).toBe('DataSource 1');
expect(result.children?.[2].title).toBe('DataSource 3');
expect(result.children).toHaveLength(2); // Including DEFAULT_DATA.STRUCTURES.LOCAL_DATASOURCE
expect(result.children?.[0].title).toBe('DataSource 1');
expect(result.children?.[1].title).toBe('DataSource 3');
expect(result.children?.some((child) => child.title === 'DataSource 2')).toBe(false);
expect(result.hasNext).toBe(true);
});
Expand Down
38 changes: 18 additions & 20 deletions src/plugins/query_enhancements/public/datasets/s3_type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,26 +196,24 @@ const fetchDataSources = async (client: SavedObjectsClientContract): Promise<Dat
type: 'data-source',
perPage: 10000,
});
const dataSources: DataStructure[] = [DEFAULT_DATA.STRUCTURES.LOCAL_DATASOURCE];
return dataSources.concat(
resp.savedObjects
.filter(
(savedObject) =>
typeof savedObject.attributes?.dataSourceEngineType === 'string' &&
!savedObject.attributes?.dataSourceEngineType?.includes('OpenSearch Serverless')
)
.map((savedObject) => ({
id: savedObject.id,
title: savedObject.attributes.title,
type: 'DATA_SOURCE',
meta: {
query: {
id: savedObject.id,
},
type: DATA_STRUCTURE_META_TYPES.CUSTOM,
} as DataStructureCustomMeta,
}))
);
const dataSources: DataStructure[] = resp.savedObjects
.filter(
(savedObject) =>
typeof savedObject.attributes?.dataSourceEngineType === 'string' &&
!savedObject.attributes?.dataSourceEngineType?.includes('OpenSearch Serverless')
)
.map((savedObject) => ({
id: savedObject.id,
title: savedObject.attributes.title,
type: 'DATA_SOURCE',
meta: {
query: {
id: savedObject.id,
},
type: DATA_STRUCTURE_META_TYPES.CUSTOM,
} as DataStructureCustomMeta,
}));
return dataSources;
};

const fetchConnections = async (
Expand Down
Loading