Skip to content

Commit 4ce43a9

Browse files
committed
linting
1 parent 8bdba89 commit 4ce43a9

12 files changed

Lines changed: 282 additions & 253 deletions

File tree

gateway/sds_gateway/api_methods/serializers/dataset_serializers.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,10 @@ def get_can_edit(self, obj):
164164
).first()
165165

166166
if permission:
167-
return permission.permission_level in [PermissionLevel.CO_OWNER, PermissionLevel.CONTRIBUTOR]
167+
return permission.permission_level in [
168+
PermissionLevel.CO_OWNER,
169+
PermissionLevel.CONTRIBUTOR,
170+
]
168171

169172
return False
170173

gateway/sds_gateway/static/js/actions/ShareActionManager.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,11 +248,14 @@ window.ShareActionManager = class ShareActionManager {
248248
this.closeModal();
249249

250250
// Refresh dataset list
251-
if (window.listRefreshManager && typeof window.listRefreshManager.loadTable === 'function') {
251+
if (
252+
window.listRefreshManager &&
253+
typeof window.listRefreshManager.loadTable === "function"
254+
) {
252255
window.listRefreshManager.loadTable();
253256
} else {
254257
// Fallback: reload the page if listRefreshManager is not available
255-
console.warn('listRefreshManager not available, reloading page');
258+
console.warn("listRefreshManager not available, reloading page");
256259
window.location.reload();
257260
}
258261
} else {

gateway/sds_gateway/static/js/actions/VersioningActionManager.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,14 @@ class VersioningActionManager {
3535
if (versionCreationButton.dataset.versionSetup === "true") {
3636
return;
3737
}
38-
38+
3939
versionCreationButton.dataset.versionSetup = "true";
4040
versionCreationButton.addEventListener("click", (event) =>
41-
this.handleVersionCreation(event, versionCreationButton, copySharedUsersCheckbox),
41+
this.handleVersionCreation(
42+
event,
43+
versionCreationButton,
44+
copySharedUsersCheckbox,
45+
),
4246
);
4347
}
4448
}
@@ -70,20 +74,23 @@ class VersioningActionManager {
7074
if (response.success) {
7175
const modalEl = document.getElementById(this.modalId);
7276
const onHidden = () => {
73-
modalEl.removeEventListener('hidden.bs.modal', onHidden);
77+
modalEl.removeEventListener("hidden.bs.modal", onHidden);
7478
window.DOMUtils.showAlert(
7579
`Dataset version updated to v${response.version} successfully`,
7680
"success",
7781
);
78-
if (window.listRefreshManager && typeof window.listRefreshManager.loadTable === 'function') {
82+
if (
83+
window.listRefreshManager &&
84+
typeof window.listRefreshManager.loadTable === "function"
85+
) {
7986
window.listRefreshManager.loadTable();
8087
} else {
81-
console.warn('listRefreshManager not available, reloading page');
88+
console.warn("listRefreshManager not available, reloading page");
8289
window.location.reload();
8390
}
8491
};
8592
if (modalEl) {
86-
modalEl.addEventListener('hidden.bs.modal', onHidden);
93+
modalEl.addEventListener("hidden.bs.modal", onHidden);
8794
}
8895
window.DOMUtils.closeModal(this.modalId);
8996
if (!modalEl) {

gateway/sds_gateway/static/js/core/DOMUtils.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,12 @@ class DOMUtils {
194194

195195
// Check if modal instance already exists
196196
let bootstrapModal = bootstrap.Modal.getInstance(modal);
197-
197+
198198
// If instance exists but is in a bad state (no _config), dispose and recreate
199-
if (bootstrapModal && (!bootstrapModal._config || !bootstrapModal._config.backdrop)) {
199+
if (
200+
bootstrapModal &&
201+
(!bootstrapModal._config || !bootstrapModal._config.backdrop)
202+
) {
200203
try {
201204
bootstrapModal.dispose();
202205
bootstrapModal = null;
@@ -205,7 +208,7 @@ class DOMUtils {
205208
bootstrapModal = null;
206209
}
207210
}
208-
211+
209212
// If no instance exists, create one with default config
210213
if (!bootstrapModal) {
211214
bootstrapModal = new bootstrap.Modal(modal, {
@@ -214,7 +217,7 @@ class DOMUtils {
214217
focus: true,
215218
});
216219
}
217-
220+
218221
bootstrapModal.show();
219222
}
220223

gateway/sds_gateway/static/js/core/PageLifecycleManager.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ class PageLifecycleManager {
270270
*/
271271
initializeDatasetModals() {
272272
// Pre-initialize all modals on the page with proper config to prevent Bootstrap auto-initialization errors
273-
const allModals = document.querySelectorAll('.modal');
273+
const allModals = document.querySelectorAll(".modal");
274274
for (const modal of allModals) {
275275
if (window.bootstrap) {
276276
// Dispose any existing instance that might be in a bad state
@@ -280,10 +280,10 @@ class PageLifecycleManager {
280280
existingInstance.dispose();
281281
} catch (e) {
282282
// If disposal fails, the instance is already broken - continue
283-
console.warn('Failed to dispose modal instance:', e);
283+
console.warn("Failed to dispose modal instance:", e);
284284
}
285285
}
286-
286+
287287
// Create a new instance with proper config
288288
new bootstrap.Modal(modal, {
289289
backdrop: true,
@@ -500,14 +500,18 @@ class PageLifecycleManager {
500500
// initializeDatasetModals() so there is no gap.
501501

502502
// Clear manager references from modal elements so re-init creates fresh managers
503-
const datasetModals = document.querySelectorAll(".modal[data-item-type='dataset']");
503+
const datasetModals = document.querySelectorAll(
504+
".modal[data-item-type='dataset']",
505+
);
504506
for (const modal of datasetModals) {
505507
delete modal.shareActionManager;
506508
delete modal.versioningActionManager;
507509
delete modal.downloadActionManager;
508510
delete modal.detailsActionManager;
509511
}
510-
const captureModals = document.querySelectorAll(".modal[data-item-type='capture']");
512+
const captureModals = document.querySelectorAll(
513+
".modal[data-item-type='capture']",
514+
);
511515
for (const modal of captureModals) {
512516
delete modal.shareActionManager;
513517
delete modal.downloadActionManager;

gateway/sds_gateway/static/js/core/__tests__/DOMUtils.test.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,9 +1204,7 @@ describe("DOMUtils", () => {
12041204
const existingInstance = {
12051205
dispose: jest.fn(),
12061206
};
1207-
global.bootstrap.Dropdown.getInstance = jest.fn(
1208-
() => existingInstance,
1209-
);
1207+
global.bootstrap.Dropdown.getInstance = jest.fn(() => existingInstance);
12101208

12111209
domUtils.initializeListDropdowns();
12121210

gateway/sds_gateway/static/js/core/__tests__/PageLifecycleManager.test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,9 @@ describe("PageLifecycleManager", () => {
274274
});
275275

276276
// Mock action manager classes
277-
global.window.ShareActionManager = jest.fn().mockImplementation(() => ({}));
277+
global.window.ShareActionManager = jest
278+
.fn()
279+
.mockImplementation(() => ({}));
278280
global.window.VersioningActionManager = jest
279281
.fn()
280282
.mockImplementation(() => ({}));

gateway/sds_gateway/templates/users/components/dataset_list_modals.html

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
Context: page_obj (paginated dataset list)
55
{% endcomment %}
66
{% for dataset in page_obj %}
7-
{% include "users/partials/dataset_details_modal.html" with dataset=dataset %}
8-
{% include "users/partials/web_download_modal.html" with dataset=dataset %}
9-
{% include "users/partials/share_modal.html" with item=dataset item_type="dataset" %}
10-
{% include "users/partials/sdk_download_modal.html" with dataset=dataset %}
11-
{% if dataset.is_owner or dataset.permission_level == 'co-owner' %}
12-
{% include "users/partials/dataset_version_control.html" with dataset=dataset %}
13-
{% if not dataset.dataset.status == 'final' or not dataset.is_public %}
14-
{% include "users/partials/publish_dataset_modal.html" with dataset=dataset %}
7+
{% include "users/partials/dataset_details_modal.html" with dataset=dataset %}
8+
{% include "users/partials/web_download_modal.html" with dataset=dataset %}
9+
{% include "users/partials/share_modal.html" with item=dataset item_type="dataset" %}
10+
{% include "users/partials/sdk_download_modal.html" with dataset=dataset %}
11+
{% if dataset.is_owner or dataset.permission_level == 'co-owner' %}
12+
{% include "users/partials/dataset_version_control.html" with dataset=dataset %}
13+
{% if not dataset.dataset.status == 'final' or not dataset.is_public %}
14+
{% include "users/partials/publish_dataset_modal.html" with dataset=dataset %}
15+
{% endif %}
1516
{% endif %}
16-
{% endif %}
1717
{% endfor %}

0 commit comments

Comments
 (0)