From 9a05de238d044894ccda4e51276ec1615af42a8b Mon Sep 17 00:00:00 2001 From: uday biswas Date: Fri, 2 Aug 2024 15:34:32 +0530 Subject: [PATCH 01/10] folder path resolved --- .../project-file-explorer.component.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Analysim.Web/ClientApp/src/app/projects/project-file-explorer/project-file-explorer.component.ts b/src/Analysim.Web/ClientApp/src/app/projects/project-file-explorer/project-file-explorer.component.ts index 43f348b..678b23c 100644 --- a/src/Analysim.Web/ClientApp/src/app/projects/project-file-explorer/project-file-explorer.component.ts +++ b/src/Analysim.Web/ClientApp/src/app/projects/project-file-explorer/project-file-explorer.component.ts @@ -59,14 +59,17 @@ export class ProjectFileExplorerComponent implements OnInit { this.dataBrowserURL = 'https://observablehq.com/embed/@sfsu/untitled?cell=*&dataset='; this.currentDirectory = this.extractDirectory(this.router.url); this.setDirectoryFile(this.currentDirectory); - this.folders = "/ " + this.currentDirectory.split("/").join(" / "); + let directory = this.currentDirectory.endsWith('.csv') ? this.currentDirectory.split('/').slice(0, -1).join('/') : this.currentDirectory; + directory = directory.endsWith('/') ? directory.slice(0,-1) : directory; + this.folders = "/ " + directory.split("/").join(" / "); this.router.events.subscribe((ev) => { if (ev instanceof NavigationEnd) { this.currentDirectory = this.extractDirectory(this.router.url); this.setDirectoryFile(this.currentDirectory) + directory = this.currentDirectory.endsWith('.csv') ? this.currentDirectory.split('/').slice(0, -1).join('/') : this.currentDirectory; + directory = directory.endsWith('/') ? directory.slice(0,-1) : directory; } - // console.log(this.currentDirectory); - this.folders = "/ " + this.currentDirectory.split("/").join(" / "); + this.folders = "/ " + directory.split("/").join(" / "); // console.log(this.folders); }); } From f0416dd974eef3a5ad85d68a4a11d9b4268fa387 Mon Sep 17 00:00:00 2001 From: uday biswas Date: Fri, 9 Aug 2024 05:50:33 +0530 Subject: [PATCH 02/10] readme file setting --- src/Analysim.Web/ClientApp/angular.json | 1 + src/Analysim.Web/ClientApp/package-lock.json | 380 ++++++++++++++---- src/Analysim.Web/ClientApp/package.json | 5 + .../modal-upload-notebook.component.ts | 8 + ...project-notebook-item-display.component.ts | 3 +- .../projects/project/project.component.html | 9 +- .../projects/project/project.component.scss | 44 +- .../app/projects/project/project.component.ts | 71 +++- .../Controllers/ProjectController.cs | 50 +++ 9 files changed, 481 insertions(+), 90 deletions(-) diff --git a/src/Analysim.Web/ClientApp/angular.json b/src/Analysim.Web/ClientApp/angular.json index 2fb7871..19c195a 100644 --- a/src/Analysim.Web/ClientApp/angular.json +++ b/src/Analysim.Web/ClientApp/angular.json @@ -31,6 +31,7 @@ "node_modules/bootstrap/dist/css/bootstrap.min.css", "node_modules/ngx-toastr/toastr.css", "node_modules/@fortawesome/fontawesome-free/css/all.min.css", + "node_modules/highlight.js/styles/default.css", "src/styles.scss" ], "scripts": [ diff --git a/src/Analysim.Web/ClientApp/package-lock.json b/src/Analysim.Web/ClientApp/package-lock.json index 6182452..e82d36b 100644 --- a/src/Analysim.Web/ClientApp/package-lock.json +++ b/src/Analysim.Web/ClientApp/package-lock.json @@ -24,9 +24,12 @@ "d3": "^7.8.5", "file-saver": "^2.0.5", "fontawesome": "^5.6.3", + "highlight.js": "^11.10.0", "jquery": "^3.6.0", "jwt-decode": "^3.1.2", "localforage": "^1.10.0", + "marked": "^13.0.3", + "marked-highlight": "^2.1.3", "ng": "^0.0.0", "ngx-bootstrap": "^9.0.0", "ngx-toastr": "^15.0.0", @@ -48,12 +51,14 @@ "@types/jest": "^29.5.4", "@types/mocha": "^10.0.1", "@types/node": "^20.4.2", + "css-loader": "^7.1.2", "jasmine-core": "~4.1.0", "karma": "~6.3.0", "karma-chrome-launcher": "~3.1.0", "karma-coverage": "~2.2.0", "karma-jasmine": "~5.0.0", "karma-jasmine-html-reporter": "~1.7.0", + "style-loader": "^4.0.0", "typescript": "~4.7.2" } }, @@ -211,6 +216,32 @@ } } }, + "node_modules/@angular-devkit/build-angular/node_modules/css-loader": { + "version": "6.7.1", + "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-6.7.1.tgz", + "integrity": "sha512-yB5CNFa14MbPJcomwNh3wLThtkZgcNyI2bNMRt8iE5Z8Vwl7f8vQXFAzn2HDOJvtDq2NTZBUGMSUNNyrv3/+cw==", + "dev": true, + "dependencies": { + "icss-utils": "^5.1.0", + "postcss": "^8.4.7", + "postcss-modules-extract-imports": "^3.0.0", + "postcss-modules-local-by-default": "^4.0.0", + "postcss-modules-scope": "^3.0.0", + "postcss-modules-values": "^4.0.0", + "postcss-value-parser": "^4.2.0", + "semver": "^7.3.5" + }, + "engines": { + "node": ">= 12.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.0.0" + } + }, "node_modules/@angular-devkit/build-angular/node_modules/rxjs": { "version": "6.6.7", "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz", @@ -5022,29 +5053,78 @@ } }, "node_modules/css-loader": { - "version": "6.7.1", - "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-6.7.1.tgz", - "integrity": "sha512-yB5CNFa14MbPJcomwNh3wLThtkZgcNyI2bNMRt8iE5Z8Vwl7f8vQXFAzn2HDOJvtDq2NTZBUGMSUNNyrv3/+cw==", + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-7.1.2.tgz", + "integrity": "sha512-6WvYYn7l/XEGN8Xu2vWFt9nVzrCn39vKyTEFf/ExEyoksJjjSZV/0/35XPlMbpnr6VGhZIUg5yJrL8tGfes/FA==", "dev": true, "dependencies": { "icss-utils": "^5.1.0", - "postcss": "^8.4.7", - "postcss-modules-extract-imports": "^3.0.0", - "postcss-modules-local-by-default": "^4.0.0", - "postcss-modules-scope": "^3.0.0", + "postcss": "^8.4.33", + "postcss-modules-extract-imports": "^3.1.0", + "postcss-modules-local-by-default": "^4.0.5", + "postcss-modules-scope": "^3.2.0", "postcss-modules-values": "^4.0.0", "postcss-value-parser": "^4.2.0", - "semver": "^7.3.5" + "semver": "^7.5.4" }, "engines": { - "node": ">= 12.13.0" + "node": ">= 18.12.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/webpack" }, "peerDependencies": { - "webpack": "^5.0.0" + "@rspack/core": "0.x || 1.x", + "webpack": "^5.27.0" + }, + "peerDependenciesMeta": { + "@rspack/core": { + "optional": true + }, + "webpack": { + "optional": true + } + } + }, + "node_modules/css-loader/node_modules/postcss": { + "version": "8.4.40", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.40.tgz", + "integrity": "sha512-YF2kKIUzAofPMpfH6hOi2cGnv/HrUlfucspc7pDyvv7kGdqXrfj8SCl/t8owkEgKEuu8ZcRjSOxFxVLqwChZ2Q==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "nanoid": "^3.3.7", + "picocolors": "^1.0.1", + "source-map-js": "^1.2.0" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/css-loader/node_modules/semver": { + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" } }, "node_modules/css-prefers-color-scheme": { @@ -7314,6 +7394,14 @@ "integrity": "sha512-7kIufnBqdsBGcSZLPJwqHT3yhk1QTsSlFsVD3kx5ixH/AlgBs9yM1q6DPhXZ8f8gtdqgh7N7/5btRLpQsS2gHw==", "dev": true }, + "node_modules/highlight.js": { + "version": "11.10.0", + "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-11.10.0.tgz", + "integrity": "sha512-SYVnVFswQER+zu1laSya563s+F8VDGt7o35d4utbamowvUNLLMovFqwCLSocpZTz3MgaSRA1IbqRWZv97dtErQ==", + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/hosted-git-info": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-5.0.0.tgz", @@ -9424,14 +9512,22 @@ } }, "node_modules/marked": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/marked/-/marked-4.3.0.tgz", - "integrity": "sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==", + "version": "13.0.3", + "resolved": "https://registry.npmjs.org/marked/-/marked-13.0.3.tgz", + "integrity": "sha512-rqRix3/TWzE9rIoFGIn8JmsVfhiuC8VIQ8IdX5TfzmeBucdY05/0UlzKaw0eVtpcN/OdVFpBk7CjKGo9iHJ/zA==", "bin": { "marked": "bin/marked.js" }, "engines": { - "node": ">= 12" + "node": ">= 18" + } + }, + "node_modules/marked-highlight": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/marked-highlight/-/marked-highlight-2.1.3.tgz", + "integrity": "sha512-t35JWm2u8HanOJ+gSJBAYQ0Jgr3vy+gl7ORAXN8bSEQFHl5FYXH0A7YXVMrfhmKaSuBSy6LidXECn3U9Qv/dHA==", + "peerDependencies": { + "marked": ">=4 <14" } }, "node_modules/media-typer": { @@ -9737,10 +9833,16 @@ "dev": true }, "node_modules/nanoid": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz", - "integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==", + "version": "3.3.7", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", + "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], "bin": { "nanoid": "bin/nanoid.cjs" }, @@ -10013,6 +10115,17 @@ "marked": "^4.0.10" } }, + "node_modules/notebookjs/node_modules/marked": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/marked/-/marked-4.3.0.tgz", + "integrity": "sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==", + "bin": { + "marked": "bin/marked.js" + }, + "engines": { + "node": ">= 12" + } + }, "node_modules/npm-bundled": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.1.2.tgz", @@ -10718,9 +10831,9 @@ } }, "node_modules/picocolors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.1.tgz", + "integrity": "sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==", "dev": true }, "node_modules/picomatch": { @@ -11162,9 +11275,9 @@ } }, "node_modules/postcss-modules-extract-imports": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/postcss-modules-extract-imports/-/postcss-modules-extract-imports-3.0.0.tgz", - "integrity": "sha512-bdHleFnP3kZ4NYDhuGlVK+CMrQ/pqUm8bx/oGL93K6gVwiclvX5x0n76fYMKuIGKzlABOy13zsvqjb0f92TEXw==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/postcss-modules-extract-imports/-/postcss-modules-extract-imports-3.1.0.tgz", + "integrity": "sha512-k3kNe0aNFQDAZGbin48pL2VNidTF0w4/eASDsxlyspobzU3wZQLOGj7L9gfRe0Jo9/4uud09DsjFNH7winGv8Q==", "dev": true, "engines": { "node": "^10 || ^12 || >= 14" @@ -11174,9 +11287,9 @@ } }, "node_modules/postcss-modules-local-by-default": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/postcss-modules-local-by-default/-/postcss-modules-local-by-default-4.0.0.tgz", - "integrity": "sha512-sT7ihtmGSF9yhm6ggikHdV0hlziDTX7oFoXtuVWeDd3hHObNkcHRo9V3yg7vCAY7cONyxJC/XXCmmiHHcvX7bQ==", + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/postcss-modules-local-by-default/-/postcss-modules-local-by-default-4.0.5.tgz", + "integrity": "sha512-6MieY7sIfTK0hYfafw1OMEG+2bg8Q1ocHCpoWLqOKj3JXlKu4G7btkmM/B7lFubYkYWmRSPLZi5chid63ZaZYw==", "dev": true, "dependencies": { "icss-utils": "^5.0.0", @@ -11191,9 +11304,9 @@ } }, "node_modules/postcss-modules-scope": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/postcss-modules-scope/-/postcss-modules-scope-3.0.0.tgz", - "integrity": "sha512-hncihwFA2yPath8oZ15PZqvWGkWf+XUfQgUGamS4LqoP1anQLOsOJw0vr7J7IwLpoY9fatA2qiGUGmuZL0Iqlg==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/postcss-modules-scope/-/postcss-modules-scope-3.2.0.tgz", + "integrity": "sha512-oq+g1ssrsZOsx9M96c5w8laRmvEu9C3adDSjI8oTcbfkrTE8hx/zfyobUoWIxaKPO8bt6S62kxpw5GqypEw1QQ==", "dev": true, "dependencies": { "postcss-selector-parser": "^6.0.4" @@ -12555,9 +12668,9 @@ } }, "node_modules/source-map-js": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", - "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.0.tgz", + "integrity": "sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==", "dev": true, "engines": { "node": ">=0.10.0" @@ -12820,6 +12933,22 @@ "node": ">=6" } }, + "node_modules/style-loader": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/style-loader/-/style-loader-4.0.0.tgz", + "integrity": "sha512-1V4WqhhZZgjVAVJyt7TdDPZoPBPNHbekX4fWnCJL1yQukhCeZhJySUL+gL9y6sNdN95uEOS83Y55SqHcP7MzLA==", + "dev": true, + "engines": { + "node": ">= 18.12.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.27.0" + } + }, "node_modules/stylus": { "version": "0.57.0", "resolved": "https://registry.npmjs.org/stylus/-/stylus-0.57.0.tgz", @@ -14147,6 +14276,22 @@ "webpack-subresource-integrity": "5.1.0" }, "dependencies": { + "css-loader": { + "version": "6.7.1", + "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-6.7.1.tgz", + "integrity": "sha512-yB5CNFa14MbPJcomwNh3wLThtkZgcNyI2bNMRt8iE5Z8Vwl7f8vQXFAzn2HDOJvtDq2NTZBUGMSUNNyrv3/+cw==", + "dev": true, + "requires": { + "icss-utils": "^5.1.0", + "postcss": "^8.4.7", + "postcss-modules-extract-imports": "^3.0.0", + "postcss-modules-local-by-default": "^4.0.0", + "postcss-modules-scope": "^3.0.0", + "postcss-modules-values": "^4.0.0", + "postcss-value-parser": "^4.2.0", + "semver": "^7.3.5" + } + }, "rxjs": { "version": "6.6.7", "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz", @@ -15612,13 +15757,15 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/@csstools/postcss-unset-value/-/postcss-unset-value-1.0.1.tgz", "integrity": "sha512-f1G1WGDXEU/RN1TWAxBPQgQudtLnLQPyiWdtypkPC+mVYNKFKH/HYXSxH4MVNqwF8M0eDsoiU7HumJHCg/L/jg==", - "dev": true + "dev": true, + "requires": {} }, "@csstools/selector-specificity": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/@csstools/selector-specificity/-/selector-specificity-2.0.1.tgz", "integrity": "sha512-aG20vknL4/YjQF9BSV7ts4EWm/yrjagAN7OWBNmlbEOUiu0llj4OGrFoOKK3g2vey4/p2omKCoHrWtPxSwV3HA==", - "dev": true + "dev": true, + "requires": {} }, "@discoveryjs/json-ext": { "version": "0.5.7", @@ -15787,7 +15934,8 @@ "version": "14.0.3", "resolved": "https://registry.npmjs.org/@ngtools/webpack/-/webpack-14.0.3.tgz", "integrity": "sha512-PwvgCeY7mbijazovpA0ggeo81A3yzwOb8AfVD3yfGT15Z2qnEVyL+05Tj6ttRTngceF3gsERamFcB6lRKdcjdw==", - "dev": true + "dev": true, + "requires": {} }, "@nodelib/fs.scandir": { "version": "2.1.5", @@ -16689,7 +16837,8 @@ "version": "1.8.0", "resolved": "https://registry.npmjs.org/acorn-import-assertions/-/acorn-import-assertions-1.8.0.tgz", "integrity": "sha512-m7VZ3jwz4eK6A4Vtt8Ew1/mNbP24u0FhdyfA7fSvnJR6LMdfOYnmuIrrJAgrYfYJ10F/otaHTtrtrtmHdMNzEw==", - "dev": true + "dev": true, + "requires": {} }, "acorn-walk": { "version": "7.2.0", @@ -17089,7 +17238,8 @@ "bootstrap": { "version": "4.6.2", "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-4.6.2.tgz", - "integrity": "sha512-51Bbp/Uxr9aTuy6ca/8FbFloBUJZLHwnhTcnjIeRn2suQWsWzcuJhGjKDB5eppVte/8oCdOL3VuwxvZDUggwGQ==" + "integrity": "sha512-51Bbp/Uxr9aTuy6ca/8FbFloBUJZLHwnhTcnjIeRn2suQWsWzcuJhGjKDB5eppVte/8oCdOL3VuwxvZDUggwGQ==", + "requires": {} }, "bootstrap-icons": { "version": "1.11.3", @@ -17738,26 +17888,46 @@ } }, "css-loader": { - "version": "6.7.1", - "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-6.7.1.tgz", - "integrity": "sha512-yB5CNFa14MbPJcomwNh3wLThtkZgcNyI2bNMRt8iE5Z8Vwl7f8vQXFAzn2HDOJvtDq2NTZBUGMSUNNyrv3/+cw==", + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-7.1.2.tgz", + "integrity": "sha512-6WvYYn7l/XEGN8Xu2vWFt9nVzrCn39vKyTEFf/ExEyoksJjjSZV/0/35XPlMbpnr6VGhZIUg5yJrL8tGfes/FA==", "dev": true, "requires": { "icss-utils": "^5.1.0", - "postcss": "^8.4.7", - "postcss-modules-extract-imports": "^3.0.0", - "postcss-modules-local-by-default": "^4.0.0", - "postcss-modules-scope": "^3.0.0", + "postcss": "^8.4.33", + "postcss-modules-extract-imports": "^3.1.0", + "postcss-modules-local-by-default": "^4.0.5", + "postcss-modules-scope": "^3.2.0", "postcss-modules-values": "^4.0.0", "postcss-value-parser": "^4.2.0", - "semver": "^7.3.5" + "semver": "^7.5.4" + }, + "dependencies": { + "postcss": { + "version": "8.4.40", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.40.tgz", + "integrity": "sha512-YF2kKIUzAofPMpfH6hOi2cGnv/HrUlfucspc7pDyvv7kGdqXrfj8SCl/t8owkEgKEuu8ZcRjSOxFxVLqwChZ2Q==", + "dev": true, + "requires": { + "nanoid": "^3.3.7", + "picocolors": "^1.0.1", + "source-map-js": "^1.2.0" + } + }, + "semver": { + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "dev": true + } } }, "css-prefers-color-scheme": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/css-prefers-color-scheme/-/css-prefers-color-scheme-6.0.3.tgz", "integrity": "sha512-4BqMbZksRkJQx2zAjrokiGMd07RqOa2IxIrrN10lyBe9xhn9DEvjUK79J6jkeiv9D9hQFXKb6g1jwU62jziJZA==", - "dev": true + "dev": true, + "requires": {} }, "css-select": { "version": "4.3.0", @@ -19337,6 +19507,11 @@ "integrity": "sha512-7kIufnBqdsBGcSZLPJwqHT3yhk1QTsSlFsVD3kx5ixH/AlgBs9yM1q6DPhXZ8f8gtdqgh7N7/5btRLpQsS2gHw==", "dev": true }, + "highlight.js": { + "version": "11.10.0", + "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-11.10.0.tgz", + "integrity": "sha512-SYVnVFswQER+zu1laSya563s+F8VDGt7o35d4utbamowvUNLLMovFqwCLSocpZTz3MgaSRA1IbqRWZv97dtErQ==" + }, "hosted-git-info": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-5.0.0.tgz", @@ -19513,7 +19688,8 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/icss-utils/-/icss-utils-5.1.0.tgz", "integrity": "sha512-soFhflCVWLfRNOPU3iv5Z9VUdT44xFRbzjLsEzSr5AQmgqPMTHdU3PMT1Cf1ssx8fLNJDA1juftYl+PUcv3MqA==", - "dev": true + "dev": true, + "requires": {} }, "ieee754": { "version": "1.2.1", @@ -20318,7 +20494,8 @@ "ws": { "version": "7.5.9", "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", - "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==" + "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", + "requires": {} } } }, @@ -20542,7 +20719,8 @@ "version": "1.7.0", "resolved": "https://registry.npmjs.org/karma-jasmine-html-reporter/-/karma-jasmine-html-reporter-1.7.0.tgz", "integrity": "sha512-pzum1TL7j90DTE86eFt48/s12hqwQuiD+e5aXx2Dc9wDEn2LfGq6RoAxEZZjFiN0RDSCOnosEKRZWxbQ+iMpQQ==", - "dev": true + "dev": true, + "requires": {} }, "karma-source-map-support": { "version": "1.4.0", @@ -20932,9 +21110,15 @@ } }, "marked": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/marked/-/marked-4.3.0.tgz", - "integrity": "sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==" + "version": "13.0.3", + "resolved": "https://registry.npmjs.org/marked/-/marked-13.0.3.tgz", + "integrity": "sha512-rqRix3/TWzE9rIoFGIn8JmsVfhiuC8VIQ8IdX5TfzmeBucdY05/0UlzKaw0eVtpcN/OdVFpBk7CjKGo9iHJ/zA==" + }, + "marked-highlight": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/marked-highlight/-/marked-highlight-2.1.3.tgz", + "integrity": "sha512-t35JWm2u8HanOJ+gSJBAYQ0Jgr3vy+gl7ORAXN8bSEQFHl5FYXH0A7YXVMrfhmKaSuBSy6LidXECn3U9Qv/dHA==", + "requires": {} }, "media-typer": { "version": "0.3.0", @@ -21159,9 +21343,9 @@ "dev": true }, "nanoid": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz", - "integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==", + "version": "3.3.7", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", + "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", "dev": true }, "needle": { @@ -21362,6 +21546,13 @@ "dompurify": "^2.2.9", "jsdom": "^16.6.0", "marked": "^4.0.10" + }, + "dependencies": { + "marked": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/marked/-/marked-4.3.0.tgz", + "integrity": "sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==" + } } }, "npm-bundled": { @@ -21908,9 +22099,9 @@ "dev": true }, "picocolors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.1.tgz", + "integrity": "sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==", "dev": true }, "picomatch": { @@ -22089,13 +22280,15 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/postcss-font-variant/-/postcss-font-variant-5.0.0.tgz", "integrity": "sha512-1fmkBaCALD72CK2a9i468mA/+tr9/1cBxRRMXOUaZqO43oWPR5imcyPjXwuv7PXbCid4ndlP5zWhidQVVa3hmA==", - "dev": true + "dev": true, + "requires": {} }, "postcss-gap-properties": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/postcss-gap-properties/-/postcss-gap-properties-3.0.3.tgz", "integrity": "sha512-rPPZRLPmEKgLk/KlXMqRaNkYTUpE7YC+bOIQFN5xcu1Vp11Y4faIXv6/Jpft6FMnl6YRxZqDZG0qQOW80stzxQ==", - "dev": true + "dev": true, + "requires": {} }, "postcss-image-set-function": { "version": "4.0.6", @@ -22121,7 +22314,8 @@ "version": "4.0.1", "resolved": "https://registry.npmjs.org/postcss-initial/-/postcss-initial-4.0.1.tgz", "integrity": "sha512-0ueD7rPqX8Pn1xJIjay0AZeIuDoF+V+VvMt/uOnn+4ezUKhZM/NokDeP6DwMNyIoYByuN/94IQnt5FEkaN59xQ==", - "dev": true + "dev": true, + "requires": {} }, "postcss-lab-function": { "version": "4.2.0", @@ -22148,24 +22342,27 @@ "version": "5.0.4", "resolved": "https://registry.npmjs.org/postcss-logical/-/postcss-logical-5.0.4.tgz", "integrity": "sha512-RHXxplCeLh9VjinvMrZONq7im4wjWGlRJAqmAVLXyZaXwfDWP73/oq4NdIp+OZwhQUMj0zjqDfM5Fj7qby+B4g==", - "dev": true + "dev": true, + "requires": {} }, "postcss-media-minmax": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/postcss-media-minmax/-/postcss-media-minmax-5.0.0.tgz", "integrity": "sha512-yDUvFf9QdFZTuCUg0g0uNSHVlJ5X1lSzDZjPSFaiCWvjgsvu8vEVxtahPrLMinIDEEGnx6cBe6iqdx5YWz08wQ==", - "dev": true + "dev": true, + "requires": {} }, "postcss-modules-extract-imports": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/postcss-modules-extract-imports/-/postcss-modules-extract-imports-3.0.0.tgz", - "integrity": "sha512-bdHleFnP3kZ4NYDhuGlVK+CMrQ/pqUm8bx/oGL93K6gVwiclvX5x0n76fYMKuIGKzlABOy13zsvqjb0f92TEXw==", - "dev": true + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/postcss-modules-extract-imports/-/postcss-modules-extract-imports-3.1.0.tgz", + "integrity": "sha512-k3kNe0aNFQDAZGbin48pL2VNidTF0w4/eASDsxlyspobzU3wZQLOGj7L9gfRe0Jo9/4uud09DsjFNH7winGv8Q==", + "dev": true, + "requires": {} }, "postcss-modules-local-by-default": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/postcss-modules-local-by-default/-/postcss-modules-local-by-default-4.0.0.tgz", - "integrity": "sha512-sT7ihtmGSF9yhm6ggikHdV0hlziDTX7oFoXtuVWeDd3hHObNkcHRo9V3yg7vCAY7cONyxJC/XXCmmiHHcvX7bQ==", + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/postcss-modules-local-by-default/-/postcss-modules-local-by-default-4.0.5.tgz", + "integrity": "sha512-6MieY7sIfTK0hYfafw1OMEG+2bg8Q1ocHCpoWLqOKj3JXlKu4G7btkmM/B7lFubYkYWmRSPLZi5chid63ZaZYw==", "dev": true, "requires": { "icss-utils": "^5.0.0", @@ -22174,9 +22371,9 @@ } }, "postcss-modules-scope": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/postcss-modules-scope/-/postcss-modules-scope-3.0.0.tgz", - "integrity": "sha512-hncihwFA2yPath8oZ15PZqvWGkWf+XUfQgUGamS4LqoP1anQLOsOJw0vr7J7IwLpoY9fatA2qiGUGmuZL0Iqlg==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/postcss-modules-scope/-/postcss-modules-scope-3.2.0.tgz", + "integrity": "sha512-oq+g1ssrsZOsx9M96c5w8laRmvEu9C3adDSjI8oTcbfkrTE8hx/zfyobUoWIxaKPO8bt6S62kxpw5GqypEw1QQ==", "dev": true, "requires": { "postcss-selector-parser": "^6.0.4" @@ -22211,13 +22408,15 @@ "version": "3.0.3", "resolved": "https://registry.npmjs.org/postcss-overflow-shorthand/-/postcss-overflow-shorthand-3.0.3.tgz", "integrity": "sha512-CxZwoWup9KXzQeeIxtgOciQ00tDtnylYIlJBBODqkgS/PU2jISuWOL/mYLHmZb9ZhZiCaNKsCRiLp22dZUtNsg==", - "dev": true + "dev": true, + "requires": {} }, "postcss-page-break": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/postcss-page-break/-/postcss-page-break-3.0.4.tgz", "integrity": "sha512-1JGu8oCjVXLa9q9rFTo4MbeeA5FMe00/9C7lN4va606Rdb+HkxXtXsmEDrIraQ11fGz/WvKWa8gMuCKkrXpTsQ==", - "dev": true + "dev": true, + "requires": {} }, "postcss-place": { "version": "7.0.4", @@ -22294,7 +22493,8 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/postcss-replace-overflow-wrap/-/postcss-replace-overflow-wrap-4.0.0.tgz", "integrity": "sha512-KmF7SBPphT4gPPcKZc7aDkweHiKEEO8cla/GjcBK+ckKxiZslIu3C4GCRW3DNfL0o7yW7kMQu9xlZ1kXRXLXtw==", - "dev": true + "dev": true, + "requires": {} }, "postcss-selector-not": { "version": "5.0.0", @@ -22855,7 +23055,8 @@ "version": "3.5.2", "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", - "dev": true + "dev": true, + "requires": {} }, "json-schema-traverse": { "version": "0.4.1", @@ -23191,9 +23392,9 @@ "dev": true }, "source-map-js": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", - "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.0.tgz", + "integrity": "sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==", "dev": true }, "source-map-loader": { @@ -23403,6 +23604,13 @@ "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", "dev": true }, + "style-loader": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/style-loader/-/style-loader-4.0.0.tgz", + "integrity": "sha512-1V4WqhhZZgjVAVJyt7TdDPZoPBPNHbekX4fWnCJL1yQukhCeZhJySUL+gL9y6sNdN95uEOS83Y55SqHcP7MzLA==", + "dev": true, + "requires": {} + }, "stylus": { "version": "0.57.0", "resolved": "https://registry.npmjs.org/stylus/-/stylus-0.57.0.tgz", @@ -23561,7 +23769,8 @@ "version": "3.5.2", "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", - "dev": true + "dev": true, + "requires": {} }, "json-schema-traverse": { "version": "0.4.1", @@ -23981,7 +24190,8 @@ "version": "3.5.2", "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", - "dev": true + "dev": true, + "requires": {} }, "json-schema-traverse": { "version": "0.4.1", @@ -24081,7 +24291,8 @@ "version": "8.8.0", "resolved": "https://registry.npmjs.org/ws/-/ws-8.8.0.tgz", "integrity": "sha512-JDAgSYQ1ksuwqfChJusw1LSJ8BizJ2e/vVu5Lxjq3YvNJNlROv1ui4i+c/kUUrPheBvQl4c5UbERhTwKa6QBJQ==", - "dev": true + "dev": true, + "requires": {} } } }, @@ -24222,7 +24433,8 @@ "version": "8.2.3", "resolved": "https://registry.npmjs.org/ws/-/ws-8.2.3.tgz", "integrity": "sha512-wBuoj1BDpC6ZQ1B7DWQBYVLphPWkm8i9Y0/3YdHjHKHiohOJ1ws+3OccDWtH+PoC9DZD5WOTrJvNbWvjS6JWaA==", - "dev": true + "dev": true, + "requires": {} }, "xml-name-validator": { "version": "3.0.0", diff --git a/src/Analysim.Web/ClientApp/package.json b/src/Analysim.Web/ClientApp/package.json index c6d9c61..31f13ba 100644 --- a/src/Analysim.Web/ClientApp/package.json +++ b/src/Analysim.Web/ClientApp/package.json @@ -26,9 +26,12 @@ "d3": "^7.8.5", "file-saver": "^2.0.5", "fontawesome": "^5.6.3", + "highlight.js": "^11.10.0", "jquery": "^3.6.0", "jwt-decode": "^3.1.2", "localforage": "^1.10.0", + "marked": "^13.0.3", + "marked-highlight": "^2.1.3", "ng": "^0.0.0", "ngx-bootstrap": "^9.0.0", "ngx-toastr": "^15.0.0", @@ -50,12 +53,14 @@ "@types/jest": "^29.5.4", "@types/mocha": "^10.0.1", "@types/node": "^20.4.2", + "css-loader": "^7.1.2", "jasmine-core": "~4.1.0", "karma": "~6.3.0", "karma-chrome-launcher": "~3.1.0", "karma-coverage": "~2.2.0", "karma-jasmine": "~5.0.0", "karma-jasmine-html-reporter": "~1.7.0", + "style-loader": "^4.0.0", "typescript": "~4.7.2" } } diff --git a/src/Analysim.Web/ClientApp/src/app/projects/project-overview/project-overview-view/project-content/modal-upload-notebook/modal-upload-notebook.component.ts b/src/Analysim.Web/ClientApp/src/app/projects/project-overview/project-overview-view/project-content/modal-upload-notebook/modal-upload-notebook.component.ts index 6eec719..57112dc 100644 --- a/src/Analysim.Web/ClientApp/src/app/projects/project-overview/project-overview-view/project-content/modal-upload-notebook/modal-upload-notebook.component.ts +++ b/src/Analysim.Web/ClientApp/src/app/projects/project-overview/project-overview-view/project-content/modal-upload-notebook/modal-upload-notebook.component.ts @@ -35,6 +35,7 @@ export class ModalUploadNotebookComponent implements OnInit { @Input() currentDirectory: string; ngOnInit(): void { + // console.log(this.project); this.showCreateNotebook = true; this.notebookName = new FormControl('', [Validators.required, Validators.minLength(1), Validators.maxLength(20)]); @@ -70,6 +71,13 @@ export class ModalUploadNotebookComponent implements OnInit { } addNotebook() { + + for(let notebook of this.project.notebooks){ + if(notebook.name.toLowerCase() === this.notebookName.value.toLowerCase() && notebook.extension === ".ipynb"){ + alert("Notebook name must be unique"); + return; + } + } if (this.showCreateNotebook) { this.notebook = { 'file': this.file, diff --git a/src/Analysim.Web/ClientApp/src/app/projects/project-overview/project-overview-view/project-content/project-notebook-item/project-notebook-item-display/project-notebook-item-display.component.ts b/src/Analysim.Web/ClientApp/src/app/projects/project-overview/project-overview-view/project-content/project-notebook-item/project-notebook-item-display/project-notebook-item-display.component.ts index f563bd3..7e4791f 100644 --- a/src/Analysim.Web/ClientApp/src/app/projects/project-overview/project-overview-view/project-content/project-notebook-item/project-notebook-item-display/project-notebook-item-display.component.ts +++ b/src/Analysim.Web/ClientApp/src/app/projects/project-overview/project-overview-view/project-content/project-notebook-item/project-notebook-item-display/project-notebook-item-display.component.ts @@ -57,7 +57,7 @@ export class ProjectNotebookItemDisplayComponent { console.log("some unknown error occurred , please open the notebook again."); alert("some unknown error occurred , please open the notebook again."); } - }, 25000); + }, 30000); } loadNotebook() { @@ -67,6 +67,7 @@ export class ProjectNotebookItemDisplayComponent { this.projectService.getNotebookFile(this.notebook, this.version) .subscribe(nbContent => { + // console.log("the notebook content is : ", nbContent); const notebookName = `${this.notebook.name}${this.notebook.extension}`; const notebookData = { content: nbContent, // The content of the notebook diff --git a/src/Analysim.Web/ClientApp/src/app/projects/project/project.component.html b/src/Analysim.Web/ClientApp/src/app/projects/project/project.component.html index 9b546bf..c3fcba3 100644 --- a/src/Analysim.Web/ClientApp/src/app/projects/project/project.component.html +++ b/src/Analysim.Web/ClientApp/src/app/projects/project/project.component.html @@ -99,7 +99,10 @@

- +
+ +
+
Go to Readme
@@ -288,4 +291,6 @@

--> + diff --git a/src/Analysim.Web/ClientApp/src/app/projects/project/project.component.scss b/src/Analysim.Web/ClientApp/src/app/projects/project/project.component.scss index 03e91e9..315c05d 100644 --- a/src/Analysim.Web/ClientApp/src/app/projects/project/project.component.scss +++ b/src/Analysim.Web/ClientApp/src/app/projects/project/project.component.scss @@ -34,7 +34,7 @@ // } -.project-overview-container { +:host ::ng-deep .project-overview-container { border: 1px solid rgba(0,0,0,.125); padding-top: 20px; @@ -42,6 +42,47 @@ padding: 0px 20px; } + .project-notebook-row{ + /* Jupyter Notebook-like styling */ + .notebook-readme{ + max-height: 100vh; + overflow: hidden; + -webkit-mask-image: linear-gradient(rgb(0, 0, 0) 70%, transparent); + mask-image: linear-gradient(rgb(0, 0, 0) 70%, transparent); + } + +.notebook-cell pre code div { + background: #cfc8c8; + padding: 10px; +} +.notebook-cell pre{ + padding: 10px; +} +.notebook-cell img { + max-width: 100%; + height: auto; +} + +pre code.hljs{display:block;overflow-x:auto;padding:1em} +code.hljs{padding:3px 5px} +.hljs{background:#f3f3f3;color:#444} +.hljs-comment{color:#697070} +.hljs-punctuation,.hljs-tag{color:#444a} +.hljs-tag .hljs-attr,.hljs-tag .hljs-name{color:#444} +.hljs-attribute,.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-name,.hljs-selector-tag{font-weight:700}.hljs-deletion,.hljs-number,.hljs-quote,.hljs-selector-class,.hljs-selector-id,.hljs-string,.hljs-template-tag,.hljs-type{color:#800}.hljs-section,.hljs-title{color:#800;font-weight:700}.hljs-link,.hljs-operator,.hljs-regexp,.hljs-selector-attr,.hljs-selector-pseudo,.hljs-symbol,.hljs-template-variable,.hljs-variable{color:#ab5656}.hljs-literal{color:#695}.hljs-addition,.hljs-built_in,.hljs-bullet,.hljs-code{color:#397300}.hljs-meta{color:#1f7199}.hljs-meta .hljs-string{color:#38a}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:700} + } + .readme-button{ + margin: auto; + width: max-content; + padding: 8px; + color: white; + background-color: var(--button-background-color) !important; + border-radius: 5px; + margin-top:-20px; + margin-bottom: 30px; + cursor: pointer; + } + .project-detail-row { .project-description { width: 70%; @@ -325,3 +366,4 @@ } } } + diff --git a/src/Analysim.Web/ClientApp/src/app/projects/project/project.component.ts b/src/Analysim.Web/ClientApp/src/app/projects/project/project.component.ts index 15220a9..20afe0a 100644 --- a/src/Analysim.Web/ClientApp/src/app/projects/project/project.component.ts +++ b/src/Analysim.Web/ClientApp/src/app/projects/project/project.component.ts @@ -9,6 +9,8 @@ import { ProjectFileExplorerComponent } from '../project-file-explorer/project-f import { ProjectUser } from 'src/app/interfaces/project-user'; import { BsModalService, BsModalRef } from 'ngx-bootstrap/modal'; import { DomSanitizer, SafeUrl } from '@angular/platform-browser'; +import { marked, Marked } from 'marked'; +import hljs from 'highlight.js'; @Component({ @@ -43,6 +45,10 @@ export class ProjectComponent implements OnInit { fileDirectory: string forkedFrom: Project = null profileImageUrls: { [key: string]: SafeUrl } = {}; + notebookContent: any; + versions: number[] = []; + latestVersion: number = 1; + readmeNotebook: any; toggleMoreOption: boolean = false toggleNotebookExpand: boolean = false @@ -69,7 +75,7 @@ export class ProjectComponent implements OnInit { this.projectService.getProjectByRoute(owner, projectname).subscribe( result => { this.project = result - //console.log("project is : ", this.project); + // console.log("project is : ", this.project); this.loadProfileImages(); this.forkedFrom = null if (this.project.forkedFromProjectID != 0) { @@ -79,10 +85,25 @@ export class ProjectComponent implements OnInit { } ) } - console.log(this.project.forkedFromProjectID) + // console.log(this.project.forkedFromProjectID) if (this.currentUser != null && this.project.projectUsers.find(x => x.userID == this.currentUser.id) != undefined) { this.projectUser = this.project.projectUsers.find(x => x.userID == this.currentUser.id) } + this.readmeNotebook = result.notebooks.filter((notebook) => notebook.name.toLowerCase() === "readme")[0]; + this.projectService.getNotebookVersions(result.notebooks.filter((notebook) => notebook.name.toLowerCase() === "readme")[0]).subscribe(versions => { + this.versions = versions; + //console.log("Versions: ", this.versions); + if (this.versions.length > 0) { + this.latestVersion = this.versions[0]; // Default to the latest version + } + // console.log("the loatest version : ", this.latestVersion); + }); + // console.log("readme file is : ", result.notebooks.filter((notebook) => notebook.name.toLowerCase() === "readme")[0]); + this.projectService.getNotebookFile(result.notebooks.filter((notebook) => notebook.name.toLowerCase() === "readme")[0], this.latestVersion).subscribe( + notebookJson => { + this.notebookContent = this.sanitizer.bypassSecurityTrustHtml(this.renderNotebook(notebookJson)); + // console.log("the notebook content is : ", this.notebookContent); + }); } ) @@ -120,12 +141,58 @@ export class ProjectComponent implements OnInit { }) } + ngAfterViewInit() { + // hljs.registerLanguage('python', python); + hljs.highlightAll(); + } + ngOnChanges(changes: SimpleChanges): void { if (changes['project']) { this.loadProfileImages(); } } + navigateToNotebook() { + // https://localhost:5001/project/uday-bi/testing-readme/notebook/readme?isNotebook=true¬ebookId=93&version=0 + this.router.navigate([this.router.url + "/notebook/" + this.readmeNotebook.name], { + queryParams: { + isNotebook: true, + notebookId: this.readmeNotebook.notebookID, + version: this.latestVersion, + }, queryParamsHandling: 'merge' + }); + } + + renderNotebook(notebookJson: any): string { + // Simple rendering of the notebook. Customize as needed. + let htmlContent = '
'; + for (const cell of notebookJson.cells) { + htmlContent += '
'; + if (cell.cell_type === 'markdown') { + htmlContent += marked(cell.source.join('')); + } else if (cell.cell_type === 'code') { + htmlContent += '
' + hljs.highlight(cell.source.join(''), {language: 'python'}).value + '
'; + if (cell.outputs) { + for (const output of cell.outputs) { + if (output.data && output.data['text/html']) { + htmlContent += output.data['text/html'].join(''); + } else if (output.data && output.data['image/png']) { + htmlContent += ``; + } else if (output.data && output.data['text/plain']) { + htmlContent += '
' + output.data['text/plain'].join('') + '
'; + } + else if (output.text) { + htmlContent += '
' + output.text.join('') + '
'; + } + } + } + } + htmlContent += '
'; + } + htmlContent += '
'; + return htmlContent; + } + loadProfileImages(): void { if (this.project && this.project.projectUsers) { this.project.projectUsers.forEach(member => { diff --git a/src/Analysim.Web/Controllers/ProjectController.cs b/src/Analysim.Web/Controllers/ProjectController.cs index 154ead8..1e31e33 100644 --- a/src/Analysim.Web/Controllers/ProjectController.cs +++ b/src/Analysim.Web/Controllers/ProjectController.cs @@ -563,6 +563,56 @@ await _dbContext.ProjectTags.AddRangeAsync( // Save Changes await _dbContext.SaveChangesAsync(); + //uploading a readme file + var readmeContent = new + { + cells = new[] + { + new + { + cell_type = "markdown", + metadata = new { }, + source = new[] { $"# Hello, this is Readme file of {formdata.Name}" } + } + }, + metadata = new { }, + nbformat = 4, + nbformat_minor = 2 + }; + + var readmeJson = System.Text.Json.JsonSerializer.Serialize(readmeContent); + var readmeFileContent = System.Text.Encoding.UTF8.GetBytes(readmeJson); + + Notebook readmeNotebook = new Notebook + { + Container = "notebook-" + newProject.Name.ToLower(), + Name = "readme", + Directory = "notebook/", + Extension = ".ipynb", + Uri = "", + Size = readmeFileContent.Length, + DateCreated = DateTime.UtcNow, + LastModified = DateTime.UtcNow, + ProjectID = newProject.ProjectID, + type = "new" + }; + + await _dbContext.Notebook.AddAsync(readmeNotebook); + await _dbContext.SaveChangesAsync(); + + NotebookContent readmeNotebookContent = new NotebookContent + { + NotebookID = readmeNotebook.NotebookID, + Version = 1, + Content = readmeFileContent, + Author = "hello", + Size = readmeFileContent.Length, + DateCreated = DateTime.UtcNow + }; + + await _dbContext.NotebookContent.AddAsync(readmeNotebookContent); + await _dbContext.SaveChangesAsync(); + // Return Ok Request return Ok(new { From 02b4f6aaf89253cf5b26d31b4ef5c4e9a05b8e5c Mon Sep 17 00:00:00 2001 From: uday biswas Date: Tue, 20 Aug 2024 09:17:11 +0530 Subject: [PATCH 03/10] readme file errors resolved --- .../src/app/projects/project/project.component.html | 10 ++++++---- .../src/app/projects/project/project.component.ts | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Analysim.Web/ClientApp/src/app/projects/project/project.component.html b/src/Analysim.Web/ClientApp/src/app/projects/project/project.component.html index c3fcba3..fd028ba 100644 --- a/src/Analysim.Web/ClientApp/src/app/projects/project/project.component.html +++ b/src/Analysim.Web/ClientApp/src/app/projects/project/project.component.html @@ -98,16 +98,18 @@

+
-
-
Go to Readme
+
+
More...
Date: Tue, 20 Aug 2024 09:50:30 +0530 Subject: [PATCH 04/10] resolved conflict --- .../ClientApp/src/app/projects/project/project.component.html | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Analysim.Web/ClientApp/src/app/projects/project/project.component.html b/src/Analysim.Web/ClientApp/src/app/projects/project/project.component.html index fd028ba..e901193 100644 --- a/src/Analysim.Web/ClientApp/src/app/projects/project/project.component.html +++ b/src/Analysim.Web/ClientApp/src/app/projects/project/project.component.html @@ -294,5 +294,4 @@

--> From 0e5f5807905a73622bb814b14fc2f8302d765148 Mon Sep 17 00:00:00 2001 From: uday biswas Date: Tue, 20 Aug 2024 09:57:34 +0530 Subject: [PATCH 05/10] resolved conflict --- .../ClientApp/src/app/projects/project/project.component.html | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Analysim.Web/ClientApp/src/app/projects/project/project.component.html b/src/Analysim.Web/ClientApp/src/app/projects/project/project.component.html index e901193..4c885af 100644 --- a/src/Analysim.Web/ClientApp/src/app/projects/project/project.component.html +++ b/src/Analysim.Web/ClientApp/src/app/projects/project/project.component.html @@ -293,5 +293,4 @@

Date: Sat, 24 Aug 2024 05:17:42 +0530 Subject: [PATCH 07/10] updated readme notebook more button --- .../project-file-explorer.component.ts | 2 +- .../projects/project/project.component.html | 10 ++++---- .../projects/project/project.component.scss | 4 ++++ .../app/projects/project/project.component.ts | 23 +++++++++---------- 4 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/Analysim.Web/ClientApp/src/app/projects/project-file-explorer/project-file-explorer.component.ts b/src/Analysim.Web/ClientApp/src/app/projects/project-file-explorer/project-file-explorer.component.ts index 678b23c..3674a31 100644 --- a/src/Analysim.Web/ClientApp/src/app/projects/project-file-explorer/project-file-explorer.component.ts +++ b/src/Analysim.Web/ClientApp/src/app/projects/project-file-explorer/project-file-explorer.component.ts @@ -57,7 +57,7 @@ export class ProjectFileExplorerComponent implements OnInit { async ngOnInit() { this.dataBrowserURL = 'https://observablehq.com/embed/@sfsu/untitled?cell=*&dataset='; - this.currentDirectory = this.extractDirectory(this.router.url); + this.currentDirectory = this.extractDirectory(this.router.url).slice(5); this.setDirectoryFile(this.currentDirectory); let directory = this.currentDirectory.endsWith('.csv') ? this.currentDirectory.split('/').slice(0, -1).join('/') : this.currentDirectory; directory = directory.endsWith('/') ? directory.slice(0,-1) : directory; diff --git a/src/Analysim.Web/ClientApp/src/app/projects/project/project.component.html b/src/Analysim.Web/ClientApp/src/app/projects/project/project.component.html index 4c885af..787e8d6 100644 --- a/src/Analysim.Web/ClientApp/src/app/projects/project/project.component.html +++ b/src/Analysim.Web/ClientApp/src/app/projects/project/project.component.html @@ -99,18 +99,18 @@

-
+

-
More...
+
{{isFull ? 'Read Less..' : 'Read More..'}}
-