Skip to content

Commit

Permalink
chore: hide delete option for notebook template (#19841)
Browse files Browse the repository at this point in the history
  • Loading branch information
daibhin authored Jan 18, 2024
1 parent 318907d commit e86acf7
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 38 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
52 changes: 24 additions & 28 deletions frontend/src/scenes/notebooks/NotebookMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,35 +21,31 @@ export function NotebookMenu({ shortId }: NotebookLogicProps): JSX.Element {
<LemonMenu
items={[
{
items: [
{
label: 'Export JSON',
icon: <IconExport />,
onClick: () => exportJSON(),
},
{
label: 'History',
icon: <IconClock />,
onClick: () => setShowHistory(!showHistory),
},
{
label: 'Share',
icon: <IconShare />,
onClick: () => openNotebookShareDialog({ shortId }),
},
!isLocalOnly &&
!notebook?.is_template && {
label: 'Delete',
icon: <IconDelete />,
status: 'danger',

onClick: () => {
notebooksModel.actions.deleteNotebook(shortId, notebook?.title)
router.actions.push(urls.notebooks())
},
},
],
label: 'Export JSON',
icon: <IconExport />,
onClick: () => exportJSON(),
},
{
label: 'History',
icon: <IconClock />,
onClick: () => setShowHistory(!showHistory),
},
{
label: 'Share',
icon: <IconShare />,
onClick: () => openNotebookShareDialog({ shortId }),
},
!isLocalOnly &&
!notebook?.is_template && {
label: 'Delete',
icon: <IconDelete />,
status: 'danger',

onClick: () => {
notebooksModel.actions.deleteNotebook(shortId, notebook?.title)
router.actions.push(urls.notebooks())
},
},
]}
actionable
>
Expand Down
19 changes: 9 additions & 10 deletions frontend/src/scenes/notebooks/NotebooksTable/NotebooksTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,20 @@ export function NotebooksTable(): JSX.Element {
>,
{
render: function Render(_, notebook) {
if (notebook.is_template) {
return null
}
return (
<LemonMenu
items={[
{
items: [
{
label: 'Delete',
icon: <IconDelete />,
status: 'danger',
label: 'Delete',
icon: <IconDelete />,
status: 'danger',

onClick: () => {
notebooksModel.actions.deleteNotebook(notebook.short_id, notebook?.title)
},
},
],
onClick: () => {
notebooksModel.actions.deleteNotebook(notebook.short_id, notebook?.title)
},
},
]}
actionable
Expand Down

0 comments on commit e86acf7

Please sign in to comment.