Skip to content
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
131 changes: 67 additions & 64 deletions gateway/package.json
Original file line number Diff line number Diff line change
@@ -1,66 +1,69 @@
{
"name": "sds_gateway",
"version": "0.0.1",
"devDependencies": {
"@babel/core": "^7.29.7",
"@babel/plugin-transform-runtime": "^7.29.7",
"@babel/preset-env": "^7.29.7",
"@biomejs/biome": "^1.9.4",
"@popperjs/core": "^2.11.8",
"autoprefixer": "^10.5.0",
"babel-jest": "^29.7.0",
"babel-loader": "^9.2.1",
"bootstrap": "^5.3.8",
"css-loader": "^6.11.0",
"fallow": "^2.89.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"mini-css-extract-plugin": "^2.10.2",
"node-sass-tilde-importer": "^1.0.2",
"pixrem": "^5.0.0",
"postcss": "^8.5.15",
"postcss-loader": "^8.2.1",
"postcss-preset-env": "^9.6.0",
"sass": "^1.100.0",
"sass-loader": "^14.2.1",
"webpack": "^5.107.2",
"webpack-bundle-tracker": "^3.2.4",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^5.2.4",
"webpack-merge": "^5.10.0"
},
"dependencies": {
"@babel/runtime": "^7.29.7"
},
"engines": {
"node": "24"
},
"devEngines": {
"runtime": {
"name": "node",
"version": "^24.0",
"onFail": "download"
}
},
"browserslist": ["last 2 versions"],
"babel": {
"presets": ["@babel/preset-env"],
"plugins": ["@babel/plugin-transform-runtime"]
},
"parser": "babel-eslint",
"parserOptions": {
"sourceType": "module",
"allowImportExportEverywhere": true
},
"scripts": {
"dev": "webpack --config webpack/dev.config.js; webpack serve --config webpack/dev.config.js",
"build": "webpack --config webpack/prod.config.js",
"test": "jest --config sds_gateway/static/js/tests-config/jest.config.js",
"test:watch": "jest --config sds_gateway/static/js/tests-config/jest.config.js --watch",
"test:coverage": "jest --config sds_gateway/static/js/tests-config/jest.config.js --coverage",
"test:ci": "jest --config sds_gateway/static/js/tests-config/jest.config.js --ci --coverage --watchAll=false",
"fallow": "fallow --summary",
"fallow:static-js": "node scripts/fallow-static-js-dead-code.cjs"
},
"packageManager": "pnpm@11.5.2"
"name": "sds_gateway",
"version": "0.0.1",
"devDependencies": {
"@babel/core": "^7.29.7",
"@babel/plugin-transform-runtime": "^7.29.7",
"@babel/preset-env": "^7.29.7",
"@biomejs/biome": "^1.9.4",
"@popperjs/core": "^2.11.8",
"autoprefixer": "^10.5.0",
"babel-jest": "^29.7.0",
"babel-loader": "^9.2.1",
"bootstrap": "^5.3.8",
"css-loader": "^6.11.0",
"fallow": "^2.89.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"mini-css-extract-plugin": "^2.10.2",
"node-sass-tilde-importer": "^1.0.2",
"pixrem": "^5.0.0",
"postcss": "^8.5.15",
"postcss-loader": "^8.2.1",
"postcss-preset-env": "^9.6.0",
"sass": "^1.100.0",
"sass-loader": "^14.2.1",
"webpack": "^5.107.2",
"webpack-bundle-tracker": "^3.2.4",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^5.2.4",
"webpack-merge": "^5.10.0"
},
"dependencies": {
"@babel/runtime": "^7.29.7"
},
"engines": {
"node": "24"
},
"devEngines": {
"runtime": {
"name": "node",
"version": "^24.0",
"onFail": "download"
}
},
"browserslist": ["last 2 versions"],
"babel": {
"presets": ["@babel/preset-env"],
"plugins": ["@babel/plugin-transform-runtime"]
},
"parser": "babel-eslint",
"parserOptions": {
"sourceType": "module",
"allowImportExportEverywhere": true
},
"scripts": {
"dev": "webpack --config webpack/dev.config.js; webpack serve --config webpack/dev.config.js",
"build": "webpack --config webpack/prod.config.js",
"test": "jest --config sds_gateway/static/js/tests-config/jest.config.js",
"test:watch": "jest --config sds_gateway/static/js/tests-config/jest.config.js --watch",
"test:coverage": "jest --config sds_gateway/static/js/tests-config/jest.config.js --coverage",
"test:ci": "jest --config sds_gateway/static/js/tests-config/jest.config.js --ci --coverage --watchAll=false",
"fallow": "fallow --summary",
"fallow:static-js": "node scripts/fallow-static-js-dead-code.cjs"
},
"packageManager": "pnpm@11.5.2",
"workspaces": [
"."
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,17 @@ describe("detailsModalConfig", () => {
)
})

test("capture afterInject wires attachUuidCopyButton on modal", () => {
const attachUuidCopyButton = jest.fn()
window.DetailsActionManager = { attachUuidCopyButton }
window.CaptureDetailsModalBehavior = {
afterInject: jest.fn(),
}
const modal = document.getElementById("asset-details-modal")
registry().capture.afterInject({ modal, meta: { uuid: "cap-42" } })
expect(attachUuidCopyButton).toHaveBeenCalledWith(modal, "cap-42")
})

test("dataset afterInject wires uuid copy on modal", () => {
const attachUuidCopyButton = jest.fn()
window.DetailsActionManager = { attachUuidCopyButton }
Expand Down
6 changes: 6 additions & 0 deletions gateway/sds_gateway/static/js/constants/detailsModalConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@
if (window.CaptureDetailsModalBehavior?.afterInject) {
window.CaptureDetailsModalBehavior.afterInject(ctx)
}
if (window.DetailsActionManager?.attachUuidCopyButton) {
window.DetailsActionManager.attachUuidCopyButton(
ctx.modal,
ctx.meta?.uuid,
)
}
Comment thread
lucaspar marked this conversation as resolved.
},
loadingTitle: "Loading capture details...",
}
Expand Down
1 change: 1 addition & 0 deletions gateway/sds_gateway/templates/users/capture_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ <h2 class="accordion-header" id="headingDate">
<script src="{% static 'js/actions/CaptureReindexingManager.js' %}"></script>
<script src="{% static 'js/actions/AssetDeletionManager.js' %}"></script>
<script src="{% static 'js/actions/CaptureListSelectionManager.js' %}"></script>
<script src="{% static 'js/actions/DetailsActionManager.js' %}"></script>
<script src="{% static 'js/constants/detailsModalConfig.js' %}"></script>
<script src="{% static 'js/visualizations/visualizationModal.js' %}"></script>
<script src="{% static 'js/constants/FileListConfig.js' %}"></script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,19 @@ <h6 class="mb-0 fw-bold">
<span class="fw-medium text-muted">{{ channel_label }}:</span>
<span class="ms-2">{{ channel_value }}</span>
</div>
<div class="mb-2">
<span class="fw-medium text-muted">UUID:</span>
<code class="ms-2">{{ capture_uuid }}</code>
<button type="button"
class="copy-uuid-btn btn btn-link p-0 border-0 ms-2"
data-bs-toggle="tooltip"
data-bs-placement="top"
title="Copy Capture UUID"
data-uuid="{{ capture_uuid }}"
aria-label="Copy capture UUID">
<i class="bi bi-clipboard"></i> Copy UUID
</button>
</div>
</div>
<div class="mb-4">
<div class="d-flex align-items-center mb-3">
Expand Down Expand Up @@ -160,3 +173,17 @@ <h2 class="accordion-header" id="heading-channel-{{ forloop.counter0 }}">
</div>
{% endif %}
<div class="mt-4">{% include "users/components/capture_files_summary_fragment.html" %}</div>
<hr class="my-3" />
<div class="d-flex align-items-center text-muted small">
<i class="bi bi-code-slash me-2"></i>
<span>
<a href="https://sds.crc.nd.edu/sdk/api/captures/"
target="_blank"
rel="noopener"
class="text-decoration-none">SDK Captures API</a>
· <a href="https://sds.crc.nd.edu/sdk/common-workflows/capture-uploads/"
target="_blank"
rel="noopener"
class="text-decoration-none">Upload via SDK</a>
</span>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,21 @@ <h6 class="mb-0">
<label class="fw-bold text-muted mb-0">Dataset Name:</label>
<div class="d-flex align-items-center gap-2">
<p class="mb-0 dataset-details-name">{{ dataset.name }} (v{{ dataset.version }})</p>
<button type="button"
class="copy-uuid-btn btn btn-link p-0 border-0"
data-bs-toggle="tooltip"
data-bs-placement="top"
title="Copy Dataset UUID"
data-uuid="{{ dataset_uuid }}"
aria-label="Copy dataset UUID">
<i class="bi bi-clipboard"></i>
</button>
</div>
</div>
<div class="mb-3">
<label class="fw-bold text-muted">UUID:</label>
<code class="ms-2">{{ dataset_uuid }}</code>
<button type="button"
class="copy-uuid-btn btn btn-link p-0 border-0 ms-2"
data-bs-toggle="tooltip"
data-bs-placement="top"
title="Copy Dataset UUID"
data-uuid="{{ dataset_uuid }}"
aria-label="Copy dataset UUID">
<i class="bi bi-clipboard"></i> Copy UUID
</button>
</div>
<div class="mb-3">
<label class="fw-bold text-muted">Author(s):</label>
<p class="mb-0 dataset-details-author">
Expand Down Expand Up @@ -143,4 +147,18 @@ <h6 class="card-title mb-1">Total Size</h6>
</div>
</div>
</div>
<hr class="my-3" />
<div class="d-flex align-items-center text-muted small">
<i class="bi bi-code-slash me-2"></i>
<span>
<a href="https://sds.crc.nd.edu/sdk/api/datasets/"
target="_blank"
rel="noopener"
class="text-decoration-none">SDK Datasets API</a>
· <a href="https://sds.crc.nd.edu/sdk/common-workflows/dataset-downloads/"
target="_blank"
rel="noopener"
class="text-decoration-none">Download via SDK</a>
</span>
</div>
</div>
34 changes: 33 additions & 1 deletion gateway/sds_gateway/templates/users/file_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@
<div>
<a href="{% url 'users:files' %}?page={{ returning_page|default:1 }}"
class="btn btn-primary mt-3">Back to File List</a>
<div class="alert alert-info d-flex align-items-center my-3" role="alert">
<i class="bi bi-code-slash me-2"></i>
<div>
<a href="https://sds.crc.nd.edu/sdk/api/sds_files/"
class="alert-link"
target="_blank"
rel="noopener">Manage files via the Python SDK</a>.
</div>
</div>
<h2>
File <code>{{ file.name }}</code>
</h2>
Expand All @@ -35,7 +44,18 @@ <h2>
</strong>
</div>
<div class="col-9">
{% if key == "directory" or key == "sum_blake3" or key == "uuid" %}
{% if key == "uuid" %}
<code>{{ value }}</code>
<button type="button"
class="copy-uuid-btn btn btn-link p-0 border-0 ms-2"
data-bs-toggle="tooltip"
data-bs-placement="top"
title="Copy UUID"
data-uuid="{{ value }}"
aria-label="Copy file UUID">
<i class="bi bi-clipboard"></i> Copy UUID
</button>
{% elif key == "directory" or key == "sum_blake3" %}
<code>{{ value }}</code>
{% elif key == "owner" %}
{{ request.user.name }}
Expand All @@ -62,3 +82,15 @@ <h2>
{% endfor %}
</ul>
{% endblock content %}
{% block javascript %}
{{ block.super }}
<script src="{% static 'js/actions/DetailsActionManager.js' %}"></script>
<script>
document.addEventListener("DOMContentLoaded", function() {
var btn = document.querySelector(".copy-uuid-btn");
if (btn && btn.dataset.uuid) {
DetailsActionManager.attachUuidCopyButton(document, btn.dataset.uuid);
}
});
</script>
Comment thread
lucaspar marked this conversation as resolved.
{% endblock javascript %}
15 changes: 14 additions & 1 deletion gateway/sds_gateway/templates/users/files.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<div class="main-content-area">
<div class="container mt-4">
<div class="d-flex justify-content-between align-items-center mb-4">
<h1 class="page-title">Files</h1>
<h1 class="page-title mb-3">Files</h1>
<div class="dropdown">
<button class="btn btn-primary dropdown-toggle"
type="button"
Expand All @@ -66,6 +66,18 @@ <h1 class="page-title">Files</h1>
<i class="material-icons file-icon">description</i> Other Files
</a>
</li>
<li>
<hr class="dropdown-divider" />
</li>
<li>
<a class="dropdown-item"
href="https://sds.crc.nd.edu/sdk/getting-started/"
target="_blank"
rel="noopener">
<i class="bi bi-code-slash"></i> SDK Setup Guide
<span class="text-body-secondary fst-italic">Python</span>
</a>
</li>
</ul>
</div>
</div>
Expand Down Expand Up @@ -303,6 +315,7 @@ <h5 class="modal-title" id="filePreviewModalLabel">File Preview</h5>
{% endblock content %}
{% block javascript %}
{{ block.super }}
<script src="{% static 'js/actions/DetailsActionManager.js' %}"></script>
<script src="{% static 'js/constants/detailsModalConfig.js' %}"></script>
<script src="{% static 'js/share/UserSearchDropdown.js' %}"></script>
<script src="{% static 'js/actions/ShareActionManager.js' %}"></script>
Expand Down
14 changes: 14 additions & 0 deletions gateway/sds_gateway/templates/users/generate_api_key_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,20 @@ <h1 id="generate-api-key-section" class="page-title">Generate an API Key</h1>
<i class="bi bi-key"></i> View API Keys
</a>
</div>
<!-- SDK Documentation Banner -->
<div class="alert alert-info d-flex align-items-center mb-3" role="alert">
<i class="bi bi-code-slash me-2"></i>
<div>
<a href="https://sds.crc.nd.edu/sdk/getting-started/"
class="alert-link"
target="_blank"
rel="noopener">Use your API key with the Python SDK</a>
— see the <a href="https://sds.crc.nd.edu/sdk/faq/#how-to-generate-a-secret-token"
class="alert-link"
target="_blank"
rel="noopener">FAQ for token generation</a>.
</div>
</div>
<hr />
<div class="col-lg-12 mx-auto">
<form method="post" action="{% url 'users:view_api_key' %}">
Expand Down
9 changes: 9 additions & 0 deletions gateway/sds_gateway/templates/users/new_api_key.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ <h2>Your New API Key</h2>
<pre class="api-key-text"><strong>{{ api_key }}</strong></pre>
</div>
<p class="text-danger mt-3">Keep this key safe and secure. You will not be able to view it again.</p>
<div class="alert alert-info d-flex align-items-center my-3" role="alert">
<i class="bi bi-code-slash me-2"></i>
<div>
<a href="https://sds.crc.nd.edu/sdk/getting-started/"
class="alert-link"
target="_blank"
rel="noopener">Next: Set up the Python SDK with this key</a>.
</div>
</div>
<p>
<button type="button"
onclick="window.location.href='{% url 'users:view_api_key' %}'"
Expand Down
Loading