From 2c92ceb25233078dd3b4e3c40e908fba48159dd5 Mon Sep 17 00:00:00 2001 From: Umar Farooq Ghumman Date: Thu, 9 May 2024 08:04:06 -0500 Subject: [PATCH] Added navigation buttons + updating verticapy using git --- project/ui/conn.ipynb | 265 +++++++++++------------------------- project/ui/qprof-ui.ipynb | 39 ++++++ project/ui/qprof_main.ipynb | 39 ++++++ 3 files changed, 160 insertions(+), 183 deletions(-) diff --git a/project/ui/conn.ipynb b/project/ui/conn.ipynb index 4b76a1bb..75acc849 100644 --- a/project/ui/conn.ipynb +++ b/project/ui/conn.ipynb @@ -2,7 +2,46 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, + "id": "646eaee7-3870-4fee-af2a-3e2df937d88c", + "metadata": {}, + "outputs": [], + "source": [ + "import ipywidgets as widgets\n", + "from IPython.display import display, HTML\n", + "\n", + "# Define the URLs for the links\n", + "url1 = \"/lab/\"\n", + "url2 = \"/voila/render/ui/qprof_main.ipynb\"\n", + "\n", + "# Define the button labels\n", + "button_label1 = \"Go to Home Page\"\n", + "button_label2 = \"Go to Query Profiler\"\n", + "\n", + "# Define HTML links for buttons\n", + "button_html1 = f\"\"\n", + "button_html2 = f\"{button_label2}\"\n", + "\n", + "\n", + "# Create HTML widgets\n", + "html_button1 = widgets.HTML(value=button_html1)\n", + "html_button2 = widgets.HTML(value=button_html2)\n", + "\n", + "# Display buttons\n", + "display(widgets.HBox([html_button1, html_button2]))\n" + ] + }, + { + "cell_type": "markdown", + "id": "6537d006-71a5-45ae-b6d9-032a4b2879e9", + "metadata": {}, + "source": [ + "_________" + ] + }, + { + "cell_type": "code", + "execution_count": null, "id": "739353e9-44cd-4dbb-8891-f1dea998067f", "metadata": {}, "outputs": [], @@ -16,7 +55,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "8ed8016c-dacf-437d-af27-7005b66f6739", "metadata": {}, "outputs": [], @@ -41,25 +80,10 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "1cdf1aa6-6310-4764-823c-c0aff71e396a", "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "09fd8c1943344c58ade9173242e7e43f", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "VBox(children=(Text(value='', description='Host', placeholder=\"Enter Host (default is 'verticadb')\"), Text(val…" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "import ipywidgets as widgets\n", "\n", @@ -75,39 +99,10 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "a70eb307-19eb-4ecd-866f-54864d981032", "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "ec3f62d585ee463da4c13e30b491b62d", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "Button(description='Create a Connection', style=ButtonStyle())" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "62eeee9a4c154b7fa341937bb05bb531", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "Output(layout=Layout(border_bottom='1px solid black', border_left='1px solid black', border_right='1px solid b…" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "\n", "button = widgets.Button(description=\"Create a Connection\")\n", @@ -146,53 +141,10 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "074edcaf-2212-4dbf-9d3e-0b430ef514ac", "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "0a1d68d3a20e4c09a2bde924745e8504", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "Dropdown(description='Available Coneections:', layout=Layout(width='300px'), options=('Yuanzhe', 'VerticaDSN')…" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "9821d701390645ae98d18fdd9bd8784c", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "Button(description='Create a Connection', style=ButtonStyle())" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "5eaf0e2b73004f838a77404fa4be150f", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "Output(layout=Layout(border_bottom='1px solid black', border_left='1px solid black', border_right='1px solid b…" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "from verticapy.connection import change_auto_connection\n", "\n", @@ -215,76 +167,9 @@ "button_select.on_click(on_button_clicked_select)" ] }, - { - "cell_type": "markdown", - "id": "b3ef9cd5-0769-4586-98f1-0f460a22ff1c", - "metadata": {}, - "source": [ - "____" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "id": "14e6b51c-72d8-4611-b991-47f9aeaa1473", - "metadata": { - "collapsed": true, - "jupyter": { - "outputs_hidden": true - } - }, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "1d01048d0ffd4a88a33456ba7a857415", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "HBox(children=(HTML(value=\"\"\n", - "button_html2 = f\"{button_label2}\"\n", - "\n", - "\n", - "# Create HTML widgets\n", - "html_button1 = widgets.HTML(value=button_html1)\n", - "html_button2 = widgets.HTML(value=button_html2)\n", - "\n", - "# Display buttons\n", - "display(widgets.HBox([html_button1, html_button2]))\n" - ] - }, - { - "cell_type": "markdown", - "id": "32f3c37b-1446-4114-99a0-8dc62998ac5d", - "metadata": {}, - "source": [ - "____" - ] - }, { "cell_type": "code", - "execution_count": 29, + "execution_count": null, "id": "dd19b4c5-f99f-4467-b885-3cc34a58a7ae", "metadata": {}, "outputs": [], @@ -306,38 +191,52 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": null, "id": "db3e615b-7ed6-4b14-a508-432a0e6735a5", "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "2100538297184c6494d87fa467acb6f5", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "Accordion(children=(VBox(children=(Button(description='Click to display', style=ButtonStyle()), Output(outputs…" - ] - }, - "execution_count": 27, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "accordion = widgets.Accordion(children=[version_details], titles=('Version Details',))\n", "accordion" ] }, + { + "cell_type": "markdown", + "id": "b295fdd4-b6c3-4749-a639-d9a589e1d46b", + "metadata": {}, + "source": [ + "_________" + ] + }, { "cell_type": "code", "execution_count": null, "id": "c7e6ed2f-af31-48a8-80fc-f5a9402647b4", "metadata": {}, "outputs": [], - "source": [] + "source": [ + "import subprocess\n", + "output_install = widgets.Output()\n", + "\n", + "def install_verticapy(_):\n", + " with output_install:\n", + " subprocess.run([\"pip\", \"install\", \"git+https://github.com/vertica/VerticaPy.git@master\"])\n", + " print(\"Successfully installed latest verticapy from the master branch.\")\n", + " print(\"Note: You must refresh to get the latest version.\")\n", + "\n", + "install_button = widgets.Button(description=\"Install latest verticapy\")\n", + "install_button.on_click(install_verticapy)\n", + "\n", + "display(install_button, output_install)" + ] + }, + { + "cell_type": "markdown", + "id": "a935e70f-9cad-4149-9f66-a8c6b95e9405", + "metadata": {}, + "source": [ + "_________" + ] } ], "metadata": { @@ -356,7 +255,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.12" + "version": "3.10.13" } }, "nbformat": 4, diff --git a/project/ui/qprof-ui.ipynb b/project/ui/qprof-ui.ipynb index 9d45a67e..1557cd44 100644 --- a/project/ui/qprof-ui.ipynb +++ b/project/ui/qprof-ui.ipynb @@ -1,5 +1,44 @@ { "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "c7fde2aa-9a00-43b2-8e83-dc89087fa142", + "metadata": {}, + "outputs": [], + "source": [ + "import ipywidgets as widgets\n", + "from IPython.display import display, HTML\n", + "\n", + "# Define the URLs for the links\n", + "url1 = \"/lab/\"\n", + "url2 = \"/voila/render/ui/conn.ipynb\"\n", + "\n", + "# Define the button labels\n", + "button_label1 = \"Go to Home Page\"\n", + "button_label2 = \"Go to Connection\"\n", + "\n", + "# Define HTML links for buttons\n", + "button_html1 = f\"\"\n", + "button_html2 = f\"{button_label2}\"\n", + "\n", + "\n", + "# Create HTML widgets\n", + "html_button1 = widgets.HTML(value=button_html1)\n", + "html_button2 = widgets.HTML(value=button_html2)\n", + "\n", + "# Display buttons\n", + "display(widgets.HBox([html_button1, html_button2]))\n" + ] + }, + { + "cell_type": "markdown", + "id": "662f76f4-35c2-4d00-8205-257eb50e3315", + "metadata": {}, + "source": [ + "________" + ] + }, { "cell_type": "code", "execution_count": null, diff --git a/project/ui/qprof_main.ipynb b/project/ui/qprof_main.ipynb index 83b76ada..101f894d 100644 --- a/project/ui/qprof_main.ipynb +++ b/project/ui/qprof_main.ipynb @@ -1,5 +1,44 @@ { "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "bdf3c956-2080-4d20-9263-def117c59119", + "metadata": {}, + "outputs": [], + "source": [ + "import ipywidgets as widgets\n", + "from IPython.display import display, HTML\n", + "\n", + "# Define the URLs for the links\n", + "url1 = \"/lab/\"\n", + "url2 = \"/voila/render/ui/conn.ipynb\"\n", + "\n", + "# Define the button labels\n", + "button_label1 = \"Go to Home Page\"\n", + "button_label2 = \"Go to Connection\"\n", + "\n", + "# Define HTML links for buttons\n", + "button_html1 = f\"\"\n", + "button_html2 = f\"{button_label2}\"\n", + "\n", + "\n", + "# Create HTML widgets\n", + "html_button1 = widgets.HTML(value=button_html1)\n", + "html_button2 = widgets.HTML(value=button_html2)\n", + "\n", + "# Display buttons\n", + "display(widgets.HBox([html_button1, html_button2]))\n" + ] + }, + { + "cell_type": "markdown", + "id": "825c74ba-73fe-47e5-b844-3141e46d3a06", + "metadata": {}, + "source": [ + "_______" + ] + }, { "cell_type": "code", "execution_count": null,