diff --git a/psa_car_controller/web/tools/Button.py b/psa_car_controller/web/tools/Button.py index 24f9811..a5dade8 100644 --- a/psa_car_controller/web/tools/Button.py +++ b/psa_car_controller/web/tools/Button.py @@ -18,12 +18,13 @@ class Button: self.html_el = self.get_html() self._fct = fct self._output = Output(self.get_response_id(), 'children') - callback_id = create_callback_id(self._output) + self.input_button = Input(self.get_button_id(), 'n_clicks') + callback_id = create_callback_id(self._output, self.input_button) if callback_id not in dash_app.callback_map: self._set_callback(prevent_initial_call) def _set_callback(self, prevent_initial_call): - dash_app.callback(self._output, Input(self.get_button_id(), 'n_clicks'), + dash_app.callback(self._output, self.input_button, prevent_initial_call=prevent_initial_call)(self.call) def get_button_id(self): diff --git a/psa_car_controller/web/tools/figurefilter.py b/psa_car_controller/web/tools/figurefilter.py index 63231c4..beb5928 100644 --- a/psa_car_controller/web/tools/figurefilter.py +++ b/psa_car_controller/web/tools/figurefilter.py @@ -113,7 +113,12 @@ class FigureFilter: return params def set_clientside_callback(self, dash_app, config: dict): - callback_id = create_callback_id(self.__get_output()) + output = self.__get_output() + inputs = [Input('clientside-data-store', 'data'), + Input('date-slider', 'value'), + Input('clientside-figure-store', 'data'), + *self.__get_table_input_sort_by()] + callback_id = create_callback_id(self.__get_output(), inputs) if callback_id not in dash_app.callback_map: config_str = json.dumps(config) if logger.isEnabledFor(DEBUG): @@ -126,12 +131,7 @@ class FigureFilter: return filterAndSort(data, range, figures, params, logLevel, {self.__gen_sort_dict()}, {config_str}) }}""" - dash_app.clientside_callback(fct_def, - *self.__get_output(), - Input('clientside-data-store', 'data'), - Input('date-slider', 'value'), - Input('clientside-figure-store', 'data'), - *self.__get_table_input_sort_by()) + dash_app.clientside_callback(fct_def, *output, *inputs) return True return False diff --git a/psa_car_controller/web/view/config_views.py b/psa_car_controller/web/view/config_views.py index ddc1b86..c07fb7d 100644 --- a/psa_car_controller/web/view/config_views.py +++ b/psa_car_controller/web/view/config_views.py @@ -150,7 +150,7 @@ def askCode(n_clicks): # pylint: disable=unused-argument if ctx.triggered: try: app.myp.remote_client.get_sms_otp_code() - return dbc.Alert("Sms sent", color="success") + return dbc.Alert("SMS sent", color="success") except Exception as e: res = str(e) return dbc.Alert(res, color="danger") diff --git a/pyproject.toml b/pyproject.toml index 1d7df63..2abcf3e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,7 +13,7 @@ include = [ [tool.poetry.dependencies] python = ">=3.7.0, <4.0.0" paho-mqtt = ">=1.5.0" -dash = ">2.0.0, <2.9.0" +dash = ">=2.9.0, <3.0.0" dash-daq = "^0.5.0" plotly = ">=5" cryptography = ">=2.6" @@ -21,7 +21,6 @@ Werkzeug = ">=1.0.0" Flask = ">=1.0.4" dash-bootstrap-components = ">=1" ConfigUpdater = ">=3.0" -pandas = ">=0.23" oauth2-client = "^1.2.1" requests = "^2.27.1" pytz = "^2021.0" @@ -35,7 +34,7 @@ pydantic = "^1.9.0" certifi = ">=14.05.14" six = ">=1.10" python-dateutil = ">=2.5.3" -urllib3 = ">=1.15.1" +urllib3 = ">=1.15.1 <2.0.0" importlib-metadata = {version = ">=1.7.0", python = "<3.8"} [tool.poetry.dev-dependencies]