Skip to content

Commit

Permalink
update angular;fix server crashing when navigating to non-existent an…
Browse files Browse the repository at this point in the history
…alysis/model
  • Loading branch information
chinook25 committed Jan 9, 2020
1 parent 92b3e3e commit f701efe
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 60 deletions.
5 changes: 3 additions & 2 deletions gemtc.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ var logger = require('./standalone-app/logger');
var StartupDiagnostics = require('startup-diagnostics')(db, logger, 'GeMTC');

function rightsCallback(response, next, userId, error, workspace) {
if (error) { next(error); }
if (workspace.owner !== userId) {
if (error) {
next(error);
} else if (workspace.owner !== userId) {
response.status(403).send('Insufficient user rights');
} else {
next();
Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@
"devDependencies": {
"@babel/core": "^7.1.2",
"@babel/preset-env": "^7.1.0",
"angular": "~1.6.6",
"angular-animate": "~1.6.6",
"angular-cookies": "~1.6.6",
"angular": "~1.7.9",
"angular-animate": "~1.7.9",
"angular-cookies": "~1.7.9",
"angular-foundation-6": "drugis/angular-foundation-6#master",
"angular-mocks": "~1.6.6",
"angular-mocks": "~1.7.9",
"angular-patavi-client": "drugis/angular-patavi-client#2.1.1",
"angular-resource": "~1.6.6",
"angular-sanitize": "~1.6.0",
"angular-touch": "~1.6.6",
"angular-resource": "~1.7.9",
"angular-sanitize": "~1.7.9",
"angular-touch": "~1.7.9",
"angular-ui-router": "~1.0.5",
"angular1-templateurl-loader": "^1.0.0",
"babel-loader": "^8.0.4",
Expand All @@ -64,7 +64,7 @@
"clipboard": "~2.0.1",
"css-loader": "^1.0.0",
"d3": "~3.5.6",
"error-reporting": "drugis/error-reporting#~1.3.1",
"error-reporting": "drugis/error-reporting#~1.3.3",
"export-directive": "drugis/export-directive#1.2.4",
"file-loader": "^1.1.11",
"font-awesome": "~4.3.0",
Expand Down
24 changes: 15 additions & 9 deletions standalone-app/analysisRepository.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ function get(analysisId, callback) {
if (error) {
logger.error('error at db.get, error: ' + error);
callback(error);
} else if (result.rowCount === 0) {
logger.error('error at db.get, error: requested analysis not found');
callback({
message: 'Analysis not found',
statusCode: 404
});
} else {
callback(error, rowMapper(result.rows[0]));
}
Expand Down Expand Up @@ -106,16 +112,16 @@ function deleteAnalysis(analysisId, callback) {
}

function setProblem(analysisId, problem, callback) {
logger.debug('setProblem');
logger.debug('setProblem');
db.query('UPDATE analysis SET problem = $1 WHERE id = $2', [problem, analysisId],
(error) => {
if (error) {
logger.error('error occured while setting the problem: ' + error);
callback(error);
} else {
callback();
}
});
(error) => {
if (error) {
logger.error('error occured while setting the problem: ' + error);
callback(error);
} else {
callback();
}
});
}

module.exports = {
Expand Down
36 changes: 19 additions & 17 deletions standalone-app/modelRepository.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ var columnString = 'title, analysisId, linearModel,' +
' outcome_scale, heterogeneity_prior, regressor,' +
' sensitivity, archived, archived_on';


function mapModelRow(modelRow) {
var model = {
id: modelRow.id,
Expand Down Expand Up @@ -57,22 +56,22 @@ function createModel(analysisId, newModel, callback) {
db.query(
' INSERT INTO model (' + columnString + ') ' +
' VALUES($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15) RETURNING id', [
newModel.title,
analysisId,
newModel.linearModel,
newModel.burnInIterations,
newModel.inferenceIterations,
newModel.thinningFactor,
newModel.modelType,
newModel.likelihood,
newModel.link,
newModel.outcomeScale,
newModel.heterogeneityPrior,
newModel.regressor,
newModel.sensitivity,
false, // is archived
null // archived on
],
newModel.title,
analysisId,
newModel.linearModel,
newModel.burnInIterations,
newModel.inferenceIterations,
newModel.thinningFactor,
newModel.modelType,
newModel.likelihood,
newModel.link,
newModel.outcomeScale,
newModel.heterogeneityPrior,
newModel.regressor,
newModel.sensitivity,
false, // is archived
null // archived on
],
function(error, result) {
if (error) {
logger.error('error creating model, error: ' + error);
Expand All @@ -91,6 +90,9 @@ function getModel(modelId, callback) {
if (error) {
logger.error('error retrieving model, error: ' + error);
callback(error);
} else if (result.rowCount === 0) {
logger.error('error retrieving model, error: requested model not found');
callback('Model not found');
} else {
logger.debug('ModelRepository.getModel return model = ' + JSON.stringify(result.rows[0]));
callback(error, mapModelRow(result.rows[0]));
Expand Down
58 changes: 34 additions & 24 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -898,40 +898,45 @@ angular-animate@~1.6.6:
resolved "https://registry.yarnpkg.com/angular-animate/-/angular-animate-1.6.10.tgz#c520f6d341370e34e0a62060c99bcf47b7d7db8c"
integrity sha512-RU9ZJbTspq0W0x675H5k1DeSgKbAFfp2aiYoNGdlD+wQNKvwwMR5ho+EkDKkx9zE02a5goe8Z6EhhYPQSff9dA==

angular-cookies@~1.6.6:
version "1.6.10"
resolved "https://registry.yarnpkg.com/angular-cookies/-/angular-cookies-1.6.10.tgz#20a014d501242e2edacd21397c0e5480e08dee00"
integrity sha512-ADfbqXLhwcaecAiWIaxpl8XWFJgWsrDl/ksSEkYm5dSoXHYlj3HKlAhPbjBv/foYS7pdI0apmSGHWrBPqdjF/g==
angular-animate@~1.7.9:
version "1.7.9"
resolved "https://registry.yarnpkg.com/angular-animate/-/angular-animate-1.7.9.tgz#a397f82434c1e7ed5b7a298fa70fc3de989a6785"
integrity sha512-fV+AISy/HTzurQH2ngsJg+lLIvfu0ahc1h4AYKauaXVw97rZc2k4iUA1bMstiEyClsdayQX568kjQc1NK+oYhw==

angular-cookies@~1.7.9:
version "1.7.9"
resolved "https://registry.yarnpkg.com/angular-cookies/-/angular-cookies-1.7.9.tgz#0f0cd2a9d1c81e5b8d6c6711d41f0909f9d0b8e0"
integrity sha512-3eRq/aPrtCZKDWQnc3nW3sFoMbLiHkCkyDF2O9u7VXnqvVsUPaipk5R1ZqahgcSQHQrN/F5IU4T4nrz52qAZmA==

angular-foundation-6@drugis/angular-foundation-6#master:
version "0.11.16"
resolved "https://codeload.github.com/drugis/angular-foundation-6/tar.gz/6ddb6a90f17a7263020cea5ef3b9bc14be84a569"

angular-mocks@~1.6.6:
version "1.6.10"
resolved "https://registry.yarnpkg.com/angular-mocks/-/angular-mocks-1.6.10.tgz#6a139e43c461d0c9a5a1acebc91e63db16031176"
integrity sha512-1865/NmqHNogibNoglY1MGBjx882iu2hI46BBhYDWyz0C4TDM5ER8H8SnYwQKUUG4RXMDsJizszEQ2BEoYKV9w==
angular-mocks@~1.7.9:
version "1.7.9"
resolved "https://registry.yarnpkg.com/angular-mocks/-/angular-mocks-1.7.9.tgz#0a3b7e28b9a493b4e3010ed2b0f69a68e9b4f79b"
integrity sha512-LQRqqiV3sZ7NTHBnNmLT0bXtE5e81t97+hkJ56oU0k3dqKv1s6F+nBWRlOVzqHWPGFOiPS8ZJVdrS8DFzHyNIA==

angular-patavi-client@drugis/angular-patavi-client#2.1.1:
version "2.1.1"
resolved "https://codeload.github.com/drugis/angular-patavi-client/tar.gz/7a234c36a63cdd74f2e54d6d15b16e71b841348b"
dependencies:
angular "~1.6.6"

angular-resource@~1.6.6:
version "1.6.10"
resolved "https://registry.yarnpkg.com/angular-resource/-/angular-resource-1.6.10.tgz#28c1834e9fa623467d2f9894716a4e6c7e077459"
integrity sha512-jrYXUGPtpv/lTBlYZ6HZefIV6Lb+6e1HUavBPg9TSzW7s4zYRBWzMj6vMg8gZzVjWdH/nYBWfilV0qfnmZSI+A==
angular-resource@~1.7.9:
version "1.7.9"
resolved "https://registry.yarnpkg.com/angular-resource/-/angular-resource-1.7.9.tgz#fa53623fae2c60debe2410d692447dcb0ba02396"
integrity sha512-rXXhCE2qT31Pn4Sl+2XL+ntv4zxnA2OzY+clCl8/pOp/s/gIzxpQlEtXipo3QK8Qur3glbIkeF/bJw+gjVAdUw==

angular-sanitize@~1.6.0:
version "1.6.10"
resolved "https://registry.yarnpkg.com/angular-sanitize/-/angular-sanitize-1.6.10.tgz#635a362afb2dd040179f17d3a5455962b2c1918f"
integrity sha512-01i1Xoq9ykUrsoYQMSB6dWZmPp9Df5hfCqMAGGzJBWZ7L2WY0OtUphdI0YvR8ZF9lAsWtGNtsEFilObjq5nTgQ==
angular-sanitize@~1.7.9:
version "1.7.9"
resolved "https://registry.yarnpkg.com/angular-sanitize/-/angular-sanitize-1.7.9.tgz#6b4d5e826abdabd352b13a7c65c8c74daf6a7b15"
integrity sha512-nB/xe7JQWF9nLvhHommAICQ3eWrfRETo0EVGFESi952CDzDa+GAJ/2BFBNw44QqQPxj1Xua/uYKrbLsOGWZdbQ==

angular-touch@~1.6.6:
version "1.6.10"
resolved "https://registry.yarnpkg.com/angular-touch/-/angular-touch-1.6.10.tgz#bd51fa48bd2c2c477fea776817535601e6340c2f"
integrity sha512-ZblW46aN5s7OOihpXDa0qzrJXdaVGE44jc+a8e1NpOjhCKZDQze+nBHh3xw3toAF1BIfDJIkRstadk4h2R/uLg==
angular-touch@~1.7.9:
version "1.7.9"
resolved "https://registry.yarnpkg.com/angular-touch/-/angular-touch-1.7.9.tgz#a85375407f9f2fb20442cb3ded48937c558d9267"
integrity sha512-qNKWUnecfah4mZxG7GM96AemhXyOVcE03kg3SrWExfmyO/hQNPE50Qqyszb+1UE8GO7WiWOYn1Y5wn9CtOInqA==

angular-ui-router@~1.0.5:
version "1.0.22"
Expand All @@ -952,6 +957,11 @@ angular@~1.6.6:
resolved "https://registry.yarnpkg.com/angular/-/angular-1.6.10.tgz#eed3080a34d29d0f681ff119b18ce294e3f74826"
integrity sha512-PCZ5/hVdvPQiYyH0VwsPjrErPHRcITnaXxhksceOXgtJeesKHLA7KDu4X/yvcAi+1zdGgGF+9pDxkJvghXI9Wg==

angular@~1.7.9:
version "1.7.9"
resolved "https://registry.yarnpkg.com/angular/-/angular-1.7.9.tgz#e52616e8701c17724c3c238cfe4f9446fd570bc4"
integrity sha512-5se7ZpcOtu0MBFlzGv5dsM1quQDoDeUTwZrWjGtTNA7O88cD8TEk5IEKCTDa3uECV9XnvKREVUr7du1ACiWGFQ==

ansi-regex@^2.0.0:
version "2.1.1"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df"
Expand Down Expand Up @@ -2694,11 +2704,11 @@ error-ex@^1.3.1:
dependencies:
is-arrayish "^0.2.1"

error-reporting@drugis/error-reporting#~1.3.1:
version "1.3.1"
resolved "https://codeload.github.com/drugis/error-reporting/tar.gz/3caac291ef38c067379d6e4e7399811900be9200"
error-reporting@drugis/error-reporting#~1.3.3:
version "1.3.3"
resolved "https://codeload.github.com/drugis/error-reporting/tar.gz/a5e776d6ebf0dd9e1bd8ff697ed0c556a8416502"
dependencies:
angular "~1.6.6"
angular "~1.7.9"

es-abstract@^1.12.0, es-abstract@^1.5.1:
version "1.13.0"
Expand Down

0 comments on commit f701efe

Please sign in to comment.