Skip to content

Commit

Permalink
Version 1.10.3 (#69)
Browse files Browse the repository at this point in the history
* Added create page framework

* fixed relative imports

* fixed relative imports

* Add git remote url input (#68)

* Updated git remote check for windows

* Added os dependent spacer

* Removed spacer

* Added favicon

* remove unused import

* Added construction page

* Version 1.10.3

* Updated docs
  • Loading branch information
andrew-hossack authored Oct 30, 2022
1 parent 60a4f3a commit 99b14a8
Show file tree
Hide file tree
Showing 19 changed files with 438 additions and 176 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ temp/

*.egg-info/
/build/
docs/build/
.env
__pycache__

Expand Down
6 changes: 6 additions & 0 deletions docs/source/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

All notable changes to this project will be documented in this file.

## [1.10.3] - 2022-10-30

### Fixed

- Fixed bug with running os commands on windows; thanks [@Coding-with-Adam](https://github.com/Coding-with-Adam) for support!

## [1.10.2] - 2022-10-26

### Fixed
Expand Down
10 changes: 10 additions & 0 deletions docs/source/commands/gui/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
=======
gui
=======

The ``gui`` command is used to start the DashTools UI at http://127.0.0.1:8050/

Usage
========

``dashtools gui``
1 change: 1 addition & 0 deletions docs/source/commands/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Commands
:maxdepth: 2

docker/index
gui/index
heroku/index
init/index
run/index
Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -- Project information

__version__ = '1.10.2'
__version__ = '1.10.3'

project = 'DashTools'
author = 'Andrew Hossack'
Expand Down
23 changes: 13 additions & 10 deletions docs/source/getting started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ Prerequisites
----------------------------

- **Git CLI** - `Download Here <https://git-scm.com/downloads>`_
- **Heroku CLI** - `Download Here <https://devcenter.heroku.com/articles/heroku-cli#install-the-heroku-cli>`_
- **OS** - Linux, MacOS, Windows
- **Python Version** ≥ 3.6

- **[OPTIONAL] Heroku CLI** - `Download Here <https://devcenter.heroku.com/articles/heroku-cli#install-the-heroku-cli>`_

PyPI
-------
Expand All @@ -30,7 +30,7 @@ Using dash-tools is similar to other popular command line clients for creating a
.. note::
Some Windows users may need to run dashtools with ``.\dashtools`` in the following examples.


|
Creating a Project
**********************

Expand All @@ -40,27 +40,30 @@ Creating a new dash project is simple. Here we choose to name it "MyApp". Doing
dashtools init MyApp
|
Deploying a Project
**********************

You can deploy any project containing a src/app.py file that is published to a GitHub Public repository. Run the DashTools Render GUI for a seamless experience.


You can deploy your application to Render.com with the easy to use UI. You can deploy any project containing a src/app.py file! Running the following command will start the dashtools gui at http://127.0.0.1:8050/

.. code-block:: bash
dashtools gui
Running the following command will create Procfile, requirements.txt, and runtime.txt if they are not found. Follow the on-screen prompts to complete the deployment to Heroku.

Update: Heroku is not supporting free-tier hosting anymore. Check out Render.com for a great alternative!

You can deploy any project containing an app.py file. Running the following command will create Procfile, requirements.txt, and runtime.txt if they are not found. Follow the on-screen prompts to complete the deployment to Heroku.
.. note::
Heroku has stopped supporting free-tier hosting on their platform. Check out Render.com for a great alternative!

.. code-block:: bash
dashtools heroku --deploy
Updating a deployed Project
|
Updating a Deployed Project on Heroku
************************************

Updating a deployed project is as easy as pushing changes to the remote Heroku repository. Using the following command from the project root will update the remote 'heroku' repository and restart the application.
Expand All @@ -69,7 +72,7 @@ Updating a deployed project is as easy as pushing changes to the remote Heroku r
dashtools heroku --update
|
Running a Project
**********************

Expand All @@ -79,7 +82,7 @@ Running the app.py file is as simple as running the following command from the p
dashtools run
|
Dockerizing a Project
**********************

Expand Down
Binary file removed src/dashtools/dashboard/assets/_favicon.ico
Binary file not shown.
Binary file added src/dashtools/dashboard/assets/favicon.ico
Binary file not shown.
Empty file.
41 changes: 41 additions & 0 deletions src/dashtools/dashboard/callbacks/createPage_callbacks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
'''
# @ Author: Andrew Hossack
# @ Create Time: 2022-10-23 14:52:57
'''


from dash import Dash, Input, Output, State, no_update, ctx, html
try:
from dashtools.dashboard.pages import createPage
except ModuleNotFoundError:
from ..pages import createPage


def generate_callbacks(app: Dash):
@ app.callback(
[
Output('create-terminal', 'value'),
Output('create-terminal-runjs', 'run'),
],
Input('create-terminal-refresh-interval', 'n_intervals'),
State('create-terminal', 'value'),
)
def update_terminal(n, current_value):
logCMD = '''
var textarea = document.getElementById('create-terminal');
textarea.scrollTop = textarea.scrollHeight;
'''
new_value = createPage.terminal.read()
if current_value != new_value:
return new_value, logCMD
return no_update, ""

@app.callback(
Output('create-terminal-hidden-div', 'children'),
Input('create-terminal-clear-button', 'n_clicks')
)
def deploy_button(clear_terminal):
button_clicked = ctx.triggered_id
if button_clicked == 'create-terminal-clear-button' and clear_terminal:
createPage.terminal.clear()
return html.Div()
Original file line number Diff line number Diff line change
@@ -1,37 +1,24 @@
import os
import time

import dash_mantine_components as dmc
from dash import Dash, Input, Output, State, ctx, dcc, html, no_update
import time

try:
import alerts
import tree
from pages import createPage, deployPage, errorPage, infoPage
from dashtools.dashboard.pages import deployPage
except ModuleNotFoundError:
from .pages import createPage, deployPage, errorPage, infoPage
from . import tree
from . import alerts
from .pages import deployPage
from .. import tree
from .. import alerts
from ..pages import deployPage

from dash_iconify import DashIconify
from dashtools.deploy import fileUtils, gitUtils, herokuUtils


def generate_callbacks(app: Dash):

@app.callback(Output("page-content", "children"), [Input("url", "pathname")])
def render_page_content(pathname):
# Clear data
if pathname == "/deploy" or pathname == '/':
deployPage.terminal.clear()
return deployPage.render()
elif pathname == "/info":
return infoPage.render()
elif pathname == "/create":
return createPage.render()
else:
return errorPage.render()

@app.callback(
Output('hidden-div', 'children'),
Input('app-control-deploy-button', 'n_clicks'),
Expand Down
29 changes: 29 additions & 0 deletions src/dashtools/dashboard/callbacks/router.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
'''
# @ Author: Andrew Hossack
# @ Create Time: 2022-10-23 14:52:57
'''

from dash import Dash, Input, Output, dcc

try:
from dashtools.dashboard.pages import createPage, deployPage, errorPage, infoPage
except ModuleNotFoundError:
from dashtools.dashboard.pages import createPage, deployPage, errorPage, infoPage


def generate_callbacks(app: Dash):
@app.callback(Output("page-content", "children"), [Input("url", "pathname")])
def render_page_content(pathname):
if pathname == '/':
# Setup url redirect to default page
return dcc.Location(id="url", pathname='/deploy')
elif pathname == "/deploy":
deployPage.terminal.clear()
return deployPage.render()
elif pathname == "/info":
return infoPage.render()
elif pathname == "/create":
createPage.terminal.clear()
return createPage.render()
else:
return errorPage.render()
Empty file.
100 changes: 100 additions & 0 deletions src/dashtools/dashboard/components/sidebar.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
from dash import html
import dash_mantine_components as dmc
import dash_bootstrap_components as dbc
from dash_iconify import DashIconify
from dashtools import version


def render() -> html.Div:
return html.Div(
[
html.Div(id='hidden-div'),
dmc.Center([
DashIconify(icon='heroicons:command-line-20-solid',
height=60, style={'margin-bottom': '8px', 'margin-right': '5px'}),
html.H2("DashTools", className='dashtools-logo'),
]),
dmc.Space(h=1, style={'margin-top': '-20px'}),
html.H6(
"Application Management Dashboard",
style={'font-weight': 'inherit', 'font-size': '14px'}
),


dbc.Nav(
[
dbc.NavLink(
[
DashIconify(icon='akar-icons:plus',
style={'margin-right': '5px'}),
"Create"
], href="/create", active="exact"),
dbc.NavLink(
[
DashIconify(icon='akar-icons:cloud',
style={'margin-right': '5px'}),
"Deploy"
], href="/deploy", active="exact"),
# dbc.NavLink( # TODO
# [
# DashIconify(icon='akar-icons:info',
# style={'margin-right': '5px'}),
# "Info"
# ], href="/info", active="exact"),
],
vertical=True,
pills=True,
),

dmc.Space(style={'height': '460px'}),
html.Hr(),
html.Div([
html.H6(
[
html.A(
[
DashIconify(
icon='logos:pypi',
width=20,
style={'margin-right': '10px'}),
f'PyPi v{version.__version__}',
],
href="https://pypi.org/project/dash-tools/", target='_blank', style={'text-decoration': 'none', 'color': 'black', 'font-weight': 'lighter'}),
]),
html.H6(
[
html.A(
[
DashIconify(
icon='file-icons:readthedocs',
width=15,
style={'margin-right': '10px', 'margin-left': '5px'}),
f'Read the Docs',
],
href="https://dash-tools.readthedocs.io/en/latest/index.html", target='_blank', style={'text-decoration': 'none', 'color': 'black', 'font-weight': 'lighter'}),
]),
html.H6(
[
html.A(
[
DashIconify(
icon='ant-design:github-filled',
width=20,
style={'margin-right': '8px', 'margin-left': '2px'}),
f'GitHub',
],
href="https://github.com/andrew-hossack/dash-tools", target='_blank', style={'text-decoration': 'none', 'color': 'black', 'font-weight': 'lighter'}),
]),
]),
],
style={
"position": "fixed",
"top": 0,
"left": 0,
"bottom": 0,
"width": "20rem",
"padding": "2rem 1rem",
"background-color": "#f8f9fa",
},

)
Loading

0 comments on commit 99b14a8

Please sign in to comment.