Skip to content

Remove support for legacy notebooks #2406

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

Merged
merged 2 commits into from
Apr 8, 2025
Merged
Changes from 1 commit
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
30 changes: 7 additions & 23 deletions public/components/notebooks/components/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,29 +95,13 @@

// Fetches path and id for all stored notebooks
fetchNotebooks = () => {
if (this.props.dataSourceEnabled) {
// If `MDS` is enabled, only fetch from the first endpoint.
return this.props.http
.get(`${NOTEBOOKS_API_PREFIX}/savedNotebook`)
.then((savedNotebooksResponse) => {
this.setState({ data: savedNotebooksResponse.data });
})
.catch((err) => {
console.error('Issue in fetching the notebooks', err.body.message);
});
}
// If `MDS` is not enabled /savedNotebook API returns notebooks stored as saved objects, and the other one returns notebooks stored as observability objects.
// ${NOTEBOOKS_API_PREFIX}/savedNotebook: this point to new notebooks saved in saved objects
// ${NOTEBOOKS_API_PREFIX}/: this point to old notebooks saved in observability index
return Promise.all([
this.props.http.get(`${NOTEBOOKS_API_PREFIX}/savedNotebook`),
this.props.http.get(`${NOTEBOOKS_API_PREFIX}/`),
Copy link
Member

Choose a reason for hiding this comment

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

should this route also be removed?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, removed all legacy ones here: 7a7adae

])
.then(([savedNotebooksResponse, secondResponse]) => {
const combinedData = {
data: [...savedNotebooksResponse.data, ...secondResponse.data],
};
this.setState(combinedData);
// Notebooks plugin only supports savedNotebooks stored in .kibana
// The support for notebooks in .opensearch-observability is removed in OSD 3.0.0 version
// Related Issue: https://github.com/opensearch-project/dashboards-observability/issues/2350
return this.props.http
.get(`${NOTEBOOKS_API_PREFIX}/savedNotebook`)
.then((savedNotebooksResponse) => {
this.setState({ data: savedNotebooksResponse.data });
})
.catch((err) => {
console.error('Issue in fetching the notebooks', err.body.message);
Expand Down Expand Up @@ -156,7 +140,7 @@
};

// Renames an existing notebook
renameNotebook = async (editedNoteName: string, editedNoteID: string): Promise<any> => {

Check warning on line 143 in public/components/notebooks/components/main.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
if (editedNoteName.length >= 50 || editedNoteName.length === 0) {
this.setToast('Invalid notebook name', 'danger');
return;
Expand Down Expand Up @@ -427,7 +411,7 @@
body: JSON.stringify({ visIds }),
})
.then((res) => {
const newData = res.body.map((notebook: any) => ({

Check warning on line 414 in public/components/notebooks/components/main.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
path: notebook.name,
id: notebook.id,
dateCreated: notebook.dateCreated,
Expand All @@ -438,7 +422,7 @@
}));
});
this.setToast(`Sample notebooks successfully added.`);
} catch (err: any) {

Check warning on line 425 in public/components/notebooks/components/main.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
this.setToast('Error adding sample notebooks.', 'danger');
console.error(err.body.message);
} finally {
Expand Down
Loading