Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ def convert_authors_to_object_format(apps, schema_editor):
logger.debug("Dataset %s already in new format, skipping", dataset.uuid)
skipped_count += 1
continue

# Convert string authors to object format
if isinstance(current_authors[0], str):
new_authors = []
Expand Down Expand Up @@ -126,7 +125,6 @@ def reverse_authors_to_string_format(apps, schema_editor):
if isinstance(current_authors[0], dict) and "name" in current_authors[0]:
# Convert object authors back to string format
string_authors = [author["name"] for author in current_authors]

# Update the dataset
dataset.authors = json.dumps(string_authors)
dataset.save(update_fields=["authors"])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class DatasetGetSerializer(serializers.ModelSerializer[Dataset]):
created_at = serializers.DateTimeField(format="%m/%d/%Y %H:%M:%S", read_only=True)
is_shared_with_me = serializers.SerializerMethodField()
is_owner = serializers.SerializerMethodField()
is_public = serializers.BooleanField(default=False)
status_display = serializers.CharField(source="get_status_display", read_only=True)
shared_users = serializers.SerializerMethodField()
owner_name = serializers.SerializerMethodField()
Expand Down Expand Up @@ -44,6 +45,10 @@ def get_is_owner(self, obj):
return obj.owner == request.user
return False

def get_is_public(self, obj):
"""Check if the dataset is public."""
return obj.is_public
Comment on lines +48 to +50
Copy link

Copilot AI Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The get_is_public method is redundant. Since is_public is already defined as a BooleanField on line 16, it will automatically serialize the model's is_public attribute. The get_is_public method (lines 48-50) simply returns the same value without any transformation. This method should be removed, and the field declaration on line 16 is sufficient.

Suggested change
def get_is_public(self, obj):
"""Check if the dataset is public."""
return obj.is_public

Copilot uses AI. Check for mistakes.

def get_shared_users(self, obj):
"""Get users and groups who have access to this dataset."""
request = self.context.get("request")
Expand Down
18 changes: 18 additions & 0 deletions gateway/sds_gateway/static/css/components.css
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@
box-shadow: none;
}

/* Ensure textarea also has proper padding when disabled */
textarea.form-control[readonly],
textarea.form-control:disabled,
textarea.form-control-plaintext {
padding: 0.75rem 1rem;
}

/* Author management styling */
.author-item {
transition: all 0.3s ease;
Expand Down Expand Up @@ -160,6 +167,12 @@
opacity: 0.7;
}

/* Disabled state styling */
.disabled-element {
opacity: 0.5;
pointer-events: none;
}

/* Authors management styling */
.author-item {
transition: all 0.2s ease;
Expand Down Expand Up @@ -1092,6 +1105,11 @@ body {
padding: 1.25rem;
}

.disable-events {
pointer-events: none;
cursor: not-allowed;
}

.display-block {
display: block;
}
Expand Down
22 changes: 17 additions & 5 deletions gateway/sds_gateway/static/js/actions/DetailsActionManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,9 @@ class DetailsActionManager {
".dataset-details-description",
datasetData.description || "No description provided",
);
this.updateElementText(
modal,
".dataset-details-status",
datasetData.status || "Unknown",
);
// Update status as badge
this.updateStatusBadge(modal, datasetData.status);

this.updateElementText(
modal,
".dataset-details-created",
Expand Down Expand Up @@ -306,6 +304,20 @@ class DetailsActionManager {
}
}

/**
* Update status badge
* @param {Element} modal - Modal element
* @param {string} status - Status value ('draft' or 'final')
*/
updateStatusBadge(modal, status) {
const statusContainer = modal.querySelector(".dataset-details-status");
const statusText = status[0].toUpperCase() + status.slice(1);
const statusClass = status === "final" ? "success" : "secondary";
if (statusContainer) {
statusContainer.innerHTML = `<span class="badge bg-${statusClass}">${statusText}</span>`;
}
}
Comment on lines +312 to +319
Copy link

Copilot AI Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The updateStatusBadge method will throw a runtime error if status is null, undefined, or an empty string, because it attempts to access status[0] and call status.slice(1) without validation. Add a check for valid status value before string manipulation.

Suggested fix:

updateStatusBadge(modal, status) {
    const statusContainer = modal.querySelector(".dataset-details-status");
    if (!status || typeof status !== 'string') {
        if (statusContainer) {
            statusContainer.innerHTML = `<span class="badge bg-secondary">Unknown</span>`;
        }
        return;
    }
    const statusText = status[0].toUpperCase() + status.slice(1);
    const statusClass = status === "final" ? "success" : "secondary";
    if (statusContainer) {
        statusContainer.innerHTML = `<span class="badge bg-${statusClass}">${statusText}</span>`;
    }
}

Copilot uses AI. Check for mistakes.

/**
* Set up UUID copy button functionality
* @param {Element} modal - Modal element
Expand Down
Loading