Avaiga / taipy

Turns Data and AI algorithms into production-ready web applications in no time.
https://www.taipy.io
Apache License 2.0
15.36k stars 1.87k forks source link

[πŸ› BUG] Can't edit tabular data in data node viewer #1613

Closed AlexandreSajus closed 2 months ago

AlexandreSajus commented 3 months ago

What went wrong? πŸ€”

I have a Taipy application. I have created a new scenario and want to edit the "demand" data node. In the data node viewer, when I press edit data, the data tab shows a lock sign with hovertext "locked by you" and I can't edit the data: image

Expected Behavior

I want to edit the datanode "demand".

Steps to Reproduce Issue

  1. Clone the demo repo
    git clone https://github.com/Avaiga/demo-workforce-plan.git
  2. Install the develop version of Taipy
    pip install git+https://github.com/Avaiga/taipy.git
  3. Install requirements
    pip install -r requirements.txt
  4. Run main.py
    python main.py
  5. Create a new scenario using the scenario selector and try editing the demand data node in the data node viewer

Browsers

Chrome

OS

Windows

Version of Taipy

develop

Acceptance Criteria

Code of Conduct

FlorianJacta commented 3 months ago

You can test it with this code:

# Import necessary libraries
import pandas as pd
import taipy as tp
from taipy import Config, Scope, Frequency
from taipy.gui import notify
import time

import datetime as dt

Config.configure_job_executions(mode="standalone", max_nb_of_workers=2)

# Function to run a Dataiku scenario
def run_something(input_1, input_2):
    datetime = dt.datetime.now()
    date = dt.date(2018, 1, 1)
    int_var = 10
    string_var = "String"
    return datetime, date, int_var, string_var

data = {"toto": [i for i in range(10_000)], 
        "titi": [2*i for i in range(10_000)],
        "tata": [4*i for i in range(10_000)]}

data_2 = {"toto": [2*i for i in range(10_000)], 
        "titi": [i for i in range(10_000)],
        "tata": [3*i for i in range(10_000)]}

input_1_cfg = Config.configure_data_node(
    id="input_1_data_node",
    default_data=1,
)

input_2_cfg = Config.configure_data_node(
    id="input_2_data_node",
    default_data=data,
)

datetime_cfg = Config.configure_data_node(id="datetime_data_node")
date_cfg = Config.configure_data_node(id="date_data_node")
int_cfg = Config.configure_data_node(id="int_data_node")
string_cfg = Config.configure_data_node(id="string_data_node")

# Scenario and task configuration in Taipy
scenario_task_cfg = Config.configure_task(
    id="scenario_task",
    function=run_something,
    input=[input_1_cfg, input_2_cfg],
    output=[datetime_cfg, date_cfg, int_cfg, string_cfg]
)

scenario_cfg = Config.configure_scenario(
    id="scenario",
    task_configs=[scenario_task_cfg],
    frequency=Frequency.DAILY)

data_node = None
# GUI Markdown content
scenario_md = """
<|{scenario}|scenario_selector|on_change=change_data_node|>

<|{data_node}|data_node|>
"""

def change_data_node(state):
    if isinstance(state.scenario, tp.Scenario):
        state.data_node = state.scenario.input_1_data_node

# Main execution block with GUI setup
if __name__ == "__main__":
    tp.Core().run()
    scenario = tp.create_scenario(scenario_cfg, name="Scenario 1")
    scenario.input_1_data_node.write(data_2)

    tp.Gui(scenario_md).run(title="Bug replication", port=3248)