Skip to content

Commit

Permalink
Merge pull request #3150 from cisagov/za/lint-2737
Browse files Browse the repository at this point in the history
[BUGFIX] Fix failing linter + fix javascript bug (failing js on pages) - [MEOWARD]
  • Loading branch information
abroddrick authored Nov 26, 2024
2 parents b52cad3 + c966fff commit 3a4ba38
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/registrar/assets/js/get-gov.js
Original file line number Diff line number Diff line change
Expand Up @@ -2925,7 +2925,7 @@ document.addEventListener("DOMContentLoaded", () => {
const selectParent = select?.parentElement;
const suborgContainer = document.getElementById("suborganization-container");
const suborgDetailsContainer = document.getElementById("suborganization-container__details");
const subOrgCreateNewOption = document.getElementById("option-to-add-suborg").value
const subOrgCreateNewOption = document.getElementById("option-to-add-suborg")?.value;
// Make sure all crucial page elements exist before proceeding.
// This more or less ensures that we are on the Requesting Entity page, and not elsewhere.
if (!radios || !select || !selectParent || !suborgContainer || !suborgDetailsContainer) return;
Expand Down
9 changes: 7 additions & 2 deletions src/registrar/models/user_portfolio_permission.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
from django.forms import ValidationError
from registrar.models.user_domain_role import UserDomainRole
from registrar.utility.waffle import flag_is_active_for_user
from registrar.models.utility.portfolio_helper import UserPortfolioPermissionChoices, UserPortfolioRoleChoices, DomainRequestPermissionDisplay, MemberPermissionDisplay
from registrar.models.utility.portfolio_helper import (
UserPortfolioPermissionChoices,
UserPortfolioRoleChoices,
DomainRequestPermissionDisplay,
MemberPermissionDisplay,
)
from .utility.time_stamped_model import TimeStampedModel
from django.contrib.postgres.fields import ArrayField

Expand Down Expand Up @@ -115,7 +120,7 @@ def get_domain_request_permission_display(cls, roles, additional_permissions):
UserPortfolioPermissionChoices.VIEW_ALL_REQUESTS,
UserPortfolioPermissionChoices.EDIT_REQUESTS,
]

if all(perm in all_permissions for perm in all_domain_perms):
return DomainRequestPermissionDisplay.VIEWER_REQUESTER
elif UserPortfolioPermissionChoices.VIEW_ALL_REQUESTS in all_permissions:
Expand Down
2 changes: 2 additions & 0 deletions src/registrar/models/utility/portfolio_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class DomainRequestPermissionDisplay(StrEnum):
- VIEWER: "Viewer"
- NONE: "None"
"""

VIEWER_REQUESTER = "Viewer Requester"
VIEWER = "Viewer"
NONE = "None"
Expand All @@ -64,6 +65,7 @@ class MemberPermissionDisplay(StrEnum):
- VIEWER: "Viewer"
- NONE: "None"
"""

MANAGER = "Manager"
VIEWER = "Viewer"
NONE = "None"
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
{% endblock %}

{% block form_fields %}
<input id="option-to-add-suborg" value="Other (enter your suborganization manually)"/>
{% comment %}
Store the other option in a variable to be used by the js function handleRequestingEntity.
Injected into the 'sub_organization' option list.
{% endcomment %}
<input id="option-to-add-suborg" class="display-none" value="Other (enter your suborganization manually)"/>
<fieldset class="usa-fieldset">
<legend>
<h2>Who will use the domain you’re requesting?</h2>
Expand Down
23 changes: 2 additions & 21 deletions src/registrar/utility/csv_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ def annotate_and_retrieve_fields(

# We can infer that if we're passing in annotations,
# we want to grab the result of said annotation.
if computed_fields :
related_table_fields.extend(computed_fields .keys())
if computed_fields:
related_table_fields.extend(computed_fields.keys())

# Get prexisting fields on the model
model_fields = set()
Expand Down Expand Up @@ -263,25 +263,6 @@ def get_annotated_queryset(cls, **kwargs):
def get_model_annotation_dict(cls, **kwargs):
return convert_queryset_to_dict(cls.get_annotated_queryset(**kwargs), is_model=False)

@classmethod
def export_data_to_csv(cls, csv_file, **kwargs):
"""
All domain metadata:
Exports domains of all statuses plus domain managers.
"""
writer = csv.writer(csv_file)
columns = cls.get_columns()
models_dict = cls.get_model_annotation_dict(**kwargs)

# Write to csv file before the write_csv
cls.write_csv_before(writer, **kwargs)

# Write the csv file
rows = cls.write_csv(writer, columns, models_dict)

# Return rows that for easier parsing and testing
return rows

@classmethod
def write_csv(
cls,
Expand Down
1 change: 1 addition & 0 deletions src/registrar/utility/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class DefaultUserValues(StrEnum):
- SYSTEM: "System" <= Default username
- UNRETRIEVED: "Unretrieved" <= Default email state
"""

HELP_EMAIL = "[email protected]"
SYSTEM = "System"
UNRETRIEVED = "Unretrieved"
Expand Down
2 changes: 0 additions & 2 deletions src/registrar/views/portfolio_members_json.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from django.http import JsonResponse
from django.core.paginator import Paginator
from django.db.models import Value, F, CharField, TextField, Q, Case, When, OuterRef, Subquery
from django.db.models.expressions import Func
from django.db.models.functions import Cast, Coalesce, Concat
from django.contrib.postgres.aggregates import ArrayAgg
from django.urls import reverse
Expand Down Expand Up @@ -214,4 +213,3 @@ def serialize_members(self, request, portfolio, item, user):
"svg_icon": ("visibility" if view_only else "settings"),
}
return member_json

0 comments on commit 3a4ba38

Please sign in to comment.