Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve risk assessment display #270

Merged
merged 1 commit into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions backend/core/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
class BaseModelSerializer(serializers.ModelSerializer):
def update(self, instance: models.Model, validated_data: Any) -> models.Model:
if hasattr(instance, "urn") and getattr(instance, "urn"):
raise PermissionDenied(
{"urn": "Imported objects cannot be modified"}
)
raise PermissionDenied({"urn": "Imported objects cannot be modified"})
try:
object_updated = super().update(instance, validated_data)
return object_updated
Expand Down Expand Up @@ -134,6 +132,7 @@ class Meta:

class RiskAssessmentReadSerializer(AssessmentReadSerializer):
risk_scenarios = FieldsRelatedField(many=True)
risk_scenarios_count = serializers.IntegerField(source="risk_scenarios.count")
risk_matrix = FieldsRelatedField()

class Meta:
Expand Down Expand Up @@ -162,7 +161,7 @@ class Meta:

class ReferenceControlReadSerializer(ReferenceControlWriteSerializer):
folder = FieldsRelatedField()
library = FieldsRelatedField(["name","urn"])
library = FieldsRelatedField(["name", "urn"])


class LibraryReadSerializer(BaseModelSerializer):
Expand All @@ -187,7 +186,7 @@ class Meta:

class ThreatReadSerializer(BaseModelSerializer):
folder = FieldsRelatedField()
library = FieldsRelatedField(["name","urn"])
library = FieldsRelatedField(["name", "urn"])

class Meta:
model = Threat
Expand Down Expand Up @@ -407,7 +406,7 @@ class Meta:

class FrameworkReadSerializer(BaseModelSerializer):
folder = FieldsRelatedField()
library = FieldsRelatedField(["name","urn"])
library = FieldsRelatedField(["name", "urn"])

class Meta:
model = Framework
Expand Down Expand Up @@ -503,4 +502,3 @@ class RequirementAssessmentWriteSerializer(BaseModelSerializer):
class Meta:
model = RequirementAssessment
fields = "__all__"

11 changes: 2 additions & 9 deletions frontend/src/lib/utils/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,15 @@ export const listViewFields = {
},
'risk-assessments': {
head: ['name', 'riskMatrix', 'description', 'riskScenarios', 'project'],
body: ['name', 'risk_matrix', 'description', 'risk_scenarios', 'project']
body: ['name', 'risk_matrix', 'description', 'risk_scenarios_count', 'project']
},
threats: {
head: ['ref', 'name', 'description', 'provider', 'domain'],
body: ['ref_id', 'name', 'description', 'provider', 'folder'],
meta: ['id', 'urn']
},
'risk-scenarios': {
head: [
'name',
'threats',
'riskAssessment',
'appliedControls',
'currentLevel',
'residualLevel'
],
head: ['name', 'threats', 'riskAssessment', 'appliedControls', 'currentLevel', 'residualLevel'],
body: [
'name',
'threats',
Expand Down
Loading