Skip to content

Commit

Permalink
UI deploy tool (#62)
Browse files Browse the repository at this point in the history
* Added `dashtools gui` render.com deploy page
  • Loading branch information
andrew-hossack committed Oct 17, 2022
1 parent 04912b3 commit 9b64e3a
Show file tree
Hide file tree
Showing 34 changed files with 1,325 additions and 186 deletions.
7 changes: 5 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ global-include *.json
global-include *.include
global-include *.html
global-include *.ini
global-include *.ico
global-include *.css
global-include *.csv
global-include *.eot
global-include *.tff
global-include *.woff
global-include *.png
global-include *.woff2
global-include *.sh
global-include requirements.txt
Expand All @@ -19,5 +21,6 @@ global-include *.js
global-include *.ts
global-include *.template
global-include packages.txt
graft dash_tools/templating/templates
global-exclude docs/*
graft dashtools/dashboard/*
global-exclude docs/*
global include dashtools/assets/*
21 changes: 19 additions & 2 deletions dashtools/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import webbrowser

from dashtools.cli import update
from dashtools.dashboard import dashboard
from dashtools.deploy import deployHeroku
from dashtools.docker import dockerUtils
from dashtools.runtime import runtimeUtils
Expand All @@ -22,13 +23,15 @@ class MyArgumentParser(argparse.ArgumentParser):
def print_help(self, file=None):
if file is None:
file = _sys.stdout
message = f"""The dashtools v{__version__} CLI for Plotly Dash. See https://github.com/andrew-hossack/dash-tools for more details.
message = f"""The dashtools v{__version__} CLI for Plotly Dash. See https://dash-tools.readthedocs.io/ for more details.
\nUsage:
{'dashtools <command> [options]':<29}
\nCommands and Options:
{'docker':<29}Handle Docker creation. Choose option:
{'--init <image name>':<25}Creates a docker image in current directory
{'gui':<29}Starts the DashTools UI.
{'heroku':<29}Handle Heroku deployment. Choose option:
{'--deploy':<25}Deploys the current project to Heroku
{'--update [remote name]':<25}Push changes to existing Heroku remote
Expand Down Expand Up @@ -119,6 +122,20 @@ def docker(args):
exit('dashtools: Available docker options: --init [--dir, -d]')


@ subcommand(
[
argument(
"gui",
help='Starts the deploy UI.',
action='store_true',
default=False
),
])
def gui(args):
"""Initialize a new app."""
dashboard.start_dashboard(debug=True)


@ subcommand(
[
argument(
Expand Down Expand Up @@ -162,14 +179,14 @@ def init(args):
])
def templates(args):
if args.list:
print('dashtools: View templates at https://dash-tools.readthedocs.io/en/latest/commands/templates/index.html')
print('dashtools: Templates usage example, type: dashtools init MyApp csv')
print('dashtools: templates: List of available templates:')
buildAppUtils.print_templates()
elif args.init:
createTemplate.create_template(src=args.init[0], dest=os.getcwd())
else:
print('dashtools: templates error: too few arguments')
print('dashtools: For more information on templates, see https://github.com/andrew-hossack/dash-tools#templates')
exit('dashtools: Available templates options: --list, --init')


Expand Down
3 changes: 3 additions & 0 deletions dashtools/dashboard/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Dashtools Dashboard

Makes it easy for non CLI users to spin up the `dashtools gui` UI to deploy their dash apps.
Empty file added dashtools/dashboard/__init__.py
Empty file.
61 changes: 61 additions & 0 deletions dashtools/dashboard/alerts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import dash_mantine_components as dmc
from dash_iconify import DashIconify

# NOTIFICATION_DURATION_SECONDS = 8


def render(key: str):
if key == 'FileNotFoundError':
return dmc.Notification(
message="The file path you provided does not exist. Please check your filepath and try again.",
title="Warning",
color='red',
icon=[DashIconify(icon="ep:warning")],
action='show',
id='error-file-not-found'
)
elif key == 'PermissionError':
return dmc.Notification(
message="You do not have sufficient permission to access that file!",
title="Warning",
color='red',
icon=[DashIconify(icon="ep:warning")],
action='show',
id='error-permissions'
)
elif key == 'FileRequiredError':
return dmc.Notification(
message="You must have an Open File in File Explorer to do this action!",
title="Warning",
color='red',
icon=[DashIconify(icon="ep:warning")],
action='show',
id='error-permissions'
)
elif key == 'NameRequiredError':
return dmc.Notification(
message="A Render App Name is required to do this action!",
title="Warning",
color='red',
icon=[DashIconify(icon="ep:warning")],
action='show',
id='error-permissions'
)
elif key == 'GitNotInstalledError':
return dmc.Notification(
message="Git must be installed on your system to deploy to Render.com!",
title="Warning",
color='red',
icon=[DashIconify(icon="ep:warning")],
action='show',
id='error-permissions'
)
elif key == 'NotGitRepoError':
return dmc.Notification(
message="You must publish your project to Git before continuing!",
title="Warning",
color='red',
icon=[DashIconify(icon="ep:warning")],
action='show',
id='error-permissions'
)
Binary file added dashtools/dashboard/assets/_favicon.ico
Binary file not shown.
6 changes: 6 additions & 0 deletions dashtools/dashboard/assets/code.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
code {
color: black;
background:rgba(248, 249, 250, 0.65);
padding: .1rem .3rem .2rem;
border-radius: .2rem;
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions dashtools/dashboard/assets/logo.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

.dashtools-logo {
-webkit-font-smoothing: antialiased;
font-family: Inter, sans-serif;
-webkit-tap-highlight-color: transparent;
/* color: rgb(73, 80, 87); */
font-size: 50px;
line-height: 1.55;
text-decoration: none;
}
Binary file added dashtools/dashboard/assets/logo_bk.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dashtools/dashboard/assets/logo_bk_small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dashtools/dashboard/assets/logo_w.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dashtools/dashboard/assets/logo_w_small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 9b64e3a

Please sign in to comment.