Update app.py
Browse files
app.py
CHANGED
@@ -213,39 +213,6 @@ app.layout = dbc.Container([
|
|
213 |
dcc.Download(id="download-markdown")
|
214 |
])
|
215 |
|
216 |
-
@app.callback(
|
217 |
-
[Output("output-notes", "children"),
|
218 |
-
Output("download-button", "disabled"),
|
219 |
-
Output("pr-button", "disabled")],
|
220 |
-
[Input("generate-button", "n_clicks")],
|
221 |
-
[State("git-provider", "value"),
|
222 |
-
State("repo-url", "value"),
|
223 |
-
State("start-date", "value"),
|
224 |
-
State("end-date", "value"),
|
225 |
-
State("folder-location", "value")]
|
226 |
-
)
|
227 |
-
def update_output(n_clicks, git_provider, repo_url, start_date, end_date, folder_location):
|
228 |
-
if n_clicks is None:
|
229 |
-
return "", True, True
|
230 |
-
|
231 |
-
notes, file_name = generate_release_notes(git_provider, repo_url, start_date, end_date, folder_location)
|
232 |
-
return notes, False, False
|
233 |
-
|
234 |
-
@app.callback(
|
235 |
-
Output("download-markdown", "data"),
|
236 |
-
Input("download-button", "n_clicks"),
|
237 |
-
prevent_initial_call=True
|
238 |
-
)
|
239 |
-
def download_markdown(n_clicks):
|
240 |
-
if n_clicks is None:
|
241 |
-
return dash.no_update
|
242 |
-
|
243 |
-
global generated_file
|
244 |
-
if generated_file is None:
|
245 |
-
return dash.no_update
|
246 |
-
|
247 |
-
return dcc.send_bytes(generated_file.getvalue(), f"release_notes_{datetime.now().strftime('%Y%m%d%H%M%S')}.md")
|
248 |
-
|
249 |
@app.callback(
|
250 |
[Output("output-notes", "children"),
|
251 |
Output("download-button", "disabled"),
|
@@ -264,7 +231,7 @@ def download_markdown(n_clicks):
|
|
264 |
def handle_all_actions(generate_clicks, download_clicks, pr_clicks,
|
265 |
git_provider, repo_url, start_date, end_date, folder_location):
|
266 |
global generated_file, pr_url
|
267 |
-
ctx = callback_context
|
268 |
|
269 |
if not ctx.triggered:
|
270 |
return "", True, True, None, "Create PR"
|
|
|
213 |
dcc.Download(id="download-markdown")
|
214 |
])
|
215 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
216 |
@app.callback(
|
217 |
[Output("output-notes", "children"),
|
218 |
Output("download-button", "disabled"),
|
|
|
231 |
def handle_all_actions(generate_clicks, download_clicks, pr_clicks,
|
232 |
git_provider, repo_url, start_date, end_date, folder_location):
|
233 |
global generated_file, pr_url
|
234 |
+
ctx = dash.callback_context
|
235 |
|
236 |
if not ctx.triggered:
|
237 |
return "", True, True, None, "Create PR"
|