From 0de148693d0f1d46900ef934df18835aa8c447b2 Mon Sep 17 00:00:00 2001 From: Eslam Ashraf Date: Tue, 21 May 2024 17:12:46 +0300 Subject: [PATCH 01/27] Update .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 2213a448..d9a30af0 100644 --- a/.gitignore +++ b/.gitignore @@ -56,3 +56,4 @@ Thumbs.db /cypress/screenshots/ /uiLicenseReport.json +.angular/ From 29618d8910eea3590665a54340c196de7b4f8a67 Mon Sep 17 00:00:00 2001 From: Eslam Ashraf Date: Tue, 21 May 2024 22:15:36 +0300 Subject: [PATCH 02/27] add edit celll present type --- package-lock.json | 32 ++++++------------- .../edit-notebook.component.html | 12 +++++-- .../edit-notebook/edit-notebook.component.ts | 9 +++++- .../nb-cell/nb-cell.component.html | 8 +++++ .../nb-cell/nb-cell.component.ts | 2 ++ .../edit-notebook/notebook-wrapper.ts | 16 ++++++++++ .../notebooks/models/notebook.model.ts | 1 + 7 files changed, 55 insertions(+), 25 deletions(-) diff --git a/package-lock.json b/package-lock.json index cc620e98..ec6b7872 100644 --- a/package-lock.json +++ b/package-lock.json @@ -52,6 +52,7 @@ "ngx-perfect-scrollbar": "^8.0.0", "ngx-plyr": "^4.0.0", "plyr": "^3.6.3", + "prismjs": "1.29.0", "rxjs": "^6.5.5", "rxjs-compat": "^6.5.5", "sass": "^1.26.3", @@ -3200,17 +3201,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/ansi-html": { - "version": "0.0.9", - "resolved": "https://registry.npmjs.org/ansi-html/-/ansi-html-0.0.9.tgz", - "integrity": "sha512-ozbS3LuenHVxNRh/wdnN16QapUHzauqSomAl1jwwJRRsGwFwtj644lIhxfWu0Fy0acCij2+AEgHvjscq3dlVXg==", - "engines": [ - "node >= 0.8.0" - ], - "bin": { - "ansi-html": "bin/ansi-html" - } - }, "node_modules/ansi-regex": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", @@ -4754,9 +4744,12 @@ "integrity": "sha1-AMYIq33Nk4l8AAllGx06jh5zu9E=" }, "node_modules/component-emitter": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", - "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==" + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.1.tgz", + "integrity": "sha512-T0+barUSQRTUQASh8bx02dl+DhF54GtIDY13Y3m9oWTklKbb3Wv974meRpeZ3lp1JpLVECWWNHC4vaG2XHXouQ==", + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, "node_modules/component-inherit": { "version": "0.0.3", @@ -21396,11 +21389,6 @@ "type-fest": "^0.21.3" } }, - "ansi-html": { - "version": "0.0.9", - "resolved": "https://registry.npmjs.org/ansi-html/-/ansi-html-0.0.9.tgz", - "integrity": "sha512-ozbS3LuenHVxNRh/wdnN16QapUHzauqSomAl1jwwJRRsGwFwtj644lIhxfWu0Fy0acCij2+AEgHvjscq3dlVXg==" - }, "ansi-regex": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", @@ -22690,9 +22678,9 @@ "integrity": "sha1-AMYIq33Nk4l8AAllGx06jh5zu9E=" }, "component-emitter": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", - "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==" + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.1.tgz", + "integrity": "sha512-T0+barUSQRTUQASh8bx02dl+DhF54GtIDY13Y3m9oWTklKbb3Wv974meRpeZ3lp1JpLVECWWNHC4vaG2XHXouQ==" }, "component-inherit": { "version": "0.0.3", diff --git a/src/app/plugins/notebooks/components/edit-notebook/edit-notebook.component.html b/src/app/plugins/notebooks/components/edit-notebook/edit-notebook.component.html index 8063de8b..deee7c0b 100644 --- a/src/app/plugins/notebooks/components/edit-notebook/edit-notebook.component.html +++ b/src/app/plugins/notebooks/components/edit-notebook/edit-notebook.component.html @@ -146,7 +146,13 @@ - +
@@ -180,6 +186,7 @@

