Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
d941f41
fix: webpack version
EstherRocio012 Feb 10, 2026
7a4f466
Merge branch 'main' into edit_metadata
EstherRocio012 Feb 10, 2026
90df4d5
feat: add edit metadata to create and edit dataset template
EstherRocio012 Feb 23, 2026
c4d4364
feat: add edit metadata to dataset list view
EstherRocio012 Feb 23, 2026
c65fc22
feat: add edit metadata to dataset detail view
EstherRocio012 Feb 23, 2026
99efda5
feat: add edit metadata routes
EstherRocio012 Feb 23, 2026
c8320f8
feat: add edit metadata to service logic
EstherRocio012 Feb 23, 2026
eb189ba
feat: tests for edit metadata
EstherRocio012 Feb 23, 2026
d863d88
feat: changes to modify metadata in synchronized dataset in routes
EstherRocio012 Feb 24, 2026
9327c55
feat: changes to modify metadata in synchronized dataset in the view …
EstherRocio012 Feb 24, 2026
48d4ef1
feat: changes to modify metadata in synchronized dataset in the datas…
EstherRocio012 Feb 24, 2026
4b9cb65
feat: changes to modify metadata in synchronized dataset in dataset view
EstherRocio012 Feb 24, 2026
ffed428
feat: changes to modify metadata in synchronized dataset in zenodo se…
EstherRocio012 Feb 24, 2026
992f0b0
feat: changes to modify metadata in synchronized dataset in dataset s…
EstherRocio012 Feb 24, 2026
3f2bc47
feat: tests for edit metadata in synchronized dataset
EstherRocio012 Feb 24, 2026
233b2af
fix: test unitario para zenodo
EstherRocio012 Feb 24, 2026
aee5c4c
fix: allow edit the publication doi
EstherRocio012 Feb 24, 2026
39e2e3e
fix: datasets anonymous in the edit mode
EstherRocio012 Feb 24, 2026
b34eac8
fix: lint formating
EstherRocio012 Feb 24, 2026
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
10 changes: 9 additions & 1 deletion app/modules/dataset/assets/js/stepper.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ function updateDropzoneStatus() {

function get_summary() {
const datasetTypeElement = document.querySelector('input[name="dataset_type"]:checked');
const isAnonymousUpload = datasetTypeElement?.value === "zenodo_anonymous";
const datasetType = datasetTypeElement
? document.querySelector(`label[for="${datasetTypeElement.id}"]`)?.innerText.trim() || "Not selected"
: "Not selected";
Expand Down Expand Up @@ -257,6 +258,11 @@ function get_summary() {
let summaryContent = `
<h3>Summary</h3>
<p><strong>Dataset Type:</strong><br>${datasetType}</p>
${
isAnonymousUpload
? '<div class="alert alert-warning py-3"><strong>Anonymous upload:</strong> enabled.</div>'
: ''
}
<p><strong>Title:</strong> ${title}</p>
<p><strong>Description:</strong> ${description}</p>
<p><strong>Publication Type:</strong> ${publicationType}</p>
Expand All @@ -269,7 +275,9 @@ function get_summary() {
<h4>Authors</h4>
`;

if (authors.length > 0) {
if (isAnonymousUpload) {
summaryContent += '<p><strong>Anonymous:</strong> Enabled. Author details will be hidden in publication.</p>';
} else if (authors.length > 0) {
summaryContent += '<ul>';
authors.forEach((author, index) => {
summaryContent += `
Expand Down
58 changes: 56 additions & 2 deletions app/modules/dataset/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,29 @@
import tempfile
from datetime import datetime

from flask import abort, current_app, jsonify, make_response, redirect, render_template, request, send_file, url_for
from flask import (
abort,
current_app,
flash,
jsonify,
make_response,
redirect,
render_template,
request,
send_file,
url_for,
)
from flask_login import current_user, login_required

from app.modules.apikeys.decorators import require_api_key
from app.modules.dataset import dataset_bp
from app.modules.dataset.decorators import is_dataset_owner
from app.modules.dataset.forms import DataSetForm
from app.modules.dataset.models import DataSet
from app.modules.dataset.models import DataSet, PublicationType
from app.modules.dataset.services import (
AuthorService,
DatasetMetadataUpdateError,
DatasetMetadataValidationError,
DataSetService,
DOIMappingService,
DSDownloadRecordService,
Expand Down Expand Up @@ -118,6 +131,47 @@ def create_dataset():
return render_template("dataset/create_and_edit_dataset.html", form=form)


@dataset_bp.route("/dataset/edit/<int:dataset_id>", methods=["GET", "POST"])
@login_required
def edit_metadata(dataset_id):
dataset = dataset_service.get_or_404(dataset_id)
form = DataSetForm()
if dataset.user_id != current_user.id:
abort(403)

if request.method == "POST":
is_ajax = request.headers.get("X-Requested-With") == "XMLHttpRequest"
try:
dataset_service.update_metadata_from_request(dataset, request.form, zenodo_service=zenodo_service)
if is_ajax:
return jsonify({"message": "Dataset updated successfully"}), 200
flash("Dataset updated successfully!", "success")
except DatasetMetadataValidationError as exc:
if is_ajax:
return jsonify({"message": str(exc)}), 400
flash(str(exc), "danger")
return redirect(url_for("dataset.edit_metadata", dataset_id=dataset_id))
except DatasetMetadataUpdateError as exc:
if is_ajax:
return jsonify({"message": f"Error updating metadata: {exc}"}), 400
flash(f"Error updating metadata: {exc}", "danger")
except Exception as exc:
logger.exception("[EDIT DATASET] Unexpected error updating dataset %s", dataset_id)
if is_ajax:
return jsonify({"message": f"Unexpected error updating metadata: {exc}"}), 400
flash(f"Unexpected error updating metadata: {exc}", "danger")

return redirect(url_for("dataset.list_dataset"))

return render_template(
"dataset/create_and_edit_dataset.html",
dataset=dataset,
is_edit=True,
form=form,
PublicationType=PublicationType,
)


@dataset_bp.route("/datasets/list", methods=["GET"])
@login_required
def list_dataset():
Expand Down
Loading