Skip to content

Commit

Permalink
Merge branch 'main' into move-thunor-core
Browse files Browse the repository at this point in the history
  • Loading branch information
alubbock authored Sep 4, 2024
2 parents a245f04 + 81e7a1c commit f2b931a
Show file tree
Hide file tree
Showing 18 changed files with 130 additions and 148 deletions.
12 changes: 2 additions & 10 deletions thunorweb/templates/base-inner.html
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,8 @@
</div>
<div class="powered-by">Powered by <i class="fa fa-bolt"></i> Thunor</div>

{% load webpack_loader %}{% get_files 'sentry' 'js' as sentry_js %}
<script src="{{ sentry_js.0.url }}" crossorigin="anonymous"></script>

<script>{% load thunorweb_tags %}Sentry.init({
dsn: '{% sentry_public_dsn %}',
environment: '{% sentry_environment %}', release: '{% thunorweb_version %}'
});
{% if user.is_authenticated %}Sentry.setUser({email: '{{ user.email }}',
id: '{{ user.id }}'});{% endif %}</script>

{% load webpack_loader %}
{% include "sentry_init.html" %}
{% render_bundle 'vendor' 'js' %}
<script>$('.tt').tooltip();
$('.help-link').click(function(e) {
Expand Down
10 changes: 2 additions & 8 deletions thunorweb/templates/plotly_plot.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,8 @@
</div>
<div class="powered-by"><i class="fa fa-bolt"></i> Thunor</div>

{% load webpack_loader %}{% get_files 'sentry' 'js' as sentry_js %}
<script src="{{ sentry_js.0.url }}" crossorigin="anonymous"></script>
<script>{% load thunorweb_tags %}Sentry.init({
dsn: '{% sentry_public_dsn %}',
environment: '{% sentry_environment %}', release: '{% thunorweb_version %}'
});
{% if user.is_authenticated %}Sentry.setUser({email: '{{ user.email }}',
id: '{{ user.id }}'});{% endif %}</script>
{% load webpack_loader %}
{% include "sentry_init.html" %}
{% render_bundle 'vendor' 'js' %}
{% render_bundle 'app' 'js' %}
{% render_bundle 'plots' 'js' %}
Expand Down
10 changes: 10 additions & 0 deletions thunorweb/templates/sentry_init.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{% load webpack_loader %}
{% get_files 'sentry' 'js' as sentry_js %}
<script src="{{ sentry_js.0.url }}" crossorigin="anonymous"></script>

<script>{% load thunorweb_tags %}Sentry.init({
dsn: '{% sentry_public_dsn %}',
environment: '{% sentry_environment %}', release: '{% thunorweb_version %}'
});
{% if user.is_authenticated %}Sentry.setUser({email: '{{ user.email }}',
id: '{{ user.id }}'});{% endif %}</script>
1 change: 1 addition & 0 deletions thunorweb/webpack/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ COPY package.json $BUILD_DIR
RUN npm install

COPY webpack.config.js $BUILD_DIR
COPY sentry.js $BUILD_DIR
COPY plotly.js $BUILD_DIR
COPY .bootstraprc $BUILD_DIR
COPY bootstrap-customisations.scss $BUILD_DIR
Expand Down
1 change: 1 addition & 0 deletions thunorweb/webpack/sentry.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "@sentry/browser"
28 changes: 13 additions & 15 deletions thunorweb/webpack/thunorweb/js/dataset.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
"use strict";
import { ajax } from './modules/ajax'
import { ui } from './modules/ui'

var ui = require("./modules/ui"),
ajax = require("./modules/ajax");

var delete_dataset = function() {
const delete_dataset = function() {
ui.loadingModal.show();
$.ajax({type: 'POST',
url: ajax.url("delete_dataset"),
Expand All @@ -19,7 +17,7 @@ var delete_dataset = function() {
dataType: 'json'});
};

var accept_license = function() {
const accept_license = function() {
ui.loadingModal.show();
$.ajax({type: 'POST',
url: ajax.url("accept_license", $('#dataset-id').val()),
Expand All @@ -32,23 +30,23 @@ var accept_license = function() {
};


var dataset = function(showLicense) {
const activate = function(showLicense) {
$('#dataset-name-edit').click(function() {
var datasetName = $('.dataset-name').first().text();
$('#dataset-name').hide();
$('#dataset-rename').show().find("input[name=datasetName]").val(datasetName).select();
});

$('#dataset-rename-cancel').click(function() {
$('#dataset-rename').hide();
$('#dataset-name').show();
$('#dataset-rename').hide();
$('#dataset-name').show();
});

$('#dataset-rename-form').submit(function(e) {
e.preventDefault();
ui.loadingModal.show();
e.preventDefault();
ui.loadingModal.show();

$.ajax({type: 'POST',
$.ajax({type: 'POST',
url: ajax.url("rename_dataset"),
headers: { 'X-CSRFToken': ajax.getCsrfToken() },
data: $(this).serialize(),
Expand Down Expand Up @@ -108,6 +106,6 @@ var dataset = function(showLicense) {
}
};

module.exports = {
activate: dataset
};
export const dataset = {
activate: activate
}
14 changes: 4 additions & 10 deletions thunorweb/webpack/thunorweb/js/dataset_permissions.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
"use strict";
import { ajax } from './modules/ajax'
import { ui } from './modules/ui'

var ui = require("./modules/ui"),
ajax = require("./modules/ajax");

var set_dataset_group_permission = function(dataset_id, group_id, perm_id,
const set_dataset_group_permission = function(dataset_id, group_id, perm_id,
state, $caller) {
ui.loadingModal.show();
$.ajax({type: 'POST',
Expand All @@ -27,7 +25,7 @@ var set_dataset_group_permission = function(dataset_id, group_id, perm_id,
dataType: 'json'});
};

var dataset_permissions = function() {
export const dataset_permissions = function() {
$("input[type=checkbox]").bootstrapSwitch({
'onSwitchChange': function(event, state) {
var $target = $(event.currentTarget);
Expand All @@ -41,7 +39,3 @@ var dataset_permissions = function() {
}
});
};

module.exports = {
activate: dataset_permissions
};
24 changes: 11 additions & 13 deletions thunorweb/webpack/thunorweb/js/home.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
var ajax = require("./modules/ajax"),
datasetTable = require("./modules/dataset_table");
import { ajax } from './modules/ajax'
import { initDatasetTable } from './modules/dataset_table'

var home = function() {
var callbackFn = function (data, type, full, meta) {
return "<a href=\"" + ajax.url("page_view_dataset",
full.id) + "\">" + full.name + "</a>";
};
datasetTable.initDatasetTable(callbackFn);
};

module.exports = {
activate: home
};
export const home = {
activate: function() {
var callbackFn = function (data, type, full, meta) {
return "<a href=\"" + ajax.url("page_view_dataset",
full.id) + "\">" + full.name + "</a>";
};
initDatasetTable(callbackFn);
}
}
7 changes: 2 additions & 5 deletions thunorweb/webpack/thunorweb/js/modules/ajax.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
"use strict";
import { ui } from "./ui"

var ui = require("./ui");

var ajax = (function () {
export const ajax = (function () {
var csrfToken = null;

var getCookie = function (name) {
Expand Down Expand Up @@ -174,4 +172,3 @@ var ajax = (function () {
url: url
}
})();
module.exports = ajax;
12 changes: 4 additions & 8 deletions thunorweb/webpack/thunorweb/js/modules/dataset_table.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
var ajax = require("./ajax"),
util = require("./util");
import { ajax } from './ajax'
import { util } from './util'

var formatISODate = function(data) {
const formatISODate = function(data) {
return data.replace('T', ' ').slice(0, -5) + ' UTC';
};

var initDatasetTable = function(tableRowCallbackFn, loadingCompleteCallbackFn) {
export const initDatasetTable = function(tableRowCallbackFn, loadingCompleteCallbackFn) {
var $tabContent = $(".tab-content");
$tabContent.loadingOverlay("show");

Expand Down Expand Up @@ -63,7 +63,3 @@ var initDatasetTable = function(tableRowCallbackFn, loadingCompleteCallbackFn) {
$this.addClass("active");
});
};

module.exports = {
initDatasetTable: initDatasetTable
};
4 changes: 1 addition & 3 deletions thunorweb/webpack/thunorweb/js/modules/ui.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"use strict";
var ui = (function() {
export const ui = (function() {
var modalBase = $(
'<div class="modal fade" tabindex="-1" role="dialog"' +
' aria-hidden="true" data-success="false">' +
Expand Down Expand Up @@ -160,4 +159,3 @@ var ui = (function() {
loadingModal: loadingModal
}
})();
module.exports = ui;
5 changes: 1 addition & 4 deletions thunorweb/webpack/thunorweb/js/modules/util.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"use strict";

var util = (function() {
export const util = (function() {
var onlyUnique = function (value, index, self) {
return self.indexOf(value) === index;
};
Expand Down Expand Up @@ -197,4 +195,3 @@ var util = (function() {
}
}
})();
module.exports = util;
28 changes: 15 additions & 13 deletions thunorweb/webpack/thunorweb/js/plate_mapper.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
"use strict";

var ui = require('./modules/ui'),
util = require('./modules/util'),
ajax = require('./modules/ajax');
import { ui } from './modules/ui'
import { util } from './modules/util'
import { ajax } from './modules/ajax'
import { tsvParse } from 'd3-dsv'

var Well = function(well) {
if(well === undefined) {
Expand Down Expand Up @@ -372,13 +371,15 @@ PlateMap.prototype = {
}
};

var check_loading = function() {
export { PlateMap }

export const checkLoading = function() {
if(pyHTS.state.plates.length > 0 && pyHTS.state.plates[0] !== "MASTER") {
ui.loadingModal.show();
}
};

var plate_mapper = function () {
const activate = function () {
var setWellSizes = function() {
var numWells = pyHTS.state.plateMap.wells.length;
var $plate = $('#hts-well-plate-inner');
Expand Down Expand Up @@ -1728,8 +1729,7 @@ var plate_mapper = function () {
});

var tsvToJson = function(tsv) {
var d3 = require("d3-dsv");
var rows = d3.tsvParse(tsv);
var rows = tsvParse(tsv);
var rLen = rows.length;
if(rLen !== pyHTS.state.plateMap.wells.length) {
return upErr('File has '+rLen+' wells, but current plate map has '+pyHTS.state.plateMap.wells.length+' wells');
Expand Down Expand Up @@ -1980,8 +1980,10 @@ var plate_mapper = function () {
}
}
};
module.exports = {
activate: plate_mapper,
checkLoading: check_loading,

export const plate_mapper = {
activate: activate,
checkLoading: checkLoading,
PlateMap: PlateMap
};
}

12 changes: 5 additions & 7 deletions thunorweb/webpack/thunorweb/js/plate_upload.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
"use strict";
import { ui } from './modules/ui'
import { ajax } from './modules/ajax'

var ui = require("./modules/ui"),
ajax = require("./modules/ajax");

var plate_upload = function () {
const activate = function () {
var ajaxSettings = {
headers: {"X-CSRFToken": ajax.getCsrfToken()}
};
Expand Down Expand Up @@ -111,6 +109,6 @@ var plate_upload = function () {
}
};

module.exports = {
activate: plate_upload
export const plate_upload = {
activate: activate
};
Loading

0 comments on commit f2b931a

Please sign in to comment.