{{name}}

[isFirst]="i === 0" [isLast]="i === nb.cells.length-1" [selectedCellType]="selectedCellType" + [selectedPresentType]="selectedPresentType" [(mode)]="mode" [namespaces]="namespaces" [nbLanguage]="kernelSpec?.spec?.language || 'python'" @@ -190,7 +197,8 @@

{{name}}

(duplicate)="duplicateCell(cell.id)" (delete)="deleteCell($event)" (selected)="selectCell($event)" - (changeType)="onTypeChange($event)"> + (changeType)="onTypeChange($event)" + (ChangePresent)="onPresentChange($event)">
diff --git a/src/app/plugins/notebooks/components/edit-notebook/edit-notebook.component.ts b/src/app/plugins/notebooks/components/edit-notebook/edit-notebook.component.ts index a42e76b2..b957a6a5 100644 --- a/src/app/plugins/notebooks/components/edit-notebook/edit-notebook.component.ts +++ b/src/app/plugins/notebooks/components/edit-notebook/edit-notebook.component.ts @@ -22,7 +22,7 @@ import {WebuiSettingsService} from '../../../../services/webui-settings.service' import {ModalDirective} from 'ngx-bootstrap/modal'; import {CdkDragDrop, moveItemInArray} from '@angular/cdk/drag-drop'; import {NbCellComponent} from './nb-cell/nb-cell.component'; -import {CellType, NotebookWrapper} from './notebook-wrapper'; +import {CellType, NotebookWrapper,PresentType} from './notebook-wrapper'; import {delay, mergeMap, take, tap} from 'rxjs/operators'; import {LoadingScreenService} from '../../../../components/loading-screen/loading-screen.service'; import {FormControl, FormGroup, Validators} from '@angular/forms'; @@ -44,6 +44,7 @@ export class EditNotebookComponent implements OnInit, OnChanges, OnDestroy { private subscriptions = new Subscription(); selectedCell: NotebookCell; selectedCellType: CellType = 'code'; + selectedPresentType: string='skip'; busyCellIds = new Set(); mode: NbMode = 'command'; namespaces: string[] = []; @@ -533,6 +534,7 @@ export class EditNotebookComponent implements OnInit, OnChanges, OnDestroy { if (id !== unselectId) { this.selectedComponent?.editor?.blur(); this.selectedCell = this.nb.getCell(id); + this.selectedPresentType=this.nb.getCellPresent(this.selectedCell); if (this.selectedCell) { this.selectedCellType = this.nb.getCellType(this.selectedCell); this.scrollCellIntoView(id); @@ -709,6 +711,11 @@ export class EditNotebookComponent implements OnInit, OnChanges, OnDestroy { const type: CellType = (event.target as HTMLOptionElement).value; this.setCellType(type); } + onPresentChange(event: Event) { + const type: PresentType = (event.target as HTMLOptionElement).value; + this.selectedPresentType = type; + this.nb.changeCellPresent(this.selectedCell, type); + } setCellType(type: CellType) { const oldType = this.selectedCell.cell_type; diff --git a/src/app/plugins/notebooks/components/edit-notebook/nb-cell/nb-cell.component.html b/src/app/plugins/notebooks/components/edit-notebook/nb-cell/nb-cell.component.html index def88971..9a61409b 100644 --- a/src/app/plugins/notebooks/components/edit-notebook/nb-cell/nb-cell.component.html +++ b/src/app/plugins/notebooks/components/edit-notebook/nb-cell/nb-cell.component.html @@ -10,6 +10,14 @@ +
-
- -
- -
- -
- -
-
-
-

{{name}}

-
- -
-
- -
-
-
- [ ]: - {{getPreviewText(cell)}} + + +
+

{{name}}

+
+ +
+
+ +
+
+
+ [ ]: + {{getPreviewText(cell)}} +
+
-
-
- + +
+ +

The Selected Kernel No Longer Exists

+

You can either close the notebook (you can save your changes if you want), or start a new kernel

+ + +
- -

The Selected Kernel No Longer Exists

-

You can either close the notebook (you can save your changes if you want), or start a new kernel

- - -
+
+ + +