Skip to content

Commit

Permalink
⏪️ v2.7.2 Revert the stored instance session changes to fix the Web C…
Browse files Browse the repository at this point in the history
…onsole dropdowns.
  • Loading branch information
bmeares committed Dec 28, 2024
1 parent 67bbbf1 commit 60e985a
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 27 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

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

### v2.7.0 – v2.7.1
### v2.7.0 – v2.7.2

- **Introduce the `bytes` data type.**
Instance connectors which support binary data (e.g. `SQLConnector`) may now take advantage of the `bytes` dtype. Other connectors (e.g. `ValkeyConnector`) may use `meerschaum.utils.dtypes.serialize_bytes()` to store binary data as a base64-encoded string.
Expand Down Expand Up @@ -97,6 +97,9 @@ This is the current release cycle, so stay tuned for future releases!
- **Store `numeric` as `TEXT` for SQLite and DuckDB.**
Due to limited precision, `numeric` columns are now stored as `TEXT`, then parsed into `Decimal` objects upon retrieval.

- **Show the Webterm by default when changing instances.**
On the Web Console, changing the instance select will make the Webterm visible.

- **Improve dtype inference.**

## 2.6.x Releases
Expand Down
5 changes: 4 additions & 1 deletion docs/mkdocs/news/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

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

### v2.7.0 – v2.7.1
### v2.7.0 – v2.7.2

- **Introduce the `bytes` data type.**
Instance connectors which support binary data (e.g. `SQLConnector`) may now take advantage of the `bytes` dtype. Other connectors (e.g. `ValkeyConnector`) may use `meerschaum.utils.dtypes.serialize_bytes()` to store binary data as a base64-encoded string.
Expand Down Expand Up @@ -97,6 +97,9 @@ This is the current release cycle, so stay tuned for future releases!
- **Store `numeric` as `TEXT` for SQLite and DuckDB.**
Due to limited precision, `numeric` columns are now stored as `TEXT`, then parsed into `Decimal` objects upon retrieval.

- **Show the Webterm by default when changing instances.**
On the Web Console, changing the instance select will make the Webterm visible.

- **Improve dtype inference.**

## 2.6.x Releases
Expand Down
1 change: 0 additions & 1 deletion meerschaum/api/dash/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
dash_app.layout = html.Div([
location,
dcc.Store(id='session-store', storage_type='local', data={}),
dcc.Store(id='instance-store', storage_type='session', data={}),
html.Div([], id='page-layout-div'),
])

Expand Down
13 changes: 2 additions & 11 deletions meerschaum/api/dash/callbacks/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,19 +486,18 @@ def build_row(index: int, val: Optional[str], val_text: Optional[str]):
Output('location-keys-dropdown', 'value'),
Output('instance-select', 'value'),
Output('instance-alert-div', 'children'),
Output('instance-store', 'data'),
Input('connector-keys-dropdown', 'value'),
Input('metric-keys-dropdown', 'value'),
Input('location-keys-dropdown', 'value'),
Input('instance-select', 'value'),
State('instance-store', 'data'),
*keys_state ### NOTE: Necessary for `ctx.states`.
)
def update_keys_options(
connector_keys: Optional[List[str]],
metric_keys: Optional[List[str]],
location_keys: Optional[List[str]],
instance_keys: Optional[str],
instance_store_data: Optional[Dict[str, Any]],
*keys
):
"""
Update the keys dropdown menus' options.
Expand All @@ -507,8 +506,6 @@ def update_keys_options(
trigger = ctx.triggered[0]['prop_id'].split('.')[0]
instance_click = trigger == 'instance-select'

session_instance = instance_store_data.get('session_instance', None)

### Update the instance first.
update_instance_keys = False
if not instance_keys:
Expand All @@ -517,11 +514,6 @@ def update_keys_options(
instance_keys = str(get_api_connector())
update_instance_keys = True

instance_store_data_to_return = (
{**(instance_store_data or {}), **{'session_instance': instance_keys}}
if update_instance_keys or session_instance != instance_keys
else dash.no_update
)
if not trigger and not update_instance_keys:
raise PreventUpdate

Expand Down Expand Up @@ -626,7 +618,6 @@ def add_options(options, keys, key_type):
location_keys,
(instance_keys if update_instance_keys else dash.no_update),
instance_alerts,
instance_store_data_to_return,
)

dash_app.clientside_callback(
Expand Down
16 changes: 7 additions & 9 deletions meerschaum/api/dash/connectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@
"""

from __future__ import annotations
from meerschaum.utils.typing import WebState, Union, Optional

import meerschaum as mrsm
from meerschaum.utils.typing import WebState, Union
from meerschaum.connectors.parse import parse_instance_keys
from meerschaum.config import get_config
from meerschaum.api import debug, get_api_connector

def get_web_connector(state : WebState) -> Union[
meerschaum.connectors.api.APIConnector,
meerschaum.connectors.sql.SQLConnector,
]:
def get_web_connector(state: WebState) -> Union[
mrsm.connectors.api.APIConnector,
mrsm.connectors.sql.SQLConnector,
]:
"""
Parse the web instance keys into a connector.
"""
Expand All @@ -24,7 +25,4 @@ def get_web_connector(state : WebState) -> Union[
if not state.get('instance-select.value', None)
else state['instance-select.value']
)

return parse_instance_keys(instance_keys, debug=debug)


6 changes: 3 additions & 3 deletions meerschaum/api/resources/templates/termpage.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
connector_keys_str += " " + quote_str + ck + quote_str;
}
}
if (connector_keys.length === 0){
if (connector_keys_str === " -c"){
connector_keys_str = "";
}
let metric_keys_str = " -m";
Expand All @@ -47,7 +47,7 @@
metric_keys_str += " " + quote_str + mk + quote_str;
}
}
if (metric_keys.length === 0){
if (metric_keys_str === " -m"){
metric_keys_str = "";
}
let location_keys_str = " -l";
Expand All @@ -57,7 +57,7 @@
location_keys_str += " " + quote_str + lk + quote_str;
}
}
if (location_keys.length === 0){
if (location_keys_str === " -l"){
location_keys_str = "";
}

Expand Down
2 changes: 1 addition & 1 deletion meerschaum/config/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
Specify the Meerschaum release version.
"""

__version__ = "2.7.1"
__version__ = "2.7.2"

0 comments on commit 60e985a

Please sign in to comment.