From cacfa5ff0615c6c379bbd8864c8290696224effd Mon Sep 17 00:00:00 2001 From: roypaulin Date: Thu, 11 Apr 2024 22:20:21 +0200 Subject: [PATCH 1/3] Update extensions --- Makefile | 6 +- README.md | 1 + bin/verticapylab | 23 +- .../extensions-v2/vertica_tools/src/icon.tsx | 43 ++- .../extensions-v2/vertica_tools/src/index.ts | 92 ++++++- .../vertica_tools/src/launcher.tsx | 24 +- .../vertica_tools/style/icons/admintools.svg | 1 + .../vertica_tools/style/icons/course1.svg | 37 +++ .../style/icons/grafana-icon.svg | 1 + .../vertica_tools/style/{ => icons}/query.svg | 0 .../vertica_tools/style/icons/rocket.svg | 1 + .../vertica_tools/style/icons/vertica2.svg | 13 + .../style/{ => icons}/verticapy.svg | 0 .../vertica_tools/style/icons/vsql.svg | 1 + .../extensions-v2/vertica_tools/yarn.lock | 250 ++++++++++++++++++ docker-verticapy/requirements.txt | 2 +- 16 files changed, 465 insertions(+), 30 deletions(-) create mode 100644 docker-verticapy/extensions-v2/vertica_tools/style/icons/admintools.svg create mode 100644 docker-verticapy/extensions-v2/vertica_tools/style/icons/course1.svg create mode 100644 docker-verticapy/extensions-v2/vertica_tools/style/icons/grafana-icon.svg rename docker-verticapy/extensions-v2/vertica_tools/style/{ => icons}/query.svg (100%) create mode 100644 docker-verticapy/extensions-v2/vertica_tools/style/icons/rocket.svg create mode 100644 docker-verticapy/extensions-v2/vertica_tools/style/icons/vertica2.svg rename docker-verticapy/extensions-v2/vertica_tools/style/{ => icons}/verticapy.svg (100%) create mode 100644 docker-verticapy/extensions-v2/vertica_tools/style/icons/vsql.svg diff --git a/Makefile b/Makefile index 05d96034..baa3fffd 100644 --- a/Makefile +++ b/Makefile @@ -123,10 +123,8 @@ verticapylab-start: etc/VerticaPyLab.conf ## Start a jupyterlab fi; \ fi; \ docker container rm "$$VERTICAPYLAB_CONTAINER_NAME" >/dev/null 2>&1; \ - bin/verticapylab; \ - else \ - echo "$$VERTICAPYLAB_CONTAINER_NAME is already running"; \ - fi + fi; \ + bin/verticapylab; # this builds the image from the python base image for the purposes of # testing it locally before pushing it to dockerhub diff --git a/README.md b/README.md index 3c67f573..e377ef3e 100644 --- a/README.md +++ b/README.md @@ -157,6 +157,7 @@ A Vertica database. To get a simple single-node Vertica CE database, see the [Ve ``` make verticapylab-start ``` + Note: If the container already exists, this command will simply display the link to access verticapylab 2. Open the displayed link in a browser. 3. To stop the container: diff --git a/bin/verticapylab b/bin/verticapylab index 643ecee7..7048cdcc 100755 --- a/bin/verticapylab +++ b/bin/verticapylab @@ -31,7 +31,7 @@ function usage { exit 1 } -while getopts "p:c:i:h" opt; do +while getopts "p:c:v:i:h" opt; do case ${opt} in h) usage @@ -55,6 +55,21 @@ while getopts "p:c:i:h" opt; do esac done +# Get the basic URL and remap the hostname and port +if [[ $VERTICAPYLAB_BIND_ADDRESS == 0.0.0.0 ]]; then + url_host=$(hostname) +else + url_host="$VERTICAPYLAB_BIND_ADDRESS" +fi + +if docker exec -i "$VERTICAPYLAB_CONTAINER_NAME" true 2>/dev/null; then + echo "$VERTICAPYLAB_CONTAINER_NAME is already running" + URL=$(docker logs "$VERTICAPYLAB_CONTAINER_NAME" 2>&1 | grep -Eo 'http[s]?://[0-9.]+:8888/.*' | head -n 1 | sed "s/[0-9.]*:8888/$url_host:$VERTICAPYLAB_PORT/") + echo "Copy and paste this URL in browser:" + echo " $URL" + exit 0 +fi + if [[ ${TEST_MODE^^} == "YES" ]]; then VERTICAPYLAB_IMG_VERSION=$VERSION fi @@ -149,12 +164,6 @@ while ! docker logs -n 5 "$VERTICAPYLAB_CONTAINER_NAME" 2>&1 | grep 'Or copy and sleep 1 done -# Get the basic URL and remap the hostname and port -if [[ $VERTICAPYLAB_BIND_ADDRESS == 0.0.0.0 ]]; then - url_host=$(hostname) -else - url_host="$VERTICAPYLAB_BIND_ADDRESS" -fi URL=$(docker logs "$VERTICAPYLAB_CONTAINER_NAME" 2>&1 | grep -Eo 'http[s]?://[0-9.]+:8888/.*' | head -n 1 | sed "s/[0-9.]*:8888/$url_host:$VERTICAPYLAB_PORT/") # This checks the kernel name to set the correct command to open the link in browser, # because Linux systems will use xdg-open while MacOs will use open diff --git a/docker-verticapy/extensions-v2/vertica_tools/src/icon.tsx b/docker-verticapy/extensions-v2/vertica_tools/src/icon.tsx index 2d4c3e56..99119e3a 100644 --- a/docker-verticapy/extensions-v2/vertica_tools/src/icon.tsx +++ b/docker-verticapy/extensions-v2/vertica_tools/src/icon.tsx @@ -1,7 +1,18 @@ import { LabIcon } from '@jupyterlab/ui-components'; -import verticapyIconSvg from '../style/verticapy.svg'; -import queryIconSvg from '../style/query.svg'; +import vsqlIconSvg from '../style/icons/vsql.svg'; +import verticapyIconSvg from '../style/icons/verticapy.svg'; +import queryIconSvg from '../style/icons/query.svg'; +import admintoolsIconSvg from '../style/icons/admintools.svg'; +import course1IconSvg from '../style/icons/course1.svg'; +import grafanaIconSvg from '../style/icons/grafana-icon.svg'; +import rocketIconSvg from '../style/icons/rocket.svg'; +import verticaIconSvg from '../style/icons/vertica2.svg'; + +export const verticaIcon = new LabIcon({ + name: 'vertica:verticaicon', + svgstr: verticaIconSvg + }); export const verticapyIcon = new LabIcon({ name: 'vertica:verticapyicon', @@ -11,4 +22,30 @@ export const verticapyIcon = new LabIcon({ export const queryIcon = new LabIcon({ name: 'vertica:queryicon', svgstr: queryIconSvg -}); \ No newline at end of file +}); + +export const admintoolsIcon = new LabIcon({ + name: 'vertica:admintools', + svgstr: admintoolsIconSvg +}); + +export const vsqlIcon = new LabIcon({ + name: 'vertica:vsql', + svgstr: vsqlIconSvg +}); + +export const course1Icon = new LabIcon({ + name: 'vertica:course1', + svgstr: course1IconSvg +}); + +export const grafanaIcon = new LabIcon({ + name: 'grafana:grafanaicon', + svgstr: grafanaIconSvg +}); + +export const rocketIcon = new LabIcon({ + name: 'grafana:rocketicon', + svgstr: rocketIconSvg +}); + diff --git a/docker-verticapy/extensions-v2/vertica_tools/src/index.ts b/docker-verticapy/extensions-v2/vertica_tools/src/index.ts index 00dfd195..17875bda 100644 --- a/docker-verticapy/extensions-v2/vertica_tools/src/index.ts +++ b/docker-verticapy/extensions-v2/vertica_tools/src/index.ts @@ -9,17 +9,33 @@ import { ICommandPalette, MainAreaWidget } from '@jupyterlab/apputils'; import { IMainMenu } from '@jupyterlab/mainmenu'; import { ITranslator } from '@jupyterlab/translation'; import { launcherIcon, addIcon } from '@jupyterlab/ui-components'; - import { toArray } from '@lumino/algorithm'; import { Widget } from '@lumino/widgets'; -import { Launcher } from './launcher'; -import { verticapyIcon, queryIcon } from './icon' +import { Launcher, VERTICAPY_UI, VERTICAPY_LESSONS, VERTICA } from './launcher'; +import { verticapyIcon, queryIcon, course1Icon, grafanaIcon, rocketIcon } from './icon'; namespace CommandIDs { export const createNew = 'launcher:create'; export const openConnect = "launcher:connect"; export const openQprof = "launcher:qprof"; + export const openCourseDSE = 'launcher:open-dse'; + export const openHelp = 'launcher:open-help'; + export const openGrafanaExplorer = 'launcher:explorer'; + export const openVerticaPerformanceDashboard = 'launcher:perf' +} + +/** + * constants used by grafana commands + */ + +namespace Grafana { + // 'PORT' will be overridden by the actual port used by the grafana container + export const port = "3000"; + + export const explorerPathName = "explore"; + + export const perfDashboardPathName = "d/vertica-perf/vertica-performance-dashboard"; } const extension: JupyterFrontEndPlugin = { @@ -97,6 +113,48 @@ const extension: JupyterFrontEndPlugin = { } }); + commands.addCommand(CommandIDs.openCourseDSE, { + label: 'Data Science Essentials', + icon: course1Icon, + execute: (args: any) => { + window.open('/voila/render/demos/enablement/Data%20Science%20Essentials/Data_Science_Essentials.ipynb?', '_blank'); + } + }); + + commands.addCommand(CommandIDs.openHelp, { + label: 'Documentation', + icon: verticapyIcon, + execute: (args: any) => { + window.open('https://www.vertica.com/python/', '_blank'); + } + }); + + let grafanaUrl = new URL(window.location.href); + grafanaUrl.port = Grafana.port; + // Create grafana explorer and vertica performance dashboard urls + let explorerUrl = new URL(grafanaUrl.href); + let perfDashboardUrl = new URL(grafanaUrl.href); + explorerUrl.pathname = Grafana.explorerPathName; + perfDashboardUrl.pathname = Grafana.perfDashboardPathName; + + commands.addCommand(CommandIDs.openGrafanaExplorer, { + label: 'Grafana', + caption: 'Open Grafana', + icon: grafanaIcon, + execute: (args: any) => { + window.open(explorerUrl.href, '_blank'); + } + }); + + commands.addCommand(CommandIDs.openVerticaPerformanceDashboard, { + label: 'Performance', + caption: 'Open Performance Dashboard', + icon: rocketIcon, + execute: (args: any) => { + window.open(perfDashboardUrl.href, '_blank'); + } + }); + // Add the command to the palette if (palette) { palette.addItem({ @@ -107,13 +165,37 @@ const extension: JupyterFrontEndPlugin = { model.add({ command: CommandIDs.openConnect, - category: 'VerticaPy UI', + category: VERTICAPY_UI, rank: 1 }); model.add({ command: CommandIDs.openQprof, - category: 'VerticaPy UI', + category: VERTICAPY_UI, + rank: 2 + }); + + model.add({ + command: CommandIDs.openCourseDSE, + category: VERTICAPY_LESSONS, + rank: 1 + }); + + model.add({ + command: CommandIDs.openHelp, + category: VERTICAPY_LESSONS, + rank: 2 + }); + + model.add({ + command: CommandIDs.openGrafanaExplorer, + category: VERTICA, + rank: 1 + }); + + model.add({ + command: CommandIDs.openVerticaPerformanceDashboard, + category: VERTICA, rank: 2 }); diff --git a/docker-verticapy/extensions-v2/vertica_tools/src/launcher.tsx b/docker-verticapy/extensions-v2/vertica_tools/src/launcher.tsx index 8ec88334..81175fe6 100644 --- a/docker-verticapy/extensions-v2/vertica_tools/src/launcher.tsx +++ b/docker-verticapy/extensions-v2/vertica_tools/src/launcher.tsx @@ -8,18 +8,14 @@ import { LabIcon } from '@jupyterlab/ui-components'; import { each } from '@lumino/algorithm'; import * as React from 'react'; -import verticaIconSvg from '../style/verticapy.svg'; - -export const verticaIcon = new LabIcon({ - name: 'vertica:vertica', - svgstr: verticaIconSvg - }); +import { verticapyIcon, verticaIcon } from './icon'; /** * The known categories of launcher items and their default ordering. */ -const VERTICA_CATEGORY = 'VerticaPy UI'; -// const VERTICAPY_LESSONS = 'VerticaPy Lessons'; +export const VERTICAPY_UI = 'VerticaPy UI'; +export const VERTICAPY_LESSONS = 'VerticaPy Lessons'; +export const VERTICA = 'Vertica' export class Launcher extends JupyterlabLauncher { @@ -75,7 +71,9 @@ export class Launcher extends JupyterlabLauncher { const categories: React.ReactElement[] = []; const knownCategories = [ - VERTICA_CATEGORY, + VERTICAPY_UI, + VERTICAPY_LESSONS, + VERTICA, this._translator.__('Notebook'), this._translator.__('Console'), this._translator.__('Other') @@ -86,7 +84,13 @@ export class Launcher extends JupyterlabLauncher { each(knownCategories, (category, index) => { React.Children.forEach(launcherCategories, cat => { if (cat.key === category) { - if (cat.key === VERTICA_CATEGORY) { + if (cat.key === VERTICAPY_UI) { + cat = this.replaceCategoryIcon(cat, verticapyIcon); + } + if (cat.key === VERTICAPY_LESSONS) { + cat = this.replaceCategoryIcon(cat, verticapyIcon); + } + if (cat.key === VERTICA) { cat = this.replaceCategoryIcon(cat, verticaIcon); } categories.push(cat); diff --git a/docker-verticapy/extensions-v2/vertica_tools/style/icons/admintools.svg b/docker-verticapy/extensions-v2/vertica_tools/style/icons/admintools.svg new file mode 100644 index 00000000..e0bd2808 --- /dev/null +++ b/docker-verticapy/extensions-v2/vertica_tools/style/icons/admintools.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docker-verticapy/extensions-v2/vertica_tools/style/icons/course1.svg b/docker-verticapy/extensions-v2/vertica_tools/style/icons/course1.svg new file mode 100644 index 00000000..844d5888 --- /dev/null +++ b/docker-verticapy/extensions-v2/vertica_tools/style/icons/course1.svg @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docker-verticapy/extensions-v2/vertica_tools/style/icons/grafana-icon.svg b/docker-verticapy/extensions-v2/vertica_tools/style/icons/grafana-icon.svg new file mode 100644 index 00000000..c7ea1c5d --- /dev/null +++ b/docker-verticapy/extensions-v2/vertica_tools/style/icons/grafana-icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docker-verticapy/extensions-v2/vertica_tools/style/query.svg b/docker-verticapy/extensions-v2/vertica_tools/style/icons/query.svg similarity index 100% rename from docker-verticapy/extensions-v2/vertica_tools/style/query.svg rename to docker-verticapy/extensions-v2/vertica_tools/style/icons/query.svg diff --git a/docker-verticapy/extensions-v2/vertica_tools/style/icons/rocket.svg b/docker-verticapy/extensions-v2/vertica_tools/style/icons/rocket.svg new file mode 100644 index 00000000..b38c4014 --- /dev/null +++ b/docker-verticapy/extensions-v2/vertica_tools/style/icons/rocket.svg @@ -0,0 +1 @@ +ionicons-v5-p \ No newline at end of file diff --git a/docker-verticapy/extensions-v2/vertica_tools/style/icons/vertica2.svg b/docker-verticapy/extensions-v2/vertica_tools/style/icons/vertica2.svg new file mode 100644 index 00000000..ee2eb0eb --- /dev/null +++ b/docker-verticapy/extensions-v2/vertica_tools/style/icons/vertica2.svg @@ -0,0 +1,13 @@ + + + + + + + diff --git a/docker-verticapy/extensions-v2/vertica_tools/style/verticapy.svg b/docker-verticapy/extensions-v2/vertica_tools/style/icons/verticapy.svg similarity index 100% rename from docker-verticapy/extensions-v2/vertica_tools/style/verticapy.svg rename to docker-verticapy/extensions-v2/vertica_tools/style/icons/verticapy.svg diff --git a/docker-verticapy/extensions-v2/vertica_tools/style/icons/vsql.svg b/docker-verticapy/extensions-v2/vertica_tools/style/icons/vsql.svg new file mode 100644 index 00000000..ce86d73a --- /dev/null +++ b/docker-verticapy/extensions-v2/vertica_tools/style/icons/vsql.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docker-verticapy/extensions-v2/vertica_tools/yarn.lock b/docker-verticapy/extensions-v2/vertica_tools/yarn.lock index f6e7f6fd..15e56ff9 100644 --- a/docker-verticapy/extensions-v2/vertica_tools/yarn.lock +++ b/docker-verticapy/extensions-v2/vertica_tools/yarn.lock @@ -2149,6 +2149,35 @@ __metadata: languageName: node linkType: hard +"@jupyterlab/apputils@npm:^4.2.6": + version: 4.2.6 + resolution: "@jupyterlab/apputils@npm:4.2.6" + dependencies: + "@jupyterlab/coreutils": ^6.1.6 + "@jupyterlab/observables": ^5.1.6 + "@jupyterlab/rendermime-interfaces": ^3.9.6 + "@jupyterlab/services": ^7.1.6 + "@jupyterlab/settingregistry": ^4.1.6 + "@jupyterlab/statedb": ^4.1.6 + "@jupyterlab/statusbar": ^4.1.6 + "@jupyterlab/translation": ^4.1.6 + "@jupyterlab/ui-components": ^4.1.6 + "@lumino/algorithm": ^2.0.1 + "@lumino/commands": ^2.2.0 + "@lumino/coreutils": ^2.1.2 + "@lumino/disposable": ^2.1.2 + "@lumino/domutils": ^2.0.1 + "@lumino/messaging": ^2.0.1 + "@lumino/signaling": ^2.1.2 + "@lumino/virtualdom": ^2.0.1 + "@lumino/widgets": ^2.3.1 + "@types/react": ^18.0.26 + react: ^18.2.0 + sanitize-html: ~2.7.3 + checksum: 2ca507223fb1ca3a527ce6c544c6fc1433a0eef9a41db54031f1b159a3ef29f4908e7408c22ce0cbf6e8a2e46999ab3f9175e06df54412dd6f583a5bdf11fb6a + languageName: node + linkType: hard + "@jupyterlab/attachments@npm:^4.1.1": version: 4.1.1 resolution: "@jupyterlab/attachments@npm:4.1.1" @@ -2320,6 +2349,20 @@ __metadata: languageName: node linkType: hard +"@jupyterlab/coreutils@npm:^6.1.6": + version: 6.1.6 + resolution: "@jupyterlab/coreutils@npm:6.1.6" + dependencies: + "@lumino/coreutils": ^2.1.2 + "@lumino/disposable": ^2.1.2 + "@lumino/signaling": ^2.1.2 + minimist: ~1.2.0 + path-browserify: ^1.0.0 + url-parse: ~1.5.4 + checksum: f351f327f9c7ab14ac291e4ca85a8f4289dd315e9f2e68fc6acb52efab6c47fde158f65a83ba780c382665459995bad68c7b1f9c4ffef6b9038ac81252a3f07a + languageName: node + linkType: hard + "@jupyterlab/docmanager@npm:^4.1.1": version: 4.1.1 resolution: "@jupyterlab/docmanager@npm:4.1.1" @@ -2481,6 +2524,15 @@ __metadata: languageName: node linkType: hard +"@jupyterlab/nbformat@npm:^4.1.6": + version: 4.1.6 + resolution: "@jupyterlab/nbformat@npm:4.1.6" + dependencies: + "@lumino/coreutils": ^2.1.2 + checksum: 4ef43fdaaecec06732528753c5316adaa883c77ae86d129fb5d1f0542124acc0e7bb5692aae799463722b8c47ce8934356572c040d682e0ce41548eca3ca421b + languageName: node + linkType: hard + "@jupyterlab/notebook@npm:^4.1.1": version: 4.1.1 resolution: "@jupyterlab/notebook@npm:4.1.1" @@ -2531,6 +2583,19 @@ __metadata: languageName: node linkType: hard +"@jupyterlab/observables@npm:^5.1.6": + version: 5.1.6 + resolution: "@jupyterlab/observables@npm:5.1.6" + dependencies: + "@lumino/algorithm": ^2.0.1 + "@lumino/coreutils": ^2.1.2 + "@lumino/disposable": ^2.1.2 + "@lumino/messaging": ^2.0.1 + "@lumino/signaling": ^2.1.2 + checksum: 930e53ca38dd08232ec46585acf8d49ebbef9628a792619fbf51a1da13f3249da24a7a8b24c34a2c7ce3fa50145a4e647b65e19275ea5ce92946a2ad805faa82 + languageName: node + linkType: hard + "@jupyterlab/outputarea@npm:^4.1.1": version: 4.1.1 resolution: "@jupyterlab/outputarea@npm:4.1.1" @@ -2563,6 +2628,16 @@ __metadata: languageName: node linkType: hard +"@jupyterlab/rendermime-interfaces@npm:^3.9.6": + version: 3.9.6 + resolution: "@jupyterlab/rendermime-interfaces@npm:3.9.6" + dependencies: + "@lumino/coreutils": ^1.11.0 || ^2.1.2 + "@lumino/widgets": ^1.37.2 || ^2.3.1 + checksum: 9dd08d4c71ece6e68e2972b4ce950153e2d38cc876208bb1f0e5d533daf50b062bd6aa1711c94934ea2a1f8445cf49dc6370cda80e1372b3fbede0d4534b0235 + languageName: node + linkType: hard + "@jupyterlab/rendermime@npm:^4.1.1": version: 4.1.1 resolution: "@jupyterlab/rendermime@npm:4.1.1" @@ -2602,6 +2677,25 @@ __metadata: languageName: node linkType: hard +"@jupyterlab/services@npm:^7.1.6": + version: 7.1.6 + resolution: "@jupyterlab/services@npm:7.1.6" + dependencies: + "@jupyter/ydoc": ^1.1.1 + "@jupyterlab/coreutils": ^6.1.6 + "@jupyterlab/nbformat": ^4.1.6 + "@jupyterlab/settingregistry": ^4.1.6 + "@jupyterlab/statedb": ^4.1.6 + "@lumino/coreutils": ^2.1.2 + "@lumino/disposable": ^2.1.2 + "@lumino/polling": ^2.1.2 + "@lumino/properties": ^2.0.1 + "@lumino/signaling": ^2.1.2 + ws: ^8.11.0 + checksum: ad47d3c9b211be4be3aad2714f3028e66ad381a6367a57f347644c693f055ee9c7655d15630a637d9181b42e89c2b8183675abc561c3959820a6bc03d3f2af12 + languageName: node + linkType: hard + "@jupyterlab/settingregistry@npm:^4.1.1": version: 4.1.1 resolution: "@jupyterlab/settingregistry@npm:4.1.1" @@ -2621,6 +2715,25 @@ __metadata: languageName: node linkType: hard +"@jupyterlab/settingregistry@npm:^4.1.6": + version: 4.1.6 + resolution: "@jupyterlab/settingregistry@npm:4.1.6" + dependencies: + "@jupyterlab/nbformat": ^4.1.6 + "@jupyterlab/statedb": ^4.1.6 + "@lumino/commands": ^2.2.0 + "@lumino/coreutils": ^2.1.2 + "@lumino/disposable": ^2.1.2 + "@lumino/signaling": ^2.1.2 + "@rjsf/utils": ^5.13.4 + ajv: ^8.12.0 + json5: ^2.2.3 + peerDependencies: + react: ">=16" + checksum: 93c1a4921a30243f2bd2c9591319e749e2f5cb5884f6962241857640afb6b67600cdba44fb308a23bffacc7defa3c6fc3d2ad15be52ff5946f0a8fd873b5fddd + languageName: node + linkType: hard + "@jupyterlab/statedb@npm:^4.1.1": version: 4.1.1 resolution: "@jupyterlab/statedb@npm:4.1.1" @@ -2634,6 +2747,19 @@ __metadata: languageName: node linkType: hard +"@jupyterlab/statedb@npm:^4.1.6": + version: 4.1.6 + resolution: "@jupyterlab/statedb@npm:4.1.6" + dependencies: + "@lumino/commands": ^2.2.0 + "@lumino/coreutils": ^2.1.2 + "@lumino/disposable": ^2.1.2 + "@lumino/properties": ^2.0.1 + "@lumino/signaling": ^2.1.2 + checksum: 4aba49eeead6ac6306ec2d8146543230db9296e7bf088380290eb4b89698b66573c00ba630890b821047b584fc59716b64ba06a013d4698551adeaf20b034301 + languageName: node + linkType: hard + "@jupyterlab/statusbar@npm:^4.1.1": version: 4.1.1 resolution: "@jupyterlab/statusbar@npm:4.1.1" @@ -2650,6 +2776,42 @@ __metadata: languageName: node linkType: hard +"@jupyterlab/statusbar@npm:^4.1.6": + version: 4.1.6 + resolution: "@jupyterlab/statusbar@npm:4.1.6" + dependencies: + "@jupyterlab/ui-components": ^4.1.6 + "@lumino/algorithm": ^2.0.1 + "@lumino/coreutils": ^2.1.2 + "@lumino/disposable": ^2.1.2 + "@lumino/messaging": ^2.0.1 + "@lumino/signaling": ^2.1.2 + "@lumino/widgets": ^2.3.1 + react: ^18.2.0 + checksum: ad8a7f366b8a3b3f1f6a4993a0b890192f5de99f0fe3b29aecb7a6474d568203798bee63b77012d4cfdc793b7b376ec8bd64b3c5e67cb26511b13801e7a75f77 + languageName: node + linkType: hard + +"@jupyterlab/terminal@npm:^4.1.6": + version: 4.1.6 + resolution: "@jupyterlab/terminal@npm:4.1.6" + dependencies: + "@jupyterlab/apputils": ^4.2.6 + "@jupyterlab/services": ^7.1.6 + "@jupyterlab/translation": ^4.1.6 + "@lumino/coreutils": ^2.1.2 + "@lumino/domutils": ^2.0.1 + "@lumino/messaging": ^2.0.1 + "@lumino/widgets": ^2.3.1 + xterm: ~5.1.0 + xterm-addon-canvas: ~0.3.0 + xterm-addon-fit: ~0.7.0 + xterm-addon-web-links: ~0.8.0 + xterm-addon-webgl: ~0.14.0 + checksum: 22704365949aa624442de3ac21fc184f19083a1a1089be88267b4991c64226f4de6dbf550974f18bba8fc4d4e4d868acfd3f5e3bff9893f4c48fe77cecb1a7f3 + languageName: node + linkType: hard + "@jupyterlab/testing@npm:^4.1.1": version: 4.1.1 resolution: "@jupyterlab/testing@npm:4.1.1" @@ -2723,6 +2885,19 @@ __metadata: languageName: node linkType: hard +"@jupyterlab/translation@npm:^4.1.6": + version: 4.1.6 + resolution: "@jupyterlab/translation@npm:4.1.6" + dependencies: + "@jupyterlab/coreutils": ^6.1.6 + "@jupyterlab/rendermime-interfaces": ^3.9.6 + "@jupyterlab/services": ^7.1.6 + "@jupyterlab/statedb": ^4.1.6 + "@lumino/coreutils": ^2.1.2 + checksum: 6de45e310d7ac83f2ed2e3e0c372ba71d087e597891d9e9a7ff791f6fc7fc3804d0d18dad5b152757c5a2b583d564ed7f4361561fa993be303e415a47e8b2fa6 + languageName: node + linkType: hard + "@jupyterlab/ui-components@npm:^4.1.1": version: 4.1.1 resolution: "@jupyterlab/ui-components@npm:4.1.1" @@ -2754,6 +2929,37 @@ __metadata: languageName: node linkType: hard +"@jupyterlab/ui-components@npm:^4.1.6": + version: 4.1.6 + resolution: "@jupyterlab/ui-components@npm:4.1.6" + dependencies: + "@jupyter/react-components": ^0.15.2 + "@jupyter/web-components": ^0.15.2 + "@jupyterlab/coreutils": ^6.1.6 + "@jupyterlab/observables": ^5.1.6 + "@jupyterlab/rendermime-interfaces": ^3.9.6 + "@jupyterlab/translation": ^4.1.6 + "@lumino/algorithm": ^2.0.1 + "@lumino/commands": ^2.2.0 + "@lumino/coreutils": ^2.1.2 + "@lumino/disposable": ^2.1.2 + "@lumino/messaging": ^2.0.1 + "@lumino/polling": ^2.1.2 + "@lumino/properties": ^2.0.1 + "@lumino/signaling": ^2.1.2 + "@lumino/virtualdom": ^2.0.1 + "@lumino/widgets": ^2.3.1 + "@rjsf/core": ^5.13.4 + "@rjsf/utils": ^5.13.4 + react: ^18.2.0 + react-dom: ^18.2.0 + typestyle: ^2.0.4 + peerDependencies: + react: ^18.2.0 + checksum: f555138b2345aac6ee5c580b517fd563b55b8a6b33f132de362d559a514bbbec970bd690970676173872674f802a5dd9de7ac75b897a0a2b09d7428dddc3c04d + languageName: node + linkType: hard + "@lezer/common@npm:^1.0.0, @lezer/common@npm:^1.0.2, @lezer/common@npm:^1.1.0, @lezer/common@npm:^1.2.0, @lezer/common@npm:^1.2.1": version: 1.2.1 resolution: "@lezer/common@npm:1.2.1" @@ -9993,6 +10199,7 @@ __metadata: "@jupyterlab/builder": ^4.0.0 "@jupyterlab/launcher": ^4.1.1 "@jupyterlab/mainmenu": ^4.1.1 + "@jupyterlab/terminal": ^4.1.6 "@jupyterlab/testutils": ^4.0.0 "@lumino/algorithm": ^2.0.1 "@types/jest": ^29.2.0 @@ -10438,6 +10645,49 @@ __metadata: languageName: node linkType: hard +"xterm-addon-canvas@npm:~0.3.0": + version: 0.3.0 + resolution: "xterm-addon-canvas@npm:0.3.0" + peerDependencies: + xterm: ^5.0.0 + checksum: 21eabd28a2718e775399f27e21922ec4e22528576ae88278ef39c68239119e4576eecd59cf0f1c76dfcbea0f82b779f8dbaf4ce38e04e648844c33ac7632d333 + languageName: node + linkType: hard + +"xterm-addon-fit@npm:~0.7.0": + version: 0.7.0 + resolution: "xterm-addon-fit@npm:0.7.0" + peerDependencies: + xterm: ^5.0.0 + checksum: 512d41f80d6f9427ba02dab4e6fd642e94775a9cf7ef72ae4b55eab2a36856b5c67069bfc66b4af412fdce29a0842f9c6382af3672f0b514c4352dfd47defe8f + languageName: node + linkType: hard + +"xterm-addon-web-links@npm:~0.8.0": + version: 0.8.0 + resolution: "xterm-addon-web-links@npm:0.8.0" + peerDependencies: + xterm: ^5.0.0 + checksum: fe07572adfaa84ceeb961db3ae577aeb2342ea5dcd4948170d1b733ae8045693fab8808f9c63cc43a532b033ae95e63e62ac14bc2e34def764e68f6362ccae2b + languageName: node + linkType: hard + +"xterm-addon-webgl@npm:~0.14.0": + version: 0.14.0 + resolution: "xterm-addon-webgl@npm:0.14.0" + peerDependencies: + xterm: ^5.0.0 + checksum: 05f144c920660ad8122aa13564612b1ce71b92ba8f74b3387db3e39b616437659da36b7edf3aefe5900c59956cd6ca1272a0892248df751c8899a202befe019c + languageName: node + linkType: hard + +"xterm@npm:~5.1.0": + version: 5.1.0 + resolution: "xterm@npm:5.1.0" + checksum: cbacbc9dc1bbcf21dabecff46856b43f2d5854b42c1bec4ea03a5720000f2a88d79b0da45b6c38213d6607474a1fbe66d5ff25fa120b7e9e60eeed964dd840a1 + languageName: node + linkType: hard + "y-protocols@npm:^1.0.5": version: 1.0.6 resolution: "y-protocols@npm:1.0.6" diff --git a/docker-verticapy/requirements.txt b/docker-verticapy/requirements.txt index b529ff71..8981b3c4 100644 --- a/docker-verticapy/requirements.txt +++ b/docker-verticapy/requirements.txt @@ -1,4 +1,4 @@ -jupyterlab==4.0.7 +jupyterlab==4.1.5 jupyterlab-lsp==5.0.0 python-lsp-server[all] ipython==8.18.0 From c27a3466f2b69b9b0ffbbb7fb8b6b6acd8b22740 Mon Sep 17 00:00:00 2001 From: roypaulin Date: Fri, 12 Apr 2024 15:31:41 +0200 Subject: [PATCH 2/3] Fix TEST_MODE on mac --- Makefile | 8 +++--- bin/verticapylab | 61 +++++++++++++++++++++++------------------- bin/verticapylab-build | 2 +- 3 files changed, 38 insertions(+), 33 deletions(-) diff --git a/Makefile b/Makefile index baa3fffd..d2d2fa51 100644 --- a/Makefile +++ b/Makefile @@ -110,12 +110,12 @@ vsql: ## Run a basic sanity test (optional -DQUERY="select 'whatever') .PHONY: verticapylab-start verticapylab-start: etc/VerticaPyLab.conf ## Start a jupyterlab @source etc/VerticaPyLab.conf; \ - if [[ $${TEST_MODE^^} == "YES" ]] ; then \ - VERTICAPYLAB_IMG_VERSION=$(VERSION); \ + if [[ $$(tr '[:lower:]' '[:upper:]'<<< ${TEST_MODE}) == "YES" ]] ; then \ + VERTICAPYLAB_IMG_VERSION=$(VERSION); \ fi; \ if (($$(docker ps --no-trunc -q -f NAME="$$VERTICAPYLAB_CONTAINER_NAME" | wc -l)==0)); then \ if [[ -z $$(docker image ls -q "opentext/$$VERTICAPYLAB_IMG:$$VERTICAPYLAB_IMG_VERSION" 2>&1) ]]; then \ - if [[ $${TEST_MODE^^} == "YES" ]] ; then \ + if [[ $$(tr '[:lower:]' '[:upper:]'<<< ${TEST_MODE}) == "YES" ]] ; then \ echo "Building image opentext/$$VERTICAPYLAB_IMG:$$VERTICAPYLAB_IMG_VERSION"; \ TEST_MODE=yes $(MAKE) verticapylab-build; \ else \ @@ -165,7 +165,7 @@ verticapylab-stop: ## Shut down the jupyterlab server and remove the container .PHONY: verticapylab-uninstall verticapylab-uninstall: ## Remove the verticapylab container and associated images. @source etc/VerticaPyLab.conf; \ - if [[ $${TEST_MODE^^} == "YES" ]] ; then \ + if [[ $$(tr '[:lower:]' '[:upper:]'<<< ${TEST_MODE}) == "YES" ]] ; then \ VERTICAPYLAB_IMG_VERSION=$(VERSION); \ fi; \ docker stop "$$VERTICAPYLAB_CONTAINER_NAME" >/dev/null 2>&1; \ diff --git a/bin/verticapylab b/bin/verticapylab index 7048cdcc..281c51c4 100755 --- a/bin/verticapylab +++ b/bin/verticapylab @@ -62,15 +62,42 @@ else url_host="$VERTICAPYLAB_BIND_ADDRESS" fi +function openURL() { + container=$1 + host=$2 + URL=$(docker logs "$container" 2>&1 | grep -Eo 'http[s]?://[0-9.]+:8888/.*' | head -n 1 | sed "s/[0-9.]*:8888/$host:$VERTICAPYLAB_PORT/") + # This checks the kernel name to set the correct command to open the link in browser, + # because Linux systems will use xdg-open while MacOs will use open + if [[ $OSTYPE == darwin* ]]; then # OSX uses different args for stat + OPEN_CMD=open + elif [[ $(uname -r) =~ WSL ]]; then + OPEN_CMD="$BIN/open" + else + OPEN_CMD=xdg-open + fi + # Open the correct url in browser. We know that the correct url is the second one. + # So even if in some cases a 3rd one is created this will not be affected + echo + echo "Waiting for url to open in browser..." + $OPEN_CMD "$URL" 2> /dev/null + if [[ $? -eq 0 ]]; then + echo + echo "If the link does not open or does not work, copy and paste this URL in browser:" + else + echo + echo "Copy and paste this URL in browser:" + fi + echo " $URL" +} + +# If the container already exists, open the url in the browser if docker exec -i "$VERTICAPYLAB_CONTAINER_NAME" true 2>/dev/null; then echo "$VERTICAPYLAB_CONTAINER_NAME is already running" - URL=$(docker logs "$VERTICAPYLAB_CONTAINER_NAME" 2>&1 | grep -Eo 'http[s]?://[0-9.]+:8888/.*' | head -n 1 | sed "s/[0-9.]*:8888/$url_host:$VERTICAPYLAB_PORT/") - echo "Copy and paste this URL in browser:" - echo " $URL" + openURL $VERTICAPYLAB_CONTAINER_NAME $url_host exit 0 fi -if [[ ${TEST_MODE^^} == "YES" ]]; then +if [[ $(tr '[:lower:]' '[:upper:]'<<< ${TEST_MODE}) == "YES" ]] ; then VERTICAPYLAB_IMG_VERSION=$VERSION fi @@ -137,7 +164,7 @@ Host $VERTICA_HOST_NAME $SSH_CONFIG_EXTRA_HOSTNAME User dbadmin " | docker exec -i "$VERTICAPYLAB_CONTAINER_NAME" bash -c 'umask 077; mkdir -p $HOME/.ssh; cat >> $HOME/.ssh/config' -if [[ ${TEST_MODE^^} == "YES" ]]; then +if [[ $(tr '[:lower:]' '[:upper:]'<<< ${TEST_MODE}) == "YESo" ]] ; then trap ' tput setaf 1; echo "VerticaPy installation failed"; tput sgr0; ' EXIT echo "Uninstalling old VerticaPy" @@ -164,26 +191,4 @@ while ! docker logs -n 5 "$VERTICAPYLAB_CONTAINER_NAME" 2>&1 | grep 'Or copy and sleep 1 done -URL=$(docker logs "$VERTICAPYLAB_CONTAINER_NAME" 2>&1 | grep -Eo 'http[s]?://[0-9.]+:8888/.*' | head -n 1 | sed "s/[0-9.]*:8888/$url_host:$VERTICAPYLAB_PORT/") -# This checks the kernel name to set the correct command to open the link in browser, -# because Linux systems will use xdg-open while MacOs will use open -if [[ $OSTYPE == darwin* ]]; then # OSX uses different args for stat - OPEN_CMD=open -elif [[ $(uname -r) =~ WSL ]]; then - OPEN_CMD="$BIN/open" -else - OPEN_CMD=xdg-open -fi -# Open the correct url in browser. We know that the correct url is the second one. -# So even if in some cases a 3rd one is created this will not be affected -echo -echo "Waiting for url to open in browser..." -$OPEN_CMD "$URL" 2> /dev/null -if [[ $? -eq 0 ]]; then - echo - echo "If the link does not open or does not work, copy and paste this URL in browser:" -else - echo - echo "Copy and paste this URL in browser:" -fi -echo " $URL" +openURL $VERTICAPYLAB_CONTAINER_NAME $url_host diff --git a/bin/verticapylab-build b/bin/verticapylab-build index bce9da49..339b9453 100755 --- a/bin/verticapylab-build +++ b/bin/verticapylab-build @@ -16,7 +16,7 @@ fi # Load the configuration source $CONFIG_FILE || abort $? "Cannot load config file $CONFIG_FILE" -if [[ ${TEST_MODE^^} == "YES" ]]; then +if [[ $(tr '[:lower:]' '[:upper:]'<<< ${TEST_MODE}) == "YES" ]] ; then VERTICAPYLAB_IMG_VERSION=$VERSION fi From 3bf34eeab710d7fd95cb9b9a413c047c893ab7db Mon Sep 17 00:00:00 2001 From: roypaulin Date: Fri, 12 Apr 2024 15:53:03 +0200 Subject: [PATCH 3/3] Fix test --- Makefile | 6 +++--- bin/verticapylab | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index d2d2fa51..92787607 100644 --- a/Makefile +++ b/Makefile @@ -110,12 +110,12 @@ vsql: ## Run a basic sanity test (optional -DQUERY="select 'whatever') .PHONY: verticapylab-start verticapylab-start: etc/VerticaPyLab.conf ## Start a jupyterlab @source etc/VerticaPyLab.conf; \ - if [[ $$(tr '[:lower:]' '[:upper:]'<<< ${TEST_MODE}) == "YES" ]] ; then \ + if [[ $$(tr '[:lower:]' '[:upper:]'<<< $${TEST_MODE}) == "YES" ]] ; then \ VERTICAPYLAB_IMG_VERSION=$(VERSION); \ fi; \ if (($$(docker ps --no-trunc -q -f NAME="$$VERTICAPYLAB_CONTAINER_NAME" | wc -l)==0)); then \ if [[ -z $$(docker image ls -q "opentext/$$VERTICAPYLAB_IMG:$$VERTICAPYLAB_IMG_VERSION" 2>&1) ]]; then \ - if [[ $$(tr '[:lower:]' '[:upper:]'<<< ${TEST_MODE}) == "YES" ]] ; then \ + if [[ $$(tr '[:lower:]' '[:upper:]'<<< $${TEST_MODE}) == "YES" ]] ; then \ echo "Building image opentext/$$VERTICAPYLAB_IMG:$$VERTICAPYLAB_IMG_VERSION"; \ TEST_MODE=yes $(MAKE) verticapylab-build; \ else \ @@ -165,7 +165,7 @@ verticapylab-stop: ## Shut down the jupyterlab server and remove the container .PHONY: verticapylab-uninstall verticapylab-uninstall: ## Remove the verticapylab container and associated images. @source etc/VerticaPyLab.conf; \ - if [[ $$(tr '[:lower:]' '[:upper:]'<<< ${TEST_MODE}) == "YES" ]] ; then \ + if [[ $$(tr '[:lower:]' '[:upper:]'<<< $${TEST_MODE}) == "YES" ]] ; then \ VERTICAPYLAB_IMG_VERSION=$(VERSION); \ fi; \ docker stop "$$VERTICAPYLAB_CONTAINER_NAME" >/dev/null 2>&1; \ diff --git a/bin/verticapylab b/bin/verticapylab index 281c51c4..2e70d29f 100755 --- a/bin/verticapylab +++ b/bin/verticapylab @@ -164,7 +164,7 @@ Host $VERTICA_HOST_NAME $SSH_CONFIG_EXTRA_HOSTNAME User dbadmin " | docker exec -i "$VERTICAPYLAB_CONTAINER_NAME" bash -c 'umask 077; mkdir -p $HOME/.ssh; cat >> $HOME/.ssh/config' -if [[ $(tr '[:lower:]' '[:upper:]'<<< ${TEST_MODE}) == "YESo" ]] ; then +if [[ $(tr '[:lower:]' '[:upper:]'<<< ${TEST_MODE}) == "YES" ]] ; then trap ' tput setaf 1; echo "VerticaPy installation failed"; tput sgr0; ' EXIT echo "Uninstalling old VerticaPy"