diff --git a/app/js/ajax-utilities.js b/app/js/ajax-utilities.js index d5f445eb..7b32c485 100644 --- a/app/js/ajax-utilities.js +++ b/app/js/ajax-utilities.js @@ -128,8 +128,8 @@ exports.sendEmail = function(req, res){ var attachment = fileContent == "no-data" ? false : true; let mailOptions = { // should be replaced with real recipient's account - //to: 'replyto.lcsb.gitlab+minerva-core-499-3hxqgkf3oh3yq2zb9veolqjo6-issue@gmail.com', - to: "newteditor@gmail.com", + to: 'replyto.lcsb.gitlab+minerva-core-499-3hxqgkf3oh3yq2zb9veolqjo6-issue@gmail.com', + //to: "newteditor@gmail.com", cc: 'newteditor@gmail.com', subject: "Error Report From Newt", text: req.body.message, diff --git a/app/js/app-menu.js b/app/js/app-menu.js index 9c6bf08e..89d5dc01 100644 --- a/app/js/app-menu.js +++ b/app/js/app-menu.js @@ -648,6 +648,33 @@ module.exports = function() { } }); + $("#gpml-file-input").change(function () { + + var chiseInstance = appUtilities.getActiveChiseInstance(); + var cy = appUtilities.getActiveCy(); + if ($(this).val() != "") { + var file = this.files[0]; + appUtilities.setFileContent(file.name); + chiseInstance.loadGpml(file, success = function(data){ + if (cy.elements().length !== 0) { + promptConfirmationView.render(function () { + chiseInstance.loadSBGNMLText(data.message, false, file.name, cy); + }); + } + else { + chiseInstance.loadSBGNMLText(data.message, false, file.name, cy); + } + }, + error = function(data){ + promptFileConversionErrorView.render(); + document.getElementById("file-conversion-error-message").innerText = "Conversion service is not available!"; + + }); + + $(this).val(""); + } + }); + $("#simple-af-file-input").change(function () { var chiseInstance = appUtilities.getActiveChiseInstance(); @@ -791,6 +818,18 @@ module.exports = function() { // clear urlParams from scratch appUtilities.setScratch(cy, 'urlParams', undefined); + + // get applyLayout value before map properties are filtered, apply layout + // isn't really a map property so its not added to sbgnviz + // validMapProperties + const applyLayout = urlParams.applyLayoutOnURL === "true"; + const fromURL = urlParams.url !== undefined; + + if (urlParams.compoundPadding) { + const compoundPadding = urlParams.compoundPadding; + chiseInstance.setCompoundPadding(Number(compoundPadding)); + } + // filter map properties from the url parameters // get applyLayout value before map properties are filtered, apply layout @@ -829,6 +868,24 @@ module.exports = function() { appUtilities.applyMapColorScheme(urlParams.mapColorScheme, currentGeneralProperties.mapColorSchemeStyle, appUtilities.colorSchemeInspectorView); } + if (fromURL && applyLayout) { + let currentLayoutProperties = appUtilities.getScratch(cy, 'currentLayoutProperties'); + + // Below is copied from sbgnviz.graphUtilities.updateGraph + let preferences = {}; + if(cy.nodes().length > 3000 || cy.edges().length > 3000) { + preferences.quality = "draft"; + } + preferences.animate = false; + preferences.randomize = true; + preferences = $.extend({}, currentLayoutProperties, preferences); + layoutPropertiesView.applyLayout(preferences); + } + + if (urlParams.mapColorScheme) { + appUtilities.applyMapColorScheme(urlParams.mapColorScheme, currentGeneralProperties.mapColorSchemeStyle, appUtilities.colorSchemeInspectorView); + } + // merge the map properties coming from url into // the map properties read from file for ( var prop in mapPropsFromUrl ) { diff --git a/app/js/app-utilities.js b/app/js/app-utilities.js index a668ca6b..9269962b 100644 --- a/app/js/app-utilities.js +++ b/app/js/app-utilities.js @@ -3067,7 +3067,7 @@ appUtilities.launchWithModelFile = function() { function loadFromURL(filepath, chiseInstance, promptInvalidURLWarning){ chiseInstance.startSpinner('paths-byURL-spinner'); - + var loadCallbackSBGNMLValidity = function (text) { $.ajax({ type: 'post', @@ -3121,7 +3121,6 @@ appUtilities.launchWithModelFile = function() { chiseInstance.showSpinnerText('paths-byURL-spinner') } - if (!data.error && data.response.statusCode == 200 && data.response.body) { $(document).trigger('sbgnvizLoadFromURL', [filename, cyInstance]); const fileContents = data.response.body; @@ -3244,7 +3243,6 @@ appUtilities.launchWithModelFile = function() { error: function(xhr, options, err){ loadCallbackInvalidityWarning(); chiseInstance.endSpinner("paths-byURL-spinner"); - } }); } diff --git a/index.html b/index.html index 7c1e9824..ad026aa7 100644 --- a/index.html +++ b/index.html @@ -521,7 +521,7 @@ - +