Skip to content

Commit 0b3ae7a

Browse files
committed
reorder listings to scm/build/orch for logical usage
1 parent f58e2f3 commit 0b3ae7a

6 files changed

Lines changed: 53 additions & 53 deletions

File tree

dojo/cicd_infrastructure/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
class CICDInfrastructure(models.Model):
77
INFRASTRUCTURE_TYPE_CHOICES = (
8-
("build_server", "Build Server"),
98
("scm_server", "SCM Server"),
9+
("build_server", "Build Server"),
1010
("orchestration", "Orchestration Engine"),
1111
)
1212

dojo/db_migrations/0269_cicd_infrastructure.py

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ def migrate_tool_configs_to_cicd_infrastructure(apps, schema_editor):
1818
CICDInfrastructure = apps.get_model("dojo", "CICDInfrastructure")
1919

2020
field_mappings = [
21-
("build_server", "cicd_build_server", "build_server"),
2221
("source_code_management_server", "cicd_scm_server", "scm_server"),
22+
("build_server", "cicd_build_server", "build_server"),
2323
("orchestration_engine", "cicd_orchestration_engine", "orchestration"),
2424
]
2525

@@ -66,7 +66,7 @@ class Migration(migrations.Migration):
6666
("name", models.CharField(max_length=200)),
6767
("description", models.CharField(blank=True, default="", max_length=2000)),
6868
("url", models.URLField(blank=True, default="", help_text="Public URL of the tool (e.g., https://jenkins.company.com)", max_length=2000)),
69-
("infrastructure_type", models.CharField(choices=[("build_server", "Build Server"), ("scm_server", "SCM Server"), ("orchestration", "Orchestration Engine")], max_length=30)),
69+
("infrastructure_type", models.CharField(choices=[("scm_server", "SCM Server"), ("build_server", "Build Server"), ("orchestration", "Orchestration Engine")], max_length=30)),
7070
],
7171
options={
7272
"ordering": ["name"],
@@ -76,28 +76,28 @@ class Migration(migrations.Migration):
7676
# Step 2: Add new FK fields to Engagement (before removing old ones)
7777
migrations.AddField(
7878
model_name="engagement",
79-
name="cicd_build_server",
79+
name="cicd_scm_server",
8080
field=models.ForeignKey(
8181
blank=True, null=True,
82-
help_text="Build server used for this CI/CD engagement",
83-
limit_choices_to={"infrastructure_type": "build_server"},
82+
help_text="Source code management server used for this CI/CD engagement",
83+
limit_choices_to={"infrastructure_type": "scm_server"},
8484
on_delete=django.db.models.deletion.SET_NULL,
85-
related_name="engagements_as_build_server",
85+
related_name="engagements_as_scm_server",
8686
to="dojo.cicdinfrastructure",
87-
verbose_name="Build Server",
87+
verbose_name="SCM Server",
8888
),
8989
),
9090
migrations.AddField(
9191
model_name="engagement",
92-
name="cicd_scm_server",
92+
name="cicd_build_server",
9393
field=models.ForeignKey(
9494
blank=True, null=True,
95-
help_text="Source code management server used for this CI/CD engagement",
96-
limit_choices_to={"infrastructure_type": "scm_server"},
95+
help_text="Build server used for this CI/CD engagement",
96+
limit_choices_to={"infrastructure_type": "build_server"},
9797
on_delete=django.db.models.deletion.SET_NULL,
98-
related_name="engagements_as_scm_server",
98+
related_name="engagements_as_build_server",
9999
to="dojo.cicdinfrastructure",
100-
verbose_name="SCM Server",
100+
verbose_name="Build Server",
101101
),
102102
),
103103
migrations.AddField(
@@ -134,11 +134,11 @@ class Migration(migrations.Migration):
134134
# Step 5: Remove old FK fields from Engagement
135135
migrations.RemoveField(
136136
model_name="engagement",
137-
name="build_server",
137+
name="source_code_management_server",
138138
),
139139
migrations.RemoveField(
140140
model_name="engagement",
141-
name="source_code_management_server",
141+
name="build_server",
142142
),
143143
migrations.RemoveField(
144144
model_name="engagement",
@@ -147,19 +147,24 @@ class Migration(migrations.Migration):
147147
# Step 6: Update pghistory event table FK fields to point to CICDInfrastructure
148148
migrations.RenameField(
149149
model_name="engagementevent",
150-
old_name="build_server",
151-
new_name="cicd_build_server",
150+
old_name="source_code_management_server",
151+
new_name="cicd_scm_server",
152152
),
153153
migrations.RenameField(
154154
model_name="engagementevent",
155-
old_name="source_code_management_server",
156-
new_name="cicd_scm_server",
155+
old_name="build_server",
156+
new_name="cicd_build_server",
157157
),
158158
migrations.RenameField(
159159
model_name="engagementevent",
160160
old_name="orchestration_engine",
161161
new_name="cicd_orchestration_engine",
162162
),
163+
migrations.AlterField(
164+
model_name='engagementevent',
165+
name='cicd_scm_server',
166+
field=models.ForeignKey(blank=True, db_constraint=False, db_index=False, help_text='Source code management server used for this CI/CD engagement', limit_choices_to={'infrastructure_type': 'scm_server'}, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', related_query_name='+', to='dojo.cicdinfrastructure', verbose_name='SCM Server'),
167+
),
163168
migrations.AlterField(
164169
model_name='engagementevent',
165170
name='cicd_build_server',
@@ -170,11 +175,6 @@ class Migration(migrations.Migration):
170175
name='cicd_orchestration_engine',
171176
field=models.ForeignKey(blank=True, db_constraint=False, db_index=False, help_text='Orchestration engine used for this CI/CD engagement', limit_choices_to={'infrastructure_type': 'orchestration'}, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', related_query_name='+', to='dojo.cicdinfrastructure', verbose_name='Orchestration Engine'),
172177
),
173-
migrations.AlterField(
174-
model_name='engagementevent',
175-
name='cicd_scm_server',
176-
field=models.ForeignKey(blank=True, db_constraint=False, db_index=False, help_text='Source code management server used for this CI/CD engagement', limit_choices_to={'infrastructure_type': 'scm_server'}, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', related_query_name='+', to='dojo.cicdinfrastructure', verbose_name='SCM Server'),
177-
),
178178
# Step 7: Re-create pgtrigger triggers with new column names
179179
pgtrigger.migrations.AddTrigger(
180180
model_name='engagement',

dojo/forms.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,10 +1058,10 @@ def __init__(self, *args, **kwargs):
10581058
del self.fields["build_id"]
10591059
del self.fields["commit_hash"]
10601060
del self.fields["branch_tag"]
1061-
del self.fields["cicd_build_server"]
10621061
del self.fields["cicd_scm_server"]
1063-
# del self.fields['source_code_management_uri']
1062+
del self.fields["cicd_build_server"]
10641063
del self.fields["cicd_orchestration_engine"]
1064+
# del self.fields['source_code_management_uri']
10651065
else:
10661066
del self.fields["test_strategy"]
10671067
del self.fields["status"]

dojo/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1474,8 +1474,8 @@ class Engagement(BaseModel):
14741474
branch_tag = models.CharField(editable=True, max_length=150,
14751475
null=True, blank=True, help_text=_("Tag or branch of the product the engagement tested."), verbose_name=_("Branch/Tag"))
14761476
source_code_management_uri = models.URLField(max_length=600, null=True, blank=True, editable=True, verbose_name=_("Repo"), help_text=_("Resource link to source code"))
1477-
cicd_build_server = models.ForeignKey(CICDInfrastructure, null=True, blank=True, related_name="engagements_as_build_server", on_delete=models.SET_NULL, limit_choices_to={"infrastructure_type": "build_server"}, verbose_name=_("Build Server"), help_text=_("Build server used for this CI/CD engagement"))
14781477
cicd_scm_server = models.ForeignKey(CICDInfrastructure, null=True, blank=True, related_name="engagements_as_scm_server", on_delete=models.SET_NULL, limit_choices_to={"infrastructure_type": "scm_server"}, verbose_name=_("SCM Server"), help_text=_("Source code management server used for this CI/CD engagement"))
1478+
cicd_build_server = models.ForeignKey(CICDInfrastructure, null=True, blank=True, related_name="engagements_as_build_server", on_delete=models.SET_NULL, limit_choices_to={"infrastructure_type": "build_server"}, verbose_name=_("Build Server"), help_text=_("Build server used for this CI/CD engagement"))
14791479
cicd_orchestration_engine = models.ForeignKey(CICDInfrastructure, null=True, blank=True, related_name="engagements_as_orchestration", on_delete=models.SET_NULL, limit_choices_to={"infrastructure_type": "orchestration"}, verbose_name=_("Orchestration Engine"), help_text=_("Orchestration engine used for this CI/CD engagement"))
14801480
deduplication_on_engagement = models.BooleanField(default=False, verbose_name=_("Deduplication within this engagement only"), help_text=_("If enabled deduplication will only mark a finding in this engagement as duplicate of another finding if both findings are in this engagement. If disabled, deduplication is on the product level."))
14811481

dojo/templates/dojo/view_eng.html

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -889,19 +889,6 @@ <h3 class="panel-title"><span class="fa-solid fa-server" aria-hidden="true"></sp
889889
<td><strong>Branch/Tag</strong></td>
890890
<td>{{ eng.branch_tag|notspecified }}</td>
891891
</tr>
892-
<tr>
893-
<td><strong>Orchestration</strong></td>
894-
<td>
895-
{% if eng.cicd_orchestration_engine %}
896-
<a href="{% url 'edit_cicd_infrastructure' eng.cicd_orchestration_engine.id %}">{{ eng.cicd_orchestration_engine.name }}</a>
897-
{% if eng.cicd_orchestration_engine.url %}
898-
<a target="_blank" href="{{ eng.cicd_orchestration_engine.url }}" data-toggle="tooltip" title="{{ eng.cicd_orchestration_engine.url }}"><i class="fa-solid fa-arrow-up-right-from-square"></i></a>
899-
{% endif %}
900-
{% else %}
901-
{{ eng.cicd_orchestration_engine|notspecified }}
902-
{% endif %}
903-
</td>
904-
</tr>
905892
<tr>
906893
<td><strong>SCM Server</strong></td>
907894
<td>
@@ -928,6 +915,19 @@ <h3 class="panel-title"><span class="fa-solid fa-server" aria-hidden="true"></sp
928915
{% endif %}
929916
</td>
930917
</tr>
918+
<tr>
919+
<td><strong>Orchestration</strong></td>
920+
<td>
921+
{% if eng.cicd_orchestration_engine %}
922+
<a href="{% url 'edit_cicd_infrastructure' eng.cicd_orchestration_engine.id %}">{{ eng.cicd_orchestration_engine.name }}</a>
923+
{% if eng.cicd_orchestration_engine.url %}
924+
<a target="_blank" href="{{ eng.cicd_orchestration_engine.url }}" data-toggle="tooltip" title="{{ eng.cicd_orchestration_engine.url }}"><i class="fa-solid fa-arrow-up-right-from-square"></i></a>
925+
{% endif %}
926+
{% else %}
927+
{{ eng.cicd_orchestration_engine|notspecified }}
928+
{% endif %}
929+
</td>
930+
</tr>
931931
</tbody>
932932
</table>
933933
</div>

dojo/templates_classic/dojo/view_eng.html

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -891,19 +891,6 @@ <h3 class="panel-title"><span class="fa-solid fa-server" aria-hidden="true"></sp
891891
<td><strong>Branch/Tag</strong></td>
892892
<td>{{ eng.branch_tag|notspecified }}</td>
893893
</tr>
894-
<tr>
895-
<td><strong>Orchestration</strong></td>
896-
<td>
897-
{% if eng.cicd_orchestration_engine.id %}
898-
<a href="{% url 'edit_cicd_infrastructure' eng.cicd_orchestration_engine.id %}">{{ eng.cicd_orchestration_engine.name }}</a>
899-
{% if eng.cicd_orchestration_engine.url %}
900-
<a target="_blank" href="{{ eng.cicd_orchestration_engine.url }}" data-toggle="tooltip" title="{{ eng.cicd_orchestration_engine.url }}"><i class="fa-solid fa-arrow-up-right-from-square"></i></a>
901-
{% endif %}
902-
{% else %}
903-
{{ eng.cicd_orchestration_engine.name|notspecified }}
904-
{% endif %}
905-
</td>
906-
</tr>
907894
<tr>
908895
<td><strong>SCM Server</strong></td>
909896
<td>
@@ -930,6 +917,19 @@ <h3 class="panel-title"><span class="fa-solid fa-server" aria-hidden="true"></sp
930917
{% endif %}
931918
</td>
932919
</tr>
920+
<tr>
921+
<td><strong>Orchestration</strong></td>
922+
<td>
923+
{% if eng.cicd_orchestration_engine.id %}
924+
<a href="{% url 'edit_cicd_infrastructure' eng.cicd_orchestration_engine.id %}">{{ eng.cicd_orchestration_engine.name }}</a>
925+
{% if eng.cicd_orchestration_engine.url %}
926+
<a target="_blank" href="{{ eng.cicd_orchestration_engine.url }}" data-toggle="tooltip" title="{{ eng.cicd_orchestration_engine.url }}"><i class="fa-solid fa-arrow-up-right-from-square"></i></a>
927+
{% endif %}
928+
{% else %}
929+
{{ eng.cicd_orchestration_engine.name|notspecified }}
930+
{% endif %}
931+
</td>
932+
</tr>
933933
</tbody>
934934
</table>
935935
</div>

0 commit comments

Comments
 (0)