├── .devcontainer ├── Dockerfile └── devcontainer.json ├── .dockerignore ├── .env ├── .github └── workflows │ └── ci.yml ├── .gitignore ├── CHANGELOG.md ├── Dockerfile ├── README.md ├── ReleaseNotes.md ├── cnext_app ├── .babelrc ├── .dockerignore ├── .env ├── .env.development ├── Dockerfile ├── README.md ├── jest.config.js ├── jest.setup.js ├── lib │ ├── @jupyter-widgets │ │ ├── base │ │ │ ├── LICENSE │ │ │ ├── css │ │ │ │ └── index.css │ │ │ ├── lib │ │ │ │ ├── backbone-patch.d.ts │ │ │ │ ├── backbone-patch.js │ │ │ │ ├── index.d.ts │ │ │ │ ├── index.js │ │ │ │ ├── manager-base.d.ts │ │ │ │ ├── manager-base.js │ │ │ │ ├── nativeview.d.ts │ │ │ │ ├── nativeview.js │ │ │ │ ├── registry.d.ts │ │ │ │ ├── registry.js │ │ │ │ ├── services-shim.d.ts │ │ │ │ ├── services-shim.js │ │ │ │ ├── utils.d.ts │ │ │ │ ├── utils.js │ │ │ │ ├── version.d.ts │ │ │ │ ├── version.js │ │ │ │ ├── viewlist.d.ts │ │ │ │ ├── viewlist.js │ │ │ │ ├── widget.d.ts │ │ │ │ ├── widget.js │ │ │ │ ├── widget_layout.d.ts │ │ │ │ ├── widget_layout.js │ │ │ │ ├── widget_style.d.ts │ │ │ │ └── widget_style.js │ │ │ └── package.json │ │ ├── controls │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── css │ │ │ │ ├── labvariables.css │ │ │ │ ├── materialcolors.css │ │ │ │ ├── phosphor.css │ │ │ │ ├── widgets-base.css │ │ │ │ ├── widgets.built.css │ │ │ │ └── widgets.css │ │ │ ├── lib │ │ │ │ ├── index.d.ts │ │ │ │ ├── index.js │ │ │ │ ├── phosphor │ │ │ │ │ ├── accordion.d.ts │ │ │ │ │ ├── accordion.js │ │ │ │ │ ├── currentselection.d.ts │ │ │ │ │ ├── currentselection.js │ │ │ │ │ ├── tabpanel.d.ts │ │ │ │ │ └── tabpanel.js │ │ │ │ ├── utils.d.ts │ │ │ │ ├── utils.js │ │ │ │ ├── version.d.ts │ │ │ │ ├── version.js │ │ │ │ ├── widget_audio.d.ts │ │ │ │ ├── widget_audio.js │ │ │ │ ├── widget_bool.d.ts │ │ │ │ ├── widget_bool.js │ │ │ │ ├── widget_box.d.ts │ │ │ │ ├── widget_box.js │ │ │ │ ├── widget_button.d.ts │ │ │ │ ├── widget_button.js │ │ │ │ ├── widget_color.d.ts │ │ │ │ ├── widget_color.js │ │ │ │ ├── widget_controller.d.ts │ │ │ │ ├── widget_controller.js │ │ │ │ ├── widget_core.d.ts │ │ │ │ ├── widget_core.js │ │ │ │ ├── widget_date.d.ts │ │ │ │ ├── widget_date.js │ │ │ │ ├── widget_description.d.ts │ │ │ │ ├── widget_description.js │ │ │ │ ├── widget_float.d.ts │ │ │ │ ├── widget_float.js │ │ │ │ ├── widget_image.d.ts │ │ │ │ ├── widget_image.js │ │ │ │ ├── widget_int.d.ts │ │ │ │ ├── widget_int.js │ │ │ │ ├── widget_link.d.ts │ │ │ │ ├── widget_link.js │ │ │ │ ├── widget_selection.d.ts │ │ │ │ ├── widget_selection.js │ │ │ │ ├── widget_selectioncontainer.d.ts │ │ │ │ ├── widget_selectioncontainer.js │ │ │ │ ├── widget_string.d.ts │ │ │ │ ├── widget_string.js │ │ │ │ ├── widget_upload.d.ts │ │ │ │ ├── widget_upload.js │ │ │ │ ├── widget_video.d.ts │ │ │ │ └── widget_video.js │ │ │ └── package.json │ │ ├── html-manager │ │ │ ├── LICENSE │ │ │ ├── css │ │ │ │ └── output.css │ │ │ ├── lib │ │ │ │ ├── embed-amd-render.d.ts │ │ │ │ ├── embed-amd-render.js │ │ │ │ ├── embed.d.ts │ │ │ │ ├── embed.js │ │ │ │ ├── htmlmanager.d.ts │ │ │ │ ├── htmlmanager.js │ │ │ │ ├── index.d.ts │ │ │ │ ├── index.js │ │ │ │ ├── libembed-amd.d.ts │ │ │ │ ├── libembed-amd.js │ │ │ │ ├── libembed.d.ts │ │ │ │ ├── libembed.js │ │ │ │ ├── output.d.ts │ │ │ │ ├── output.js │ │ │ │ ├── output_renderers.d.ts │ │ │ │ └── output_renderers.js │ │ │ └── package.json │ │ ├── jupyterlab-manager │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── lib │ │ │ │ ├── index.d.ts │ │ │ │ ├── index.js │ │ │ │ ├── manager.d.ts │ │ │ │ ├── manager.js │ │ │ │ ├── output.d.ts │ │ │ │ ├── output.js │ │ │ │ ├── plugin.d.ts │ │ │ │ ├── plugin.js │ │ │ │ ├── renderer.d.ts │ │ │ │ ├── renderer.js │ │ │ │ ├── semvercache.d.ts │ │ │ │ └── semvercache.js │ │ │ ├── package.json │ │ │ └── schema │ │ │ │ └── plugin.json │ │ ├── output │ │ │ ├── LICENSE │ │ │ ├── lib │ │ │ │ ├── index.d.ts │ │ │ │ ├── index.js │ │ │ │ ├── output.d.ts │ │ │ │ └── output.js │ │ │ └── package.json │ │ └── schema │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── generate-spec.py │ │ │ ├── index.js │ │ │ ├── jupyterwidgetmodels.latest.md │ │ │ ├── jupyterwidgetmodels.v6.md │ │ │ ├── jupyterwidgetmodels.v7-1.md │ │ │ ├── jupyterwidgetmodels.v7-2.md │ │ │ ├── jupyterwidgetmodels.v7-3.md │ │ │ ├── jupyterwidgetmodels.v7-4.md │ │ │ ├── jupyterwidgetmodels.v7-5.md │ │ │ ├── jupyterwidgetmodels.v7.md │ │ │ ├── jupyterwidgetmodels.v8.md │ │ │ ├── messages.md │ │ │ ├── package.json │ │ │ ├── v1 │ │ │ ├── state.schema.json │ │ │ └── view.schema.json │ │ │ └── v2 │ │ │ ├── state.schema.json │ │ │ └── view.schema.json │ ├── @xterm │ │ ├── XTerm.tsx │ │ └── index.ts │ ├── cassist │ │ └── CAssistPlotGen.tsx │ ├── codemirror │ │ ├── autocomplete-lsp │ │ │ ├── autocomplete │ │ │ │ └── index.js │ │ │ ├── df-plugin.js │ │ │ ├── helper.js │ │ │ ├── index.d.ts │ │ │ ├── index.js │ │ │ ├── ls-plugin.js │ │ │ ├── signature.js │ │ │ ├── source.js │ │ │ └── theme.js │ │ ├── basic-setup │ │ │ └── index.ts │ │ ├── grammar │ │ │ ├── cnext-python.grammar │ │ │ ├── cnext-python.js │ │ │ ├── cnext-python.terms.js │ │ │ ├── cnext-query.grammar │ │ │ ├── cnext-query.grammer │ │ │ ├── cnext-query.js │ │ │ ├── extensions.js │ │ │ ├── lang-cnext-python.js │ │ │ ├── lang-cnext-query.js │ │ │ ├── lang-python.js │ │ │ ├── python.grammar │ │ │ ├── tokens.js │ │ │ ├── zzz-cnext-python.grammer │ │ │ ├── zzz-python-tokens.js │ │ │ └── zzz-python.grammer │ │ └── tooltip │ │ │ └── index.js │ ├── components │ │ ├── FooterBar.tsx │ │ ├── Main.tsx │ │ ├── Socket.tsx │ │ ├── StyledComponents.tsx │ │ ├── WorkingPanel.tsx │ │ ├── ansi-to-react │ │ │ └── index.ts │ │ ├── code-panel │ │ │ ├── CodeEditor.tsx │ │ │ ├── CodePanel.tsx │ │ │ ├── CodeToolbar.tsx │ │ │ ├── DFReview.tsx │ │ │ ├── PluginOutput.tsx │ │ │ ├── TextIOComponent.tsx │ │ │ ├── libCAssist.tsx │ │ │ ├── libCellDeco.tsx │ │ │ ├── libCellFold.tsx │ │ │ ├── libCellWidget.tsx │ │ │ ├── libCodeEditor.tsx │ │ │ └── text-io │ │ │ │ ├── Console.tsx │ │ │ │ └── Terminal.tsx │ │ ├── dataframe-manager │ │ │ ├── DataFrameManager.tsx │ │ │ ├── libDataFrameManager.tsx │ │ │ └── udf │ │ │ │ └── libUDF.tsx │ │ ├── error-boundary │ │ │ └── ErrorBoundary.tsx │ │ ├── executor-manager │ │ │ ├── ExecutorCommandConfirmation.tsx │ │ │ ├── ExecutorManager.tsx │ │ │ ├── ExecutorStatus.tsx │ │ │ └── ExecutorToolbar.tsx │ │ ├── file-manager │ │ │ ├── DeleteConfirmation.tsx │ │ │ ├── FileContextMenu.tsx │ │ │ ├── FileExplorer.tsx │ │ │ ├── FileManager.tsx │ │ │ └── NewItemInput.tsx │ │ ├── hotkeys │ │ │ └── HotKeys.tsx │ │ ├── libs.tsx │ │ ├── libs │ │ │ ├── ContextMenu.tsx │ │ │ ├── OverlayComponent.tsx │ │ │ └── utils.tsx │ │ ├── notifier │ │ │ └── Notifier.tsx │ │ ├── richoutput-panel │ │ │ ├── RichOuputPanelHeader.tsx │ │ │ ├── RichOutputPanel.tsx │ │ │ ├── data-panel │ │ │ │ ├── ColumnHistogram.tsx │ │ │ │ ├── ColumnSelector.tsx │ │ │ │ ├── CountNA.tsx │ │ │ │ ├── DFExplorer.tsx │ │ │ │ ├── DFFilter.tsx │ │ │ │ ├── DataPanel.tsx │ │ │ │ ├── DataView.tsx │ │ │ │ ├── DataViewMode.tsx │ │ │ │ ├── GridView.tsx │ │ │ │ ├── InputCheckbox.tsx │ │ │ │ ├── InputComponent.tsx │ │ │ │ ├── InputSelection.tsx │ │ │ │ ├── InputText.tsx │ │ │ │ ├── TableView.tsx │ │ │ │ ├── TableViewVirtual.tsx │ │ │ │ ├── UDFContainer.tsx │ │ │ │ ├── UDFSelector.tsx │ │ │ │ ├── libDataView.tsx │ │ │ │ ├── styles.tsx │ │ │ │ ├── useLoadDFMetaData.tsx │ │ │ │ └── useLoadTableData.tsx │ │ │ ├── experiment-panel │ │ │ │ ├── ExperimentsManager.tsx │ │ │ │ ├── MetricPlots.tsx │ │ │ │ └── WindowDims.js │ │ │ ├── model-panel │ │ │ │ ├── ModelExplorer.tsx │ │ │ │ └── ModelManager.tsx │ │ │ ├── result-panel │ │ │ │ ├── DashboardView.tsx │ │ │ │ ├── IPyWidgetPanel.tsx │ │ │ │ ├── MarkdownProcessor.tsx │ │ │ │ ├── ResultContent.tsx │ │ │ │ ├── ResultPanel.tsx │ │ │ │ ├── StdInInput.tsx │ │ │ │ └── libStdInInput.tsx │ │ │ └── summary-panel │ │ │ │ ├── ColumnSummary.tsx │ │ │ │ └── SummaryView.tsx │ │ ├── sidebar │ │ │ ├── Logo.tsx │ │ │ └── Sidebar.tsx │ │ ├── terminal-manager │ │ │ └── TerminalManager.tsx │ │ ├── tests │ │ │ ├── CypressIds.js │ │ │ ├── TestTableData.tsx │ │ │ └── TestVizData.tsx │ │ └── user-manager │ │ │ ├── Account.tsx │ │ │ └── AccountManager.tsx │ └── interfaces │ │ ├── IAccount.tsx │ │ ├── IApp.tsx │ │ ├── ICAssist.tsx │ │ ├── ICodeEditor.tsx │ │ ├── IContextMenu.tsx │ │ ├── IDataFrameManager.tsx │ │ ├── IDataFrameStatus.tsx │ │ ├── IExecutorManager.tsx │ │ ├── IExperimentManager.tsx │ │ ├── IFileManager.tsx │ │ ├── ILogsManager.tsx │ │ ├── IModelManager.tsx │ │ └── IRichOuputViewer.tsx ├── next-env.d.ts ├── next.config.js ├── package-lock.json ├── package.json ├── pages │ ├── _app.tsx │ └── index.tsx ├── public │ ├── favicon.ico │ └── icons │ │ ├── cube-white.svg │ │ └── cube.svg ├── redux │ ├── actions │ │ └── themeActions.js │ ├── constants.js │ ├── reducers │ │ ├── CodeEditorRedux.tsx │ │ ├── DFUpdatesRedux.tsx │ │ ├── DataFramesRedux.tsx │ │ ├── ExecutorManagerRedux.tsx │ │ ├── ExperimentManagerRedux.tsx │ │ ├── ModelManagerRedux.tsx │ │ ├── NotificationRedux.tsx │ │ ├── ProjectManagerRedux.tsx │ │ ├── RichOutputRedux.tsx │ │ └── TerminalRedux.tsx │ └── store │ │ └── index.tsx ├── sentry.client.config.js ├── sentry.properties ├── sentry.server.config.js ├── styles │ ├── example-styles.css │ ├── global.css │ ├── styles.css │ └── utils.module.css ├── tests │ ├── intergration │ │ ├── Dockerfile │ │ ├── cypress.json │ │ ├── cypress │ │ │ ├── fixtures │ │ │ │ └── example.json │ │ │ ├── integration │ │ │ │ ├── cyc │ │ │ │ │ ├── 0-code-editor.spec.js │ │ │ │ │ ├── 1-dataframe.spec.js │ │ │ │ │ ├── 2-file-explorer.spec.js │ │ │ │ │ ├── 3-rich-output.spec.js │ │ │ │ │ ├── 4-kernel-control.spec.js │ │ │ │ │ ├── 5-heavy-case-cyc.spec.js │ │ │ │ │ ├── project.spec.js │ │ │ │ │ └── shared.js │ │ │ │ ├── data │ │ │ │ │ └── code-text.js │ │ │ │ └── shared.js │ │ │ ├── plugins │ │ │ │ └── index.js │ │ │ ├── results │ │ │ │ └── output.xml │ │ │ └── support │ │ │ │ ├── commands.js │ │ │ │ └── index.js │ │ ├── old-test.js │ │ ├── package-lock.json │ │ └── package.json │ └── unit │ │ ├── pages │ │ └── index.test.js │ │ ├── sum.js │ │ ├── sum.test.js │ │ └── test-utils.js ├── theme │ ├── breakpoints.js │ ├── index.js │ ├── overrides.js │ ├── props.js │ ├── shadows.js │ ├── typography.js │ └── variants.js ├── tsconfig.json └── utils │ ├── cookie.ts │ ├── domain.ts │ └── index.ts ├── cnext_server ├── .gitignore ├── __init__.py ├── __main__.py ├── public │ ├── 404.html │ ├── _next │ │ └── static │ │ │ ├── 8KnY93POWcLvEaGxXR6az │ │ │ ├── _buildManifest.js │ │ │ └── _ssgManifest.js │ │ │ ├── chunks │ │ │ ├── 269.60880de422ed31e1.js │ │ │ ├── 2852872c-257ebc72a8902899.js │ │ │ ├── 4ad82c5e-eacc478f45b94eba.js │ │ │ ├── 651.bfd69ea01d64d954.js │ │ │ ├── 660.2d01b32d8f282715.js │ │ │ ├── 741.25e0d543f796a94b.js │ │ │ ├── 75fc9c18-d4f616fecc6e1230.js │ │ │ ├── 866.cd5bfa886be4b007.js │ │ │ ├── 976-3cdeccab7a0db628.js │ │ │ ├── e48519b3.c8db2bf231c5f0b8.js │ │ │ ├── ed150ef9.8a701c53cbd4d124.js │ │ │ ├── framework-0ba0ddd33199226d.js │ │ │ ├── main-79e130091ee21132.js │ │ │ ├── pages │ │ │ │ ├── _app-f9e7fff34d7b41e7.js │ │ │ │ ├── _error-c13976a61913457b.js │ │ │ │ └── index-2ac4478fd0f61aa3.js │ │ │ ├── polyfills-c67a75d1b6f99dc8.js │ │ │ └── webpack-0ca9a1df4831456a.js │ │ │ └── css │ │ │ ├── 1b4f47eca4f664f1.css │ │ │ ├── 713625ab96f56113.css │ │ │ └── f0abbfc8cca2b2f0.css │ ├── favicon.ico │ ├── icons │ │ ├── cube-white.svg │ │ └── cube.svg │ └── index.html ├── server │ ├── .dockerignore │ ├── Dockerfile │ ├── build │ │ └── config.gypi │ ├── eventLog.js │ ├── ls │ │ ├── lsp_process.js │ │ └── streams.js │ ├── package-lock.json │ ├── package.json │ ├── python │ │ ├── cassist │ │ │ ├── __init__.py │ │ │ └── cassist.py │ │ ├── code_editor │ │ │ ├── __init__.py │ │ │ ├── code_editor.py │ │ │ ├── code_editor_basekernel.py │ │ │ └── interfaces.py │ │ ├── dataframe_manager │ │ │ ├── __init__.py │ │ │ ├── dataframe.py │ │ │ ├── dataframe_manager.py │ │ │ └── dataframe_manager_basekernel.py │ │ ├── environment_manager │ │ │ ├── __init__.py │ │ │ └── environment_manager.py │ │ ├── executor_manager │ │ │ └── executor_manager.py │ │ ├── experiment_manager │ │ │ ├── __init__.py │ │ │ └── experiment_manager.py │ │ ├── file_explorer │ │ │ ├── __init__.py │ │ │ └── file_explorer.py │ │ ├── file_manager │ │ │ ├── __init__.py │ │ │ └── file_manager.py │ │ ├── jupyter_server_manager │ │ │ ├── __init__.py │ │ │ ├── jupyter_server_config.json │ │ │ └── jupyter_server_manager.py │ │ ├── libs │ │ │ ├── __init__.py │ │ │ ├── config.py │ │ │ ├── constants.py │ │ │ ├── json_serializable.py │ │ │ ├── logs.py │ │ │ ├── message.py │ │ │ ├── message_handler.py │ │ │ └── zmq_message.py │ │ ├── logs_manager │ │ │ ├── __init__.py │ │ │ └── logs_manager.py │ │ ├── model_manager │ │ │ ├── __init__.py │ │ │ ├── interfaces.py │ │ │ └── model_manager.py │ │ ├── project_manager │ │ │ ├── __init__.py │ │ │ ├── files.py │ │ │ ├── interfaces.py │ │ │ └── projects.py │ │ ├── server.py │ │ └── user_space │ │ │ ├── __init__.py │ │ │ ├── ipython │ │ │ ├── constants.py │ │ │ └── kernel.py │ │ │ └── user_space.py │ ├── routes │ │ └── index.js │ ├── server.js │ ├── server.yaml │ ├── start.sh │ ├── test.py │ └── tests │ │ ├── stack_trace.py │ │ ├── test_globals.py │ │ ├── test_plotly.py │ │ └── test_servers │ │ ├── package.json │ │ ├── server.js │ │ ├── server.py │ │ └── test_pyshell.js └── workspace.yaml ├── docker-compose.prod.yml ├── docker-compose.test.yml ├── docker-compose.yml ├── docker └── docker-entrypoint.sh ├── package-lock.json ├── poetry.lock └── pyproject.toml /.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | # See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.238.1/containers/python-3/.devcontainer/base.Dockerfile 2 | 3 | # [Choice] Python version (use -bullseye variants on local arm64/Apple Silicon): 3, 3.10, 3.9, 3.8, 3.7, 3.6, 3-bullseye, 3.10-bullseye, 3.9-bullseye, 3.8-bullseye, 3.7-bullseye, 3.6-bullseye, 3-buster, 3.10-buster, 3.9-buster, 3.8-buster, 3.7-buster, 3.6-buster 4 | ARG VARIANT="3.10-bullseye" 5 | FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT} 6 | 7 | # [Choice] Node.js version: none, lts/*, 16, 14, 12, 10 8 | ARG NODE_VERSION="none" 9 | RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi 10 | 11 | # [Optional] If your pip requirements rarely change, uncomment this section to add them to the image. 12 | # COPY requirements.txt /tmp/pip-tmp/ 13 | # RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \ 14 | # && rm -rf /tmp/pip-tmp 15 | 16 | # [Optional] Uncomment this section to install additional OS packages. 17 | # RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ 18 | # && apt-get -y install --no-install-recommends 19 | 20 | # [Optional] Uncomment this line to install global node packages. 21 | # RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g " 2>&1 22 | 23 | # Install poetry 24 | RUN pip3 install poetry 25 | -------------------------------------------------------------------------------- /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | // For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: 2 | // https://github.com/microsoft/vscode-dev-containers/tree/v0.238.1/containers/python-3 3 | { 4 | "name": "Python 3", 5 | "build": { 6 | "dockerfile": "Dockerfile", 7 | "context": "..", 8 | "args": { 9 | // Update 'VARIANT' to pick a Python version: 3, 3.10, 3.9, 3.8, 3.7, 3.6 10 | // Append -bullseye or -buster to pin to an OS version. 11 | // Use -bullseye variants on local on arm64/Apple Silicon. 12 | "VARIANT": "3.9", 13 | // Options 14 | "NODE_VERSION": "lts/*" 15 | } 16 | }, 17 | 18 | // Configure tool-specific properties. 19 | "customizations": { 20 | // Configure properties specific to VS Code. 21 | "vscode": { 22 | // Set *default* container specific settings.json values on container create. 23 | "settings": { 24 | "python.defaultInterpreterPath": "/usr/local/bin/python", 25 | "python.linting.enabled": true, 26 | "python.linting.pylintEnabled": true, 27 | "python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8", 28 | "python.formatting.blackPath": "/usr/local/py-utils/bin/black", 29 | "python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf", 30 | "python.linting.banditPath": "/usr/local/py-utils/bin/bandit", 31 | "python.linting.flake8Path": "/usr/local/py-utils/bin/flake8", 32 | "python.linting.mypyPath": "/usr/local/py-utils/bin/mypy", 33 | "python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle", 34 | "python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle", 35 | "python.linting.pylintPath": "/usr/local/py-utils/bin/pylint" 36 | }, 37 | 38 | // Add the IDs of extensions you want installed when the container is created. 39 | "extensions": [ 40 | "ms-python.python", 41 | "ms-python.vscode-pylance" 42 | ] 43 | } 44 | }, 45 | 46 | // Use 'forwardPorts' to make a list of ports inside the container available locally. 47 | // "forwardPorts": [], 48 | 49 | // Use 'postCreateCommand' to run commands after the container is created. 50 | // "postCreateCommand": "pip3 install --user -r requirements.txt", 51 | 52 | // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. 53 | "remoteUser": "vscode", 54 | "features": { 55 | // "docker-in-docker": "latest", 56 | "docker-from-docker": "latest" 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | /cnext_app/out 2 | /cnext_app/node_modules 3 | /cnext_server/public 4 | /cnext_server/server/node_modules 5 | /cnext_app/tests/ -------------------------------------------------------------------------------- /.env: -------------------------------------------------------------------------------- 1 | IMAGE_NAME = cycai/cnext 2 | IMAGE_TAG = latest 3 | CLIENT_PORT = 3000 4 | SERVER_PORT = 4000 5 | SOURCE_PROJECT_DIR = ./Skywalker -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # These are some examples of commonly ignored file patterns. 2 | # You should customize this list as applicable to your project. 3 | # Learn more about .gitignore: 4 | # https://www.atlassian.com/git/tutorials/saving-changes/gitignore 5 | 6 | # Node artifact files 7 | node_modules/ 8 | dist/ 9 | 10 | # Compiled Java class files 11 | *.class 12 | 13 | # Compiled Python bytecode 14 | *.py[cod] 15 | 16 | # Log files 17 | *.log 18 | log.txt 19 | 20 | # Package files 21 | *.jar 22 | 23 | # Maven 24 | target/ 25 | dist/ 26 | 27 | # JetBrains IDE 28 | .idea/ 29 | 30 | # Unit test reports 31 | TEST*.xml 32 | 33 | # Generated by MacOS 34 | .DS_Store 35 | 36 | # Generated by Windows 37 | Thumbs.db 38 | 39 | # Applications 40 | *.app 41 | *.exe 42 | *.war 43 | 44 | # Large media files 45 | *.mp4 46 | *.tiff 47 | *.avi 48 | *.flv 49 | *.mov 50 | *.wmv 51 | 52 | # Python compile 53 | *.pyc 54 | 55 | # vscode 56 | .vscode 57 | 58 | .next/ 59 | 60 | # package-lock.json 61 | # cnext_app/package-lock.json 62 | # cnext_app/server/package-lock.json 63 | # cnext_app/server/.server.yaml 64 | */workspace.code-workspace 65 | 66 | cnext_app/out/ 67 | # cnext_server/public 68 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | ARG PYTHON_IMAGE="3.9.13-bullseye" 2 | 3 | FROM ubuntu:22.04 4 | 5 | ARG NODE_VERSION="16" 6 | ARG CNEXT_VERSION 7 | 8 | # install packages 9 | RUN set -eux \ 10 | && apt-get update \ 11 | && apt-get install --no-install-recommends --no-install-suggests -y \ 12 | build-essential curl python3-pip python3-dev 13 | 14 | RUN set -eux \ 15 | && curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION}.x | bash - \ 16 | && apt-get install -y nodejs 17 | 18 | # Don't run production as root 19 | RUN addgroup --system --gid 1001 cnext 20 | RUN useradd -rm -g cnext -G sudo -u 1001 -s /bin/bash cnext 21 | USER cnext 22 | 23 | ENV PATH "$PATH:/home/cnext/.local/bin" 24 | 25 | RUN pip install cnext${CNEXT_VERSION:+==$CNEXT_VERSION} 26 | # RUN echo "n" | cnext-init 27 | 28 | WORKDIR /home/cnext 29 | 30 | RUN mkdir -p sample-projects \ 31 | && curl -OL https://bitbucket.org/robotdreamers/cnext_sample_projects/get/master.tar.gz \ 32 | && tar -xzf master.tar.gz --strip-components 1 -C sample-projects \ 33 | && rm master.tar.gz 34 | 35 | # RUN echo "active_project: 0cb1b520-7100-4b7e-a858-d5534b7ba7aa\nopen_projects:\n - id: 0cb1b520-7100-4b7e-a858-d5534b7ba7aa\n name: Skywalker\n path: /home/cnext/sample-projects/Skywalker\n - id: 76d3ef55-70e1-4155-811f-dc32a989fe43\n name: Jedi\n path: /home/cnext/sample-projects/Jedi" > /home/cnext/.local/lib/python3.10/site-packages/cnext_server/server/workspace.yaml 36 | 37 | ENV SHELL="/bin/bash" 38 | 39 | COPY ./docker/docker-entrypoint.sh / 40 | ENTRYPOINT ["/docker-entrypoint.sh"] 41 | CMD ["cnext", "-l", "/home/cnext/sample-projects/Skywalker"] 42 | -------------------------------------------------------------------------------- /ReleaseNotes.md: -------------------------------------------------------------------------------- 1 | # v0.5.2 - 0.5.0 2 | 3 | ##### NEW 4 | 5 | - Implement `Terminal` 6 | - Redirect all outputs to the `Result` tab 7 | - Implement button-based UI 8 | 9 | ##### IMPROVED 10 | - Allow multiple outputs from a same cell 11 | 12 | ##### FIXED 13 | 14 | - Bug fixes and usability improvement 15 | 16 | # v0.4.20 - 0.4.29 17 | 18 | ##### NEW 19 | 20 | - Implement add project feature 21 | - Add turn on/off markdown 22 | 23 | ##### IMPROVED 24 | 25 | - Improve setup script 26 | - Improve usability 27 | - Improve file explorer style 28 | 29 | ##### FIXED 30 | 31 | - Bug fixes and usability improvement 32 | - Fix bugs with panel resizing 33 | - Fix file path issues on Windows system 34 | 35 | # v0.4.18 - 0.4.19 36 | 37 | ##### NEW 38 | 39 | - Show failed execution status marker 40 | 41 | # v0.4.14 - v0.4.16 42 | 43 | ##### NEW 44 | 45 | - Add configs for dataframe manager. 46 | - Implement grouped lines folding 47 | 48 | ##### IMPROVED 49 | 50 | - 51 | 52 | ##### FIXED 53 | 54 | - Fix bugs and improve stability for model visualization. 55 | 56 | # v0.4.12 - v0.4.13 57 | 58 | ##### NEW 59 | 60 | - Allow code to be executed on any file. 61 | - Improve code suggestion behavior. 62 | - Load config dynamically from "config.json". 63 | 64 | ##### IMPROVED 65 | 66 | - 67 | 68 | ##### FIXED 69 | 70 | - 71 | 72 | # v0.4.10 73 | 74 | ##### NEW 75 | 76 | - Assign result of a group to only the first line. 77 | - Add support for full-html-page results using iframe. 78 | - Add support for .sql and .json files. 79 | 80 | ##### IMPROVED 81 | 82 | - Improve the ability to support results with javascript. you can now run bokeh plot. 83 | 84 | ##### FIXED 85 | 86 | - 87 | -------------------------------------------------------------------------------- /cnext_app/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["next/babel"], 3 | "plugins": [["styled-components", { "ssr": true }]] 4 | } 5 | 6 | -------------------------------------------------------------------------------- /cnext_app/.dockerignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | server 3 | tests -------------------------------------------------------------------------------- /cnext_app/.env: -------------------------------------------------------------------------------- 1 | NEXT_PUBLIC_SERVER_SOCKET_ENDPOINT = "/" 2 | SENTRY_PROJECT = "nextjs" 3 | SENTRY_ORG = "cnext" -------------------------------------------------------------------------------- /cnext_app/.env.development: -------------------------------------------------------------------------------- 1 | NEXT_PUBLIC_SERVER_SOCKET_ENDPOINT = "http://localhost:4000" 2 | SENTRY_PROJECT = "nextjs" 3 | SENTRY_ORG = "cnext" -------------------------------------------------------------------------------- /cnext_app/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:16.13.1 2 | 3 | ENV NODE_ENV=production 4 | ENV NEXT_PUBLIC_SERVER_SOCKET_ENDPOINT=http://server:4000 5 | 6 | WORKDIR /web 7 | 8 | COPY . . 9 | 10 | RUN npm i 11 | RUN npm run build 12 | 13 | CMD ["npm", "start"] 14 | 15 | EXPOSE 3000 16 | -------------------------------------------------------------------------------- /cnext_app/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | collectCoverageFrom: ['**/*.{js,jsx,ts,tsx}', '!**/*.d.ts', '!**/node_modules/**'], 3 | moduleNameMapper: { 4 | // Handle CSS imports (with CSS modules) 5 | // https://jestjs.io/docs/webpack#mocking-css-modules 6 | '\\.(css|less|scss|sass)$': 'identity-obj-proxy', 7 | 8 | // Handle CSS imports (without CSS modules) 9 | // '^.+\\.(css|sass|scss)$': '/__mocks__/styleMock.js', 10 | 11 | // Handle image imports 12 | // https://jestjs.io/docs/webpack#handling-static-assets 13 | // '^.+\\.(png|jpg|jpeg|gif|webp|avif|ico|bmp|svg)$/i': `/__mocks__/fileMock.js`, 14 | 15 | // Handle module aliases 16 | '^@/components/(.*)$': '/components/$1', 17 | }, 18 | // Add more setup options before each test is run 19 | // setupFilesAfterEnv: ['/jest.setup.js'], 20 | testPathIgnorePatterns: ['/node_modules/', '/.next/'], 21 | testEnvironment: 'jsdom', 22 | transform: { 23 | // Use babel-jest to transpile tests with the next/babel preset 24 | // https://jestjs.io/docs/configuration#transform-objectstring-pathtotransformer--pathtotransformer-object 25 | '^.+\\.(js|jsx|ts|tsx)$': ['babel-jest', { presets: ['next/babel'] }], 26 | }, 27 | transformIgnorePatterns: ['/node_modules/', '^.+\\.module\\.(css|sass|scss)$'], 28 | moduleFileExtensions: ['js', 'tsx', 'json', 'scss'], 29 | }; 30 | -------------------------------------------------------------------------------- /cnext_app/jest.setup.js: -------------------------------------------------------------------------------- 1 | import '@testing-library/jest-dom'; 2 | import '@testing-library/jest-dom/extend-expect'; 3 | 4 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/base/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 Project Jupyter Contributors 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | 3. Neither the name of the copyright holder nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/base/css/index.css: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Jupyter Development Team. 2 | * Distributed under the terms of the Modified BSD License. 3 | */ 4 | 5 | .jupyter-widgets-disconnected::before { 6 | content: "\f127"; /* chain-broken */ 7 | display: inline-block; 8 | font: normal normal normal 14px/1 FontAwesome; 9 | font-size: inherit; 10 | text-rendering: auto; 11 | -webkit-font-smoothing: antialiased; 12 | -moz-osx-font-smoothing: grayscale; 13 | color: #d9534f; 14 | padding: 3px; 15 | align-self: flex-start; 16 | } 17 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/base/lib/backbone-patch.d.ts: -------------------------------------------------------------------------------- 1 | export declare function set(key: string | {}, val: any, options: any): any; 2 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/base/lib/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './manager-base'; 2 | export * from './widget'; 3 | export * from './widget_layout'; 4 | export * from './widget_style'; 5 | export * from './services-shim'; 6 | export * from './viewlist'; 7 | export * from './version'; 8 | export * from './utils'; 9 | export * from './registry'; 10 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/base/lib/index.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Jupyter Development Team. 2 | // Distributed under the terms of the Modified BSD License. 3 | export * from './manager-base'; 4 | export * from './widget'; 5 | export * from './widget_layout'; 6 | export * from './widget_style'; 7 | export * from './services-shim'; 8 | export * from './viewlist'; 9 | export * from './version'; 10 | export * from './utils'; 11 | export * from './registry'; 12 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/base/lib/nativeview.d.ts: -------------------------------------------------------------------------------- 1 | import * as Backbone from 'backbone'; 2 | export declare class NativeView extends Backbone.View { 3 | _removeElement(): void; 4 | _setElement(element: HTMLElement): void; 5 | _setAttributes(attrs: { 6 | [key: string]: string; 7 | }): void; 8 | /** 9 | * Make an event delegation handler for the given `eventName` and `selector` 10 | * and attach it to `this.el`. 11 | * If selector is empty, the listener will be bound to `this.el`. If not, a 12 | * new handler that will recursively traverse up the event target's DOM 13 | * hierarchy looking for a node that matches the selector. If one is found, 14 | * the event's `delegateTarget` property is set to it and the return the 15 | * result of calling bound `listener` with the parameters given to the 16 | * handler. 17 | * 18 | * This does not properly handle selectors for things like focus and blur (see 19 | * https://github.com/jquery/jquery/blob/7d21f02b9ec9f655583e898350badf89165ed4d5/src/event.js#L442 20 | * for some similar exceptional cases). 21 | */ 22 | delegate(eventName: string, selector: any, listener: any): any; 23 | undelegate(eventName: string, selector?: any, listener?: any): this; 24 | undelegateEvents(): this; 25 | private _domEvents; 26 | } 27 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/base/lib/registry.d.ts: -------------------------------------------------------------------------------- 1 | import { Token } from '@lumino/coreutils'; 2 | import { WidgetModel, WidgetView } from './widget'; 3 | /** 4 | * A runtime interface token for a widget registry. 5 | */ 6 | export declare const IJupyterWidgetRegistry: Token; 7 | /** 8 | * A registry of Jupyter Widgets. 9 | * 10 | * This is used by widget managers that support an external registry. 11 | */ 12 | export interface IJupyterWidgetRegistry { 13 | /** 14 | * Register a widget module. 15 | */ 16 | registerWidget(data: IWidgetRegistryData): void; 17 | } 18 | export declare type ExportMap = { 19 | [key: string]: typeof WidgetModel | typeof WidgetView; 20 | }; 21 | export declare type ExportData = ExportMap | Promise | (() => ExportMap) | (() => Promise); 22 | export interface IWidgetRegistryData { 23 | /** 24 | * The widget module name. 25 | */ 26 | name: string; 27 | /** 28 | * The widget module version. 29 | */ 30 | version: string; 31 | /** 32 | * A map of object names to widget classes provided by the module, or a 33 | * promise to such a map, or a function returning the same. 34 | */ 35 | exports: ExportData; 36 | } 37 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/base/lib/registry.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Jupyter Development Team. 2 | // Distributed under the terms of the Modified BSD License. 3 | import { Token } from '@lumino/coreutils'; 4 | /** 5 | * A runtime interface token for a widget registry. 6 | */ 7 | export var IJupyterWidgetRegistry = new Token('jupyter.extensions.jupyterWidgetRegistry'); 8 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/base/lib/version.d.ts: -------------------------------------------------------------------------------- 1 | export declare const JUPYTER_WIDGETS_VERSION = "1.2.0"; 2 | export declare const PROTOCOL_VERSION = "2.1.0"; 3 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/base/lib/version.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Jupyter Development Team. 2 | // Distributed under the terms of the Modified BSD License. 3 | export var JUPYTER_WIDGETS_VERSION = '1.2.0'; 4 | export var PROTOCOL_VERSION = '2.1.0'; 5 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/base/lib/widget_layout.d.ts: -------------------------------------------------------------------------------- 1 | import { WidgetModel, WidgetView } from './widget'; 2 | export declare class LayoutModel extends WidgetModel { 3 | defaults(): any; 4 | } 5 | export declare class LayoutView extends WidgetView { 6 | /** 7 | * Public constructor 8 | */ 9 | initialize(parameters: WidgetView.InitializeParameters): void; 10 | /** 11 | * Register a CSS trait that is known by the model 12 | * @param trait 13 | */ 14 | registerTrait(trait: string): void; 15 | /** 16 | * Get the the name of the css property from the trait name 17 | * @param model attribute name 18 | * @return css property name 19 | */ 20 | css_name(trait: string): string; 21 | /** 22 | * Handles when a trait value changes 23 | */ 24 | handleChange(trait: string, value: any): void; 25 | /** 26 | * Handles when the value of overflow_x or overflow_y changes 27 | */ 28 | handleOverflowChange(trait: string, value: any): void; 29 | /** 30 | * Remove the styling from the parent view. 31 | */ 32 | unlayout(): void; 33 | private _traitNames; 34 | } 35 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/base/lib/widget_style.d.ts: -------------------------------------------------------------------------------- 1 | import { WidgetModel, WidgetView } from './widget'; 2 | export declare class StyleModel extends WidgetModel { 3 | defaults(): any; 4 | static styleProperties: { 5 | [s: string]: IStyleProperty; 6 | }; 7 | } 8 | interface IStyleProperty { 9 | attribute: string; 10 | selector: string; 11 | default: string; 12 | } 13 | export declare class StyleView extends WidgetView { 14 | /** 15 | * Public constructor 16 | */ 17 | initialize(parameters: WidgetView.InitializeParameters): void; 18 | /** 19 | * Register a CSS trait that is known by the model 20 | * @param trait 21 | */ 22 | registerTrait(trait: string): void; 23 | /** 24 | * Handles when a trait value changes 25 | */ 26 | handleChange(trait: string, value: any): void; 27 | /** 28 | * Apply styles for all registered traits 29 | */ 30 | style(): void; 31 | /** 32 | * Remove the styling from the parent view. 33 | */ 34 | unstyle(): void; 35 | private _traitNames; 36 | } 37 | export {}; 38 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/controls/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 Project Jupyter Contributors 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | 3. Neither the name of the copyright holder nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/controls/README.md: -------------------------------------------------------------------------------- 1 | Jupyter JS Widgets 2 | ================== 3 | 4 | Interactive widgets for the Jupyter notebook. 5 | 6 | This packages contains the implementation of the core Jupyter interactive 7 | widgets. 8 | 9 | The reference Python backend, `ipywidgets` is available 10 | [here](https://github.com/jupyter-widgets/ipywidgets), with more examples. 11 | 12 | Package Install 13 | --------------- 14 | 15 | **Prerequisites** 16 | - [node](http://nodejs.org/) 17 | 18 | Run the following command **at the root of this repository**. 19 | 20 | ```bash 21 | npm install --save @jupyter-widgets/controls 22 | ``` 23 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/controls/css/widgets.css: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Jupyter Development Team. 2 | * Distributed under the terms of the Modified BSD License. 3 | */ 4 | 5 | @import "./labvariables.css"; 6 | @import "./widgets-base.css"; 7 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/controls/lib/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './utils'; 2 | export * from './version'; 3 | export * from './widget_link'; 4 | export * from './widget_bool'; 5 | export * from './widget_button'; 6 | export * from './widget_box'; 7 | export * from './widget_image'; 8 | export * from './widget_video'; 9 | export * from './widget_audio'; 10 | export * from './widget_color'; 11 | export * from './widget_date'; 12 | export * from './widget_int'; 13 | export * from './widget_float'; 14 | export * from './widget_controller'; 15 | export * from './widget_selection'; 16 | export * from './widget_selectioncontainer'; 17 | export * from './widget_string'; 18 | export * from './widget_description'; 19 | export * from './widget_upload'; 20 | export declare const version: any; 21 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/controls/lib/index.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Jupyter Development Team. 2 | // Distributed under the terms of the Modified BSD License. 3 | export * from "./utils"; 4 | export * from "./version"; 5 | export * from "./widget_link"; 6 | export * from "./widget_bool"; 7 | export * from "./widget_button"; 8 | export * from "./widget_box"; 9 | export * from "./widget_image"; 10 | export * from "./widget_video"; 11 | export * from "./widget_audio"; 12 | export * from "./widget_color"; 13 | export * from "./widget_date"; 14 | export * from "./widget_int"; 15 | export * from "./widget_float"; 16 | export * from "./widget_controller"; 17 | export * from "./widget_selection"; 18 | export * from "./widget_selectioncontainer"; 19 | export * from "./widget_string"; 20 | export * from "./widget_description"; 21 | export * from "./widget_upload"; 22 | export var version = require("../package.json").version; 23 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/controls/lib/utils.d.ts: -------------------------------------------------------------------------------- 1 | export { uuid, WrappedError, resolvePromisesDict } from '@jupyter-widgets/base'; 2 | /** 3 | * Creates a wrappable Promise rejection function. 4 | * 5 | * Creates a function that returns a Promise.reject with a new WrappedError 6 | * that has the provided message and wraps the original error that 7 | * caused the promise to reject. 8 | */ 9 | export declare function reject(message: any, log: any): (error: any) => Promise; 10 | /** 11 | * Apply MathJax rendering to an element, and optionally set its text. 12 | * 13 | * If MathJax is not available, make no changes. 14 | * 15 | * Parameters 16 | * ---------- 17 | * element: Node 18 | * text: optional string 19 | */ 20 | export declare function typeset(element: HTMLElement, text?: string): void; 21 | /** 22 | * escape text to HTML 23 | */ 24 | export declare function escape_html(text: string): string; 25 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/controls/lib/utils.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Jupyter Development Team. 2 | // Distributed under the terms of the Modified BSD License. 3 | export { uuid, WrappedError, resolvePromisesDict } from '../../base'; 4 | import { WrappedError } from '../../base'; 5 | /** 6 | * Creates a wrappable Promise rejection function. 7 | * 8 | * Creates a function that returns a Promise.reject with a new WrappedError 9 | * that has the provided message and wraps the original error that 10 | * caused the promise to reject. 11 | */ 12 | export function reject(message, log) { 13 | return function promiseRejection(error) { 14 | var wrapped_error = new WrappedError(message, error); 15 | if (log) { 16 | console.error(wrapped_error); 17 | } 18 | return Promise.reject(wrapped_error); 19 | }; 20 | } 21 | /** 22 | * Apply MathJax rendering to an element, and optionally set its text. 23 | * 24 | * If MathJax is not available, make no changes. 25 | * 26 | * Parameters 27 | * ---------- 28 | * element: Node 29 | * text: optional string 30 | */ 31 | export function typeset(element, text) { 32 | if (text !== void 0) { 33 | element.textContent = text; 34 | } 35 | if (window.MathJax !== void 0) { 36 | MathJax.Hub.Queue(['Typeset', MathJax.Hub, element]); 37 | } 38 | } 39 | /** 40 | * escape text to HTML 41 | */ 42 | export function escape_html(text) { 43 | var esc = document.createElement('div'); 44 | esc.textContent = text; 45 | return esc.innerHTML; 46 | } 47 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/controls/lib/version.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * The version of the Jupyter controls widget attribute spec that this package 3 | * implements. 4 | */ 5 | export declare const JUPYTER_CONTROLS_VERSION = "1.5.0"; 6 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/controls/lib/version.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Jupyter Development Team. 2 | // Distributed under the terms of the Modified BSD License. 3 | /** 4 | * The version of the Jupyter controls widget attribute spec that this package 5 | * implements. 6 | */ 7 | export var JUPYTER_CONTROLS_VERSION = '1.5.0'; 8 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/controls/lib/widget_audio.d.ts: -------------------------------------------------------------------------------- 1 | import { DOMWidgetView } from '@jupyter-widgets/base'; 2 | import { CoreDOMWidgetModel } from './widget_core'; 3 | export declare class AudioModel extends CoreDOMWidgetModel { 4 | defaults(): any; 5 | static serializers: { 6 | value: { 7 | serialize: (value: any) => DataView; 8 | }; 9 | }; 10 | } 11 | export declare class AudioView extends DOMWidgetView { 12 | render(): void; 13 | update(): void; 14 | remove(): void; 15 | /** 16 | * The default tag name. 17 | * 18 | * #### Notes 19 | * This is a read-only attribute. 20 | */ 21 | get tagName(): string; 22 | el: HTMLAudioElement; 23 | } 24 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/controls/lib/widget_box.d.ts: -------------------------------------------------------------------------------- 1 | import { DOMWidgetView, unpack_models, ViewList, JupyterPhosphorPanelWidget, WidgetModel } from '@jupyter-widgets/base'; 2 | import { CoreDOMWidgetModel } from './widget_core'; 3 | export declare class BoxModel extends CoreDOMWidgetModel { 4 | defaults(): any; 5 | static serializers: { 6 | children: { 7 | deserialize: typeof unpack_models; 8 | }; 9 | }; 10 | } 11 | export declare class HBoxModel extends BoxModel { 12 | defaults(): any; 13 | } 14 | export declare class VBoxModel extends BoxModel { 15 | defaults(): any; 16 | } 17 | export declare class BoxView extends DOMWidgetView { 18 | _createElement(tagName: string): HTMLElement; 19 | _setElement(el: HTMLElement): void; 20 | initialize(parameters: any): void; 21 | render(): void; 22 | update_children(): void; 23 | update_box_style(): void; 24 | set_box_style(): void; 25 | add_child_model(model: WidgetModel): Promise; 26 | remove(): void; 27 | children_views: ViewList; 28 | pWidget: JupyterPhosphorPanelWidget; 29 | static class_map: { 30 | success: string[]; 31 | info: string[]; 32 | warning: string[]; 33 | danger: string[]; 34 | }; 35 | } 36 | export declare class HBoxView extends BoxView { 37 | /** 38 | * Public constructor 39 | */ 40 | initialize(parameters: any): void; 41 | } 42 | export declare class VBoxView extends BoxView { 43 | /** 44 | * Public constructor 45 | */ 46 | initialize(parameters: any): void; 47 | } 48 | export declare class GridBoxView extends BoxView { 49 | /** 50 | * Public constructor 51 | */ 52 | initialize(parameters: any): void; 53 | } 54 | export declare class GridBoxModel extends BoxModel { 55 | defaults(): any; 56 | } 57 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/controls/lib/widget_button.d.ts: -------------------------------------------------------------------------------- 1 | import { DOMWidgetView, StyleModel } from '@jupyter-widgets/base'; 2 | import { CoreDOMWidgetModel } from './widget_core'; 3 | export declare class ButtonStyleModel extends StyleModel { 4 | defaults(): any; 5 | static styleProperties: { 6 | button_color: { 7 | selector: string; 8 | attribute: string; 9 | default: any; 10 | }; 11 | font_weight: { 12 | selector: string; 13 | attribute: string; 14 | default: string; 15 | }; 16 | }; 17 | } 18 | export declare class ButtonModel extends CoreDOMWidgetModel { 19 | defaults(): any; 20 | } 21 | export declare class ButtonView extends DOMWidgetView { 22 | /** 23 | * Called when view is rendered. 24 | */ 25 | render(): void; 26 | /** 27 | * Update the contents of this view 28 | * 29 | * Called when the model is changed. The model may have been 30 | * changed by another view or by a state update from the back-end. 31 | */ 32 | update(): void; 33 | update_button_style(): void; 34 | set_button_style(): void; 35 | /** 36 | * Dictionary of events and handlers 37 | */ 38 | events(): { 39 | [e: string]: string; 40 | }; 41 | /** 42 | * Handles when the button is clicked. 43 | */ 44 | _handle_click(event: MouseEvent): void; 45 | /** 46 | * The default tag name. 47 | * 48 | * #### Notes 49 | * This is a read-only attribute. 50 | */ 51 | get tagName(): string; 52 | el: HTMLButtonElement; 53 | static class_map: { 54 | primary: string[]; 55 | success: string[]; 56 | info: string[]; 57 | warning: string[]; 58 | danger: string[]; 59 | }; 60 | } 61 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/controls/lib/widget_color.d.ts: -------------------------------------------------------------------------------- 1 | import { CoreDescriptionModel } from './widget_core'; 2 | import { DescriptionView } from './widget_description'; 3 | export declare class ColorPickerModel extends CoreDescriptionModel { 4 | defaults(): any; 5 | } 6 | export declare class ColorPickerView extends DescriptionView { 7 | render(): void; 8 | /** 9 | * Update the contents of this view 10 | * 11 | * Called when the model is changed. The model may have been 12 | * changed by another view or by a state update from the back-end. 13 | */ 14 | update(options?: any): void; 15 | events(): { 16 | [e: string]: string; 17 | }; 18 | private _update_value; 19 | private _update_concise; 20 | private _picker_change; 21 | private _text_change; 22 | private _validate_color; 23 | private _color_container; 24 | private _textbox; 25 | private _colorpicker; 26 | } 27 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/controls/lib/widget_core.d.ts: -------------------------------------------------------------------------------- 1 | import { DOMWidgetModel, WidgetModel } from '@jupyter-widgets/base'; 2 | import { DescriptionModel } from './widget_description'; 3 | export declare class CoreWidgetModel extends WidgetModel { 4 | defaults(): any; 5 | } 6 | export declare class CoreDOMWidgetModel extends DOMWidgetModel { 7 | defaults(): any; 8 | } 9 | export declare class CoreDescriptionModel extends DescriptionModel { 10 | defaults(): any; 11 | } 12 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/controls/lib/widget_date.d.ts: -------------------------------------------------------------------------------- 1 | import { DescriptionView } from './widget_description'; 2 | import { CoreDescriptionModel } from './widget_core'; 3 | export declare function serialize_date(value: Date): { 4 | year: number; 5 | month: number; 6 | date: number; 7 | }; 8 | export interface SerializedDate { 9 | /** 10 | * Full year 11 | */ 12 | year: number; 13 | /** 14 | * Zero-based month (0 means January, 11 means December) 15 | */ 16 | month: number; 17 | /** 18 | * Day of month 19 | */ 20 | date: number; 21 | } 22 | export declare function deserialize_date(value: SerializedDate): Date; 23 | export declare class DatePickerModel extends CoreDescriptionModel { 24 | static serializers: { 25 | value: { 26 | serialize: typeof serialize_date; 27 | deserialize: typeof deserialize_date; 28 | }; 29 | }; 30 | defaults(): any; 31 | } 32 | export declare class DatePickerView extends DescriptionView { 33 | render(): void; 34 | /** 35 | * Update the contents of this view 36 | * 37 | * Called when the model is changed. The model may have been 38 | * changed by another view or by a state update from the back-end. 39 | */ 40 | update(options?: any): void; 41 | events(): { 42 | [e: string]: string; 43 | }; 44 | private _update_value; 45 | private _picker_change; 46 | private _picker_focusout; 47 | private _datepicker; 48 | } 49 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/controls/lib/widget_description.d.ts: -------------------------------------------------------------------------------- 1 | import { DOMWidgetModel, DOMWidgetView, StyleModel } from '@jupyter-widgets/base'; 2 | export declare class DescriptionStyleModel extends StyleModel { 3 | defaults(): any; 4 | static styleProperties: { 5 | description_width: { 6 | selector: string; 7 | attribute: string; 8 | default: any; 9 | }; 10 | }; 11 | } 12 | export declare class DescriptionModel extends DOMWidgetModel { 13 | defaults(): any; 14 | } 15 | export declare class DescriptionView extends DOMWidgetView { 16 | render(): void; 17 | typeset(element: HTMLElement, text?: string): void; 18 | updateDescription(): void; 19 | label: HTMLLabelElement; 20 | } 21 | /** 22 | * For backwards compatibility with jupyter-js-widgets 2.x. 23 | * 24 | * Use DescriptionModel instead. 25 | */ 26 | export declare class LabeledDOMWidgetModel extends DescriptionModel { 27 | } 28 | /** 29 | * For backwards compatibility with jupyter-js-widgets 2.x. 30 | * 31 | * Use DescriptionView instead. 32 | */ 33 | export declare class LabeledDOMWidgetView extends DescriptionView { 34 | } 35 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/controls/lib/widget_image.d.ts: -------------------------------------------------------------------------------- 1 | import { DOMWidgetView } from '@jupyter-widgets/base'; 2 | import { CoreDOMWidgetModel } from './widget_core'; 3 | export declare class ImageModel extends CoreDOMWidgetModel { 4 | defaults(): any; 5 | static serializers: { 6 | value: { 7 | serialize: (value: any) => DataView; 8 | }; 9 | }; 10 | } 11 | export declare class ImageView extends DOMWidgetView { 12 | render(): void; 13 | update(): void; 14 | remove(): void; 15 | /** 16 | * The default tag name. 17 | * 18 | * #### Notes 19 | * This is a read-only attribute. 20 | */ 21 | get tagName(): string; 22 | el: HTMLImageElement; 23 | } 24 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/controls/lib/widget_link.d.ts: -------------------------------------------------------------------------------- 1 | import { WidgetModel, unpack_models } from '@jupyter-widgets/base'; 2 | import { CoreWidgetModel } from './widget_core'; 3 | export declare class DirectionalLinkModel extends CoreWidgetModel { 4 | static serializers: { 5 | target: { 6 | deserialize: typeof unpack_models; 7 | }; 8 | source: { 9 | deserialize: typeof unpack_models; 10 | }; 11 | }; 12 | defaults(): any; 13 | initialize(attributes: any, options: { 14 | model_id: string; 15 | comm: any; 16 | widget_manager: any; 17 | }): void; 18 | updateValue(sourceModel: WidgetModel, sourceAttr: string, targetModel: WidgetModel, targetAttr: string): void; 19 | updateBindings(): void; 20 | cleanup(): void; 21 | sourceModel: WidgetModel; 22 | sourceAttr: string; 23 | targetModel: WidgetModel; 24 | targetAttr: string; 25 | private _updating; 26 | } 27 | export declare class LinkModel extends DirectionalLinkModel { 28 | defaults(): any; 29 | updateBindings(): void; 30 | cleanup(): void; 31 | } 32 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/controls/lib/widget_upload.d.ts: -------------------------------------------------------------------------------- 1 | import { CoreDOMWidgetModel } from './widget_core'; 2 | import { DOMWidgetView } from '@jupyter-widgets/base'; 3 | export declare class FileUploadModel extends CoreDOMWidgetModel { 4 | defaults(): any; 5 | static serializers: { 6 | data: { 7 | serialize: (buffers: any) => any[]; 8 | }; 9 | }; 10 | } 11 | export declare class FileUploadView extends DOMWidgetView { 12 | el: HTMLButtonElement; 13 | fileInput: HTMLInputElement; 14 | fileReader: FileReader; 15 | get tagName(): string; 16 | render(): void; 17 | update(): void; 18 | update_button_style(): void; 19 | set_button_style(): void; 20 | static class_map: { 21 | primary: string[]; 22 | success: string[]; 23 | info: string[]; 24 | warning: string[]; 25 | danger: string[]; 26 | }; 27 | } 28 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/controls/lib/widget_video.d.ts: -------------------------------------------------------------------------------- 1 | import { DOMWidgetView } from '@jupyter-widgets/base'; 2 | import { CoreDOMWidgetModel } from './widget_core'; 3 | export declare class VideoModel extends CoreDOMWidgetModel { 4 | defaults(): any; 5 | static serializers: { 6 | value: { 7 | serialize: (value: any) => DataView; 8 | }; 9 | }; 10 | } 11 | export declare class VideoView extends DOMWidgetView { 12 | render(): void; 13 | update(): void; 14 | remove(): void; 15 | /** 16 | * The default tag name. 17 | * 18 | * #### Notes 19 | * This is a read-only attribute. 20 | */ 21 | get tagName(): string; 22 | el: HTMLVideoElement; 23 | } 24 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/html-manager/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 Project Jupyter Contributors 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | 3. Neither the name of the copyright holder nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/html-manager/css/output.css: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------- 2 | | Copyright (c) Jupyter Development Team. 3 | | Distributed under the terms of the Modified BSD License. 4 | |----------------------------------------------------------------------------*/ 5 | 6 | .jupyter-widgets.widget-output .jp-OutputArea-prompt { 7 | display: none; 8 | } 9 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/html-manager/lib/embed-amd-render.d.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnextio/cnext/74a29f4a6cb5d5b1ed5bff9836dae7f80461be81/cnext_app/lib/@jupyter-widgets/html-manager/lib/embed-amd-render.d.ts -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/html-manager/lib/embed-amd-render.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Jupyter Development Team. 2 | // Distributed under the terms of the Modified BSD License. 3 | window.require(['@jupyter-widgets/html-manager/dist/libembed-amd'], function (embed) { 4 | if (document.readyState === 'complete') { 5 | embed.renderWidgets(); 6 | } 7 | else { 8 | window.addEventListener('load', function () { embed.renderWidgets(); }); 9 | } 10 | }); 11 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/html-manager/lib/embed.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/html-manager/lib/embed.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Jupyter Development Team. 2 | // Distributed under the terms of the Modified BSD License. 3 | import { HTMLManager } from './index'; 4 | import { renderWidgets } from './libembed'; 5 | // Render the widgets that we can 6 | if (!window._jupyter_widget_embedder) { 7 | window._jupyter_widget_embedder = true; 8 | window.addEventListener('load', () => { 9 | renderWidgets(() => new HTMLManager()); 10 | }); 11 | } 12 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/html-manager/lib/htmlmanager.d.ts: -------------------------------------------------------------------------------- 1 | import * as base from '@jupyter-widgets/base'; 2 | import { RenderMimeRegistry } from '@jupyterlab/rendermime'; 3 | export declare class HTMLManager extends base.ManagerBase { 4 | constructor(options?: { 5 | loader?: (moduleName: string, moduleVersion: string) => Promise; 6 | }); 7 | /** 8 | * Display the specified view. Element where the view is displayed 9 | * is specified in the `options.el` argument. 10 | */ 11 | display_view(msg: any, view: any, options: { 12 | el: HTMLElement; 13 | }): Promise; 14 | /** 15 | * Placeholder implementation for _get_comm_info. 16 | */ 17 | _get_comm_info(): Promise<{}>; 18 | /** 19 | * Placeholder implementation for _create_comm. 20 | */ 21 | _create_comm(comm_target_name: string, model_id: string, data?: any, metadata?: any, buffers?: ArrayBuffer[] | ArrayBufferView[]): Promise; 22 | /** 23 | * Load a class and return a promise to the loaded object. 24 | */ 25 | protected loadClass(className: string, moduleName: string, moduleVersion: string): Promise; 26 | /** 27 | * Renderers for contents of the output widgets 28 | * 29 | * Defines how outputs in the output widget should be rendered. 30 | */ 31 | renderMime: RenderMimeRegistry; 32 | /** 33 | * A loader for a given module name and module version, and returns a promise to a module 34 | */ 35 | loader: (moduleName: string, moduleVersion: string) => Promise; 36 | } 37 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/html-manager/lib/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from "./htmlmanager"; 2 | export { requireLoader } from "./libembed-amd"; 3 | export declare const version: any; 4 | export declare function generateEmbedScript(widgetState: any, imageDataUrl: string): string; 5 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/html-manager/lib/index.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Jupyter Development Team. 2 | // Distributed under the terms of the Modified BSD License. 3 | export * from "./htmlmanager"; 4 | export { requireLoader } from "./libembed-amd"; 5 | export const version = require('../package.json').version; 6 | export function generateEmbedScript(widgetState, imageDataUrl) { 7 | return ` 8 | `; 9 | } 10 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/html-manager/lib/libembed-amd.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Load an amd module locally and fall back to specified CDN if unavailable. 3 | * 4 | * @param moduleName The name of the module to load.. 5 | * @param version The semver range for the module, if loaded from a CDN. 6 | * 7 | * By default, the CDN service used is unpkg.com. However, this default can be 8 | * overriden by specifying another URL via the HTML attribute 9 | * "data-jupyter-widgets-cdn" on a script tag of the page. 10 | * 11 | * The semver range is only used with the CDN. 12 | */ 13 | export declare function requireLoader(moduleName: string, moduleVersion: string): Promise; 14 | /** 15 | * Render widgets in a given element. 16 | * 17 | * @param element (default document.documentElement) The element containing widget state and views. 18 | * @param loader (default requireLoader) The function used to look up the modules containing 19 | * the widgets' models and views classes. (The default loader looks them up on unpkg.com) 20 | */ 21 | export declare function renderWidgets(element?: HTMLElement, loader?: (moduleName: string, moduleVersion: string) => Promise): void; 22 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/html-manager/lib/libembed.d.ts: -------------------------------------------------------------------------------- 1 | import 'font-awesome/css/font-awesome.css'; 2 | import '@lumino/widgets/style/index.css'; 3 | import '@jupyter-widgets/controls/css/widgets-base.css'; 4 | import { HTMLManager } from './index'; 5 | /** 6 | * Render the inline widgets inside a DOM element. 7 | * 8 | * @param managerFactory A function that returns a new HTMLManager 9 | * @param element (default document.documentElement) The document element in which to process for widget state. 10 | */ 11 | export declare function renderWidgets(managerFactory: () => HTMLManager, element?: HTMLElement): void; 12 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/html-manager/lib/output.d.ts: -------------------------------------------------------------------------------- 1 | import * as outputBase from '@jupyter-widgets/output'; 2 | import { Panel } from '@lumino/widgets'; 3 | import { OutputAreaModel } from '@jupyterlab/outputarea'; 4 | import { HTMLManager } from './htmlmanager'; 5 | import '../css/output.css'; 6 | export declare class OutputModel extends outputBase.OutputModel { 7 | defaults(): any; 8 | initialize(attributes: any, options: any): void; 9 | get outputs(): OutputAreaModel; 10 | clear_output(wait?: boolean): void; 11 | setOutputs(model?: any, value?: any, options?: any): void; 12 | private _outputs; 13 | widget_manager: HTMLManager; 14 | } 15 | export declare class OutputView extends outputBase.OutputView { 16 | _createElement(tagName: string): HTMLElement; 17 | _setElement(el: HTMLElement): void; 18 | render(): void; 19 | model: OutputModel; 20 | private _outputView; 21 | pWidget: Panel; 22 | } 23 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/html-manager/lib/output.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Jupyter Development Team. 2 | // Distributed under the terms of the Modified BSD License. 3 | import * as outputBase from '../../output'; 4 | import { Panel } from '@lumino/widgets'; 5 | import { OutputAreaModel, OutputArea } from '@jupyterlab/outputarea'; 6 | import $ from 'jquery'; 7 | // import '../css/output.css'; 8 | export class OutputModel extends outputBase.OutputModel { 9 | defaults() { 10 | return Object.assign(Object.assign({}, super.defaults()), { msg_id: '', outputs: [] }); 11 | } 12 | initialize(attributes, options) { 13 | super.initialize(attributes, options); 14 | this._outputs = new OutputAreaModel({ trusted: true }); 15 | this.listenTo(this, 'change:outputs', this.setOutputs); 16 | this.setOutputs(); 17 | } 18 | get outputs() { 19 | return this._outputs; 20 | } 21 | clear_output(wait = false) { 22 | this._outputs.clear(wait); 23 | } 24 | setOutputs(model, value, options) { 25 | if (!(options && options.newMessage)) { 26 | // fromJSON does not clear the existing output 27 | this.clear_output(); 28 | // fromJSON does not copy the message, so we make a deep copy 29 | this._outputs.fromJSON(JSON.parse(JSON.stringify(this.get('outputs')))); 30 | } 31 | } 32 | } 33 | export class OutputView extends outputBase.OutputView { 34 | _createElement(tagName) { 35 | this.pWidget = new Panel(); 36 | return this.pWidget.node; 37 | } 38 | _setElement(el) { 39 | if (this.el || el !== this.pWidget.node) { 40 | // Boxes don't allow setting the element beyond the initial creation. 41 | throw new Error('Cannot reset the DOM element.'); 42 | } 43 | this.el = this.pWidget.node; 44 | this.$el = $(this.pWidget.node); 45 | } 46 | render() { 47 | const manager = this.model.widget_manager; 48 | const rendermime = manager.renderMime; 49 | this._outputView = new OutputArea({ 50 | rendermime: rendermime, 51 | model: this.model.outputs 52 | }); 53 | this.pWidget.insertWidget(0, this._outputView); 54 | this.pWidget.addClass('jupyter-widgets'); 55 | this.pWidget.addClass('widget-output'); 56 | this.update(); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/html-manager/lib/output_renderers.d.ts: -------------------------------------------------------------------------------- 1 | import { Widget } from '@lumino/widgets'; 2 | import { IRenderMime } from '@jupyterlab/rendermime-interfaces'; 3 | import { HTMLManager } from './htmlmanager'; 4 | export declare const WIDGET_MIMETYPE = "application/vnd.jupyter.widget-view+json"; 5 | export declare class WidgetRenderer extends Widget implements IRenderMime.IRenderer { 6 | constructor(options: IRenderMime.IRendererOptions, manager: HTMLManager); 7 | renderModel(model: IRenderMime.IMimeModel): Promise; 8 | /** 9 | * The mimetype being rendered. 10 | */ 11 | readonly mimeType: string; 12 | private _manager; 13 | } 14 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/html-manager/lib/output_renderers.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Jupyter Development Team. 2 | // Distributed under the terms of the Modified BSD License. 3 | import { Widget } from '@lumino/widgets'; 4 | export const WIDGET_MIMETYPE = 'application/vnd.jupyter.widget-view+json'; 5 | // Renderer to allow the output widget to render sub-widgets 6 | export class WidgetRenderer extends Widget { 7 | constructor(options, manager) { 8 | super(); 9 | this.mimeType = options.mimeType; 10 | this._manager = manager; 11 | } 12 | async renderModel(model) { 13 | const source = model.data[this.mimeType]; 14 | const modelPromise = this._manager.get_model(source.model_id); 15 | if (modelPromise) { 16 | try { 17 | let wModel = await modelPromise; 18 | await this._manager.display_model(null, wModel, { el: this.node }); 19 | } 20 | catch (err) { 21 | console.log('Error displaying widget'); 22 | console.log(err); 23 | this.node.textContent = 'Error displaying widget'; 24 | this.addClass('jupyter-widgets'); 25 | } 26 | } 27 | else { 28 | this.node.textContent = 'Error creating widget: could not find model'; 29 | this.addClass('jupyter-widgets'); 30 | return Promise.resolve(); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/jupyterlab-manager/lib/index.d.ts: -------------------------------------------------------------------------------- 1 | import WidgetManagerProvider from './plugin'; 2 | import * as output from './output'; 3 | export default WidgetManagerProvider; 4 | export { registerWidgetManager } from './plugin'; 5 | export { WidgetManager } from './manager'; 6 | export { WidgetRenderer } from './renderer'; 7 | export { output }; 8 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/jupyterlab-manager/lib/index.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Jupyter Development Team. 2 | // Distributed under the terms of the Modified BSD License. 3 | import WidgetManagerProvider from './plugin'; 4 | import * as output from './output'; 5 | export default WidgetManagerProvider; 6 | export { registerWidgetManager } from './plugin'; 7 | export { WidgetManager } from './manager'; 8 | export { WidgetRenderer } from './renderer'; 9 | export { output }; 10 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/jupyterlab-manager/lib/output.d.ts: -------------------------------------------------------------------------------- 1 | import * as outputBase from '@jupyter-widgets/output'; 2 | import { JupyterPhosphorWidget } from '@jupyter-widgets/base'; 3 | import { Message } from '@lumino/messaging'; 4 | import { Panel } from '@lumino/widgets'; 5 | import { WidgetManager } from './manager'; 6 | import { OutputAreaModel, OutputArea } from '@jupyterlab/outputarea'; 7 | import { KernelMessage, Session } from '@jupyterlab/services'; 8 | export declare const OUTPUT_WIDGET_VERSION = "1.0.0"; 9 | export declare class OutputModel extends outputBase.OutputModel { 10 | defaults(): any; 11 | initialize(attributes: any, options: any): void; 12 | /** 13 | * Register a new kernel 14 | */ 15 | _handleKernelChanged({ oldValue }: Session.ISessionConnection.IKernelChangedArgs): void; 16 | /** 17 | * Reset the message id. 18 | */ 19 | reset_msg_id(): void; 20 | add(msg: KernelMessage.IIOPubMessage): void; 21 | clear_output(wait?: boolean): void; 22 | get outputs(): OutputAreaModel; 23 | setOutputs(model?: any, value?: any, options?: any): void; 24 | widget_manager: WidgetManager; 25 | private _msgHook; 26 | private _outputs; 27 | } 28 | export declare class JupyterPhosphorPanelWidget extends Panel { 29 | constructor(options: JupyterPhosphorWidget.IOptions & Panel.IOptions); 30 | /** 31 | * Process the phosphor message. 32 | * 33 | * Any custom phosphor widget used inside a Jupyter widget should override 34 | * the processMessage function like this. 35 | */ 36 | processMessage(msg: Message): void; 37 | /** 38 | * Dispose the widget. 39 | * 40 | * This causes the view to be destroyed as well with 'remove' 41 | */ 42 | dispose(): void; 43 | private _view; 44 | } 45 | export declare class OutputView extends outputBase.OutputView { 46 | _createElement(tagName: string): HTMLElement; 47 | _setElement(el: HTMLElement): void; 48 | /** 49 | * Called when view is rendered. 50 | */ 51 | render(): void; 52 | remove(): any; 53 | model: OutputModel; 54 | _outputView: OutputArea; 55 | pWidget: Panel; 56 | } 57 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/jupyterlab-manager/lib/plugin.d.ts: -------------------------------------------------------------------------------- 1 | import { DocumentRegistry } from '@jupyterlab/docregistry'; 2 | import { INotebookModel } from '@jupyterlab/notebook'; 3 | import { JupyterFrontEndPlugin } from '@jupyterlab/application'; 4 | import { IRenderMimeRegistry } from '@jupyterlab/rendermime'; 5 | import { DisposableDelegate } from '@lumino/disposable'; 6 | import { WidgetRenderer } from './renderer'; 7 | import * as base from '@jupyter-widgets/base'; 8 | import '@jupyter-widgets/base/css/index.css'; 9 | import '@jupyter-widgets/controls/css/widgets-base.css'; 10 | export declare function registerWidgetManager(context: DocumentRegistry.IContext, rendermime: IRenderMimeRegistry, renderers: IterableIterator): DisposableDelegate; 11 | /** 12 | * The widget manager provider. 13 | */ 14 | declare const plugin: JupyterFrontEndPlugin; 15 | export default plugin; 16 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/jupyterlab-manager/lib/renderer.d.ts: -------------------------------------------------------------------------------- 1 | import { IDisposable } from '@lumino/disposable'; 2 | import { Panel } from '@lumino/widgets'; 3 | import { IRenderMime } from '@jupyterlab/rendermime-interfaces'; 4 | import { WidgetManager } from './manager'; 5 | /** 6 | * A renderer for widgets. 7 | */ 8 | export declare class WidgetRenderer extends Panel implements IRenderMime.IRenderer, IDisposable { 9 | constructor(options: IRenderMime.IRendererOptions, manager?: WidgetManager); 10 | /** 11 | * The widget manager. 12 | */ 13 | set manager(value: WidgetManager); 14 | renderModel(model: IRenderMime.IMimeModel): Promise; 15 | /** 16 | * Get whether the manager is disposed. 17 | * 18 | * #### Notes 19 | * This is a read-only property. 20 | */ 21 | get isDisposed(): boolean; 22 | /** 23 | * Dispose the resources held by the manager. 24 | */ 25 | dispose(): void; 26 | private _rerender; 27 | /** 28 | * The mimetype being rendered. 29 | */ 30 | readonly mimeType: string; 31 | private _manager; 32 | private _rerenderMimeModel; 33 | } 34 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/jupyterlab-manager/lib/semvercache.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * A cache using semver ranges to retrieve values. 3 | */ 4 | export declare class SemVerCache { 5 | set(key: string, version: string, object: T): void; 6 | get(key: string, semver: string): T; 7 | private _cache; 8 | } 9 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/jupyterlab-manager/lib/semvercache.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Jupyter Development Team. 2 | // Distributed under the terms of the Modified BSD License. 3 | import { maxSatisfying } from 'semver'; 4 | /** 5 | * A cache using semver ranges to retrieve values. 6 | */ 7 | export class SemVerCache { 8 | constructor() { 9 | this._cache = Object.create(null); 10 | } 11 | set(key, version, object) { 12 | if (!(key in this._cache)) { 13 | this._cache[key] = Object.create(null); 14 | } 15 | if (!(version in this._cache[key])) { 16 | this._cache[key][version] = object; 17 | } 18 | else { 19 | throw `Version ${version} of key ${key} already registered.`; 20 | } 21 | } 22 | get(key, semver) { 23 | if (key in this._cache) { 24 | let versions = this._cache[key]; 25 | let best = maxSatisfying(Object.keys(versions), semver); 26 | return versions[best]; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/jupyterlab-manager/schema/plugin.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Jupyter Widgets", 3 | "description": "Jupyter widgets settings.", 4 | "additionalProperties": false, 5 | "properties": { 6 | "saveState": { 7 | "type": "boolean", 8 | "title": "Save Jupyter widget state in notebooks", 9 | "description": "Automatically save Jupyter widget state when a notebook is saved.", 10 | "default": false 11 | } 12 | }, 13 | "type": "object" 14 | } 15 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/output/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 Project Jupyter Contributors 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | 3. Neither the name of the copyright holder nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/output/lib/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './output'; 2 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/output/lib/index.js: -------------------------------------------------------------------------------- 1 | export * from './output'; 2 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/output/lib/output.d.ts: -------------------------------------------------------------------------------- 1 | import { DOMWidgetModel, DOMWidgetView } from '@jupyter-widgets/base'; 2 | export declare const OUTPUT_WIDGET_VERSION = "1.0.0"; 3 | export declare class OutputModel extends DOMWidgetModel { 4 | defaults(): any; 5 | } 6 | export declare class OutputView extends DOMWidgetView { 7 | } 8 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/output/lib/output.js: -------------------------------------------------------------------------------- 1 | var __extends = (this && this.__extends) || (function () { 2 | var extendStatics = function (d, b) { 3 | extendStatics = Object.setPrototypeOf || 4 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 5 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; 6 | return extendStatics(d, b); 7 | }; 8 | return function (d, b) { 9 | extendStatics(d, b); 10 | function __() { this.constructor = d; } 11 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 12 | }; 13 | })(); 14 | var __assign = (this && this.__assign) || function () { 15 | __assign = Object.assign || function(t) { 16 | for (var s, i = 1, n = arguments.length; i < n; i++) { 17 | s = arguments[i]; 18 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) 19 | t[p] = s[p]; 20 | } 21 | return t; 22 | }; 23 | return __assign.apply(this, arguments); 24 | }; 25 | import { DOMWidgetModel, DOMWidgetView } from '../../base'; 26 | export var OUTPUT_WIDGET_VERSION = '1.0.0'; 27 | var OutputModel = /** @class */ (function (_super) { 28 | __extends(OutputModel, _super); 29 | function OutputModel() { 30 | return _super !== null && _super.apply(this, arguments) || this; 31 | } 32 | OutputModel.prototype.defaults = function () { 33 | return __assign(__assign({}, _super.prototype.defaults.call(this)), { _model_name: 'OutputModel', _view_name: 'OutputView', _model_module: '../../output', _view_module: '../../output', _model_module_version: OUTPUT_WIDGET_VERSION, _view_module_version: OUTPUT_WIDGET_VERSION }); 34 | }; 35 | return OutputModel; 36 | }(DOMWidgetModel)); 37 | export { OutputModel }; 38 | var OutputView = /** @class */ (function (_super) { 39 | __extends(OutputView, _super); 40 | function OutputView() { 41 | return _super !== null && _super.apply(this, arguments) || this; 42 | } 43 | return OutputView; 44 | }(DOMWidgetView)); 45 | export { OutputView }; 46 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/output/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@jupyter-widgets/output", 3 | "version": "4.1.0", 4 | "description": "Jupyter widget wrapping cell output", 5 | "bugs": { 6 | "url": "https://github.com/jupyter-widgets/ipywidgets/issues" 7 | }, 8 | "repository": { 9 | "type": "git", 10 | "url": "https://github.com/jupyter-widgets/ipywidgets.git" 11 | }, 12 | "license": "BSD-3-Clause", 13 | "author": "Project Jupyter", 14 | "files": [ 15 | "lib/**/*.d.ts", 16 | "lib/**/*.js" 17 | ], 18 | "main": "lib/index.js", 19 | "typings": "lib/index.d.ts", 20 | "scripts": { 21 | "build": "npm run build:src", 22 | "build:src": "tsc", 23 | "clean": "rimraf lib && rimraf tsconfig.tsbuildinfo", 24 | "lint": "tslint --project tslint.json --format stylish", 25 | "prepublish": "npm run clean && npm run build", 26 | "test": "echo \"Error: no test specified\" && exit 1" 27 | }, 28 | "dependencies": { 29 | "@jupyter-widgets/base": "^4.1.0" 30 | }, 31 | "devDependencies": { 32 | "rimraf": "^2.6.1", 33 | "tslint": "^5.20.1", 34 | "typescript": "~3.7.4" 35 | }, 36 | "gitHead": "80a98429a4c9a0e88aeff9c8b873268785b3e033" 37 | } 38 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/schema/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 Project Jupyter Contributors 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | 3. Neither the name of the copyright holder nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/schema/README.md: -------------------------------------------------------------------------------- 1 | Jupyter Widgets Schema 2 | ====================== 3 | 4 | JSON schema for the json serialization of Jupyter Interactive Widgets. 5 | 6 | Package Install 7 | --------------- 8 | 9 | **Prerequisites** 10 | - [node](http://nodejs.org/) 11 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/schema/index.js: -------------------------------------------------------------------------------- 1 | export const v1 = { 2 | state: import('./v1/state.schema.json'), 3 | view: import('./v1/view.schema.json') 4 | }; 5 | export const v2 = { 6 | state: import('./v2/state.schema.json'), 7 | view: import('./v2/view.schema.json') 8 | }; 9 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/schema/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "name": "@jupyter-widgets/schema", 4 | "version": "0.4.2", 5 | "description": "Schemas for the Jupyter interactive Widgets", 6 | "main": "index.js", 7 | "scripts": { 8 | "test": "node index.js" 9 | }, 10 | "repository": { 11 | "type": "git", 12 | "url": "git+https://github.com/jupyter-widgets/ipywidgets.git" 13 | }, 14 | "keywords": [ 15 | "jupyter", 16 | "schemas", 17 | "notebook" 18 | ], 19 | "author": "Project Jupyter", 20 | "license": "BSD-3-Clause", 21 | "bugs": { 22 | "url": "https://github.com/jupyter-widgets/ipywidgets/issues" 23 | }, 24 | "homepage": "https://github.com/jupyter-widgets/ipywidgets#readme", 25 | "gitHead": "80a98429a4c9a0e88aeff9c8b873268785b3e033" 26 | } 27 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/schema/v1/state.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "description": "Jupyter Interactive Widget State JSON schema.", 4 | "type": "object", 5 | "properties" : { 6 | "version_major" : { 7 | "description": "Format version (major)", 8 | "type": "number", 9 | "minimum": 1, 10 | "maximum": 1 11 | }, 12 | "version_minor" : { 13 | "description": "Format version (minor)", 14 | "type": "number" 15 | }, 16 | "state": { 17 | "description": "Model State for All Widget Models", 18 | "type": "object", 19 | "additionalProperties": true, 20 | "additionalProperties" : { 21 | "type": "object", 22 | "properties": { 23 | "model_name": { 24 | "description" : "Name of the JavaScript class holding the model implementation", 25 | "type": "string" 26 | }, 27 | "model_module": { 28 | "description" : "Name of the JavaScript module holding the model implementation", 29 | "type": "string" 30 | }, 31 | "model_module_version": { 32 | "description" : "Semver range for the JavaScript module holding the model implementation", 33 | "type": "string" 34 | }, 35 | "state": { 36 | "description" : "Serialized state of the model", 37 | "type": "object", 38 | "additional_properties": true 39 | } 40 | }, 41 | "required": [ "model_name", "model_module", "state" ], 42 | "additionalProperties": false 43 | } 44 | } 45 | }, 46 | "required": [ "version_major", "version_minor", "state" ], 47 | "additionalProperties": false 48 | } 49 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/schema/v1/view.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "description": "Jupyter Interactive Widget View JSON schema.", 4 | "type": "object", 5 | "properties" : { 6 | "version_major" : { 7 | "description": "Format version (major)", 8 | "type": "number", 9 | "minimum": 1, 10 | "maximum": 1 11 | }, 12 | "version_minor" : { 13 | "description": "Format version (minor)", 14 | "type": "number" 15 | }, 16 | "model_id": { 17 | "description": "Unique identifier of the widget model to be displayed", 18 | "type": "string" 19 | } 20 | }, 21 | "required": [ "model_id" ], 22 | "additionalProperties": false 23 | } 24 | -------------------------------------------------------------------------------- /cnext_app/lib/@jupyter-widgets/schema/v2/view.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "description": "Jupyter Interactive Widget View JSON schema.", 4 | "type": "object", 5 | "properties": { 6 | "version_major": { 7 | "description": "Format version (major)", 8 | "type": "number", 9 | "minimum": 2, 10 | "maximum": 2 11 | }, 12 | "version_minor": { 13 | "description": "Format version (minor)", 14 | "type": "number" 15 | }, 16 | "model_id": { 17 | "description": "Unique identifier of the widget model to be displayed", 18 | "type": "string" 19 | } 20 | }, 21 | "required": [ 22 | "model_id" 23 | ] 24 | } -------------------------------------------------------------------------------- /cnext_app/lib/@xterm/index.ts: -------------------------------------------------------------------------------- 1 | import XTerm from './XTerm' 2 | 3 | export { XTerm } -------------------------------------------------------------------------------- /cnext_app/lib/codemirror/autocomplete-lsp/index.d.ts: -------------------------------------------------------------------------------- 1 | import { Socket } from "socket.io-client"; 2 | 3 | interface LanguageServerOptions { 4 | serverUri: `ws://${string}` | `wss://${string}`; 5 | rootUri: string; 6 | documentUri: string; 7 | languageId: string; 8 | socket: Socket | null; 9 | } 10 | 11 | declare function languageServer( 12 | options: LanguageServerOptions 13 | ): import("@codemirror/state").Extension[]; 14 | 15 | declare function dfFilterLanguageServer(): import("@codemirror/state").Extension[]; 16 | export { languageServer, dfFilterLanguageServer }; 17 | -------------------------------------------------------------------------------- /cnext_app/lib/codemirror/autocomplete-lsp/source.js: -------------------------------------------------------------------------------- 1 | import { Facet } from '@codemirror/state'; 2 | const useLast = (values) => values.reduce((_, v) => v, ''); 3 | 4 | export const MaxInfoWidth = 300; 5 | 6 | export const serverUri = Facet.define({ combine: useLast }); 7 | export const rootUri = Facet.define({ combine: useLast }); 8 | export const documentUri = Facet.define({ combine: useLast }); 9 | export const languageId = Facet.define({ combine: useLast }); 10 | -------------------------------------------------------------------------------- /cnext_app/lib/codemirror/grammar/cnext-python.terms.js: -------------------------------------------------------------------------------- 1 | // This file was generated by lezer-generator. You probably shouldn't edit it. 2 | export const 3 | printKeyword = 1, 4 | indent = 177, 5 | dedent = 178, 6 | newline = 179, 7 | newlineBracketed = 180, 8 | newlineEmpty = 181, 9 | eof = 182, 10 | Comment = 2, 11 | Script = 3, 12 | BinaryExpression = 6, 13 | ParenthesizedExpression = 21, 14 | ParenL = 22, 15 | binaryTest = 23, 16 | CompareOp = 26, 17 | unaryTest = 30, 18 | lambdaParams = 36, 19 | VariableName = 37, 20 | YieldExpression = 43, 21 | TupleExpression = 47, 22 | ComprehensionExpression = 48, 23 | ArrayExpression = 52, 24 | BracketL = 53, 25 | ArrayComprehensionExpression = 55, 26 | DictionaryExpression = 56, 27 | BraceL = 57, 28 | DictionaryComprehensionExpression = 59, 29 | SetExpression = 60, 30 | SetComprehensionExpression = 61, 31 | ArgList = 63, 32 | subscript = 218, 33 | PropertyName = 67, 34 | Number = 68, 35 | String = 69, 36 | FormatString = 70, 37 | FormatReplacement = 71, 38 | FormatConversion = 72, 39 | TypeDef = 78, 40 | UpdateOp = 81, 41 | ImportStatement = 97, 42 | importList = 243, 43 | CNextStarter = 106, 44 | CNextPlotExpression = 107, 45 | CNextDataFrameExpresion = 108, 46 | CNextPlotYDimExpression = 109, 47 | CNextYDimColumnNameExpression = 110, 48 | CNextPlotAddDimKeyword = 111, 49 | CNextPlotXDimExpression = 115, 50 | CNextXDimColumnNameExpression = 116, 51 | IfStatement = 120, 52 | Body = 121, 53 | TryStatement = 126, 54 | FunctionDefinition = 132, 55 | ParamList = 134, 56 | ClassDefinition = 137, 57 | Decorator = 140, 58 | At = 141 59 | -------------------------------------------------------------------------------- /cnext_app/lib/codemirror/grammar/extensions.js: -------------------------------------------------------------------------------- 1 | // import { defaultHighlightStyle } from "@codemirror/highlight"; 2 | // import { bracketMatching } from "@codemirror/matchbrackets"; 3 | // import { EditorView, keymap } from "@codemirror/view"; 4 | // import { lineNumbers } from "@codemirror/gutter"; 5 | // import { basicSetup } from "@codemirror/basic-setup"; 6 | // import { oneDark } from "@codemirror/theme-one-dark"; 7 | // import { standardKeymap, defaultTabBinding } from "./codemirrorcommands"; 8 | // import { languageServer } from 'codemirror-languageserver'; 9 | // import { python } from "./lang-python"; 10 | // import { indentUnit } from '@codemirror/language'; 11 | 12 | // const ls = languageServer({ 13 | // serverUri: "ws://localhost:3001/python", 14 | // rootUri: 'file:///', 15 | // documentUri: `file:///test`, 16 | // languageId: 'python' // As defined at https://microsoft.github.io/language-server-protocol/specification#textDocumentItem. 17 | // }); 18 | 19 | 20 | // export const extensions = [ 21 | // basicSetup, 22 | // oneDark, 23 | // EditorView.lineWrapping, 24 | // lineNumbers(), 25 | // bracketMatching(), 26 | // defaultHighlightStyle.fallback, 27 | // python(), 28 | // ls, 29 | // keymap.of([standardKeymap,defaultTabBinding]), 30 | // indentUnit.of(' '), 31 | // ]; 32 | -------------------------------------------------------------------------------- /cnext_app/lib/codemirror/grammar/lang-cnext-query.js: -------------------------------------------------------------------------------- 1 | import { parser } from './cnext-query'; 2 | import { LRLanguage, LanguageSupport } from '@codemirror/language'; 3 | import { styleTags, tags } from "@lezer/highlight"; 4 | const cnextQueryLanguage = LRLanguage.define({ 5 | parser: parser.configure({ 6 | props: [ 7 | styleTags({ 8 | "async '*' '**' FormatConversion": tags.modifier, 9 | "for while if elif else try except finally return raise break continue with pass assert await yield": tags.controlKeyword, 10 | "not index isna notna isin": tags.operatorKeyword, 11 | "import from def class global nonlocal lambda": tags.definitionKeyword, 12 | "with as print": tags.keyword, 13 | self: tags.self, 14 | Boolean: tags.bool, 15 | None: tags.null, 16 | VariableName: tags.variableName, 17 | ColumnNameExpression: tags.string, 18 | ColumnValueExpression: tags.string, 19 | "CallExpression/VariableName": tags.function(tags.variableName), 20 | "FunctionDefinition/VariableName": tags.function(tags.definition(tags.variableName)), 21 | "ClassDefinition/VariableName": tags.definition(tags.className), 22 | PropertyName: tags.propertyName, 23 | "CallExpression/MemberExpression/ProperyName": tags.function(tags.propertyName), 24 | Comment: tags.lineComment, 25 | Number: tags.number, 26 | String: tags.string, 27 | FormatString: tags.special(tags.string), 28 | UpdateOp: tags.updateOperator, 29 | ArithOp: tags.arithmeticOperator, 30 | BitOp: tags.bitwiseOperator, 31 | CompareOp: tags.compareOperator, 32 | AssignOp: tags.definitionOperator, 33 | Ellipsis: tags.punctuation, 34 | At: tags.meta, 35 | "( )": tags.paren, 36 | "[ ]": tags.squareBracket, 37 | "{ }": tags.brace, 38 | ".": tags.derefOperator, 39 | ", ;": tags.separator 40 | }) 41 | ], 42 | }) 43 | }) 44 | 45 | function cnextQuery() { 46 | return new LanguageSupport(cnextQueryLanguage); 47 | } 48 | 49 | export {cnextQueryLanguage, cnextQuery}; -------------------------------------------------------------------------------- /cnext_app/lib/components/Main.tsx: -------------------------------------------------------------------------------- 1 | import React, { FC, useEffect, useState } from "react"; 2 | import { Box } from "@mui/material"; 3 | import MiniSidebar from "./sidebar/Sidebar"; 4 | import { MainPanel } from "./StyledComponents"; 5 | import WorkingPanel from "./WorkingPanel"; 6 | import FooterBar from "./FooterBar"; 7 | import { SERVER_SOCKET_ENDPOINT, SocketContext } from "./Socket"; 8 | import openConnection, { io, Socket } from "socket.io-client"; 9 | 10 | const Main: FC = (props: any) => { 11 | const [connected, setConnected] = useState(false); 12 | const [socket, setSocket] = useState(null); 13 | 14 | useEffect(() => { 15 | const socket = openConnection(SERVER_SOCKET_ENDPOINT, { 16 | closeOnBeforeunload: false, 17 | // transports: ["websocket"], 18 | }); 19 | 20 | socket?.on("connect", function () { 21 | // the use of function here is to make sure the latest value will be read 22 | if (() => connected) { 23 | // send reconnect message to the server so it will send back any message in queue 24 | socket.emit("reconnect"); 25 | } else { 26 | // first connection; any further connections means we disconnected 27 | socket.emit("init"); 28 | setConnected(true); 29 | } 30 | }); 31 | 32 | setSocket(socket); 33 | 34 | return () => { 35 | socket.disconnect(); 36 | }; 37 | }, []); 38 | 39 | return ( 40 | // macbook pro 13 height 41 | // move this to style files 42 | 47 | {/* */} 48 | {/* 49 | 50 | 51 | */} 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | ); 61 | }; 62 | 63 | export default Main; 64 | -------------------------------------------------------------------------------- /cnext_app/lib/components/Socket.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { Socket } from "socket.io-client"; 3 | import { setNotification } from "../../redux/reducers/NotificationRedux"; 4 | import store from "../../redux/store"; 5 | import { IMessage, WebAppEndpoint } from "../interfaces/IApp"; 6 | export const SERVER_SOCKET_ENDPOINT = 7 | process.env.NEXT_PUBLIC_SERVER_SOCKET_ENDPOINT || "http://localhost:4000"; 8 | 9 | // export const socket = openConnection(SERVER_SOCKET_ENDPOINT, { 10 | // closeOnBeforeunload: false, 11 | // // transports: ["websocket"], 12 | // }); 13 | 14 | export const SocketContext = React.createContext(null); 15 | 16 | type AckFunc = (response: {[success: string]: boolean}) => void; 17 | 18 | export const sendMessage = ( 19 | socket: Socket | null, 20 | endpoint: WebAppEndpoint, 21 | message: IMessage, 22 | ack: AckFunc | undefined = undefined 23 | ) => { 24 | console.log(`Send ${endpoint} request: `, JSON.stringify(message)); 25 | socket 26 | ?.timeout(1000) 27 | .emit(endpoint, JSON.stringify(message), (error: boolean, response: any) => { 28 | if (error) { 29 | store.dispatch(setNotification("Failed to connect to the server.")); 30 | if (ack) ack({success: false}); 31 | } else { 32 | // console.log("Socket ack"); 33 | if (ack) ack({success: true}); 34 | } 35 | }); 36 | }; 37 | -------------------------------------------------------------------------------- /cnext_app/lib/components/code-panel/CodePanel.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from "react"; 2 | import { StyledCodePanel, CodeContainer } from "../StyledComponents"; 3 | import SplitPane from "react-split-pane-v2"; 4 | import CodeEditor from "./CodeEditor"; 5 | import { IMessage, ViewMode } from "../../interfaces/IApp"; 6 | import CodeToolbar from "./CodeToolbar"; 7 | import Pane from "react-split-pane-v2"; 8 | import { useSelector } from "react-redux"; 9 | import { RootState } from "../../../redux/store"; 10 | import TextIOComponent from "./TextIOComponent"; 11 | import StyledExecutorToolbar from "../executor-manager/ExecutorToolbar"; 12 | 13 | const CodePanel = ({ workingPanelViewMode, stopMouseEvent }) => { 14 | const inViewID = useSelector((state: RootState) => state.projectManager.inViewID); 15 | return ( 16 | 17 | {console.log("CodePanel render ")} 18 | 19 | 20 | 21 | 22 | 29 | {inViewID != null && ( 30 | 31 | 32 | 33 | )} 34 | 35 | 36 | 37 | 38 | 39 | 40 | ); 41 | }; 42 | 43 | export default CodePanel; 44 | -------------------------------------------------------------------------------- /cnext_app/lib/components/code-panel/TextIOComponent.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from "react"; 2 | import { 3 | TextIOContainer, 4 | TextIOHeaderText, 5 | TextIOContent, 6 | TextIOHeader, 7 | } from "../StyledComponents"; 8 | import dynamic from "next/dynamic"; 9 | import ConsoleComponent from "./text-io/Console"; 10 | import ExecutorStatus from "../executor-manager/ExecutorStatus"; 11 | const TerminalComponent = dynamic(() => import("./text-io/Terminal"), { ssr: false }); 12 | 13 | const TAB = { 14 | CONSOLE: "Console", 15 | TERMINAL: "Terminal", 16 | }; 17 | 18 | const TextIOComponent = React.memo(() => { 19 | const [textIOPanelID, setTextIOPanelID] = useState(TAB.CONSOLE); 20 | return ( 21 | 22 | {console.log("Render TextIOContainer")} 23 | 24 | {[TAB.CONSOLE, TAB.TERMINAL].map((item, key) => { 25 | return ( 26 | setTextIOPanelID(item)} 29 | variant="overline" 30 | underline={textIOPanelID === item ? 1 : 0} 31 | component="span" 32 | > 33 | {item} 34 | 35 | ); 36 | })} 37 | 38 | 39 | {textIOPanelID === TAB.CONSOLE ? ( 40 | 41 | 42 | 43 | ) : null} 44 | {textIOPanelID === TAB.TERMINAL ? ( 45 | 46 | 47 | 48 | ) : null} 49 | 50 | ); 51 | }); 52 | 53 | export default TextIOComponent; 54 | -------------------------------------------------------------------------------- /cnext_app/lib/components/code-panel/libCellFold.tsx: -------------------------------------------------------------------------------- 1 | import { EditorState } from "@codemirror/state"; 2 | import store from "../../../redux/store"; 3 | 4 | export const getCellFoldRange = (state: EditorState, lineStart: number, lineEnd: number) => { 5 | let reduxState = store.getState(); 6 | let inViewID = reduxState.projectManager.inViewID; 7 | if (state && inViewID) { 8 | const codeLines = store.getState().codeEditor.codeLines[inViewID]; 9 | const doc = state.doc; 10 | /** compare doc and codeLines to avoid bug when codeLines has been loaded but doc has not */ 11 | if (codeLines != null && doc.lines === codeLines.length && lineStart !== lineEnd) { 12 | const startLine: number = doc.lineAt(lineStart).number - 1; // 0-based 13 | let endLine: number = startLine; 14 | let curGroupID = codeLines[startLine].groupID; 15 | // console.log("CodeEditor getGroupedLineFoldRange: ", startLine, lineStart, lineEnd); 16 | if ( 17 | curGroupID != null && 18 | (startLine === 0 || 19 | (startLine > 0 && curGroupID != codeLines[startLine - 1].groupID)) 20 | ) { 21 | /** start of a group */ 22 | while ( 23 | endLine < codeLines.length - 1 && 24 | codeLines[endLine + 1].groupID === curGroupID 25 | ) { 26 | endLine += 1; 27 | } 28 | if (lineEnd < doc.line(endLine + 1).to) { 29 | return { from: lineEnd, to: doc.line(endLine + 1).to }; // convert to 1-based 30 | } 31 | } 32 | } 33 | } 34 | return null; 35 | }; 36 | -------------------------------------------------------------------------------- /cnext_app/lib/components/error-boundary/ErrorBoundary.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { Typography } from "@mui/material"; 3 | 4 | class ErrorBoundary extends React.Component { 5 | constructor(props) { 6 | super(props); 7 | this.state = { 8 | hasError: false, 9 | }; 10 | } 11 | 12 | static getDerivedStateFromError() { 13 | // Update state so the next render will show the fallback UI. 14 | return { hasError: true }; 15 | } 16 | 17 | componentDidCatch(error, errorInfo) { 18 | console.log(error); 19 | console.log(errorInfo); 20 | } 21 | 22 | render() { 23 | if (this.state.hasError) { 24 | //render any fallback UI 25 | return ( 26 |
27 | We're sorry, something went wrong! 28 | Back to page 29 |
30 | ); 31 | } 32 | 33 | // No errors were thrown 34 | return this.props.children; 35 | } 36 | } 37 | 38 | export default ErrorBoundary; 39 | -------------------------------------------------------------------------------- /cnext_app/lib/components/file-manager/DeleteConfirmation.tsx: -------------------------------------------------------------------------------- 1 | import { Button, Dialog, DialogActions, DialogContent, DialogContentText } from "@mui/material"; 2 | import React from "react"; 3 | 4 | const DeleteConfirmation = ({ deleteDialog, confirmDelete, itemName }) => { 5 | return ( 6 | confirmDelete(false)} 9 | aria-labelledby='alert-dialog-title' 10 | aria-describedby='alert-dialog-description' 11 | > 12 | 13 | 14 | Are you sure you want to delete "{itemName?.split("/").pop()}"? 15 | 16 | 17 | 18 | 26 | 33 | 34 | 35 | ); 36 | }; 37 | 38 | export default DeleteConfirmation; 39 | -------------------------------------------------------------------------------- /cnext_app/lib/components/file-manager/FileContextMenu.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { ContextMenu, ContextMenuItem } from "../StyledComponents"; 3 | import { FileContextMenuCommand } from "../../interfaces/IFileManager"; 4 | 5 | //TODO: refactor to use libs/ContextMenu instead 6 | const FileContextMenu = ({ contextMenuPos, handleClose, handleSelection, contextMenuItem }) => { 7 | const menu = [ 8 | { 9 | name: FileContextMenuCommand.NEW_FILE, 10 | text: "New file", 11 | disable: true ? contextMenuItem?.is_file : false, // disable create file function if context menu is file type 12 | }, 13 | { 14 | name: FileContextMenuCommand.NEW_FOLDER, 15 | text: "New folder", 16 | disable: true ? contextMenuItem?.is_file : false, // disable create folder function if context menu is file type 17 | }, 18 | { name: FileContextMenuCommand.DIVIDER }, 19 | { name: FileContextMenuCommand.RENAME, text: "Rename", disable: true }, 20 | { 21 | name: FileContextMenuCommand.DELETE, 22 | text: "Delete", 23 | disable: true ? !contextMenuItem?.deletable : false, 24 | }, 25 | ]; 26 | 27 | return ( 28 | 38 | {menu.map((item, index:number) => { 39 | return ( 40 | handleSelection(item.name)} 44 | key={index} 45 | > 46 | {item.text} 47 | 48 | ); 49 | })} 50 | 51 | ); 52 | }; 53 | 54 | export default FileContextMenu; 55 | -------------------------------------------------------------------------------- /cnext_app/lib/components/file-manager/NewItemInput.tsx: -------------------------------------------------------------------------------- 1 | import React, { useEffect, useRef } from "react"; 2 | import { ProjectCommand } from "../../interfaces/IFileManager"; 3 | import { ProjectExplorerNewItem } from "../StyledComponents"; 4 | import CypressIds from "../tests/CypressIds"; 5 | 6 | const NewItemInput = ({ handleKeyPress, command, ...props }) => { 7 | const newItemRef = useRef(); 8 | 9 | useEffect(() => { 10 | console.log("FileExplorer: ", newItemRef.current); 11 | if (newItemRef && newItemRef.current) { 12 | newItemRef.current.focus(); 13 | newItemRef.current.setSelectionRange(0, 0); 14 | } 15 | }, [newItemRef]); 16 | 17 | return ( 18 | 24 | handleKeyPress(event, newItemRef.current?.value, command) 25 | } 26 | {...props} 27 | /> 28 | ); 29 | }; 30 | 31 | export default NewItemInput; 32 | -------------------------------------------------------------------------------- /cnext_app/lib/components/hotkeys/HotKeys.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import Hotkeys from "react-hot-keys"; 3 | import { RootState } from "../../../redux/store"; 4 | import { useDispatch, useSelector } from "react-redux"; 5 | import { setProjectConfig } from "../../../redux/reducers/ProjectManagerRedux"; 6 | 7 | const HotkeysComponent = () => { 8 | let configs = useSelector((state: RootState) => state.projectManager.settings); 9 | const dispath = useDispatch(); 10 | 11 | let appShortcutList = []; 12 | for (let value of Object.values(configs.app_shortcut || [])) { 13 | appShortcutList.push(value); 14 | } 15 | let hotKeys = appShortcutList.join(","); 16 | 17 | const onKeyUp = (keyName, e, handle) => { 18 | console.log("App shortcut:onKeyUp", keyName, e, handle); 19 | }; 20 | 21 | const onKeyDown = (keyName, e, handle) => { 22 | // console.log('App shortcut:onKeyDown', keyName, e, handle); 23 | for (const [key, value] of Object.entries(configs.app_shortcut || [])) { 24 | let valueStr = value.replaceAll(" ", ""); 25 | 26 | if (keyName.toString() == valueStr) { 27 | procressChange(key); 28 | } 29 | } 30 | }; 31 | 32 | const procressChange = (type: string) => { 33 | let updateObj = { ...configs.code_editor }; 34 | 35 | switch (type) { 36 | case "lint_tooggle": 37 | updateObj = { 38 | ...configs.code_editor, 39 | lint: configs.code_editor.lint ? false : true, 40 | }; 41 | break; 42 | 43 | case "autocompletion_tooggle": 44 | updateObj = { 45 | ...configs.code_editor, 46 | autocompletion: configs.code_editor.autocompletion ? false : true, 47 | hover: configs.code_editor.hover ? false : true, 48 | }; 49 | break; 50 | 51 | default: 52 | } 53 | 54 | dispath( 55 | setProjectConfig({ 56 | code_editor: { 57 | ...updateObj, 58 | }, 59 | }) 60 | ); 61 | }; 62 | 63 | return ; 64 | }; 65 | 66 | export default HotkeysComponent; 67 | -------------------------------------------------------------------------------- /cnext_app/lib/components/libs.tsx: -------------------------------------------------------------------------------- 1 | export const process_plotly_figure_result = (figData: string) => { 2 | return JSON.parse(figData)["application/json"]; 3 | }; 4 | 5 | export const ifElseDict = (object: {}, key: string) => { 6 | return ifElse(object, key, {}); 7 | }; 8 | 9 | export const ifElse = (object: {}, key: string, empty: any) => { 10 | return key in object ? object[key] : empty; 11 | }; 12 | 13 | export const isJsonString = (data: string) => { 14 | try { 15 | JSON.parse(data); 16 | } catch (error) { 17 | return false; 18 | } 19 | return true; 20 | }; 21 | 22 | export const emptyString = ""; 23 | 24 | export const isImageMime = (mimeType: string) => { 25 | const imgMimeRegex = new RegExp("image/", "i"); 26 | return imgMimeRegex.test(mimeType); 27 | }; 28 | 29 | export const setPlotlyLayout = ( 30 | data: object | string | any, 31 | width: number | null = null, 32 | height: number | null = null, 33 | defaultMargin: boolean = true 34 | ) => { 35 | try { 36 | /* have to do JSON stringify and parse again to recover the original json string. It won't work without this */ 37 | let inResultData = JSON.parse(JSON.stringify(data)); 38 | inResultData["data"][0]["hovertemplate"] = "%{x}: %{y}"; 39 | inResultData.layout.width = width ? width : inResultData.layout.width; 40 | inResultData.layout.height = height ? height : inResultData.layout.height; 41 | if (defaultMargin) { 42 | inResultData.layout.margin = { b: 10, l: 80, r: 30, t: 30 }; 43 | } 44 | inResultData["config"] = { displayModeBar: false }; 45 | return inResultData; 46 | } catch { 47 | return null; 48 | } 49 | }; -------------------------------------------------------------------------------- /cnext_app/lib/components/libs/ContextMenu.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { 3 | ContextMenu as StyledContextMenu, 4 | ContextMenuItem as StyledContextMenuItem } from "../StyledComponents"; 5 | import { IContextMenu } from "../../interfaces/IContextMenu"; 6 | 7 | const ContextMenu = ({open, contextMenu, handleClose, handleSelection} : 8 | {open: boolean, contextMenu: IContextMenu|undefined, handleClose: any, handleSelection: any}) => { 9 | return ( 10 | 20 | {contextMenu && contextMenu.menu.map((item) => { 21 | return ( 22 | handleSelection(item)}>{item.text} 26 | 27 | ) 28 | })} 29 | 30 | ); 31 | }; 32 | 33 | export default ContextMenu; -------------------------------------------------------------------------------- /cnext_app/lib/components/libs/OverlayComponent.tsx: -------------------------------------------------------------------------------- 1 | import { Tooltip } from "@mui/material"; 2 | import React from "react"; 3 | import { OPERATION_DISABLED_MSG } from "../../interfaces/IApp"; 4 | import { Overlay } from "../StyledComponents"; 5 | 6 | export const OverlayComponent = () => { 7 | return ( 8 | } 13 | /> 14 | ); 15 | } -------------------------------------------------------------------------------- /cnext_app/lib/components/libs/utils.tsx: -------------------------------------------------------------------------------- 1 | import { setNotification } from "../../../redux/reducers/NotificationRedux"; 2 | import { OPERATION_DISABLED_MSG } from "../../interfaces/IApp"; 3 | import store from "../../../redux/store"; 4 | import { isRunQueueBusy } from "../code-panel/libCodeEditor"; 5 | 6 | /** */ 7 | export const runQueueSafe = (event: React.MouseEvent, func) => { 8 | const runQueueBusy = isRunQueueBusy(store.getState().codeEditor.runQueue); 9 | if (runQueueBusy){ 10 | store.dispatch(setNotification(OPERATION_DISABLED_MSG)); 11 | event.preventDefault(); 12 | event.stopPropagation(); 13 | } else { 14 | func(); 15 | } 16 | } -------------------------------------------------------------------------------- /cnext_app/lib/components/notifier/Notifier.tsx: -------------------------------------------------------------------------------- 1 | import React, { useEffect } from "react"; 2 | import { useSelector } from "react-redux"; 3 | import { toast, Slide } from "react-toastify"; 4 | import store, { RootState } from "../../../redux/store"; 5 | import { StyledDFStatusNotification } from "../StyledComponents"; 6 | import "react-toastify/dist/ReactToastify.css"; 7 | 8 | export const Notifier = () => { 9 | const notificationCounter = useSelector((state: RootState)=>{return state.notification.notificationCounter}); 10 | 11 | useEffect(()=>{ 12 | const notificationText = store.getState().notification.notificationText; 13 | toast(notificationText); 14 | console.log("Notifier: ", notificationText); 15 | }, [notificationCounter]); 16 | 17 | return ( 18 | 24 | ); 25 | } -------------------------------------------------------------------------------- /cnext_app/lib/components/richoutput-panel/RichOuputPanelHeader.tsx: -------------------------------------------------------------------------------- 1 | import React, { Fragment } from "react"; 2 | import { StyledTableViewHeader, RichOuputViewHeaderButton } from "../StyledComponents"; 3 | import { RichOutputPanelToolbarItems } from "../../interfaces/IRichOuputViewer"; 4 | import CircleIcon from "@mui/icons-material/Circle"; 5 | 6 | const RichOuputPanelHeader = ({ newItemIndicator, show, setShow }) => { 7 | // const activeDataFrame = useSelector((state) => state.dataFrames.activeDataFrame); 8 | // const dfMetadata = useSelector((state) => state.dataFrames.metadata[activeDataFrame]); 9 | 10 | return ( 11 | 12 | {console.log("Render RichOuputViewHeader ")} 13 | 14 | {Object.values(RichOutputPanelToolbarItems).map((name, index) => ( 15 | setShow(name)} 22 | > 23 | {name} 24 | {newItemIndicator && newItemIndicator === name && newItemIndicator !== show ? ( 25 | 34 | ) : null} 35 | 36 | ))} 37 | 38 | 39 | ); 40 | }; 41 | 42 | export default RichOuputPanelHeader; 43 | -------------------------------------------------------------------------------- /cnext_app/lib/components/richoutput-panel/data-panel/ColumnHistogram.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { SmallVizContainer } from "../../StyledComponents"; 3 | 4 | // redux 5 | import { useSelector } from "react-redux"; 6 | import { RootState } from "../../../../redux/store"; 7 | import { createPlot } from "../../dataframe-manager/udf/libUDF"; 8 | 9 | export function ColumnHistogram({ df_id, col_name, width, height }) { 10 | const columnHistogram = useSelector((state: RootState) => getColumHistogram(state)); 11 | 12 | function getColumHistogram(state: RootState) { 13 | let dfMetadata = state.dataFrames.metadata[df_id]; 14 | // console.log('ColumnHistogram: ', df_id, dfMetadata); 15 | if (dfMetadata) { 16 | let colMetadata = dfMetadata.columns[col_name]; 17 | if (colMetadata) return colMetadata.histogram_plot; 18 | } 19 | return null; 20 | } 21 | 22 | return columnHistogram ? ( 23 | {createPlot(columnHistogram, width, height)} 24 | ) : null; 25 | } 26 | 27 | export default ColumnHistogram; 28 | -------------------------------------------------------------------------------- /cnext_app/lib/components/richoutput-panel/data-panel/CountNA.tsx: -------------------------------------------------------------------------------- 1 | import React, { Fragment } from "react"; 2 | 3 | // redux 4 | import { useSelector } from 'react-redux' 5 | import { RootState } from "../../../../redux/store"; 6 | import { CountNAContainer } from "../../StyledComponents"; 7 | 8 | const CountNA = ({df_id, col_name}) => { 9 | const countna = useSelector((state: RootState) => _getCountNA(state)); 10 | const shape = useSelector((state: RootState) => state.dataFrames.metadata[df_id].shape); 11 | const naPct = (shape) ? countna/shape[0]*100 : 0.; 12 | 13 | function _getCountNA(state: RootState){ 14 | if (state.dataFrames.metadata[df_id]){ 15 | let colMetadata = state.dataFrames.metadata[df_id].columns[col_name]; 16 | if (colMetadata){ 17 | return colMetadata.countna; 18 | } 19 | console.log('CountNA: failed _getCountNA', col_name); 20 | return null; 21 | } 22 | } 23 | 24 | return ( 25 | (countna!==null && shape!==null) ? 26 | 0}> 27 | {(naPct>0 && naPct.toFixed(1)==="0.0") 28 | ? NA > 0.0% 29 | : NA: {naPct.toFixed(1)}%} 30 | 31 | :null 32 | ) 33 | } 34 | 35 | export default CountNA; 36 | 37 | 38 | -------------------------------------------------------------------------------- /cnext_app/lib/components/richoutput-panel/data-panel/DataPanel.tsx: -------------------------------------------------------------------------------- 1 | import React, { Fragment, useContext, useEffect } from "react"; 2 | import { DataToolbar } from "../../StyledComponents"; 3 | import DFExplorer from "./DFExplorer"; 4 | import DFFilter from "./DFFilter"; 5 | import UDFSelector from "./UDFSelector"; 6 | import DataViewMode from "./DataViewMode"; 7 | import DataView from "./DataView"; 8 | import { RootState } from "../../../../redux/store"; 9 | import { useDispatch, useSelector } from "react-redux"; 10 | import Box from "@mui/material/Box"; 11 | import { setDataPanelFocusSignal } from "../../../../redux/reducers/DataFramesRedux"; 12 | import ColumnSelector from "./ColumnSelector"; 13 | 14 | const Shape = () => { 15 | const activeDataFrame = useSelector((state: RootState) => state.dataFrames?.activeDataFrame); 16 | const shape = useSelector((state: RootState) => 17 | activeDataFrame ? state.dataFrames?.metadata[activeDataFrame]?.shape : null 18 | ); 19 | 20 | return ( 21 |
22 | {shape != null && ( 23 | <> 24 | Rows: {shape[0]}, Cols: {shape[1]} 25 | 26 | )} 27 |
28 | ); 29 | }; 30 | 31 | const DataPanel = (props: any) => { 32 | // const dispatch = useDispatch(); 33 | 34 | // useEffect(() => { 35 | // dispatch(setDataPanelFocusSignal()); 36 | // }, []); 37 | 38 | const activeDataFrame = useSelector((state: RootState) => state.dataFrames?.activeDataFrame); 39 | //TODO: move all grid view related thing to under DataView 40 | return ( 41 | <> 42 | {/* {console.log("DataPanel render activeDataFrame", activeDataFrame)} */} 43 | 44 | 45 | 46 | 47 | {activeDataFrame != null && ( 48 | <> 49 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | )} 60 | 61 | ); 62 | }; 63 | 64 | export default DataPanel; 65 | -------------------------------------------------------------------------------- /cnext_app/lib/components/richoutput-panel/data-panel/DataView.tsx: -------------------------------------------------------------------------------- 1 | import React, { Fragment } from "react"; 2 | import { useSelector } from "react-redux"; 3 | import { RootState } from "../../../../redux/store"; 4 | import GridView from "./GridView"; 5 | import TableView from "./TableView"; 6 | import { DFViewMode } from "../../../interfaces/IApp"; 7 | import SummaryView from "../summary-panel/SummaryView"; 8 | import TableViewVirtual from "./TableViewVirtual"; 9 | 10 | const DataView = () => { 11 | // const tableData = useSelector((state: RootState) => state.dataFrames.tableData); 12 | const metadata = useSelector((state: RootState) => state.dataFrames.metadata); 13 | const activeDataFrame = useSelector((state: RootState) => state.dataFrames.activeDataFrame); 14 | const dataViewMode = useSelector((state: RootState) => state.dataFrames.dataViewMode); 15 | 16 | const renderData = () => { 17 | switch (dataViewMode) { 18 | // case DFViewMode.GRID_VIEW: 19 | // return ; 20 | case DFViewMode.TABLE_VIEW: 21 | return ; 22 | // return ; 23 | case DFViewMode.SUMMARY_VIEW: 24 | return ; 25 | default: 26 | return null; 27 | } 28 | }; 29 | //TODO: move all grid view related thing to under DataView 30 | return <>{activeDataFrame && metadata[activeDataFrame] != null && renderData()}; 31 | }; 32 | 33 | export default DataView; 34 | -------------------------------------------------------------------------------- /cnext_app/lib/components/richoutput-panel/data-panel/DataViewMode.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { useDispatch, useSelector } from "react-redux"; 3 | import { SelectChangeEvent } from "@mui/material/Select"; 4 | import { 5 | DFStatsForm as DFViewModeForm, 6 | DFStats as DFViewMode, 7 | DFStatsSelector as DFViewModeSelector, 8 | DFViewModeSmallArrowIcon, 9 | DFViewModeMenuItem, 10 | } from "../../StyledComponents"; 11 | import store, { RootState } from "../../../../redux/store"; 12 | import { setDataViewMode } from "../../../../redux/reducers/DataFramesRedux"; 13 | import { OutlinedInput } from "@mui/material"; 14 | import { DFViewMode as DFViewModeOptions } from "../../../interfaces/IApp"; 15 | import CypressIds from "../../tests/CypressIds"; 16 | 17 | const DataViewMode = () => { 18 | const dispatch = useDispatch(); 19 | const viewMode: string = useSelector((state: RootState) => state.dataFrames.dataViewMode); 20 | 21 | const handleChange = (event: SelectChangeEvent) => { 22 | dispatch(setDataViewMode(event.target.value)); 23 | }; 24 | 25 | const renderComponent = () => { 26 | return ( 27 | 28 | 29 | } 42 | > 43 | {/* */} 44 | {Object.values(DFViewModeOptions).map((vm) => ( 45 | {vm} 46 | ))} 47 | {/* */} 48 | 49 | 50 | 51 | ); 52 | }; 53 | 54 | return renderComponent(); 55 | }; 56 | 57 | export default DataViewMode; 58 | -------------------------------------------------------------------------------- /cnext_app/lib/components/richoutput-panel/data-panel/InputCheckbox.tsx: -------------------------------------------------------------------------------- 1 | import { Checkbox, FormControlLabel } from "@mui/material"; 2 | import React from "react"; 3 | 4 | export function InputCheckbox({ input, name, handleChange }) { 5 | 6 | const handleChangeInternal = (event) => { 7 | // console.log("InputText ", event); 8 | handleChange(event.target.checked); 9 | }; 10 | 11 | return ( 12 | 19 | } 20 | label={name} 21 | sx={{ "& .MuiFormControlLabel-label": { fontSize: "12px" } }} 22 | onChange={handleChangeInternal} 23 | /> 24 | ); 25 | } 26 | 27 | export default InputCheckbox; 28 | -------------------------------------------------------------------------------- /cnext_app/lib/components/richoutput-panel/data-panel/InputComponent.tsx: -------------------------------------------------------------------------------- 1 | import { SyntheticEvent, useContext } from "react"; 2 | import { useDispatch } from "react-redux"; 3 | import { setTableDataCellValue } from "../../../../redux/reducers/DataFramesRedux"; 4 | import { CommandName, SpecialMimeType, WebAppEndpoint } from "../../../interfaces/IApp"; 5 | import { 6 | ICellDataCheckboxInput, 7 | ICellDataSelectionInput, 8 | ICellDataTextInput, 9 | } from "../../../interfaces/IDataFrameManager"; 10 | import { createMessage } from "../../dataframe-manager/libDataFrameManager"; 11 | import { sendMessage, SocketContext } from "../../Socket"; 12 | import InputCheckbox from "./InputCheckbox"; 13 | import InputSelection from "./InputSelection"; 14 | import InputText from "./InputText"; 15 | 16 | const InputComponent = ({ df_id, rowNumber, colName, index, item, type }) => { 17 | const socket = useContext(SocketContext); 18 | const dispatch = useDispatch(); 19 | 20 | const handleChange = (input: any) => { 21 | const value = { ...item, input: input }; 22 | dispatch( 23 | setTableDataCellValue({ 24 | df_id: df_id, 25 | col_name: colName, 26 | rowNumber: rowNumber, 27 | value: value, 28 | }) 29 | ); 30 | const message = createMessage( 31 | WebAppEndpoint.DataFrameManager, 32 | CommandName.set_dataframe_cell_value, 33 | { df_id: df_id, index: index, col_name: colName, value: value }, 34 | { df_id: df_id, col_name: colName } 35 | ); 36 | sendMessage(socket, WebAppEndpoint.DataFrameManager, message); 37 | }; 38 | 39 | return ( 40 | <> 41 | {[SpecialMimeType.INPUT_SELECTION].includes(type) && ( 42 | 46 | )} 47 | {[SpecialMimeType.INPUT_CHECKBOX].includes(type) && ( 48 | 49 | )} 50 | {[SpecialMimeType.INPUT_TEXT].includes(type) && ( 51 | 52 | )} 53 | 54 | ); 55 | }; 56 | 57 | export default InputComponent; 58 | -------------------------------------------------------------------------------- /cnext_app/lib/components/richoutput-panel/data-panel/InputSelection.tsx: -------------------------------------------------------------------------------- 1 | import { MenuItem, Select } from "@mui/material"; 2 | import React from "react"; 3 | 4 | export const InputSelection = ({ input, options, handleChange }) => { 5 | 6 | const handleChangeInternal = (event) => { 7 | // console.log("InputText ", event); 8 | const value = event.target.value; 9 | const index = options?.indexOf(value); 10 | handleChange(index); 11 | }; 12 | 13 | return ( 14 | 28 | ); 29 | } 30 | 31 | export default InputSelection; 32 | -------------------------------------------------------------------------------- /cnext_app/lib/components/richoutput-panel/data-panel/InputText.tsx: -------------------------------------------------------------------------------- 1 | import { TextField } from "@mui/material"; 2 | import React, { useState } from "react"; 3 | 4 | export function InputText({ input, handleChange }) { 5 | const [value, setValue] = useState(input); 6 | 7 | const handleChangeInternal = (event) => { 8 | setValue(event.target.value); 9 | }; 10 | 11 | const handleKeyDown = (event) => { 12 | if (event.keyCode === 13 && event.ctrlKey) { 13 | handleChange(value); 14 | } 15 | }; 16 | return ( 17 | { 23 | console.log("InputText onBlur: ", value); 24 | handleChange(value); 25 | }} 26 | sx={{ 27 | width: "100%", 28 | "& .MuiInputBase-root": { padding: "5px 10px" }, 29 | "& .MuiInputBase-input": { fontSize: "12px" }, 30 | }} 31 | defaultValue={input} 32 | /> 33 | ); 34 | } 35 | 36 | export default InputText; 37 | -------------------------------------------------------------------------------- /cnext_app/lib/components/richoutput-panel/data-panel/libDataView.tsx: -------------------------------------------------------------------------------- 1 | import { Socket } from "socket.io-client"; 2 | import { CommandName, WebAppEndpoint } from "../../../interfaces/IApp"; 3 | import { createMessage } from "../../dataframe-manager/libDataFrameManager"; 4 | import { sendMessage } from "../../Socket"; 5 | 6 | export const sendGetTableData = ( 7 | socket: Socket, 8 | df_id: string, 9 | filter: string | null = null, 10 | df_type: string, 11 | page_number: number = 0, 12 | page_size: number 13 | ) => { 14 | let fromIndex = page_number * page_size; 15 | let queryStr: string = `${df_id}${filter ?? ""}.loc[${fromIndex}:${fromIndex + page_size}]`; 16 | let message = createMessage(WebAppEndpoint.DataViewer, CommandName.get_table_data, queryStr, { 17 | df_id: df_id, 18 | filter: filter, 19 | df_type: df_type, 20 | page_number: page_number, 21 | page_size: page_size, 22 | from_index: fromIndex, 23 | to_index: fromIndex + page_size, 24 | }); 25 | sendMessage(socket, WebAppEndpoint.DataViewer, message); 26 | }; 27 | -------------------------------------------------------------------------------- /cnext_app/lib/components/richoutput-panel/experiment-panel/WindowDims.js: -------------------------------------------------------------------------------- 1 | import { useEffect, useState } from "react"; 2 | 3 | function getWindowDims() { 4 | if (typeof window !== "undefined") { 5 | const { innerWidth: winWidth, innerHeight: winHeight } = window; 6 | return { 7 | winWidth, 8 | winHeight 9 | }; 10 | } 11 | else 12 | return {undefined, undefined}; 13 | } 14 | 15 | export default function useWindowDims() { 16 | const [windowDims, setWindowDims] = useState(getWindowDims()); 17 | 18 | useEffect(() => { 19 | function handleResize() { 20 | setWindowDims(getWindowDims()); 21 | } 22 | 23 | window.addEventListener('resize', handleResize); 24 | return () => window.removeEventListener('resize', handleResize); 25 | }, []); 26 | 27 | return windowDims; 28 | } -------------------------------------------------------------------------------- /cnext_app/lib/components/richoutput-panel/result-panel/StdInInput.tsx: -------------------------------------------------------------------------------- 1 | import { InputAdornment } from "@mui/material"; 2 | import React, { useContext, useRef } from "react"; 3 | import { sendMessage, SocketContext } from "../../Socket"; 4 | import { StdInInput } from "../../StyledComponents"; 5 | import { createMessage } from "./libStdInInput"; 6 | 7 | export const InputComponent = ({ resultContent }) => { 8 | const socket = useContext(SocketContext); 9 | const inputRef = useRef(null); 10 | 11 | const handleKeyPress = (event: React.KeyboardEvent) => { 12 | if (event.key === "Enter" && socket) { 13 | // console.log("InputComponent: ", event.target.value); 14 | const message = createMessage(event.target.value); 15 | sendMessage(socket, message.webapp_endpoint, message); 16 | } 17 | }; 18 | 19 | return ( 20 | 29 | {resultContent.prompt} 30 | 31 | ), 32 | }} 33 | onKeyPress={(event) => handleKeyPress(event)} 34 | /> 35 | ); 36 | }; 37 | -------------------------------------------------------------------------------- /cnext_app/lib/components/richoutput-panel/result-panel/libStdInInput.tsx: -------------------------------------------------------------------------------- 1 | import { Socket } from "socket.io-client"; 2 | import { CommandName, ContentType, IMessage, WebAppEndpoint } from "../../../interfaces/IApp"; 3 | 4 | export const createMessage = (content: string) => { 5 | let message: IMessage = { 6 | webapp_endpoint: WebAppEndpoint.ExecutorManager, 7 | command_name: CommandName.send_stdin, 8 | content: content, 9 | type: ContentType.STRING, 10 | error: false, 11 | }; 12 | 13 | return message; 14 | }; 15 | 16 | // export const sendMessage = (socket: Socket, content: string) => { 17 | // const message = createMessage(content); 18 | // console.log(`${message.webapp_endpoint} send message: `, message); 19 | // socket?.emit(message.webapp_endpoint, JSON.stringify(message)); 20 | // }; 21 | -------------------------------------------------------------------------------- /cnext_app/lib/components/richoutput-panel/summary-panel/SummaryView.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | // redux 4 | import ColumnSummary from "./ColumnSummary"; 5 | 6 | const SummaryView = (props: any) => { 7 | return ( 8 | 9 | ); 10 | } 11 | 12 | export default SummaryView; 13 | 14 | 15 | -------------------------------------------------------------------------------- /cnext_app/lib/components/sidebar/Logo.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { Logo as StyledLogo, LogoIcon } from "../StyledComponents"; 3 | 4 | const Logo = () => { 5 | return ( 6 | 7 | 8 | 9 | ); 10 | }; 11 | 12 | export default Logo; 13 | -------------------------------------------------------------------------------- /cnext_app/lib/components/terminal-manager/TerminalManager.tsx: -------------------------------------------------------------------------------- 1 | import React, { useContext, useEffect } from "react"; 2 | import { useDispatch } from "react-redux"; 3 | import { setConfigTerminal } from "../../../redux/reducers/TerminalRedux"; 4 | import { getCookie } from "../../../utils"; 5 | import { getDomain } from "../../../utils/domain"; 6 | import { CommandName, ContentType, WebAppEndpoint } from "../../interfaces/IApp"; 7 | import { sendMessage, SocketContext } from "../Socket"; 8 | 9 | const jupyterServerCookie = `_xsrf`; 10 | 11 | const TerminalManager = () => { 12 | const socket = useContext(SocketContext); 13 | const dispatch = useDispatch(); 14 | 15 | useEffect(() => { 16 | setupSocket(); 17 | return () => { 18 | socket?.off(WebAppEndpoint.Terminal); 19 | }; 20 | }, [socket]); 21 | 22 | const setupSocket = () => { 23 | socket?.emit("ping", WebAppEndpoint.Terminal); 24 | sendMessage(socket, WebAppEndpoint.Terminal, { 25 | webapp_endpoint: WebAppEndpoint.Terminal, 26 | content: "", 27 | command_name: CommandName.get_jupyter_server_config, 28 | type: ContentType.COMMAND 29 | }); 30 | socket?.on(WebAppEndpoint.Terminal, (result: string, ack) => { 31 | try { 32 | if (JSON.parse(result).command_name === CommandName.get_jupyter_server_config) { 33 | const config = JSON.parse(result).content; 34 | dispatch(setConfigTerminal(config)); 35 | // const BASEURL = `${getDomain()}:${config.port}?token=${config.token}`; 36 | // console.log('BASEURL', BASEURL); 37 | // if (!getCookie(jupyterServerCookie)) { 38 | // const new_tab = window.open(`${BASEURL}`, "_blank"); 39 | // setTimeout(() => { 40 | // new_tab?.close(); 41 | // }, 500); 42 | // } 43 | } 44 | } catch (error) { 45 | console.error(error); 46 | // throw error; 47 | } 48 | if (ack) ack(); 49 | }); 50 | }; 51 | 52 | return null; 53 | }; 54 | 55 | export default TerminalManager; 56 | -------------------------------------------------------------------------------- /cnext_app/lib/components/tests/CypressIds.js: -------------------------------------------------------------------------------- 1 | // store all ids for automate testing 2 | const CypressIds = { 3 | codeEditor: "code-editor", 4 | dfEditor: "df-editor", 5 | projectRoot: "project-root", 6 | newFileItem: "new-file-item", 7 | dfStatsCheckboxAll: "df-stats-checkbox", 8 | dfViewMode: "df-viewmode", 9 | dfSummaryTable: "df-summary-table", 10 | }; 11 | 12 | export default CypressIds; 13 | -------------------------------------------------------------------------------- /cnext_app/lib/components/tests/TestTableData.tsx: -------------------------------------------------------------------------------- 1 | import { DataTableContent } from "../../interfaces/IApp"; 2 | 3 | function createData( 4 | name: string, 5 | calories: number, 6 | fat: number, 7 | carbs: number, 8 | protein: number, 9 | ) { 10 | return [ name, calories, fat, carbs, protein ]; 11 | } 12 | 13 | const rows = [ 14 | createData('Frozen yoghurt', 159, 6.0, 24, 4.0), 15 | createData('Ice cream sandwich', 237, 9.0, 37, 4.3), 16 | createData('Eclair', 262, 16.0, 24, 6.0), 17 | createData('Cupcake', 305, 3.7, 67, 4.3), 18 | createData('Gingerbread', 356, 16.0, 49, 3.9), 19 | ]; 20 | 21 | const header = ['Dessert (100g serving)', 'Calories', 'Fat (g)', 'Carbs (g)', 'Protein (g)']; 22 | 23 | export let tableData: DataTableContent = { 24 | header: [], 25 | rows: [] 26 | }; 27 | tableData.rows = rows; 28 | tableData.header = header; 29 | -------------------------------------------------------------------------------- /cnext_app/lib/components/user-manager/AccountManager.tsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnextio/cnext/74a29f4a6cb5d5b1ed5bff9836dae7f80461be81/cnext_app/lib/components/user-manager/AccountManager.tsx -------------------------------------------------------------------------------- /cnext_app/lib/interfaces/IAccount.tsx: -------------------------------------------------------------------------------- 1 | export enum AccountContextMenuItem { 2 | LOGIN, 3 | LOGOUT 4 | } -------------------------------------------------------------------------------- /cnext_app/lib/interfaces/IContextMenu.tsx: -------------------------------------------------------------------------------- 1 | import { AccountContextMenuItem } from "./IAccount"; 2 | 3 | export interface IMenuItem { 4 | name: MetricPlotContextMenuItems | AccountContextMenuItem | undefined; 5 | text: string; 6 | disable: boolean; 7 | metadata?: {} | undefined; 8 | } 9 | 10 | export interface IMenuPosision { 11 | mouseX: number; 12 | mouseY: number; 13 | } 14 | 15 | export interface IContextMenu { 16 | menu: IMenuItem[]; 17 | pos: IMenuPosision; 18 | } 19 | 20 | export enum MetricPlotContextMenuItems { 21 | LOAD_CHECKPOINT = "Load checkpoint", 22 | LOAD_MODEL = "Load model", 23 | COPY_CHECKPOINT_PATH = "Copy checkpoint path", 24 | } 25 | -------------------------------------------------------------------------------- /cnext_app/lib/interfaces/IDataFrameManager.tsx: -------------------------------------------------------------------------------- 1 | export interface IDataFrameMessageMetadata { 2 | df_id: string; 3 | col_name: string; 4 | udf_name?: string; 5 | } 6 | 7 | export interface IDataFrameFilter { 8 | df_id: string; 9 | /** this is the compiled query that can run directly with the dataframe */ 10 | query: string | null; 11 | /** this is the query showed in the query box */ 12 | cnext_query: string; 13 | } 14 | 15 | export enum UDFLocation { 16 | SUMMARY = "summary", 17 | TABLE_HEAD = "table_head", 18 | TABLE_BODY = "table_body", 19 | } 20 | 21 | export enum UDFOutputType { 22 | IMAGE = 0, 23 | TEXT = 1, 24 | THRESHOLD = 2, 25 | } 26 | 27 | export interface UDFPosition { 28 | row: number; 29 | col: number; 30 | } 31 | 32 | export interface UDFShape { 33 | width: number; 34 | height: number; 35 | } 36 | 37 | export interface UDFView { 38 | position: UDFPosition; 39 | shape: UDFShape; 40 | } 41 | // export interface UDFLocation { 42 | // view: UDFView; 43 | // position: UDFPosition; 44 | // } 45 | export interface UDFConfig { 46 | type: UDFOutputType; 47 | view_configs: { [name: string]: UDFView }; 48 | display_name: string; 49 | } 50 | 51 | export interface UDFFunc { 52 | func: { [name: string]: string }; 53 | } 54 | export interface UDF { 55 | config: UDFConfig; 56 | func: UDFFunc; 57 | } 58 | export interface IRegisteredUDFs { 59 | udfs: { [name: string]: UDF }; 60 | timestamp: string; 61 | } 62 | 63 | export interface IGetUDFCommand { 64 | df_id: string; 65 | col_names: string[]; 66 | udf_name: string; 67 | } 68 | 69 | export interface ICellDataURLImage { 70 | url: string; 71 | binary: string; 72 | } 73 | 74 | export interface ICellDataFileImage { 75 | file_name: string; 76 | binary: string; 77 | } 78 | 79 | export interface ICellDataSelectionInput { 80 | options: string; 81 | input: string; 82 | } 83 | 84 | export interface ICellDataCheckboxInput { 85 | name: string; 86 | input: boolean; 87 | } 88 | 89 | export interface ICellDataTextInput { 90 | input: string; 91 | } 92 | 93 | export interface ILoadDataRequest { 94 | df_id: string | null; 95 | count: number; 96 | from_index: number; 97 | } 98 | -------------------------------------------------------------------------------- /cnext_app/lib/interfaces/IDataFrameStatus.tsx: -------------------------------------------------------------------------------- 1 | export enum DataFrameUpdateType { 2 | add_cols = "add_cols", 3 | del_cols = "del_cols", 4 | add_rows = "add_rows", 5 | del_rows = "del_rows", 6 | update_cells = "update_cells", 7 | new_index = "update_index", 8 | new_df = "new_df", 9 | no_update = "no_update", 10 | } 11 | 12 | export interface IDataFrameUpdate { 13 | update_type: DataFrameUpdateType; 14 | update_content: string[] | number[] | { [id: string]: [] }; 15 | } 16 | 17 | export interface IDataFrameStatusItem { 18 | type: string; 19 | name: string; 20 | id: string; 21 | df_updated: boolean; 22 | updates: IDataFrameUpdate; 23 | op: string; 24 | line_number: number; 25 | } 26 | 27 | export interface IDataFrameStatus { 28 | is_updated: boolean; 29 | /** indiate whether this update has been showed to the user or not */ 30 | is_showed: boolean; 31 | _status_list: IDataFrameStatusItem[]; 32 | } 33 | 34 | export interface IAllDataFrameStatus { 35 | [id: string]: IDataFrameStatus; 36 | } 37 | -------------------------------------------------------------------------------- /cnext_app/lib/interfaces/IExecutorManager.tsx: -------------------------------------------------------------------------------- 1 | export enum ExecutorManagerCommand { 2 | restart_kernel = "restart_kernel", 3 | interrupt_kernel = "interrupt_kernel", 4 | get_status = "get_status", 5 | } 6 | 7 | export interface IExecutorManagerResultContent { 8 | success: boolean; 9 | } 10 | 11 | export interface IExecutorStatus { 12 | alive_status: boolean; 13 | resource_usage: object | null; 14 | } 15 | -------------------------------------------------------------------------------- /cnext_app/lib/interfaces/IExperimentManager.tsx: -------------------------------------------------------------------------------- 1 | export enum ExperimentManagerCommand { 2 | list_experiments = "list_experiments", 3 | get_metric_history = "get_metric_history", 4 | list_run_infos = "list_run_infos", 5 | get_metric_plots = "get_metric_plots", 6 | load_artifacts_to_local = "load_artifacts_to_local", 7 | set_tracking_uri = "set_tracking_uri", 8 | } 9 | 10 | export enum ReduxActionType { 11 | SET_RUN_DICT = "set_run_dict", 12 | SET_EXP_DICT = "set_exp_dict", 13 | SET_RUN_SELECTION = "set_run_selection", 14 | SET_RUNNING_RUN = "set_running_run", 15 | SET_RUNNING_EXP = "set_running_exp", 16 | } 17 | -------------------------------------------------------------------------------- /cnext_app/lib/interfaces/IFileManager.tsx: -------------------------------------------------------------------------------- 1 | export enum FileType { 2 | python = "py", 3 | jupyter = "ipy", 4 | } 5 | 6 | export enum FileStatus { 7 | edited = "edited", 8 | saved = "saved", 9 | } 10 | 11 | export enum ProjectCommand { 12 | list_dir = "list_dir", 13 | get_file_metadata = "get_file_metadata", 14 | read_file = "read_file", 15 | save_file = "save_file", 16 | create_file = "create_file", 17 | close_file = "close_file", 18 | open_file = "open_file", 19 | delete = "delete", 20 | set_name = "set_name", 21 | get_open_files = "get_open_files", 22 | create_folder = "create_folder", 23 | remove_folder = "remove_folder", 24 | set_working_dir = "set_working_dir", 25 | // get_active_project = "get_active_project", 26 | save_state = "save_state", 27 | save_project_settings = "save_project_settings", 28 | get_project_settings = "get_project_settings", 29 | add_project = "add_project", 30 | list_projects = "list_projects", 31 | get_workspace_metadata = "get_workspace_metadata", 32 | set_workspace_metadata = "set_workspace_metadata", 33 | set_active_project = "set_active_project", 34 | } 35 | 36 | export interface IFileMetadata { 37 | path: string; 38 | name: string; 39 | type: string; 40 | executor: boolean; 41 | timestamp: number; 42 | } 43 | 44 | export interface IProjectMetadata { 45 | open_files: IFileMetadata[]; 46 | open_order: string[]; 47 | } 48 | 49 | export interface IProjectInfoInWorkspace { 50 | path: string; 51 | name: string; 52 | id: string; 53 | } 54 | 55 | export interface IDirectoryMetadata { 56 | path: string; 57 | name: string; 58 | is_file: boolean; 59 | deletable?: boolean; 60 | } 61 | 62 | export interface IWorkspaceMetadata { 63 | active_project: string | null; 64 | open_projects: IProjectInfoInWorkspace[]; 65 | } 66 | 67 | export interface IDirListResult { 68 | id: string; 69 | dirs: IDirectoryMetadata[]; 70 | } 71 | 72 | export enum FileContextMenuCommand { 73 | NEW_FILE, 74 | NEW_FOLDER, 75 | RENAME, 76 | DELETE, 77 | DIVIDER, 78 | } 79 | -------------------------------------------------------------------------------- /cnext_app/lib/interfaces/ILogsManager.tsx: -------------------------------------------------------------------------------- 1 | export enum LogsCommand { 2 | send_logs = "send_logs", 3 | } 4 | -------------------------------------------------------------------------------- /cnext_app/lib/interfaces/IModelManager.tsx: -------------------------------------------------------------------------------- 1 | export interface IModelInfo { 2 | name: string; 3 | object_id: number; 4 | class: string; 5 | base_class: string; 6 | } 7 | 8 | export interface IModelViewerInfo { 9 | address: [string, number]; 10 | status: NetronStatus; 11 | } 12 | 13 | export enum ModelManagerCommand { 14 | get_active_models_info = "get_active_models_info", 15 | display_model = "display_model" 16 | }; 17 | 18 | export enum NetronStatus { 19 | OK = "ok", 20 | ERROR = "error" 21 | }; -------------------------------------------------------------------------------- /cnext_app/lib/interfaces/IRichOuputViewer.tsx: -------------------------------------------------------------------------------- 1 | export enum RichOutputPanelToolbarItems { 2 | DATA = "DATA", 3 | RESULTS = "RESULTS", 4 | EXPERIMENTS = "EXPERIMENTS", 5 | MODEL = "MODEL-VIZ", 6 | }; 7 | -------------------------------------------------------------------------------- /cnext_app/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | // NOTE: This file should not be edited 5 | // see https://nextjs.org/docs/basic-features/typescript for more information. 6 | -------------------------------------------------------------------------------- /cnext_app/next.config.js: -------------------------------------------------------------------------------- 1 | // /** @type {import('next').NextConfig} */ 2 | // const { withSentryConfig } = require("@sentry/nextjs"); 3 | 4 | // const sentryWebpackPluginOptions = { 5 | // // Additional config options for the Sentry Webpack plugin. Keep in mind that 6 | // // the following options are set automatically, and overriding them is not 7 | // // recommended: 8 | // // release, url, org, project, authToken, configFile, stripPrefix, 9 | // // urlPrefix, include, ignore 10 | // dsn: "https://25a5df08f7ea47be8a9922441cba00d1@o1259763.ingest.sentry.io/6435278", 11 | // tracesSampleRate: 0.1, 12 | // silent: false, // Suppresses all logs 13 | // // For all available options, see: 14 | // // https://github.com/getsentry/sentry-webpack-plugin#options. 15 | // }; 16 | 17 | // moduleExports = { 18 | // reactStrictMode: true, 19 | // typescript: { 20 | // // !! WARN !! 21 | // // Dangerously allow production builds to successfully complete even if 22 | // // your project has type errors. 23 | // // !! WARN !! 24 | // ignoreBuildErrors: true, 25 | // }, 26 | // }; 27 | 28 | // module.exports = withSentryConfig(moduleExports, sentryWebpackPluginOptions); 29 | 30 | /** @type {import('next').NextConfig} */ 31 | module.exports = { 32 | reactStrictMode: false, 33 | typescript: { 34 | // !! WARN !! 35 | // Dangerously allow production builds to successfully complete even if 36 | // your project has type errors. 37 | // !! WARN !! 38 | ignoreBuildErrors: true, 39 | }, 40 | }; 41 | -------------------------------------------------------------------------------- /cnext_app/pages/_app.tsx: -------------------------------------------------------------------------------- 1 | import type { AppProps } from 'next/app' 2 | 3 | import '../styles/global.css' 4 | import "../styles/styles.css"; 5 | import Helmet from 'react-helmet'; 6 | import React, {useEffect} from 'react'; 7 | import PropTypes from 'prop-types'; 8 | 9 | import { 10 | createTheme, 11 | StyledEngineProvider, 12 | ThemeProvider as MuiThemeProvider, 13 | } from "@mui/material/styles"; 14 | 15 | import {ThemeProvider} from "styled-components"; 16 | 17 | const theme = createTheme(); 18 | 19 | import { createGlobalStyle } from 'styled-components' 20 | 21 | const GlobalStyle = createGlobalStyle` 22 | body { 23 | height: 100vh; 24 | margin:0; 25 | }` 26 | 27 | function MyApp({ Component, pageProps }: AppProps) { 28 | useEffect(() => { 29 | // Remove the server-side injected CSS. 30 | const jssStyles = document.querySelector('#jss-server-side'); 31 | if (jssStyles) 32 | if(jssStyles.parentElement) 33 | jssStyles.parentElement.removeChild(jssStyles); 34 | }, []); 35 | 36 | return ( 37 | 38 | 39 | 43 | 44 | {/* */} 45 | 46 | 47 | 48 | 49 | 50 | {/* */} 51 | 52 | 53 | ); 54 | } 55 | 56 | MyApp.propTypes = { 57 | Component: PropTypes.elementType.isRequired, 58 | pageProps: PropTypes.object.isRequired, 59 | }; 60 | export default MyApp 61 | -------------------------------------------------------------------------------- /cnext_app/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnextio/cnext/74a29f4a6cb5d5b1ed5bff9836dae7f80461be81/cnext_app/public/favicon.ico -------------------------------------------------------------------------------- /cnext_app/redux/actions/themeActions.js: -------------------------------------------------------------------------------- 1 | import * as types from '../constants'; 2 | 3 | export function setTheme(value) { 4 | return { 5 | type: types.SET_THEME, 6 | payload: value 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /cnext_app/redux/constants.js: -------------------------------------------------------------------------------- 1 | export const SET_THEME = 'SET_THEME'; 2 | -------------------------------------------------------------------------------- /cnext_app/redux/reducers/DFUpdatesRedux.tsx: -------------------------------------------------------------------------------- 1 | import { createSlice } from '@reduxjs/toolkit' 2 | 3 | export const dfUpdatesSlice = createSlice({ 4 | name: 'dfUpdates', 5 | initialState: { 6 | updates: {}, 7 | reviewState: {} 8 | }, 9 | reducers: { 10 | setUpdates: (state, action) => { 11 | updates = action.payload; 12 | const df_id = ifElse(action.payload, 'df_id', null); 13 | if (df_id) { 14 | if(!(df_id in state.updates)){ 15 | state.updates[df_id] = {}; 16 | state.reviewState[df_id] = -1; //-1 mean no review showed 17 | } 18 | state.updates[df_id] = ifElseDict(action.payload, 'updates'); 19 | } 20 | } 21 | }, 22 | }) 23 | 24 | // Action creators are generated for each case reducer function 25 | export const { dfUpdates } = dfUpdatesSlice.actions 26 | 27 | export default dfUpdatesSlice.reducer -------------------------------------------------------------------------------- /cnext_app/redux/reducers/ExecutorManagerRedux.tsx: -------------------------------------------------------------------------------- 1 | import { createSlice } from "@reduxjs/toolkit"; 2 | import { IExecutorStatus } from "../../lib/interfaces/IExecutorManager"; 3 | 4 | type ExecutorManagerState = { 5 | executorStatus: IExecutorStatus; 6 | executorRestartCounter: number; 7 | }; 8 | 9 | const initialState: ExecutorManagerState = { 10 | executorStatus: { alive_status: false, resource_usage: null }, 11 | executorRestartCounter: 0 12 | }; 13 | 14 | export const ExecutorManagerRedux = createSlice({ 15 | name: "executorManager", 16 | initialState: initialState, 17 | 18 | reducers: { 19 | setExecutorStatus: (state, action) => { 20 | state.executorStatus = action.payload; 21 | }, 22 | updateExecutorRestartCounter: (state) => { 23 | state.executorRestartCounter++; 24 | } 25 | }, 26 | }); 27 | 28 | // Action creators are generated for each case reducer function 29 | export const { setExecutorStatus, updateExecutorRestartCounter } = ExecutorManagerRedux.actions; 30 | 31 | export default ExecutorManagerRedux.reducer; 32 | -------------------------------------------------------------------------------- /cnext_app/redux/reducers/ExperimentManagerRedux.tsx: -------------------------------------------------------------------------------- 1 | import { createSlice } from "@reduxjs/toolkit"; 2 | import { ReduxActionType } from "../../lib/interfaces/IExperimentManager"; 3 | 4 | type ExperimentManagerState = { 5 | runDict: { [id: string]: {} } | null; 6 | expDict: {} | null; 7 | runningRunId: string | null; 8 | runningExpId: string | null; 9 | selectedExpId: string | null; 10 | }; 11 | 12 | const initialState: ExperimentManagerState = { 13 | runDict: null, 14 | expDict: null, 15 | runningRunId: null, 16 | runningExpId: null, 17 | selectedExpId: null, 18 | }; 19 | 20 | export const ExperimentManagerRedux = createSlice({ 21 | name: "experimentManager", 22 | initialState: initialState, 23 | 24 | reducers: { 25 | setRunDict: (state, action) => { 26 | let newRunDict = action.payload; 27 | for (let key of Object.keys(newRunDict)) { 28 | let run = newRunDict[key]; 29 | let id = run["_run_id"]; 30 | if (state.runDict && state.runDict[id]) { 31 | run["selected"] = state.runDict[id].selected; 32 | } 33 | } 34 | state.runDict = newRunDict; 35 | }, 36 | 37 | setExpDict: (state, action) => { 38 | state.expDict = action.payload; 39 | }, 40 | 41 | setRunSelection: (state, action) => { 42 | let id = action.payload.id; 43 | let selected = action.payload.selected; 44 | if (state.runDict && state.runDict[id]){ 45 | state.runDict[id].selected = selected; 46 | } 47 | }, 48 | 49 | setRunningRun: (state, action) => { 50 | let runId = action.payload; 51 | state.runningRunId = runId; 52 | state.runningExpId = 53 | state.runDict && runId && state.runDict[runId] 54 | ? state.runDict[runId]._experiment_id 55 | : null; 56 | }, 57 | 58 | // setRunningExp: (state, action) => { 59 | // state.runningExpId = action.payload; 60 | // }, 61 | 62 | setSelectedExp: (state, action) => { 63 | if (state.selectedExpId === action.payload) { 64 | state.runDict = null; 65 | } 66 | state.selectedExpId = action.payload; 67 | }, 68 | }, 69 | }); 70 | 71 | // Action creators are generated for each case reducer function 72 | export const { 73 | setRunDict, 74 | setExpDict, 75 | setRunSelection, 76 | setRunningRun, 77 | // setRunningExp, 78 | setSelectedExp, 79 | } = ExperimentManagerRedux.actions; 80 | 81 | export default ExperimentManagerRedux.reducer; 82 | -------------------------------------------------------------------------------- /cnext_app/redux/reducers/NotificationRedux.tsx: -------------------------------------------------------------------------------- 1 | import { createSlice } from "@reduxjs/toolkit"; 2 | 3 | type NotificationState = { 4 | notificationCounter: number; 5 | notificationText: string|null; 6 | }; 7 | 8 | const initialState: NotificationState = { 9 | notificationCounter: 0, 10 | notificationText: null, 11 | }; 12 | 13 | export const NotificationRedux = createSlice({ 14 | name: "notification", 15 | initialState: initialState, 16 | 17 | reducers: { 18 | setNotification: (state, action) => { 19 | state.notificationText = action.payload; 20 | state.notificationCounter++; 21 | } 22 | } 23 | }); 24 | 25 | export const { setNotification } = NotificationRedux.actions; 26 | 27 | export default NotificationRedux.reducer; -------------------------------------------------------------------------------- /cnext_app/redux/reducers/RichOutputRedux.tsx: -------------------------------------------------------------------------------- 1 | import { createSlice } from "@reduxjs/toolkit"; 2 | import { ICodeResultContent, ICodeResultMessage } from "../../lib/interfaces/ICodeEditor"; 3 | 4 | type RichOutputState = { 5 | /** This count is used to trigger the update of CodeOutput view. 6 | * It will increase whenever there is an update to text output results */ 7 | textOutputUpdateSignal: number; 8 | textOutput: ICodeResultContent[]; 9 | /** this is used to indicate whether mouse is being clicked on rich output panel 10 | * one use case of this is to display the richout command execution exception in OUTPUT */ 11 | richOutputFocused: boolean; 12 | }; 13 | 14 | const initialState: RichOutputState = { 15 | textOutputUpdateSignal: 0, 16 | textOutput: [], 17 | richOutputFocused: false, 18 | }; 19 | 20 | export const RichOutputRedux = createSlice({ 21 | name: "richOutput", 22 | initialState: initialState, 23 | 24 | reducers: { 25 | setTextOutput: (state, action) => { 26 | let resultMessage: ICodeResultMessage = action.payload; 27 | // console.log("RichOutputRedux setTextOutput: ", action.payload, state.textOutputUpdateCount); 28 | if (resultMessage.content && resultMessage.content !== "") 29 | state.textOutput.push(resultMessage.content); 30 | state.textOutputUpdateSignal++; 31 | }, 32 | 33 | setRichOutputFocused: (state, action) => { 34 | // console.log("RichOutputRedux setRichOutputFocused: ", action.payload); 35 | state.richOutputFocused = action.payload; 36 | }, 37 | 38 | clearTextOutput: (state) => { 39 | state.textOutput = []; 40 | state.textOutputUpdateSignal++; 41 | }, 42 | }, 43 | }); 44 | 45 | // Action creators are generated for each case reducer function 46 | export const { setTextOutput, setRichOutputFocused, clearTextOutput } = RichOutputRedux.actions; 47 | 48 | export default RichOutputRedux.reducer; 49 | -------------------------------------------------------------------------------- /cnext_app/redux/reducers/TerminalRedux.tsx: -------------------------------------------------------------------------------- 1 | import { createSlice } from "@reduxjs/toolkit"; 2 | 3 | type TerminalState = { 4 | config: { 5 | port: number | undefined; 6 | token: string; 7 | }; 8 | session: any; 9 | }; 10 | 11 | const initialState: TerminalState = { 12 | config: { 13 | port: undefined, 14 | token: "", 15 | }, 16 | session: null, 17 | }; 18 | 19 | export const TerminalRedux = createSlice({ 20 | name: "terminal", 21 | initialState: initialState, 22 | 23 | reducers: { 24 | setConfigTerminal: (state, action) => { 25 | state.config = action.payload; 26 | }, 27 | setSessionTerminal: (state, action) => { 28 | state.session = action.payload; 29 | }, 30 | }, 31 | }); 32 | 33 | export const { setConfigTerminal, setSessionTerminal } = TerminalRedux.actions; 34 | 35 | export default TerminalRedux.reducer; 36 | -------------------------------------------------------------------------------- /cnext_app/redux/store/index.tsx: -------------------------------------------------------------------------------- 1 | import { configureStore } from "@reduxjs/toolkit"; 2 | import dataFrameReducer from "../reducers/DataFramesRedux"; 3 | import codeEditorReducer from "../reducers/CodeEditorRedux"; 4 | import ProjectManagerRedux from "../reducers/ProjectManagerRedux"; 5 | import ExperimentManagerRedux from "../reducers/ExperimentManagerRedux"; 6 | import ModelManagerRedux from "../reducers/ModelManagerRedux"; 7 | import RichOutputRedux from "../reducers/RichOutputRedux"; 8 | import NotificationRedux from "../reducers/NotificationRedux"; 9 | import TerminalRedux from "../reducers/TerminalRedux"; 10 | import ExecutorManagerRedux from "../reducers/ExecutorManagerRedux"; 11 | 12 | const store = configureStore({ 13 | reducer: { 14 | dataFrames: dataFrameReducer, 15 | codeEditor: codeEditorReducer, 16 | projectManager: ProjectManagerRedux, 17 | experimentManager: ExperimentManagerRedux, 18 | modelManager: ModelManagerRedux, 19 | richOutput: RichOutputRedux, 20 | notification: NotificationRedux, 21 | terminal: TerminalRedux, 22 | executorManager: ExecutorManagerRedux 23 | }, 24 | }); 25 | 26 | // expose store when run in Cypress 27 | if (typeof window !== "undefined") { 28 | if (window.Cypress) { 29 | window.store = store; 30 | console.log("fire here"); 31 | } 32 | } 33 | 34 | export default store; 35 | export type RootState = ReturnType; 36 | export type AppDispatch = typeof store.dispatch; 37 | -------------------------------------------------------------------------------- /cnext_app/sentry.client.config.js: -------------------------------------------------------------------------------- 1 | const Sentry = require("@sentry/nextjs"); 2 | 3 | Sentry.init({ 4 | enabled:false, 5 | dsn: "https://25a5df08f7ea47be8a9922441cba00d1@o1259763.ingest.sentry.io/6435278", 6 | authToken: "19f6f8e90778487cb1c2333518a47def664d5734769b40ac857e4bede4222f2d", 7 | // We recommend adjusting this value in production, or using tracesSampler 8 | // for finer control 9 | tracesSampleRate: 0.1, 10 | // ... 11 | // Note: if you want to override the automatic release value, do not set a 12 | // `release` value here - use the environment variable `SENTRY_RELEASE`, so 13 | // that it will also get attached to your source maps 14 | }); 15 | -------------------------------------------------------------------------------- /cnext_app/sentry.properties: -------------------------------------------------------------------------------- 1 | defaults.url=https://sentry.io/ 2 | defaults.org=cnext 3 | defaults.project=nextjs 4 | auth.dsn=https://25a5df08f7ea47be8a9922441cba00d1@o1259763.ingest.sentry.io/6435278 5 | # cli.executable=../path/to/bin/sentry-cli -------------------------------------------------------------------------------- /cnext_app/sentry.server.config.js: -------------------------------------------------------------------------------- 1 | const Sentry = require("@sentry/nextjs"); 2 | 3 | Sentry.init({ 4 | dsn: "https://25a5df08f7ea47be8a9922441cba00d1@o1259763.ingest.sentry.io/6435278", 5 | authToken: "19f6f8e90778487cb1c2333518a47def664d5734769b40ac857e4bede4222f2d", 6 | 7 | // Set tracesSampleRate to 1.0 to capture 100% 8 | // of transactions for performance monitoring. 9 | // We recommend adjusting this value in production 10 | tracesSampleRate: 0.1, 11 | }); 12 | -------------------------------------------------------------------------------- /cnext_app/styles/example-styles.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: white; 3 | /*padding: 20px;*/ 4 | overflow: scroll; 5 | } 6 | #content { 7 | width: 100%; 8 | } 9 | .react-grid-layout { 10 | /*background: white;*/ 11 | } 12 | .layoutJSON { 13 | background: white; 14 | border: 1px solid black; 15 | /*margin-top: 10px;*/ 16 | /*padding: 10px;*/ 17 | } 18 | .columns { 19 | -moz-columns: 120px; 20 | -webkit-columns: 120px; 21 | columns: 120px; 22 | } 23 | .react-grid-item { 24 | box-sizing: border-box; 25 | } 26 | .react-grid-item:not(.react-grid-placeholder) { 27 | background: white; 28 | /*border: 1px solid black;*/ 29 | } 30 | .react-grid-item.resizing { 31 | opacity: 0.9; 32 | } 33 | .react-grid-item.static { 34 | background: white; 35 | } 36 | .react-grid-item .text { 37 | font-size: 24px; 38 | text-align: center; 39 | position: absolute; 40 | top: 0; 41 | bottom: 0; 42 | left: 0; 43 | right: 0; 44 | margin: auto; 45 | /*height: 24px;*/ 46 | } 47 | .react-grid-item .minMax { 48 | font-size: 12px; 49 | } 50 | .react-grid-item .add { 51 | cursor: pointer; 52 | } 53 | .react-grid-dragHandleExample { 54 | cursor: move; /* fallback if grab cursor is unsupported */ 55 | cursor: grab; 56 | cursor: -moz-grab; 57 | cursor: -webkit-grab; 58 | } 59 | li b { 60 | font-size: 19px; 61 | line-height: 14px; 62 | } 63 | -------------------------------------------------------------------------------- /cnext_app/styles/global.css: -------------------------------------------------------------------------------- 1 | html, 2 | body { 3 | padding: 0; 4 | margin: 0; 5 | font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, 6 | Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; 7 | line-height: 1.6; 8 | font-size: 18px; 9 | } 10 | 11 | * { 12 | box-sizing: border-box; 13 | } 14 | 15 | a { 16 | color: #0070f3; 17 | text-decoration: none; 18 | } 19 | 20 | /*a:hover {*/ 21 | /* text-decoration: underline;*/ 22 | /*}*/ 23 | 24 | img { 25 | max-width: 100%; 26 | display: block; 27 | } -------------------------------------------------------------------------------- /cnext_app/styles/utils.module.css: -------------------------------------------------------------------------------- 1 | .heading2Xl { 2 | font-size: 2.5rem; 3 | line-height: 1.2; 4 | font-weight: 800; 5 | letter-spacing: -0.05rem; 6 | margin: 1rem 0; 7 | } 8 | 9 | .headingXl { 10 | font-size: 2rem; 11 | line-height: 1.3; 12 | font-weight: 800; 13 | letter-spacing: -0.05rem; 14 | margin: 1rem 0; 15 | } 16 | 17 | .headingLg { 18 | font-size: 1.5rem; 19 | line-height: 1.4; 20 | margin: 1rem 0; 21 | } 22 | 23 | .headingMd { 24 | font-size: 1.2rem; 25 | line-height: 1.5; 26 | } 27 | 28 | .borderCircle { 29 | border-radius: 9999px; 30 | } 31 | 32 | .colorInherit { 33 | color: inherit; 34 | } 35 | 36 | .padding1px { 37 | padding-top: 1px; 38 | } 39 | 40 | .list { 41 | list-style: none; 42 | padding: 0; 43 | margin: 0; 44 | } 45 | 46 | .listItem { 47 | margin: 0 0 1.25rem; 48 | } 49 | 50 | .lightText { 51 | color: #999; 52 | } -------------------------------------------------------------------------------- /cnext_app/tests/intergration/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM cypress/base:16.13.0 2 | WORKDIR /app 3 | 4 | # dependencies will be installed only if the package files change 5 | COPY package.json . 6 | 7 | # by setting CI environment variable we switch the Cypress install messages 8 | # to small "started / finished" and avoid 1000s of lines of progress messages 9 | # https://github.com/cypress-io/cypress/issues/1243 10 | ENV CI=1 11 | RUN npm i 12 | # verify that Cypress has been installed correctly. 13 | # running this command separately from "cypress run" will also cache its result 14 | # to avoid verifying again when running the tests 15 | RUN npx cypress verify 16 | -------------------------------------------------------------------------------- /cnext_app/tests/intergration/cypress.json: -------------------------------------------------------------------------------- 1 | { 2 | "projectId": "4rrkju", 3 | "baseUrl": "http://localhost:4000", 4 | "defaultCommandTimeout": 10000, 5 | "video": false, 6 | "reporter": "mocha-junit-reporter", 7 | "reporterOptions": { 8 | "testsuitesTitle": true, 9 | "mochaFile": "./cypress/reports/junit.[hash].xml" 10 | }, 11 | "env": { 12 | "wait_500mls": 500, 13 | "wait_1s": 1000, 14 | "wait_2s": 2000, 15 | "wait_3s": 3000, 16 | "wait_5s": 5000, 17 | "wait_10s": 10000 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /cnext_app/tests/intergration/cypress/fixtures/example.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Using fixtures to represent data", 3 | "email": "hello@cypress.io", 4 | "body": "Fixtures are a great way to mock data for responses to routes" 5 | } 6 | -------------------------------------------------------------------------------- /cnext_app/tests/intergration/cypress/integration/cyc/2-file-explorer.spec.js: -------------------------------------------------------------------------------- 1 | const WAIT_500MLS = Cypress.env('wait_500mls'); 2 | const WAIT_1S = Cypress.env('wait_1s'); 3 | const WAIT_2S = Cypress.env('wait_2s'); 4 | const WAIT_3S = Cypress.env('wait_3s'); 5 | 6 | describe('Check File Explorer', () => { 7 | before(() => { 8 | cy.visit('/'); 9 | cy.wait(WAIT_3S); 10 | }); 11 | 12 | it('Check create and delete file', () => { 13 | cy.get('#sidebar_Projects').should('be.visible').click(); 14 | 15 | // Create file 16 | cy.wait(WAIT_2S); 17 | cy.get('[data-cy="project-root"]').rightclick(); 18 | cy.wait(WAIT_1S); 19 | cy.get('.MuiMenuItem-root').contains('New file').click(); 20 | cy.get('[data-cy="new-file-item').type('test').type('{enter}'); 21 | cy.wait(WAIT_1S); 22 | 23 | // Delete file 24 | cy.get('.MuiTreeItem-label').contains('test.py').rightclick(); 25 | cy.wait(WAIT_1S); 26 | cy.get('.MuiMenuItem-root').contains('Delete').click(); 27 | cy.wait(WAIT_500MLS); 28 | cy.get('button').contains('Move to trash').click(); 29 | 30 | cy.get('.MuiTreeItem-label').contains('test.py').should('not.exist'); 31 | }); 32 | 33 | afterEach(() => { 34 | cy.wait(WAIT_1S); 35 | }); 36 | }); 37 | -------------------------------------------------------------------------------- /cnext_app/tests/intergration/cypress/integration/cyc/shared.js: -------------------------------------------------------------------------------- 1 | export const isMacOSPlatform = () => { 2 | return Cypress.platform.includes('darwin'); 3 | }; 4 | 5 | export const removeText = (editor) => { 6 | editor.focus(); 7 | editor.type('{selectall}'); 8 | editor.type('{del}'); 9 | }; 10 | 11 | export const randomString = () => { 12 | let text = ''; 13 | let possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; 14 | for (let i = 0; i < 10; i++) 15 | text += possible.charAt(Math.floor(Math.random() * possible.length)); 16 | 17 | return text; 18 | }; -------------------------------------------------------------------------------- /cnext_app/tests/intergration/cypress/integration/data/code-text.js: -------------------------------------------------------------------------------- 1 | export const codeCheckConsole = `print('test')`; 2 | 3 | export const codeTestDF = `import cnextlib.dataframe as cd 4 | df = cd.DataFrame('data/housing_data/data.csv')`; 5 | 6 | export const codeTestMatplotlibLine = `import matplotlib.pyplot as plt 7 | plt.plot([5,6], [7,8])`; 8 | 9 | export const codeTestMatplotlibTheCoherenceOfTwoSignals = `import numpy as np 10 | import matplotlib.pyplot as plt 11 | # Fixing random state for reproducibility 12 | np.random.seed(19680801) 13 | dt = 0.01 14 | t = np.arange(0, 30, dt) 15 | nse1 = np.random.randn(len(t)) 16 | nse2 = np.random.randn(len(t)) 17 | 18 | # Two signals with a coherent part at 10Hz and a random part 19 | s1 = np.sin(2 * np.pi * 10 * t) + nse1 20 | s2 = np.sin(2 * np.pi * 10 * t) + nse2 21 | 22 | fig, axs = plt.subplots(2, 1) 23 | axs[0].plot(t, s1, t, s2) 24 | axs[0].set_xlim(0, 2) 25 | axs[0].set_xlabel('time') 26 | axs[0].set_ylabel('s1 and s2') 27 | axs[0].grid(True) 28 | 29 | cxy, f = axs[1].cohere(s1, s2, 256, 1. / dt) 30 | axs[1].set_ylabel('coherence') 31 | 32 | fig.tight_layout() 33 | `; 34 | 35 | export const codeTestPlotly = `import plotly.express as px 36 | fig = px.scatter(x=[0, 1, 2, 3, 4], y=[0, 1, 4, 9, 16]) 37 | fig.show()`; 38 | 39 | export const codeTestAudio = `from IPython.display import Audio 40 | Audio('https://github.com/rafaelreis-hotmart/Audio-Sample-files/raw/master/sample.mp3', autoplay=False) 41 | `; 42 | 43 | export const codeTestVideo = `from IPython.display import Video 44 | Video('http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4')`; 45 | 46 | export const codeTestImageJPG = `from IPython import display 47 | display.Image("https://farm2.staticflickr.com/1533/26541536141_41abe98db3_z_d.jpg")`; 48 | 49 | export const codeTestImagePNG = `from IPython import display 50 | display.Image("https://kgo.googleusercontent.com/profile_vrt_raw_bytes_1587515358_10512.png")`; 51 | 52 | export const codeTestGroupLines = `import matplotlib.pyplot as plt 53 | plt.plot([5,6], [7,8])\n\n\n 54 | `; 55 | 56 | export const codeTestKernelControl = `import time 57 | for i in range(20): 58 | print(i) 59 | time.sleep(2) 60 | `; 61 | -------------------------------------------------------------------------------- /cnext_app/tests/intergration/cypress/integration/shared.js: -------------------------------------------------------------------------------- 1 | export const isMacOSPlatform = () => { 2 | return Cypress.platform.includes('darwin'); 3 | }; 4 | 5 | export const removeText = (editor) => { 6 | editor.focus(); 7 | editor.type('{selectall}'); 8 | editor.type('{del}'); 9 | }; 10 | 11 | export const randomString = () => { 12 | let text = ''; 13 | let possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; 14 | for (let i = 0; i < 10; i++) 15 | text += possible.charAt(Math.floor(Math.random() * possible.length)); 16 | 17 | return text; 18 | }; -------------------------------------------------------------------------------- /cnext_app/tests/intergration/cypress/plugins/index.js: -------------------------------------------------------------------------------- 1 | /// 2 | // *********************************************************** 3 | // This example plugins/index.js can be used to load plugins 4 | // 5 | // You can change the location of this file or turn off loading 6 | // the plugins file with the 'pluginsFile' configuration option. 7 | // 8 | // You can read more here: 9 | // https://on.cypress.io/plugins-guide 10 | // *********************************************************** 11 | 12 | // This function is called when a project is opened or re-opened (e.g. due to 13 | // the project's config changing) 14 | 15 | /** 16 | * @type {Cypress.PluginConfig} 17 | */ 18 | // eslint-disable-next-line no-unused-vars 19 | module.exports = (on, config) => { 20 | // `on` is used to hook into various events Cypress emits 21 | // `config` is the resolved Cypress config 22 | } 23 | -------------------------------------------------------------------------------- /cnext_app/tests/intergration/cypress/results/output.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /cnext_app/tests/intergration/cypress/support/commands.js: -------------------------------------------------------------------------------- 1 | // *********************************************** 2 | // This example commands.js shows you how to 3 | // create various custom commands and overwrite 4 | // existing commands. 5 | // 6 | // For more comprehensive examples of custom 7 | // commands please read more here: 8 | // https://on.cypress.io/custom-commands 9 | // *********************************************** 10 | // 11 | // 12 | // -- This is a parent command -- 13 | // Cypress.Commands.add('login', (email, password) => { ... }) 14 | // 15 | // 16 | // -- This is a child command -- 17 | // Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... }) 18 | // 19 | // 20 | // -- This is a dual command -- 21 | // Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... }) 22 | // 23 | // 24 | // -- This will overwrite an existing command -- 25 | // Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) 26 | 27 | Cypress.Commands.add('getBySel', (selector, ...args) => { 28 | return cy.get(`[data-cy=${selector}]`, ...args); 29 | }); 30 | 31 | Cypress.Commands.add('getBySelLike', (selector, ...args) => { 32 | return cy.get(`[data-cy*=${selector}]`, ...args); 33 | }); 34 | -------------------------------------------------------------------------------- /cnext_app/tests/intergration/cypress/support/index.js: -------------------------------------------------------------------------------- 1 | // *********************************************************** 2 | // This example support/index.js is processed and 3 | // loaded automatically before your test files. 4 | // 5 | // This is a great place to put global configuration and 6 | // behavior that modifies Cypress. 7 | // 8 | // You can change the location of this file or turn off 9 | // automatically serving support files with the 10 | // 'supportFile' configuration option. 11 | // 12 | // You can read more here: 13 | // https://on.cypress.io/configuration 14 | // *********************************************************** 15 | 16 | // Import commands.js using ES2015 syntax: 17 | import './commands' 18 | 19 | // Alternatively you can use CommonJS syntax: 20 | // require('./commands') 21 | -------------------------------------------------------------------------------- /cnext_app/tests/intergration/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "e2e", 3 | "version": "1.0.0", 4 | "description": "Cypress tests", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "cypress": "cypress open" 9 | }, 10 | "keywords": [], 11 | "author": "cyc ai members", 12 | "license": "ISC", 13 | "private": true, 14 | "devDependencies": { 15 | "cypress": "^9.5.3", 16 | "mocha-junit-reporter": "^2.0.2", 17 | "mochawesome": "^7.1.3", 18 | "mochawesome-merge": "^4.2.1", 19 | "mochawesome-report-generator": "^6.2.0" 20 | } 21 | } -------------------------------------------------------------------------------- /cnext_app/tests/unit/pages/index.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render, screen } from '../test-utils'; 3 | import Home from '../../../pages/index'; 4 | 5 | describe('HomePage', () => { 6 | it('should render the heading', () => { 7 | const textToFind = 'Hello World!'; 8 | 9 | render(); 10 | const heading = screen.getByText(textToFind); 11 | 12 | expect(heading).toBeInTheDocument(); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /cnext_app/tests/unit/sum.js: -------------------------------------------------------------------------------- 1 | function sum(a, b) { 2 | return a + b; 3 | } 4 | module.exports = sum; 5 | -------------------------------------------------------------------------------- /cnext_app/tests/unit/sum.test.js: -------------------------------------------------------------------------------- 1 | const sum = require('./sum'); 2 | 3 | test('adds 1 + 2 to equal 3', () => { 4 | expect(sum(1, 2)).toBe(3); 5 | }); 6 | -------------------------------------------------------------------------------- /cnext_app/tests/unit/test-utils.js: -------------------------------------------------------------------------------- 1 | import { render } from '@testing-library/react'; 2 | 3 | // Add in any providers here if necessary: 4 | const Providers = ({ children }) => { 5 | return children; 6 | }; 7 | 8 | const customRender = (ui, options = {}) => render(ui, { wrapper: Providers, ...options }); 9 | 10 | // re-export everything 11 | export * from '@testing-library/react'; 12 | 13 | // override render method 14 | export { customRender as render }; 15 | -------------------------------------------------------------------------------- /cnext_app/theme/breakpoints.js: -------------------------------------------------------------------------------- 1 | const breakpoints = { 2 | values: { 3 | xs: 0, 4 | sm: 600, 5 | md: 960, 6 | lg: 1280, 7 | xl: 1440 8 | } 9 | }; 10 | 11 | export default breakpoints; 12 | -------------------------------------------------------------------------------- /cnext_app/theme/index.js: -------------------------------------------------------------------------------- 1 | import { createTheme } from "@mui/material/styles"; 2 | 3 | import variants from "./variants"; 4 | import typography from "./typography"; 5 | import overrides from "./overrides"; 6 | import breakpoints from "./breakpoints"; 7 | import props from "./props"; 8 | import shadows from "./shadows"; 9 | 10 | const theme = variant => { 11 | return createTheme( 12 | { 13 | spacing: 4, 14 | breakpoints: breakpoints, 15 | overrides: overrides, 16 | props: props, 17 | typography: typography, 18 | shadows: shadows, 19 | body: variant.body, 20 | header: variant.header, 21 | palette: variant.palette, 22 | sidebar: variant.sidebar 23 | }, 24 | variant.name 25 | ); 26 | }; 27 | 28 | const themes = variants.map(variant => theme(variant)); 29 | 30 | export default themes; 31 | -------------------------------------------------------------------------------- /cnext_app/theme/overrides.js: -------------------------------------------------------------------------------- 1 | const overrides = { 2 | MuiCardHeader: { 3 | action: { 4 | marginTop: "-4px", 5 | marginRight: "-4px" 6 | } 7 | }, 8 | MuiPickersDay: { 9 | day: { 10 | fontWeight: "300" 11 | } 12 | }, 13 | MuiPickersYear: { 14 | root: { 15 | height: "64px" 16 | } 17 | }, 18 | MuiPickersCalendar: { 19 | transitionContainer: { 20 | marginTop: "6px" 21 | } 22 | }, 23 | MuiPickersCalendarHeader: { 24 | iconButton: { 25 | backgroundColor: "transparent", 26 | "& > *": { 27 | backgroundColor: "transparent" 28 | } 29 | }, 30 | switchHeader: { 31 | marginTop: "2px", 32 | marginBottom: "4px" 33 | } 34 | }, 35 | MuiPickersClock: { 36 | container: { 37 | margin: `32px 0 4px` 38 | } 39 | }, 40 | MuiPickersClockNumber: { 41 | clockNumber: { 42 | left: `calc(50% - 16px)`, 43 | width: "32px", 44 | height: "32px" 45 | } 46 | }, 47 | MuiPickerDTHeader: { 48 | dateHeader: { 49 | "& h4": { 50 | fontSize: "2.125rem", 51 | fontWeight: 400 52 | } 53 | }, 54 | timeHeader: { 55 | "& h3": { 56 | fontSize: "3rem", 57 | fontWeight: 400 58 | } 59 | } 60 | }, 61 | MuiPickersTimePicker: { 62 | hourMinuteLabel: { 63 | "& h2": { 64 | fontSize: "3.75rem", 65 | fontWeight: 300 66 | } 67 | } 68 | }, 69 | MuiPickersToolbar: { 70 | toolbar: { 71 | "& h4": { 72 | fontSize: "2.125rem", 73 | fontWeight: 400 74 | } 75 | } 76 | } 77 | }; 78 | 79 | export default overrides; 80 | -------------------------------------------------------------------------------- /cnext_app/theme/props.js: -------------------------------------------------------------------------------- 1 | const props = { 2 | MuiButtonBase: { 3 | disableRipple: true 4 | }, 5 | MuiCardHeader: { 6 | titleTypographyProps: { variant: "h6" } 7 | } 8 | }; 9 | 10 | export default props; 11 | -------------------------------------------------------------------------------- /cnext_app/theme/typography.js: -------------------------------------------------------------------------------- 1 | const typography = { 2 | useNextVariants: true, 3 | fontFamily: [ 4 | "Nunito", 5 | "-apple-system", 6 | "BlinkMacSystemFont", 7 | '"Segoe UI"', 8 | "Roboto", 9 | '"Helvetica Neue"', 10 | "Arial", 11 | "sans-serif", 12 | '"Apple Color Emoji"', 13 | '"Segoe UI Emoji"', 14 | '"Segoe UI Symbol"' 15 | ].join(","), 16 | fontSize: 14, 17 | fontWeightLight: 300, 18 | fontWeightRegular: 400, 19 | fontWeightMedium: 600, 20 | h1: { 21 | fontSize: "2rem", 22 | fontWeight: 600, 23 | lineHeight: 1.2 24 | }, 25 | h2: { 26 | fontSize: "1.75rem", 27 | fontWeight: 600, 28 | lineHeight: 1.2 29 | }, 30 | h3: { 31 | fontSize: "1.5rem", 32 | fontWeight: 600, 33 | lineHeight: 1.2 34 | }, 35 | h4: { 36 | fontSize: "1.25rem", 37 | fontWeight: 600, 38 | lineHeight: 1.2 39 | }, 40 | h5: { 41 | fontSize: "1.125rem", 42 | fontWeight: 600, 43 | lineHeight: 1.2 44 | }, 45 | h6: { 46 | fontSize: "1.0625rem", 47 | fontWeight: 600, 48 | lineHeight: 1.2 49 | }, 50 | body1: { 51 | fontSize: 14 52 | }, 53 | button: { 54 | textTransform: "none" 55 | } 56 | }; 57 | 58 | export default typography; 59 | -------------------------------------------------------------------------------- /cnext_app/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "lib": [ 5 | "dom", 6 | "dom.iterable", 7 | "esnext" 8 | ], 9 | "allowJs": true, 10 | "skipLibCheck": true, 11 | "strict": true, 12 | "forceConsistentCasingInFileNames": true, 13 | "noEmit": true, 14 | "esModuleInterop": true, 15 | "module": "esnext", 16 | "moduleResolution": "node", 17 | "resolveJsonModule": true, 18 | "isolatedModules": true, 19 | "jsx": "preserve", 20 | "downlevelIteration": true, 21 | "incremental": true, 22 | }, 23 | "include": [ 24 | "next-env.d.ts", 25 | "**/*.ts", 26 | "**/*.tsx", 27 | "lib/components/CodeAreaComponent.js", 28 | "server/server.tsx", 29 | "server/tests/test_servers/test_pyshell.jss", 30 | "lib/components/richoutput-panel/experiment-panel/WindowDims.js" 31 | ], 32 | "exclude": [ 33 | "node_modules" 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /cnext_app/utils/cookie.ts: -------------------------------------------------------------------------------- 1 | export function getCookie(cookieName: string) { 2 | let cookie: { [key: string]: string } = {}; 3 | document.cookie.split(";").forEach(function (el) { 4 | let [key, value] = el.split("="); 5 | cookie[key.trim()] = value; 6 | }); 7 | return cookie[cookieName]; 8 | } 9 | export function delete_cookie(name: string) { 10 | document.cookie = name + "=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;"; 11 | } 12 | export function deleteAllCookies() { 13 | var cookies = document.cookie.split(";"); 14 | 15 | for (var i = 0; i < cookies.length; i++) { 16 | var cookie = cookies[i]; 17 | var eqPos = cookie.indexOf("="); 18 | var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie; 19 | document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT"; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /cnext_app/utils/domain.ts: -------------------------------------------------------------------------------- 1 | export function getDomain() { 2 | let hostname = window.location.hostname; 3 | if (hostname === "localhost") return "http://localhost"; 4 | return `${window.location.protocol}//${hostname}`; 5 | } 6 | -------------------------------------------------------------------------------- /cnext_app/utils/index.ts: -------------------------------------------------------------------------------- 1 | export * from './cookie' 2 | -------------------------------------------------------------------------------- /cnext_server/.gitignore: -------------------------------------------------------------------------------- 1 | # public -------------------------------------------------------------------------------- /cnext_server/__init__.py: -------------------------------------------------------------------------------- 1 | #for control version in code 2 | __version__ = '0.7.0' 3 | -------------------------------------------------------------------------------- /cnext_server/public/404.html: -------------------------------------------------------------------------------- 1 | 404: This page could not be found

404

This page could not be found.

-------------------------------------------------------------------------------- /cnext_server/public/_next/static/8KnY93POWcLvEaGxXR6az/_buildManifest.js: -------------------------------------------------------------------------------- 1 | self.__BUILD_MANIFEST={__rewrites:{beforeFiles:[],afterFiles:[],fallback:[]},"/":["static/chunks/2852872c-257ebc72a8902899.js","static/chunks/4ad82c5e-eacc478f45b94eba.js","static/chunks/75fc9c18-d4f616fecc6e1230.js","static/chunks/976-3cdeccab7a0db628.js","static/css/1b4f47eca4f664f1.css","static/chunks/pages/index-2ac4478fd0f61aa3.js"],"/_error":["static/chunks/pages/_error-c13976a61913457b.js"],sortedPages:["/","/_app","/_error"]},self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB(); -------------------------------------------------------------------------------- /cnext_server/public/_next/static/8KnY93POWcLvEaGxXR6az/_ssgManifest.js: -------------------------------------------------------------------------------- 1 | self.__SSG_MANIFEST=new Set,self.__SSG_MANIFEST_CB&&self.__SSG_MANIFEST_CB(); -------------------------------------------------------------------------------- /cnext_server/public/_next/static/chunks/741.25e0d543f796a94b.js: -------------------------------------------------------------------------------- 1 | "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[741],{22741:function(t,e,r){var n=r(33227),u=r(88361),o=r(85971),i=r(52715),c=r(91193),a=r(87794);function p(t){var e=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=c(t);if(e){var u=c(this).constructor;r=Reflect.construct(n,arguments,u)}else r=n.apply(this,arguments);return i(this,r)}}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"AppInitialProps",{enumerable:!0,get:function(){return l.AppInitialProps}}),Object.defineProperty(e,"NextWebVitalsMetric",{enumerable:!0,get:function(){return l.NextWebVitalsMetric}}),e.default=void 0;var s=r(60932).Z,f=(0,r(92648).Z)(r(67294)),l=r(99475);function d(t){return h.apply(this,arguments)}function h(){return(h=s(a.mark((function t(e){var r,n,u;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.Component,n=e.ctx,t.next=3,l.loadGetInitialProps(r,n);case 3:return u=t.sent,t.abrupt("return",{pageProps:u});case 5:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var v=function(t){o(r,t);var e=p(r);function r(){return n(this,r),e.apply(this,arguments)}return u(r,[{key:"render",value:function(){var t=this.props,e=t.Component,r=t.pageProps;return f.default.createElement(e,Object.assign({},r))}}]),r}(f.default.Component);v.origGetInitialProps=d,v.getInitialProps=d,e.default=v}}]); -------------------------------------------------------------------------------- /cnext_server/public/_next/static/css/713625ab96f56113.css: -------------------------------------------------------------------------------- 1 | .xterm{cursor:text;position:relative;-moz-user-select:none;user-select:none;-ms-user-select:none;-webkit-user-select:none}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{position:absolute;top:0;z-index:5}.xterm .xterm-helper-textarea{padding:0;border:0;margin:0;position:absolute;opacity:0;left:-9999em;top:0;width:0;height:0;z-index:-5;white-space:nowrap;overflow:hidden;resize:none}.xterm .composition-view{background:#000;color:#fff;display:none;position:absolute;white-space:nowrap;z-index:1}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{background-color:#000;overflow-y:scroll;cursor:default;position:absolute;right:0;left:0;top:0;bottom:0}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;left:0;top:0}.xterm .xterm-scroll-area{visibility:hidden}.xterm-char-measure-element{display:inline-block;visibility:hidden;position:absolute;top:0;left:-9999em;line-height:normal}.xterm.enable-mouse-events{cursor:default}.xterm .xterm-cursor-pointer,.xterm.xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility,.xterm .xterm-message{position:absolute;left:0;top:0;bottom:0;right:0;z-index:10;color:transparent}.xterm .live-region{position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden}.xterm-dim{opacity:.5}.xterm-underline{text-decoration:underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-decoration-overview-ruler{z-index:7;position:absolute;top:0;right:0;pointer-events:none}.xterm-decoration-top{z-index:2;position:relative} -------------------------------------------------------------------------------- /cnext_server/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnextio/cnext/74a29f4a6cb5d5b1ed5bff9836dae7f80461be81/cnext_server/public/favicon.ico -------------------------------------------------------------------------------- /cnext_server/server/.dockerignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /cnext_server/server/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.9.7-buster 2 | RUN mkdir app 3 | 4 | WORKDIR /app 5 | 6 | ENV CLIENT_URL=http://web:4000 7 | 8 | RUN chmod -R 777 /app 9 | 10 | ENV POETRY_HOME=/usr/local 11 | 12 | RUN \ 13 | echo "deb https://deb.nodesource.com/node_16.x buster main" > /etc/apt/sources.list.d/nodesource.list && \ 14 | wget -qO- https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - && \ 15 | echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list && \ 16 | wget -qO- https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \ 17 | apt-get update && \ 18 | apt-get install -yqq nodejs && \ 19 | apt-get update && \ 20 | apt-get install git && \ 21 | pip install -U pip && pip install pipenv && \ 22 | npm i -g npm@^8 && \ 23 | curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python - && \ 24 | rm -rf /var/lib/apt/lists/* 25 | 26 | COPY . . 27 | 28 | RUN git clone https://kiwing:QTmTLMdSUT3HPSEQpe7N@bitbucket.org/robotdreamers/cnext_sample_projects.git 29 | 30 | #BUILD 31 | RUN /bin/bash -c "poetry install" 32 | RUN /bin/bash -c "npm install" 33 | 34 | RUN chmod -R 777 ./start.sh 35 | 36 | ENTRYPOINT [ "./start.sh" ] 37 | 38 | EXPOSE 4000 -------------------------------------------------------------------------------- /cnext_server/server/eventLog.js: -------------------------------------------------------------------------------- 1 | const request = require("request"); 2 | var package_json = require("./package.json"); 3 | 4 | function eventLog() { 5 | const AFTER_1_MIN = 60000; 6 | const AFTER_5_MINS = 300000; 7 | const AFTER_30_MINS = 1800000; 8 | 9 | sendEventTrackingAfter(AFTER_1_MIN, "launch_after_1_min"); 10 | sendEventTrackingAfter(AFTER_5_MINS, "launch_after_5_mins"); 11 | setInterval(() => { 12 | sendEventTrackingAfter(0, "launch_after_30_mins"); 13 | }, AFTER_30_MINS); 14 | } 15 | 16 | function sendEventTrackingAfter(timeout, tag) { 17 | setTimeout(() => { 18 | const loggly_url = 19 | "http://logs-01.loggly.com/inputs/c58f8bb2-2332-4915-b9f3-70c1975956bb/tag/" + tag; 20 | request.post( 21 | loggly_url, 22 | { json: { time: new Date().toUTCString(), version: package_json.version } }, 23 | function (error, response) { 24 | if (!error && response.statusCode == 200) { 25 | // console.log("send to loggly", body); 26 | } 27 | } 28 | ); 29 | }, timeout); 30 | } 31 | 32 | module.exports = { eventLog }; 33 | -------------------------------------------------------------------------------- /cnext_server/server/ls/lsp_process.js: -------------------------------------------------------------------------------- 1 | const { JsonRpcStreamReader, JsonRpcStreamWriter } = require('./streams'); 2 | const { spawn, exec } = require('child_process'); 3 | // action channel 4 | const LanguageServer = 'LanguageServer'; 5 | const LanguageServerNotifier = 'LanguageServerNotifier'; 6 | const LanguageServerHover = 'LanguageServerHover'; 7 | const LanguageServerCompletion = 'LanguageServerCompletion'; 8 | const LanguageServerSignature = 'LanguageServerSignature'; 9 | 10 | const NotifyCase = ['textDocument/publishDiagnostics']; 11 | class LSPProcess { 12 | constructor(io) { 13 | this.ls = spawn('pyls', ['-v'], { shell: true }); 14 | const reader = new JsonRpcStreamReader(this.ls.stdout); 15 | 16 | this.ls.stdout.on('data', (chunk) => { 17 | const payload = reader.getData(chunk); 18 | if (payload && payload.result) { 19 | const channel = this.getChannel(payload.result); 20 | io.emit(channel, JSON.stringify(payload.result)); 21 | reader.clearCache(); 22 | } else if (this.isNeedNotify(payload)) { 23 | io.emit(LanguageServerNotifier, JSON.stringify(payload)); 24 | reader.clearCache(); 25 | } 26 | }); 27 | 28 | this.ls.stderr.on('data', (stderr) => { 29 | // console.log('stderr', stderr.toString()); 30 | }); 31 | } 32 | 33 | isNeedNotify(payload) { 34 | return payload && payload.method && NotifyCase.includes(payload.method); 35 | } 36 | 37 | getChannel(result) { 38 | if ('signatures' in result) { 39 | return LanguageServerSignature; 40 | } else if ('contents' in result) { 41 | return LanguageServerHover; 42 | } else if ('isIncomplete' in result) { 43 | return LanguageServerCompletion; 44 | } else { 45 | return LanguageServer; 46 | } 47 | } 48 | 49 | sendMessageToLsp(message) { 50 | const writer = new JsonRpcStreamWriter(); 51 | const lspPayload = writer.getPayload(message); 52 | this.ls.stdin.write(Buffer.from(lspPayload, 'utf-8')); 53 | } 54 | } 55 | module.exports = { 56 | LSPProcess, 57 | LanguageServer, 58 | LanguageServerHover, 59 | LanguageServerSignature, 60 | LanguageServerCompletion, 61 | }; 62 | -------------------------------------------------------------------------------- /cnext_server/server/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cnext-server", 3 | "version": "0.11.6", 4 | "private": true, 5 | "scripts": { 6 | "start": "nodemon server.js", 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "start-prod": "node server.js", 9 | "dev": "set EVENT_LOG_DISABLE=true && nodemon server.js" 10 | }, 11 | "dependencies": { 12 | "dotenv": "~16.0.0", 13 | "express": "~4.17.1", 14 | "http-proxy": "^1.18.1", 15 | "http-proxy-middleware": "^2.0.6", 16 | "nanoid": "^3.1.23", 17 | "node-addon-api": "~4.2.0", 18 | "node-gyp-build": "~4.3.0", 19 | "nodemon": "~2.0.15", 20 | "python-shell": "~3.0.1", 21 | "request": "^2.88.2", 22 | "socket.io": "~4.5.3", 23 | "socket.io-client": "~4.5.3", 24 | "ssh2": "^1.11.0", 25 | "yaml": "~1.10.2", 26 | "zeromq": "~6.0.0-beta.6" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /cnext_server/server/python/cassist/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnextio/cnext/74a29f4a6cb5d5b1ed5bff9836dae7f80461be81/cnext_server/server/python/cassist/__init__.py -------------------------------------------------------------------------------- /cnext_server/server/python/code_editor/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnextio/cnext/74a29f4a6cb5d5b1ed5bff9836dae7f80461be81/cnext_server/server/python/code_editor/__init__.py -------------------------------------------------------------------------------- /cnext_server/server/python/code_editor/interfaces.py: -------------------------------------------------------------------------------- 1 | import simplejson as json 2 | 3 | 4 | class PlotResult: 5 | """A class that represents the plot result""" 6 | 7 | def __init__(self, plot): 8 | self.plot = plot 9 | 10 | def toJSON(self): 11 | return json.dumps(self, default=lambda o: o.__dict__, ignore_nan=True) 12 | -------------------------------------------------------------------------------- /cnext_server/server/python/dataframe_manager/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnextio/cnext/74a29f4a6cb5d5b1ed5bff9836dae7f80461be81/cnext_server/server/python/dataframe_manager/__init__.py -------------------------------------------------------------------------------- /cnext_server/server/python/environment_manager/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnextio/cnext/74a29f4a6cb5d5b1ed5bff9836dae7f80461be81/cnext_server/server/python/environment_manager/__init__.py -------------------------------------------------------------------------------- /cnext_server/server/python/experiment_manager/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnextio/cnext/74a29f4a6cb5d5b1ed5bff9836dae7f80461be81/cnext_server/server/python/experiment_manager/__init__.py -------------------------------------------------------------------------------- /cnext_server/server/python/file_explorer/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnextio/cnext/74a29f4a6cb5d5b1ed5bff9836dae7f80461be81/cnext_server/server/python/file_explorer/__init__.py -------------------------------------------------------------------------------- /cnext_server/server/python/file_manager/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnextio/cnext/74a29f4a6cb5d5b1ed5bff9836dae7f80461be81/cnext_server/server/python/file_manager/__init__.py -------------------------------------------------------------------------------- /cnext_server/server/python/jupyter_server_manager/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnextio/cnext/74a29f4a6cb5d5b1ed5bff9836dae7f80461be81/cnext_server/server/python/jupyter_server_manager/__init__.py -------------------------------------------------------------------------------- /cnext_server/server/python/jupyter_server_manager/jupyter_server_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "ServerApp": { 3 | "allow_origin": "*" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /cnext_server/server/python/libs/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnextio/cnext/74a29f4a6cb5d5b1ed5bff9836dae7f80461be81/cnext_server/server/python/libs/__init__.py -------------------------------------------------------------------------------- /cnext_server/server/python/libs/config.py: -------------------------------------------------------------------------------- 1 | import yaml 2 | import traceback 3 | from libs import logs 4 | import simplejson as json 5 | 6 | log = logs.get_logger(__name__) 7 | yaml.emitter.Emitter.process_tag = lambda self, *args, **kw: None 8 | 9 | class Config: 10 | def __init__(self, **entries): 11 | self.__dict__.update(entries) 12 | 13 | def toJSON(self): 14 | return json.dumps(self, default=lambda o: o.__dict__, ignore_nan=True) 15 | 16 | def read_config(path, default = {}): 17 | try: 18 | config = yaml.safe_load(open(path, 'r')) 19 | log.info('Read config %s: %s'%(path, config)) 20 | return Config(**config); 21 | 22 | except Exception as error: 23 | log.error("No config file found. Return default config.") 24 | log.error("%s - %s" % (error, traceback.format_exc())) 25 | return Config(**default); 26 | 27 | def save_config(config, path, default = {}): 28 | try: 29 | # config = yaml.dump(open(path, 'r')) 30 | with open(path, 'w') as file: 31 | yaml.dump(config, file, default_flow_style=False) 32 | log.info('Save config %s: %s'%(path, config)) 33 | return True 34 | 35 | except Exception as error: 36 | log.error("No config file found. Return default config.") 37 | log.error("%s - %s" % (error, traceback.format_exc())) 38 | return Config(**default); 39 | -------------------------------------------------------------------------------- /cnext_server/server/python/libs/constants.py: -------------------------------------------------------------------------------- 1 | class TrackingModelType: 2 | PYTORCH_NN = "torch.nn.Module" 3 | TENSORFLOW_KERAS = "tensorflow.keras.Model" 4 | 5 | 6 | class TrackingDataframeType: 7 | PANDAS = "pandas.core.frame.DataFrame" 8 | CNEXT = "cnextlib.dataframe.DataFrame" 9 | DASK = "dask.dataframe.core.DataFrame" 10 | SPARK = "pyspark.pandas.frame.DataFrame" 11 | -------------------------------------------------------------------------------- /cnext_server/server/python/libs/json_serializable.py: -------------------------------------------------------------------------------- 1 | import simplejson as json 2 | 3 | 4 | class JsonSerializable: 5 | def __init__(self, obj): 6 | self.obj = obj 7 | 8 | def toJSON(self): 9 | return json.dumps(self.obj, ignore_nan=True) 10 | 11 | def __repr__(self) -> str: 12 | return self.toJSON() 13 | 14 | 15 | def ipython_internal_output(func): 16 | ''' 17 | Wrapper to return JsonSerializable instead of original object when return result inside ipython 18 | ''' 19 | def json_serializable_output(*args, **kwargs): 20 | output = func(*args, **kwargs) 21 | return JsonSerializable(output) 22 | return json_serializable_output 23 | -------------------------------------------------------------------------------- /cnext_server/server/python/libs/logs.py: -------------------------------------------------------------------------------- 1 | import logging 2 | 3 | logging.basicConfig(filename='./server.log', filemode='a', format='%(asctime)s,%(msecs)d %(name)s %(funcName)s %(levelname)s %(message)s', 4 | datefmt='%H:%M:%S', level=logging.DEBUG) 5 | logging.getLogger('asyncio').setLevel(logging.WARNING) 6 | logging.getLogger('matplotlib').setLevel(logging.WARNING) 7 | 8 | 9 | def get_logger(name): 10 | return logging.getLogger(name) 11 | -------------------------------------------------------------------------------- /cnext_server/server/python/logs_manager/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnextio/cnext/74a29f4a6cb5d5b1ed5bff9836dae7f80461be81/cnext_server/server/python/logs_manager/__init__.py -------------------------------------------------------------------------------- /cnext_server/server/python/model_manager/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnextio/cnext/74a29f4a6cb5d5b1ed5bff9836dae7f80461be81/cnext_server/server/python/model_manager/__init__.py -------------------------------------------------------------------------------- /cnext_server/server/python/model_manager/interfaces.py: -------------------------------------------------------------------------------- 1 | from libs.json_serializable import JsonSerializable 2 | 3 | class ModelInfo: 4 | def __init__(self, **entries): 5 | self.name = None 6 | self.id = None 7 | self.obj_class = None 8 | self.base_class = None 9 | self.__dict__.update(entries) 10 | 11 | class NetronStatus: 12 | OK = 'ok' 13 | ERROR = 'error' -------------------------------------------------------------------------------- /cnext_server/server/python/project_manager/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnextio/cnext/74a29f4a6cb5d5b1ed5bff9836dae7f80461be81/cnext_server/server/python/project_manager/__init__.py -------------------------------------------------------------------------------- /cnext_server/server/python/user_space/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnextio/cnext/74a29f4a6cb5d5b1ed5bff9836dae7f80461be81/cnext_server/server/python/user_space/__init__.py -------------------------------------------------------------------------------- /cnext_server/server/python/user_space/ipython/constants.py: -------------------------------------------------------------------------------- 1 | from enum import Enum 2 | 3 | from libs.json_serializable import JsonSerializable 4 | 5 | 6 | class IpythonResultMessage(JsonSerializable): 7 | def __init__(self, **entries): 8 | self.header = None 9 | self.msg_id = None 10 | self.msg_type = None 11 | self.parent_header = None 12 | self.metadata = None 13 | self.content = None 14 | self.buffers = None 15 | self.__dict__.update(entries) 16 | 17 | 18 | class IPythonConstants: 19 | class MessageType(str, Enum): 20 | EXECUTE_REPLY = 'execute_reply' 21 | INPUT_REQUEST = 'input_request' 22 | INSPECT_REPLY = 'inspect_reply' 23 | COMPLETE_REPLY = 'complete_reply' 24 | HISTORY_REPLY = 'history_reply' 25 | IS_COMPLETE_REPLY = 'is_complete_reply' 26 | CONNECT_REPLY = 'connect_reply' 27 | COMM_INFO_REPLY = 'comm_info_reply' 28 | KERNEL_INFO_REPLY = 'kernel_info_reply' 29 | SHUTDOWN_REPLY = 'shutdown_reply' 30 | INTERRUPT_REPLY = 'interrupt_reply' 31 | DEBUG_REPLY = 'debug_reply' 32 | DISPLAY_DATA = 'display_data' 33 | UPDATE_DISPLAY_DATA = 'update_display_data' 34 | EXECUTE_INPUT = 'execute_input' 35 | EXECUTE_RESULT = 'execute_result' 36 | STREAM = 'stream' 37 | ERROR = 'error' 38 | STATUS = 'status' 39 | CLEAR_OUTPUT = 'clear_output' 40 | DEBUG_EVENT = 'debug_event' 41 | INPUT_REPLY = 'input_reply' 42 | 43 | class StreamType(str, Enum): 44 | IOBUF = 'iobuf' 45 | SHELL = 'shell' 46 | STDIN = 'stdin' 47 | CONTROL = 'control' 48 | 49 | class ShellMessageStatus(str, Enum): 50 | OK = 'ok' 51 | ERROR = 'error' 52 | IDLE = 'idle' 53 | 54 | class IOBufMessageStatus(str, Enum): 55 | OK = 'ok' 56 | ERROR = 'error' 57 | ABORT = 'abort' 58 | 59 | class ExecutionState(str, Enum): 60 | STARTING = 'starting' 61 | BUSY = 'busy' 62 | IDLE = 'idle' 63 | 64 | 65 | class IPythonInteral(Enum): 66 | DF_MANAGER = '_df_manager' 67 | CASSIST = '_cassist' 68 | USER_SPACE = '_user_space' 69 | UDF_MODULE = '_udf' 70 | -------------------------------------------------------------------------------- /cnext_server/server/routes/index.js: -------------------------------------------------------------------------------- 1 | const express = require("express"); 2 | const router = express.Router(); 3 | 4 | router.get("/", (req, res) => { 5 | res.send({ response: "I am alive" }).status(200); 6 | }); 7 | 8 | module.exports = router; -------------------------------------------------------------------------------- /cnext_server/server/server.yaml: -------------------------------------------------------------------------------- 1 | p2n_comm: 2 | host: tcp://127.0.0.1 3 | port: 5000 4 | 5 | n2p_comm: 6 | host: tcp://127.0.0.1 7 | kernel_control_port: 5005 8 | 9 | path_to_cnextlib: '/Users/bachbui/works/cycai/cycdataframe' 10 | jupyter_server: 11 | port: 5008 12 | token: token123 13 | 14 | openai_api_key: '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' -------------------------------------------------------------------------------- /cnext_server/server/start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "start our services" 4 | source `poetry env info --path`/bin/activate 5 | npm start -------------------------------------------------------------------------------- /cnext_server/server/test.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | print("conda python print") -------------------------------------------------------------------------------- /cnext_server/server/tests/stack_trace.py: -------------------------------------------------------------------------------- 1 | import traceback, sys 2 | 3 | try: 4 | eval('d = long_df') 5 | except: 6 | traceback.print_exc() 7 | print(sys.exc_info()) 8 | 9 | try: 10 | eval('long_df_') 11 | except: 12 | traceback.print_exc() 13 | print(sys.exc_info()) -------------------------------------------------------------------------------- /cnext_server/server/tests/test_globals.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | 3 | df = pd.DataFrame() -------------------------------------------------------------------------------- /cnext_server/server/tests/test_plotly.py: -------------------------------------------------------------------------------- 1 | import cnextlib.dataframe as cd 2 | import plotly.express as px 3 | import plotly.io as pio 4 | import io 5 | import sys 6 | import os 7 | os.chdir('/Volumes/GoogleDrive/.shortcut-targets-by-id/1FrvaCWSo3NV1g0sR9ib6frv_lzRww_8K/CycAI/works/CAT/machine_simulation/') 8 | sys.path.append(os.getcwd()) 9 | training_data = cd.DataFrame('data/exp_data/997/21549286_out.csv') 10 | df = training_data 11 | 12 | 13 | def test_a_simple_line_graph(): 14 | # pio.renderers.default = "json" 15 | fig = px.line(df, x=df.index, y='Fuel Rail Pressure', title="Machine") 16 | fig.show() 17 | 18 | 19 | def px_original_test(): 20 | # pio.renderers.default = "json" 21 | long_df = px.data.medals_long() 22 | fig = px.bar(long_df, x="nation", y="count", 23 | color="medal", title="Long-Form Input") 24 | normal_stdout = sys.stdout 25 | sys.stdout = io.StringIO() 26 | fig.show() 27 | sys.stdout = normal_stdout 28 | 29 | 30 | def test_histogram(): 31 | # pio.renderers.default = "json" 32 | fig = eval("px.histogram(df, x='Fuel Rail Pressure')") 33 | print(type(fig)) 34 | # fig.show() 35 | 36 | # test_histogram() 37 | -------------------------------------------------------------------------------- /cnext_server/server/tests/test_servers/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "server", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "start": "node server.js", 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "dependencies": { 10 | "express": "^4.17.1", 11 | "python-shell": "^3.0.1", 12 | "socket.io": "^4.5.3", 13 | "socket.io-client": "^4.5.3" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /cnext_server/server/tests/test_servers/server.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Communicate with python server 3 | */ 4 | let {PythonShell} = require('python-shell'); 5 | let pyshell = new PythonShell('server.py', { mode: 'json'}); 6 | 7 | // processing outputs from python server 8 | pyshell.on('message', function (message) { 9 | console.log('stdout:', message); 10 | }); 11 | 12 | pyshell.on('stderr', function (message) { 13 | console.log('stderr:', message); 14 | }); 15 | 16 | pyshell.on('error', function (message) { 17 | console.log('error ', message); 18 | }) 19 | 20 | pyshell.on('close', function (message) { 21 | console.log('close ', message); 22 | }) 23 | 24 | /*********************************************************************/ 25 | 26 | pyshell.send({command: "print('Hello')"}); 27 | // pyshell.send({command: "failed command"}); 28 | // pyshell.send({command: "print('Hello')"}); -------------------------------------------------------------------------------- /cnext_server/server/tests/test_servers/server.py: -------------------------------------------------------------------------------- 1 | import sys, logging, json, io 2 | import pandas 3 | 4 | logging.basicConfig(filename='./log.txt', filemode='a', format='%(asctime)s,%(msecs)d %(name)s %(levelname)s %(message)s', 5 | datefmt='%H:%M:%S', level=logging.DEBUG) 6 | log = logging.getLogger(__name__) 7 | 8 | while True: 9 | for line in sys.stdin: 10 | try: 11 | req = json.loads(line) 12 | log.info(req) 13 | exec(req['command']) 14 | except: 15 | import traceback 16 | log.error(traceback.format_exc()) 17 | # print(json.dumps({"commandType": req['command_type'], "contentType": "str", "content": traceback.format_exc(), "error": True})) 18 | traceback.print_exc(); 19 | sys.stdout.flush() 20 | 21 | -------------------------------------------------------------------------------- /cnext_server/server/tests/test_servers/test_pyshell.js: -------------------------------------------------------------------------------- 1 | let {PythonShell} = require('python-shell'); 2 | let pyshell = new PythonShell('../server.py', { mode: 'text'}); 3 | 4 | console.log("Starting..."); 5 | 6 | pyshell.on('message', function (message) { 7 | console.log('message:', message); 8 | }); 9 | 10 | pyshell.on('stderr', function (stderr) { 11 | console.log('stderr:', stderr); 12 | }); 13 | 14 | console.log("Sending msg..."); 15 | pyshell.send('print("hello world!")\n'); -------------------------------------------------------------------------------- /cnext_server/workspace.yaml: -------------------------------------------------------------------------------- 1 | active_project: 2d034f3a-5f07-11ed-a41f-0a54423a117d 2 | open_projects: 3 | - id: 2d034f3a-5f07-11ed-a41f-0a54423a117d 4 | name: Skywalker 5 | path: /Users/bachbui/works/cycai/cnext_sample_projects/Skywalker 6 | - id: 78cc9146-610b-11ed-949c-0a54423a117d 7 | name: gpt3-q&a 8 | path: /Users/bachbui/works/cycai/cnext_sample_projects/gpt3-q&a 9 | -------------------------------------------------------------------------------- /docker-compose.prod.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | 3 | services: 4 | web: 5 | # image: ${IMAGE_NAME}:${IMAGE_TAG} 6 | build: . 7 | container_name: web 8 | working_dir: /app/cnext_app 9 | ports: 10 | - ${CLIENT_PORT}:3000 11 | command: npm start 12 | 13 | server: 14 | # image: ${IMAGE_NAME}:${IMAGE_TAG} 15 | build: . 16 | container_name: server 17 | working_dir: /app/cnext_server/server 18 | volumes: 19 | - ${SOURCE_PROJECT_DIR}:/app/cnext_server/server/cnext_sample_projects/Skywalker 20 | ports: 21 | - ${SERVER_PORT}:4000 22 | command: /bin/sh -c "./start.sh" -------------------------------------------------------------------------------- /docker-compose.test.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | 3 | services: 4 | sut: 5 | build: 6 | context: . 7 | dockerfile: Dockerfile-poetry -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | 3 | services: 4 | server: 5 | build: 6 | context: ./cnext_server/server 7 | dockerfile: Dockerfile 8 | 9 | container_name: server 10 | ports: 11 | - 4000:4000 12 | 13 | web: 14 | build: 15 | context: ./cnext_app 16 | dockerfile: Dockerfile 17 | 18 | container_name: web 19 | depends_on: 20 | - server 21 | ports: 22 | - 3000:3000 23 | 24 | cypress: 25 | image: cypress 26 | build: ./cnext_app/tests/intergration 27 | container_name: cypress 28 | depends_on: 29 | - web 30 | - server 31 | environment: 32 | - CYPRESS_baseUrl=http://web:3000 33 | command: npx cypress run --record --key 5a02471d-2779-4256-bd4b-58ec1efa6929 34 | volumes: 35 | - ./cnext_app/tests/intergration/cypress:/app/cypress 36 | - ./cnext_app/tests/intergration/cypress.json:/app/cypress.json 37 | -------------------------------------------------------------------------------- /docker/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | exec "$@" 5 | -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cnext_app", 3 | "lockfileVersion": 2, 4 | "requires": true, 5 | "packages": {} 6 | } 7 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.poetry] 2 | name = "cnext" 3 | version = "0.11.6" 4 | description = "The data-centric workspace for AI & DS" 5 | authors = ["CycAI Inc"] 6 | license = "MIT" 7 | 8 | readme = "README.md" # Markdown files are supported 9 | 10 | homepage = "https://cyc-ai.com/" 11 | 12 | packages = [ 13 | { include = "cnext_server" }, 14 | ] 15 | 16 | include = ["cnext_server/public/**/*"] 17 | 18 | exclude = [ 19 | "cnext_app/tsconfig.json", 20 | "cnext_app/README.md", 21 | "cnext_app/Dockerfile", 22 | "cnext_app/Dockerfile-poetry", 23 | "cnext_app/.dockerignore", 24 | "cnext_app/server/Dockerfile", 25 | "cnext_app/server/Dockerfile-conda", 26 | "cnext_app/server/.dockerignore", 27 | ] 28 | 29 | [tool.poetry.scripts] 30 | cnext = "cnext_server.__main__:main" 31 | 32 | [tool.poetry.dependencies] 33 | python = ">=3.9" 34 | plotly = "~5.7.0" 35 | simplejson = "^3.17.6" 36 | requests = "^2.27.1" 37 | mlflow = "^1.30.0" 38 | pyzmq = "^23.2.0" 39 | pyyaml = "^5.1" 40 | send2trash = "^1.8.0" 41 | jupyter-client = "~7.4.5" 42 | jupyterlab = "~3.4.0" 43 | matplotlib = "~3.5.1" 44 | pandas = "~1.3.5" 45 | multipledispatch = "^0.6.0" 46 | python-language-server = "^0.36.2" 47 | cnextlib = "^0.7.0" 48 | netron = "^6.0.0" 49 | sentry-sdk = "^1.5.12" 50 | protobuf = "3.20.1" 51 | pyreadline = "^2.1" 52 | jupyter-resource-usage = "^0.6.1" 53 | matplotlib-inline = "^0.1.6" 54 | 55 | [tool.poetry.dev-dependencies] 56 | 57 | [build-system] 58 | requires = ["poetry-core>=1.0.0"] 59 | build-backend = "poetry.core.masonry.api" --------------------------------------------------------------------------------