From e2f420b8c06edbd38dd70ed6435a4fd36e53518c Mon Sep 17 00:00:00 2001 From: DivergAgent Date: Thu, 10 Jul 2025 09:02:02 +0200 Subject: [PATCH 1/6] Fix 1 SonarQube issues --- src/codeas/ui/components/deployment_ui.py | 42 ++++++++++------------- 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/src/codeas/ui/components/deployment_ui.py b/src/codeas/ui/components/deployment_ui.py index e07699c..c0209ec 100644 --- a/src/codeas/ui/components/deployment_ui.py +++ b/src/codeas/ui/components/deployment_ui.py @@ -1,9 +1,13 @@ import streamlit as st -from codeas.core.state import state # Add this import +from codeas.core.state import state from codeas.use_cases.deployment import define_deployment, generate_deployment +DEPLOYMENT_STRATEGY_FILENAME = "deployment_strategy.json" +TERRAFORM_CODE_FILENAME = "terraform_code.json" + + def display(): use_previous_outputs_strategy = st.toggle( "Use previous outputs", value=True, key="use_previous_outputs_strategy" @@ -17,7 +21,7 @@ def display(): with st.spinner("Defining deployment requirements..."): if use_previous_outputs_strategy: try: - previous_output = state.read_output("deployment_strategy.json") + previous_output = state.read_output(DEPLOYMENT_STRATEGY_FILENAME) st.session_state.outputs["deployment_strategy"] = type( "Output", (), @@ -25,17 +29,13 @@ def display(): "response": {"content": previous_output["content"]}, "cost": previous_output["cost"], "tokens": previous_output["tokens"], - "messages": previous_output["messages"], # Add this line + "messages": previous_output["messages"], }, ) except FileNotFoundError: - # st.warning( - # "No previous output found for deployment strategy. Running generation..." - # ) st.session_state.outputs[ "deployment_strategy" ] = define_deployment() - # Write the output to a file state.write_output( { "content": st.session_state.outputs[ @@ -49,13 +49,12 @@ def display(): ].tokens, "messages": st.session_state.outputs[ "deployment_strategy" - ].messages, # Add this line + ].messages, }, - "deployment_strategy.json", + DEPLOYMENT_STRATEGY_FILENAME, ) else: st.session_state.outputs["deployment_strategy"] = define_deployment() - # Write the output to a file state.write_output( { "content": st.session_state.outputs[ @@ -67,9 +66,9 @@ def display(): ].tokens, "messages": st.session_state.outputs[ "deployment_strategy" - ].messages, # Add this line + ].messages, }, - "deployment_strategy.json", + DEPLOYMENT_STRATEGY_FILENAME, ) if st.button("Preview", key="preview_deployment_strategy"): @@ -110,7 +109,7 @@ def display_generate_deployment(): ].response["content"] if use_previous_outputs_deployment: try: - previous_output = state.read_output("terraform_code.json") + previous_output = state.read_output(TERRAFORM_CODE_FILENAME) st.session_state.outputs["terraform_code"] = type( "Output", (), @@ -118,17 +117,13 @@ def display_generate_deployment(): "response": {"content": previous_output["content"]}, "cost": previous_output["cost"], "tokens": previous_output["tokens"], - "messages": previous_output["messages"], # Add this line + "messages": previous_output["messages"], }, ) except FileNotFoundError: - # st.warning( - # "No previous output found for Terraform code. Running generation..." - # ) st.session_state.outputs["terraform_code"] = generate_deployment( deployment_strategy ) - # Write the output to a file state.write_output( { "content": st.session_state.outputs[ @@ -138,15 +133,14 @@ def display_generate_deployment(): "tokens": st.session_state.outputs["terraform_code"].tokens, "messages": st.session_state.outputs[ "terraform_code" - ].messages, # Add this line + ].messages, }, - "terraform_code.json", + TERRAFORM_CODE_FILENAME, ) else: st.session_state.outputs["terraform_code"] = generate_deployment( deployment_strategy ) - # Write the output to a file state.write_output( { "content": st.session_state.outputs["terraform_code"].response[ @@ -156,9 +150,9 @@ def display_generate_deployment(): "tokens": st.session_state.outputs["terraform_code"].tokens, "messages": st.session_state.outputs[ "terraform_code" - ].messages, # Add this line + ].messages, }, - "terraform_code.json", + TERRAFORM_CODE_FILENAME, ) if st.button("Preview", key="preview_terraform_code"): @@ -183,4 +177,4 @@ def display_generate_deployment(): ) with st.expander("Messages", expanded=False): st.json(output.messages) - st.markdown(output.response["content"]) + st.markdown(output.response["content"]) \ No newline at end of file From 751347bca011675276ab5d26101b0124de001f69 Mon Sep 17 00:00:00 2001 From: DivergAgent Date: Thu, 10 Jul 2025 09:11:03 +0200 Subject: [PATCH 2/6] Fix 1 SonarQube issues --- src/codeas/ui/components/deployment_ui.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/codeas/ui/components/deployment_ui.py b/src/codeas/ui/components/deployment_ui.py index c0209ec..b63f0b7 100644 --- a/src/codeas/ui/components/deployment_ui.py +++ b/src/codeas/ui/components/deployment_ui.py @@ -3,7 +3,6 @@ from codeas.core.state import state from codeas.use_cases.deployment import define_deployment, generate_deployment - DEPLOYMENT_STRATEGY_FILENAME = "deployment_strategy.json" TERRAFORM_CODE_FILENAME = "terraform_code.json" From e46a6b74e227654655021791ed0c3f2ea6cee70e Mon Sep 17 00:00:00 2001 From: DivergAgent Date: Thu, 10 Jul 2025 09:16:27 +0200 Subject: [PATCH 3/6] Fix 1 SonarQube issues --- src/codeas/ui/components/deployment_ui.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/codeas/ui/components/deployment_ui.py b/src/codeas/ui/components/deployment_ui.py index b63f0b7..52dbe26 100644 --- a/src/codeas/ui/components/deployment_ui.py +++ b/src/codeas/ui/components/deployment_ui.py @@ -3,6 +3,7 @@ from codeas.core.state import state from codeas.use_cases.deployment import define_deployment, generate_deployment +# Define constants for filenames DEPLOYMENT_STRATEGY_FILENAME = "deployment_strategy.json" TERRAFORM_CODE_FILENAME = "terraform_code.json" @@ -32,9 +33,13 @@ def display(): }, ) except FileNotFoundError: + # st.warning( + # "No previous output found for deployment strategy. Running generation..." + # ) st.session_state.outputs[ "deployment_strategy" ] = define_deployment() + # Write the output to a file state.write_output( { "content": st.session_state.outputs[ @@ -54,6 +59,7 @@ def display(): ) else: st.session_state.outputs["deployment_strategy"] = define_deployment() + # Write the output to a file state.write_output( { "content": st.session_state.outputs[ @@ -99,9 +105,7 @@ def display_generate_deployment(): "Use previous outputs", value=True, key="use_previous_outputs_deployment" ) - if st.button( - "Generate Terraform code", type="primary", key="generate_terraform_code" - ): + if st.button("Generate Terraform code", type="primary", key="generate_terraform_code"): with st.spinner("Generating Terraform code..."): deployment_strategy = st.session_state.outputs[ "deployment_strategy" @@ -120,9 +124,13 @@ def display_generate_deployment(): }, ) except FileNotFoundError: + # st.warning( + # "No previous output found for Terraform code. Running generation..." + # ) st.session_state.outputs["terraform_code"] = generate_deployment( deployment_strategy ) + # Write the output to a file state.write_output( { "content": st.session_state.outputs[ @@ -140,6 +148,7 @@ def display_generate_deployment(): st.session_state.outputs["terraform_code"] = generate_deployment( deployment_strategy ) + # Write the output to a file state.write_output( { "content": st.session_state.outputs["terraform_code"].response[ From 33030ca8afe65677fbe679d49b4e9d5de60705e0 Mon Sep 17 00:00:00 2001 From: DivergAgent Date: Thu, 10 Jul 2025 13:18:23 +0200 Subject: [PATCH 4/6] Fix 1 SonarQube issues --- src/codeas/ui/components/deployment_ui.py | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/codeas/ui/components/deployment_ui.py b/src/codeas/ui/components/deployment_ui.py index 52dbe26..2d65050 100644 --- a/src/codeas/ui/components/deployment_ui.py +++ b/src/codeas/ui/components/deployment_ui.py @@ -3,9 +3,8 @@ from codeas.core.state import state from codeas.use_cases.deployment import define_deployment, generate_deployment -# Define constants for filenames -DEPLOYMENT_STRATEGY_FILENAME = "deployment_strategy.json" -TERRAFORM_CODE_FILENAME = "terraform_code.json" +DEPLOYMENT_STRATEGY_FILE = "deployment_strategy.json" +TERRAFORM_CODE_FILE = "terraform_code.json" def display(): @@ -21,7 +20,7 @@ def display(): with st.spinner("Defining deployment requirements..."): if use_previous_outputs_strategy: try: - previous_output = state.read_output(DEPLOYMENT_STRATEGY_FILENAME) + previous_output = state.read_output(DEPLOYMENT_STRATEGY_FILE) st.session_state.outputs["deployment_strategy"] = type( "Output", (), @@ -39,7 +38,6 @@ def display(): st.session_state.outputs[ "deployment_strategy" ] = define_deployment() - # Write the output to a file state.write_output( { "content": st.session_state.outputs[ @@ -55,11 +53,10 @@ def display(): "deployment_strategy" ].messages, }, - DEPLOYMENT_STRATEGY_FILENAME, + DEPLOYMENT_STRATEGY_FILE, ) else: st.session_state.outputs["deployment_strategy"] = define_deployment() - # Write the output to a file state.write_output( { "content": st.session_state.outputs[ @@ -73,7 +70,7 @@ def display(): "deployment_strategy" ].messages, }, - DEPLOYMENT_STRATEGY_FILENAME, + DEPLOYMENT_STRATEGY_FILE, ) if st.button("Preview", key="preview_deployment_strategy"): @@ -112,7 +109,7 @@ def display_generate_deployment(): ].response["content"] if use_previous_outputs_deployment: try: - previous_output = state.read_output(TERRAFORM_CODE_FILENAME) + previous_output = state.read_output(TERRAFORM_CODE_FILE) st.session_state.outputs["terraform_code"] = type( "Output", (), @@ -130,7 +127,6 @@ def display_generate_deployment(): st.session_state.outputs["terraform_code"] = generate_deployment( deployment_strategy ) - # Write the output to a file state.write_output( { "content": st.session_state.outputs[ @@ -142,13 +138,12 @@ def display_generate_deployment(): "terraform_code" ].messages, }, - TERRAFORM_CODE_FILENAME, + TERRAFORM_CODE_FILE, ) else: st.session_state.outputs["terraform_code"] = generate_deployment( deployment_strategy ) - # Write the output to a file state.write_output( { "content": st.session_state.outputs["terraform_code"].response[ @@ -160,7 +155,7 @@ def display_generate_deployment(): "terraform_code" ].messages, }, - TERRAFORM_CODE_FILENAME, + TERRAFORM_CODE_FILE, ) if st.button("Preview", key="preview_terraform_code"): From 851f6d9000ffd66c42cedddeeaae28261013fea5 Mon Sep 17 00:00:00 2001 From: DivergAgent Date: Thu, 10 Jul 2025 13:46:45 +0200 Subject: [PATCH 5/6] Fix 1 SonarQube issues --- src/codeas/ui/components/deployment_ui.py | 27 +++++++++-------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/src/codeas/ui/components/deployment_ui.py b/src/codeas/ui/components/deployment_ui.py index 2d65050..dd50556 100644 --- a/src/codeas/ui/components/deployment_ui.py +++ b/src/codeas/ui/components/deployment_ui.py @@ -3,9 +3,8 @@ from codeas.core.state import state from codeas.use_cases.deployment import define_deployment, generate_deployment -DEPLOYMENT_STRATEGY_FILE = "deployment_strategy.json" -TERRAFORM_CODE_FILE = "terraform_code.json" - +DEPLOYMENT_STRATEGY_FILENAME = "deployment_strategy.json" +TERRAFORM_CODE_FILENAME = "terraform_code.json" def display(): use_previous_outputs_strategy = st.toggle( @@ -20,7 +19,7 @@ def display(): with st.spinner("Defining deployment requirements..."): if use_previous_outputs_strategy: try: - previous_output = state.read_output(DEPLOYMENT_STRATEGY_FILE) + previous_output = state.read_output(DEPLOYMENT_STRATEGY_FILENAME) st.session_state.outputs["deployment_strategy"] = type( "Output", (), @@ -32,9 +31,6 @@ def display(): }, ) except FileNotFoundError: - # st.warning( - # "No previous output found for deployment strategy. Running generation..." - # ) st.session_state.outputs[ "deployment_strategy" ] = define_deployment() @@ -53,7 +49,7 @@ def display(): "deployment_strategy" ].messages, }, - DEPLOYMENT_STRATEGY_FILE, + DEPLOYMENT_STRATEGY_FILENAME, ) else: st.session_state.outputs["deployment_strategy"] = define_deployment() @@ -70,7 +66,7 @@ def display(): "deployment_strategy" ].messages, }, - DEPLOYMENT_STRATEGY_FILE, + DEPLOYMENT_STRATEGY_FILENAME, ) if st.button("Preview", key="preview_deployment_strategy"): @@ -102,14 +98,16 @@ def display_generate_deployment(): "Use previous outputs", value=True, key="use_previous_outputs_deployment" ) - if st.button("Generate Terraform code", type="primary", key="generate_terraform_code"): + if st.button( + "Generate Terraform code", type="primary", key="generate_terraform_code" + ): with st.spinner("Generating Terraform code..."): deployment_strategy = st.session_state.outputs[ "deployment_strategy" ].response["content"] if use_previous_outputs_deployment: try: - previous_output = state.read_output(TERRAFORM_CODE_FILE) + previous_output = state.read_output(TERRAFORM_CODE_FILENAME) st.session_state.outputs["terraform_code"] = type( "Output", (), @@ -121,9 +119,6 @@ def display_generate_deployment(): }, ) except FileNotFoundError: - # st.warning( - # "No previous output found for Terraform code. Running generation..." - # ) st.session_state.outputs["terraform_code"] = generate_deployment( deployment_strategy ) @@ -138,7 +133,7 @@ def display_generate_deployment(): "terraform_code" ].messages, }, - TERRAFORM_CODE_FILE, + TERRAFORM_CODE_FILENAME, ) else: st.session_state.outputs["terraform_code"] = generate_deployment( @@ -155,7 +150,7 @@ def display_generate_deployment(): "terraform_code" ].messages, }, - TERRAFORM_CODE_FILE, + TERRAFORM_CODE_FILENAME, ) if st.button("Preview", key="preview_terraform_code"): From 918e9ef900415368ad583e63f37429ce604a78b5 Mon Sep 17 00:00:00 2001 From: DivergAgent Date: Thu, 10 Jul 2025 14:14:48 +0200 Subject: [PATCH 6/6] Fix 1 SonarQube issues --- src/codeas/ui/components/deployment_ui.py | 27 ++++++++++++++++------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/src/codeas/ui/components/deployment_ui.py b/src/codeas/ui/components/deployment_ui.py index dd50556..e356da9 100644 --- a/src/codeas/ui/components/deployment_ui.py +++ b/src/codeas/ui/components/deployment_ui.py @@ -3,8 +3,9 @@ from codeas.core.state import state from codeas.use_cases.deployment import define_deployment, generate_deployment -DEPLOYMENT_STRATEGY_FILENAME = "deployment_strategy.json" -TERRAFORM_CODE_FILENAME = "terraform_code.json" +DEPLOYMENT_STRATEGY_FILE = "deployment_strategy.json" +TERRAFORM_CODE_FILE = "terraform_code.json" + def display(): use_previous_outputs_strategy = st.toggle( @@ -19,7 +20,7 @@ def display(): with st.spinner("Defining deployment requirements..."): if use_previous_outputs_strategy: try: - previous_output = state.read_output(DEPLOYMENT_STRATEGY_FILENAME) + previous_output = state.read_output(DEPLOYMENT_STRATEGY_FILE) st.session_state.outputs["deployment_strategy"] = type( "Output", (), @@ -31,9 +32,13 @@ def display(): }, ) except FileNotFoundError: + # st.warning( + # "No previous output found for deployment strategy. Running generation..." + # ) st.session_state.outputs[ "deployment_strategy" ] = define_deployment() + # Write the output to a file state.write_output( { "content": st.session_state.outputs[ @@ -49,10 +54,11 @@ def display(): "deployment_strategy" ].messages, }, - DEPLOYMENT_STRATEGY_FILENAME, + DEPLOYMENT_STRATEGY_FILE, ) else: st.session_state.outputs["deployment_strategy"] = define_deployment() + # Write the output to a file state.write_output( { "content": st.session_state.outputs[ @@ -66,7 +72,7 @@ def display(): "deployment_strategy" ].messages, }, - DEPLOYMENT_STRATEGY_FILENAME, + DEPLOYMENT_STRATEGY_FILE, ) if st.button("Preview", key="preview_deployment_strategy"): @@ -107,7 +113,7 @@ def display_generate_deployment(): ].response["content"] if use_previous_outputs_deployment: try: - previous_output = state.read_output(TERRAFORM_CODE_FILENAME) + previous_output = state.read_output(TERRAFORM_CODE_FILE) st.session_state.outputs["terraform_code"] = type( "Output", (), @@ -119,9 +125,13 @@ def display_generate_deployment(): }, ) except FileNotFoundError: + # st.warning( + # "No previous output found for Terraform code. Running generation..." + # ) st.session_state.outputs["terraform_code"] = generate_deployment( deployment_strategy ) + # Write the output to a file state.write_output( { "content": st.session_state.outputs[ @@ -133,12 +143,13 @@ def display_generate_deployment(): "terraform_code" ].messages, }, - TERRAFORM_CODE_FILENAME, + TERRAFORM_CODE_FILE, ) else: st.session_state.outputs["terraform_code"] = generate_deployment( deployment_strategy ) + # Write the output to a file state.write_output( { "content": st.session_state.outputs["terraform_code"].response[ @@ -150,7 +161,7 @@ def display_generate_deployment(): "terraform_code" ].messages, }, - TERRAFORM_CODE_FILENAME, + TERRAFORM_CODE_FILE, ) if st.button("Preview", key="preview_terraform_code"):