Skip to content

Commit

Permalink
initial changes for notebook
Browse files Browse the repository at this point in the history
Signed-off-by: sumukhswamy <[email protected]>
  • Loading branch information
sumukhswamy committed Jul 8, 2024
1 parent e1e81a3 commit 89f0042
Show file tree
Hide file tree
Showing 5 changed files with 358 additions and 73 deletions.
8 changes: 4 additions & 4 deletions public/components/notebooks/components/notebook.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ export class Notebook extends Component<NotebookProps, NotebookState> {
deleteParagraphButton = (para: ParaType, index: number) => {
if (index !== -1) {
return this.props.http
.delete(`${NOTEBOOKS_API_PREFIX}/paragraph`, {
.delete(`${NOTEBOOKS_API_PREFIX}/savedNotebook/paragraph`, {
query: {
noteId: this.props.openedNoteId,
paragraphId: para.uniqueId,
Expand Down Expand Up @@ -342,7 +342,7 @@ export class Notebook extends Component<NotebookProps, NotebookState> {
// Function for delete Visualization from notebook
deleteVizualization = (uniqueId: string) => {
this.props.http
.delete(`${NOTEBOOKS_API_PREFIX}/paragraph/` + this.props.openedNoteId + '/' + uniqueId)
.delete(`${NOTEBOOKS_API_PREFIX}/savedNotebook/paragraph/` + this.props.openedNoteId + '/' + uniqueId)
.then((res) => {
this.setState({ paragraphs: res.paragraphs });
this.parseAllParagraphs();
Expand Down Expand Up @@ -418,7 +418,7 @@ export class Notebook extends Component<NotebookProps, NotebookState> {
};

return this.props.http
.post(`${NOTEBOOKS_API_PREFIX}/set_paragraphs/`, {
.post(`${NOTEBOOKS_API_PREFIX}/savedNotebook/set_paragraphs/`, {
body: JSON.stringify(moveParaObj),
})
.then((_res) => this.setState({ paragraphs, parsedPara }))
Expand Down Expand Up @@ -485,7 +485,7 @@ export class Notebook extends Component<NotebookProps, NotebookState> {
};

return this.props.http
.post(`${NOTEBOOKS_API_PREFIX}/paragraph/update/run/`, {
.post(`${NOTEBOOKS_API_PREFIX}/savedNotebook/paragraph/update/run/`, {
body: JSON.stringify(paraUpdateObject),
})
.then(async (res) => {
Expand Down
11 changes: 6 additions & 5 deletions server/adaptors/notebooks/saved_object_notebook_adapter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ export function fetchNotebooks(
) {
const notebooks: any[] = [];
// console.log(savedObjectNotebooks)
savedObjectNotebooks.forEach(
(savedObject: { type: string; attributes: { savedNotebook: any } }) => {
savedObjectNotebooks.map(
(savedObject) => {
console.log(savedObject)
if (savedObject.type === 'observability-notebook' && savedObject.attributes.savedNotebook) {
notebooks.push({
dateCreated: savedObject.attributes.savedNotebook.dateCreated,
Expand All @@ -41,7 +42,7 @@ export function createNotebook(notebookName: { name: string }) {
};

return {
object: noteObject,
savedNotebook: noteObject,
};
}

Expand All @@ -56,7 +57,7 @@ export function cloneNotebook(fetchedNotebook: DefaultNotebooks, name: string) {
};

return {
object: noteObject,
savedNotebook: noteObject,
};
}

Expand All @@ -68,7 +69,7 @@ export function renameNotebook(noteBookObj: { name: string; noteId: string }) {
};

return {
object: noteObject,
savedNotebook: noteObject,
};
}

Expand Down
Loading

0 comments on commit 89f0042

Please sign in to comment.