feat: delete hash part
Browse files- app.py +1 -4
- src/services/json_generator.py +1 -14
- src/ui/form_components.py +0 -21
app.py
CHANGED
@@ -10,8 +10,7 @@ from src.ui.form_components import (
|
|
10 |
create_software_tab,
|
11 |
create_infrastructure_tab,
|
12 |
create_environment_tab,
|
13 |
-
create_quality_tab
|
14 |
-
create_hash_tab
|
15 |
)
|
16 |
css_path = path.join(path.dirname(__file__), "./assets/styles/app.css")
|
17 |
|
@@ -46,7 +45,6 @@ with gr.Blocks(css_paths=css_path) as app:
|
|
46 |
infrastructure_components = create_infrastructure_tab()
|
47 |
environment_components = create_environment_tab()
|
48 |
quality_components = create_quality_tab()
|
49 |
-
hash_components = create_hash_tab()
|
50 |
|
51 |
# Submit and Download Buttons
|
52 |
submit_button = gr.Button("Submit")
|
@@ -67,7 +65,6 @@ with gr.Blocks(css_paths=css_path) as app:
|
|
67 |
*infrastructure_components,
|
68 |
*environment_components,
|
69 |
*quality_components,
|
70 |
-
*hash_components
|
71 |
],
|
72 |
outputs=[output, file_output, json_output]
|
73 |
)
|
|
|
10 |
create_software_tab,
|
11 |
create_infrastructure_tab,
|
12 |
create_environment_tab,
|
13 |
+
create_quality_tab
|
|
|
14 |
)
|
15 |
css_path = path.join(path.dirname(__file__), "./assets/styles/app.css")
|
16 |
|
|
|
45 |
infrastructure_components = create_infrastructure_tab()
|
46 |
environment_components = create_environment_tab()
|
47 |
quality_components = create_quality_tab()
|
|
|
48 |
|
49 |
# Submit and Download Buttons
|
50 |
submit_button = gr.Button("Submit")
|
|
|
65 |
*infrastructure_components,
|
66 |
*environment_components,
|
67 |
*quality_components,
|
|
|
68 |
],
|
69 |
outputs=[output, file_output, json_output]
|
70 |
)
|
src/services/json_generator.py
CHANGED
@@ -31,9 +31,7 @@ def generate_json(
|
|
31 |
country, latitude, longitude, location,
|
32 |
powerSupplierType, powerSource, powerSourceCarbonIntensity,
|
33 |
# Quality
|
34 |
-
quality
|
35 |
-
# Hash
|
36 |
-
hashAlgorithm, cryptographicAlgorithm, value_hash
|
37 |
):
|
38 |
"""Generate JSON data from form inputs."""
|
39 |
# Process algorithms
|
@@ -213,17 +211,6 @@ def generate_json(
|
|
213 |
if quality:
|
214 |
report["quality"] = quality
|
215 |
|
216 |
-
# proceed hash
|
217 |
-
hash = {}
|
218 |
-
if hashAlgorithm:
|
219 |
-
hash["hashAlgorithm"] = hashAlgorithm
|
220 |
-
if cryptographicAlgorithm:
|
221 |
-
hash["cryptographicAlgorithm"] = cryptographicAlgorithm
|
222 |
-
if value_hash:
|
223 |
-
hash["value_hash"] = value_hash
|
224 |
-
if hash:
|
225 |
-
report["hash"] = hash
|
226 |
-
|
227 |
# Validate obligatory fields
|
228 |
is_valid, message = validate_obligatory_fields(report)
|
229 |
if not is_valid:
|
|
|
31 |
country, latitude, longitude, location,
|
32 |
powerSupplierType, powerSource, powerSourceCarbonIntensity,
|
33 |
# Quality
|
34 |
+
quality
|
|
|
|
|
35 |
):
|
36 |
"""Generate JSON data from form inputs."""
|
37 |
# Process algorithms
|
|
|
211 |
if quality:
|
212 |
report["quality"] = quality
|
213 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
214 |
# Validate obligatory fields
|
215 |
is_valid, message = validate_obligatory_fields(report)
|
216 |
if not is_valid:
|
src/ui/form_components.py
CHANGED
@@ -570,24 +570,3 @@ def create_quality_tab():
|
|
570 |
)
|
571 |
|
572 |
return [quality]
|
573 |
-
|
574 |
-
|
575 |
-
def create_hash_tab():
|
576 |
-
"""Create the hash tab components."""
|
577 |
-
with gr.Tab("Hash"):
|
578 |
-
hashAlgorithm = gr.Dropdown(value=None,
|
579 |
-
label="Hash Algorithm",
|
580 |
-
choices=HASH_ALGORITHMS,
|
581 |
-
info="Required field<br>(the hash function to apply)",
|
582 |
-
elem_classes="mandatory_field"
|
583 |
-
)
|
584 |
-
cryptographicAlgorithm = gr.Dropdown(value=None,
|
585 |
-
label="Cryptographic Algorithm",
|
586 |
-
choices=CRYPTO_ALGORITHMS,
|
587 |
-
info="Required field<br>(the public key function to apply)",
|
588 |
-
elem_classes="mandatory_field"
|
589 |
-
)
|
590 |
-
value_hash = gr.Textbox(
|
591 |
-
label="Value", info="Required field<br>(encrypted value of the hash)", elem_classes="mandatory_field")
|
592 |
-
|
593 |
-
return [hashAlgorithm, cryptographicAlgorithm, value_hash]
|
|
|
570 |
)
|
571 |
|
572 |
return [quality]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|