Skip to content

Commit

Permalink
✨ v1.3.3 Added params editor to UI, fixed broken packages, +more (#80)
Browse files Browse the repository at this point in the history
* Change mutable default argument to `None`.

* Set to empty list if `keys` is `None`.

* Return if the given config is not a dictionary.

* Ensure `parsed_config` is a dictionary.

* Bump to version 1.3.2

* Adding parameter editing to dashboard

* v1.3.3 Added params editor, fixed broken packages, and more.

* Bump sqlalchemy version
  • Loading branch information
bmeares authored Oct 17, 2022
1 parent bf67786 commit 3ab167c
Show file tree
Hide file tree
Showing 18 changed files with 473 additions and 121 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,27 @@

This is the current release cycle, so stay tuned for future releases!

### v1.3.2 – 1.3.3

- **Fixed a bug with `begin` and `end` bounds in `Pipe.get_data()`.**
A safety measure was incorrectly checking if the quoted version of a column was in `pipe.get_columns_types()`, not the unquoted version. This patch restores functionality for `pipe.get_data()`.
- **Fixed an issue with an upgraded version of `SQLAlchemy`.**
- **Added a parameters editor the Web UI.**
You may now edit your pipes' parameters in the browser through the Web UI!
- **Added a SQL query editor to the Web UI.**
Like the parameters editor, you can edit your pipes' SQL queries in the browser.
- **Added a Sync Documents option to the Web UI.**
You can directly sync documents into pipes on the Web UI.
- **Added the arguments `order`, `limit`, `begin_add_minutes`, and `end_add_minutes` to `Pipe.get_data()`.**
These new arguments will give you finer control over the data selection behavior.
- **Enforce consistent ordering of indices in `Pipe.get_data()`.**
- **Allow syncing JSON-encoded strings.**
This patch allows pipes to sync JSON strings without first needing them to be deserialized.
- **Fixed an environment error with Ubuntu 18.04.**
- **Bumped `duckdb` and `duckdb-engine`.**
- **Added a basic CLI for `duckdb`.**
This will probably be replaced later down the line.

### v1.3.1

- **Fixed data type enforcement issues.**
Expand Down
21 changes: 21 additions & 0 deletions docs/mkdocs/news/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,27 @@

This is the current release cycle, so stay tuned for future releases!

### v1.3.2 – 1.3.3

- **Fixed a bug with `begin` and `end` bounds in `Pipe.get_data()`.**
A safety measure was incorrectly checking if the quoted version of a column was in `pipe.get_columns_types()`, not the unquoted version. This patch restores functionality for `pipe.get_data()`.
- **Fixed an issue with an upgraded version of `SQLAlchemy`.**
- **Added a parameters editor the Web UI.**
You may now edit your pipes' parameters in the browser through the Web UI!
- **Added a SQL query editor to the Web UI.**
Like the parameters editor, you can edit your pipes' SQL queries in the browser.
- **Added a Sync Documents option to the Web UI.**
You can directly sync documents into pipes on the Web UI.
- **Added the arguments `order`, `limit`, `begin_add_minutes`, and `end_add_minutes` to `Pipe.get_data()`.**
These new arguments will give you finer control over the data selection behavior.
- **Enforce consistent ordering of indices in `Pipe.get_data()`.**
- **Allow syncing JSON-encoded strings.**
This patch allows pipes to sync JSON strings without first needing them to be deserialized.
- **Fixed an environment error with Ubuntu 18.04.**
- **Bumped `duckdb` and `duckdb-engine`.**
- **Added a basic CLI for `duckdb`.**
This will probably be replaced later down the line.

### v1.3.1

- **Fixed data type enforcement issues.**
Expand Down
97 changes: 91 additions & 6 deletions meerschaum/api/dash/callbacks/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
)
from meerschaum.actions import get_subactions, actions
from meerschaum.actions.arguments._parser import get_arguments_triggers, parser
from meerschaum.connectors.sql._fetch import set_pipe_query
import meerschaum as mrsm
import json
dash = attempt_import('dash', lazy=False, check_update=CHECK_UPDATE)
Expand Down Expand Up @@ -92,9 +93,6 @@
'login',
'copy',
}
trigger_aliases = {
'keyboard' : 'go-button',
}
_paths = {
'login' : pages.login.layout,
'' : pages.dashboard.layout,
Expand Down Expand Up @@ -148,7 +146,6 @@ def update_page_layout_div(pathname : str, session_store_data : Dict[str, Any]):
Output('success-alert-div', 'children'),
Output('check-input-interval', 'disabled'),
Output('ws', 'url'),
Input('keyboard', 'n_keydowns'),
Input('go-button', 'n_clicks'),
Input('cancel-button', 'n_clicks'),
Input('get-pipes-button', 'n_clicks'),
Expand All @@ -157,7 +154,6 @@ def update_page_layout_div(pathname : str, session_store_data : Dict[str, Any]):
Input('get-users-button', 'n_clicks'),
Input('get-graphs-button', 'n_clicks'),
Input('check-input-interval', 'n_intervals'),
State('keyboard', 'keydown'),
State('location', 'href'),
State('ws', 'url'),
State('session-store', 'data'),
Expand Down Expand Up @@ -203,7 +199,6 @@ def update_content(*args):
if len(ctx.triggered) > 1 and 'check-input-interval.n_intervals' in ctx.triggered:
ctx.triggered.remove('check-input-interval.n_intervals')
trigger = ctx.triggered[0]['prop_id'].split('.')[0]
trigger = trigger_aliases[trigger] if trigger in trigger_aliases else trigger

check_input_interval_disabled = ctx.states['check-input-interval.disabled']
enable_check_input_interval = (
Expand Down Expand Up @@ -557,3 +552,93 @@ def update_pipe_accordion(item):
return accordion_items_from_pipe(pipe, active_items=[item])


@dash_app.callback(
Output({'type': 'update-parameters-success-div', 'index': MATCH}, 'children'),
Input({'type': 'update-parameters-button', 'index': MATCH}, 'n_clicks'),
State({'type': 'parameters-editor', 'index': MATCH}, 'value')
)
def update_pipe_parameters_click(n_clicks, parameters_editor_text):
if not n_clicks:
raise PreventUpdate
ctx = dash.callback_context
triggered = dash.callback_context.triggered
if triggered[0]['value'] is None:
raise PreventUpdate
pipe = pipe_from_ctx(triggered, 'n_clicks')
if pipe is None:
raise PreventUpdate

if parameters_editor_text is None:
success, msg = False, f"Unable to update parameters for {pipe}."
else:
try:
params = json.loads(parameters_editor_text)
pipe.parameters = params
success, msg = pipe.edit(debug=debug)
except Exception as e:
success, msg = False, f"Invalid JSON:\n{e}"

return alert_from_success_tuple((success, msg))


@dash_app.callback(
Output({'type': 'update-sql-success-div', 'index': MATCH}, 'children'),
Input({'type': 'update-sql-button', 'index': MATCH}, 'n_clicks'),
State({'type': 'sql-editor', 'index': MATCH}, 'value')
)
def update_pipe_sql_click(n_clicks, sql_editor_text):
if not n_clicks:
raise PreventUpdate
ctx = dash.callback_context
triggered = dash.callback_context.triggered
if triggered[0]['value'] is None:
raise PreventUpdate
pipe = pipe_from_ctx(triggered, 'n_clicks')
if pipe is None:
raise PreventUpdate

if sql_editor_text is None:
success, msg = False, f"Unable to update SQL definition for {pipe}."
else:
try:
set_pipe_query(pipe, sql_editor_text)
success, msg = pipe.edit(debug=debug)
except Exception as e:
success, msg = False, f"Invalid SQL query:\n{e}"

return alert_from_success_tuple((success, msg))


@dash_app.callback(
Output({'type': 'sync-success-div', 'index': MATCH}, 'children'),
Input({'type': 'update-sync-button', 'index': MATCH}, 'n_clicks'),
State({'type': 'sync-editor', 'index': MATCH}, 'value')
)
def sync_documents_click(n_clicks, sync_editor_text):
if not n_clicks:
raise PreventUpdate
ctx = dash.callback_context
triggered = dash.callback_context.triggered
if triggered[0]['value'] is None:
raise PreventUpdate
pipe = pipe_from_ctx(triggered, 'n_clicks')
if pipe is None:
raise PreventUpdate

try:
msg = '... '
docs = json.loads(sync_editor_text)
except Exception as e:
docs = None
msg = str(e)
if docs is None:
success, msg = False, (msg + f"Unable to sync documents to {pipe}.")
else:
try:
success, msg = pipe.sync(docs, debug=debug)
except Exception as e:
import traceback
traceback.print_exc()
success, msg = False, f"Encountered exception:\n{e}"

return alert_from_success_tuple((success, msg))
3 changes: 1 addition & 2 deletions meerschaum/api/dash/pages/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
daq = attempt_import('dash_daq', warn=False, check_update=CHECK_UPDATE)

from meerschaum.api.dash.components import (
go_button, search_parameters_editor, keyboard, websocket, test_button,
go_button, search_parameters_editor, websocket, test_button,
get_items_menu, bottom_buttons_content, console_div, download_dataframe, navbar,
)
from meerschaum.api.dash.keys import (
Expand All @@ -31,7 +31,6 @@
children = [
websocket,
keys_lists_content,
keyboard,
download_dataframe,
dcc.Interval(
id = 'check-input-interval',
Expand Down
Loading

0 comments on commit 3ab167c

Please sign in to comment.