Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove references to FORMATS setting, re #1380 #1381

Merged
merged 3 commits into from
Oct 25, 2023
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
15 changes: 0 additions & 15 deletions arches_for_science/media/js/afs-formats.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,18 @@ define([
'uuid',
'arches',
'models/tile',
'afs-formats',
'js-cookie',
'templates/views/components/workflows/chemical-analysis-workflow/ca-upload-files-step.htm',
'bindings/uppy'
], function(_, ko, uuid, arches, TileModel, formats, Cookies, uploadFilesStepTemplate) {
], function(_, ko, uuid, arches, TileModel, Cookies, uploadFilesStepTemplate) {
return ko.components.register('ca-upload-files-step', {
viewModel: function(params) {
// TODO: Fix afs-formats.js, loadComponentDependencies was commented out

var self = this;
const physicalThingId = params.projectinfo["select-phys-thing-step"].savedData().physicalThing;
const observationInfo = params.observationinfo['instrument-info'].savedData();

const datasetFileNodeId = "7c486328-d380-11e9-b88e-a4d18cec433a";
const rendererLookup = {
"3526790a-c73d-4558-b29d-98f574c91e61": {name: "Bruker Artax x-ray fluorescence spectrometer", renderer: "xrf-reader", rendererid: "31be40ae-dbe6-4f41-9c13-1964d7d17042"},
"73717b33-1235-44a1-8acb-63c97a5c1157": {name: "Renishaw inVia Raman microscope using a 785 nm laser", renderer: "raman-reader", rendererid: "94fa1720-6773-4f99-b49b-4ea0926b3933"},
"3365c1bf-070d-4a8e-b859-52dec6876c1d": {name: "ASD HiRes FieldSpec4", renderer: "fors-renderer", rendererid: "88dccb59-14e3-4445-8f1b-07f0470b38bb"},
"image": {rendererid: "5e05aa2e-5db0-4922-8938-b4d2b7919733", renderer: "imagereader"},
"pdf": {rendererid: "09dec059-1ee8-4fbd-85dd-c0ab0428aa94", renderer: "pdfreader"},
};
const physThingName = params.projectinfo["select-phys-thing-step"].savedData().physThingName;

this.datasetId = undefined;
Expand Down Expand Up @@ -54,7 +45,6 @@ define([

this.loadingMessage = ko.observable();
this.loading = ko.observable(false);
this.formats = ko.observableArray(Object.values(formats).map(format => {return {"text": format.name, "id": format.id};}));

this.deleteFile = async(file) => {
const fileTile = ko.unwrap(file.tileId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ define([
'models/tile',
], function($, ko, fileInterpretationStepTemplate, arches, uuid, CardComponentViewModel, CardMultiSelectViewModel, WorkbenchComponentViewModel, fileRenderers, Cookies, TileModel) {
function viewModel(params) {
// TODO: Fix afs-formats.js, loadComponentDependencies was commented out

params.configKeys = ['acceptedFiles', 'maxFilesize'];
var self = this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@ define([
'viewmodels/alert-json',
'views/components/iiif-viewer',
'js-cookie',
'afs-formats',
'templates/views/components/workflows/upload-dataset/select-dataset-files-step.htm',
'bindings/dropzone'
], function(ko, koMapping, uuid, arches, resourceUtils, reportUtils, physicalThingUtils, JsonErrorAlertViewModel, IIIFViewerViewmodel, Cookies, formats, selectDatasetFilesStepTemplate) {
], function(ko, koMapping, uuid, arches, resourceUtils, reportUtils, physicalThingUtils, JsonErrorAlertViewModel, IIIFViewerViewmodel, Cookies, selectDatasetFilesStepTemplate) {
return ko.components.register('select-dataset-files-step', {
viewModel: function(params) {
// TODO: Fix afs-formats.js, loadComponentDependencies was commented out

this.buildStrObject = str => {
return {[arches.activeLanguage]: {
Expand Down Expand Up @@ -68,7 +66,6 @@ define([
this.mainMenu = ko.observable(false);
this.files = ko.observableArray([]);
this.uploadFailed = ko.observable(false);
self.formats = ko.observableArray(Object.values(formats).map(format => {return {"text": format.name, "id": format.id};}));
this.initialValue = params.form.savedData() || undefined;
this.snapshot = undefined;
this.loadingMessage = ko.observable();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ define([
'views/components/plugins/file-configuration',
], function($, ko, fileInterpretationStepTemplate, arches, WorkbenchComponentViewModel, fileRenderers) {
function viewModel(params) {
// TODO: Fix afs-formats.js, loadComponentDependencies was commented out

params.configKeys = ['acceptedFiles', 'maxFilesize'];
const datasetInfo = params.datasetInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@ define([
'uuid',
'arches',
'models/tile',
'afs-formats',
'js-cookie',
'templates/views/components/workflows/upload-dataset/upload-files-step.htm',
'bindings/dropzone'
], function(_, ko, uuid, arches, TileModel, formats, Cookies, uploadFilesStepTemplate) {
], function(_, ko, uuid, arches, TileModel, Cookies, uploadFilesStepTemplate) {
return ko.components.register('upload-files-step', {
viewModel: function(params) {
// TODO: Fix afs-formats.js, loadComponentDependencies was commented out

var self = this;
self.uploadFailed = ko.observable(false);
Expand All @@ -36,7 +34,6 @@ define([

this.loadingMessage = ko.observable();
this.loading = ko.observable(false);
this.formats = ko.observableArray(Object.values(formats).map(format => {return {"text": format.name, "id": format.id}}));

this.deleteFile = async(file) => {
const fileTile = ko.unwrap(file.tileId);
Expand Down
12 changes: 0 additions & 12 deletions arches_for_science/templates/javascript.htm
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,4 @@
cloudStorage='{"enabled": {{ project_settings.CLOUD_STORAGE_ENABLED }}}'
></div>

<!-- consumed by media/js/afs-formats.js -->
<div
id="afsFormatData"
style="display: none;"
afsFormats='{{% for format in project_settings.FORMATS %}
"{{ format.id }}": {
"name": "{{ format.name }}",
"id": "{{ format.id }}",
"renderer": "{{ format.renderer }}"
},
{% endfor %}}'
></div>
{% endblock project_modules %}
2 changes: 1 addition & 1 deletion arches_for_science/utils/context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ def project_settings(request):
cloud_storage_enabled = (
settings.STORAGES["default"]["BACKEND"] == "storages.backends.s3boto3.S3Boto3Storage"
) # add additional supported formats as needed
return {"project_settings": {"FORMATS": settings.FORMATS, "CLOUD_STORAGE_ENABLED": "true" if cloud_storage_enabled else "false"}}
return {"project_settings": {"CLOUD_STORAGE_ENABLED": "true" if cloud_storage_enabled else "false"}}
Loading