Update app.py
Browse files
app.py
CHANGED
@@ -139,9 +139,9 @@ def update_output(list_of_contents, list_of_names, existing_files):
|
|
139 |
file_content = parse_file_content(content, name)
|
140 |
uploaded_files[name] = file_content
|
141 |
new_files.append(html.Div([
|
142 |
-
html.Button('×', id={'type': 'remove-file', 'index': name},
|
143 |
html.Span(name)
|
144 |
-
]))
|
145 |
if existing_files is None:
|
146 |
existing_files = []
|
147 |
return existing_files + new_files
|
@@ -156,11 +156,11 @@ def update_output(list_of_contents, list_of_names, existing_files):
|
|
156 |
def remove_file(n_clicks, existing_files):
|
157 |
global uploaded_files
|
158 |
ctx = dash.callback_context
|
159 |
-
if not ctx.triggered
|
160 |
raise PreventUpdate
|
161 |
|
162 |
triggered_id = ctx.triggered[0]['prop_id']
|
163 |
-
removed_file = triggered_id.split('
|
164 |
|
165 |
uploaded_files.pop(removed_file, None)
|
166 |
return [file for file in existing_files if file['props']['children'][1]['props']['children'] != removed_file]
|
|
|
139 |
file_content = parse_file_content(content, name)
|
140 |
uploaded_files[name] = file_content
|
141 |
new_files.append(html.Div([
|
142 |
+
html.Button('×', id={'type': 'remove-file', 'index': name}, className='remove-file-button'),
|
143 |
html.Span(name)
|
144 |
+
], style={'marginBottom': '5px'}))
|
145 |
if existing_files is None:
|
146 |
existing_files = []
|
147 |
return existing_files + new_files
|
|
|
156 |
def remove_file(n_clicks, existing_files):
|
157 |
global uploaded_files
|
158 |
ctx = dash.callback_context
|
159 |
+
if not ctx.triggered:
|
160 |
raise PreventUpdate
|
161 |
|
162 |
triggered_id = ctx.triggered[0]['prop_id']
|
163 |
+
removed_file = json.loads(triggered_id.split('.')[0])['index']
|
164 |
|
165 |
uploaded_files.pop(removed_file, None)
|
166 |
return [file for file in existing_files if file['props']['children'][1]['props']['children'] != removed_file]
|