From 243022ed3abddbeab8573e5ac6f590ed6753623a Mon Sep 17 00:00:00 2001 From: Taras Mankovski Date: Sat, 24 Sep 2016 11:27:09 -0700 Subject: [PATCH 1/8] Upgraded EmberCLI to 2.8.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f83d6d6b2c..9fefea7a4e 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "broccoli-serviceworker": "0.1.1", "ember-ajax": "2.5.1", "ember-browserify": "^1.1.12", - "ember-cli": "^2.7.0", + "ember-cli": "^2.8.0", "ember-cli-active-link-wrapper": "0.3.0", "ember-cli-app-version": "^2.0.0", "ember-cli-babel": "^5.1.6", From 870975a93e5892553f615c2163babebb0e6d506b Mon Sep 17 00:00:00 2001 From: Taras Mankovski Date: Sat, 24 Sep 2016 14:15:19 -0700 Subject: [PATCH 2/8] Upgraded to Ember 2.8 --- bower.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bower.json b/bower.json index cb73d7a2f4..29cd73b5f5 100644 --- a/bower.json +++ b/bower.json @@ -3,7 +3,7 @@ "dependencies": { "JsBarcode": "https://github.com/HospitalRun/JsBarcode.git", "bootstrap": "~3.3.5", - "ember": "~2.7.0", + "ember": "~2.8.0", "ember-cli-shims": "0.1.1", "ember-qunit-notifications": "0.1.0", "filer.js": "https://github.com/ebidel/filer.js.git#~0.4.3", diff --git a/package.json b/package.json index 9fefea7a4e..18c23eddfe 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "ember-load-initializers": "^0.5.1", "ember-pouch": "4.0.1", "ember-radio-buttons": "^4.0.1", - "ember-rapid-forms": "1.0.0-beta7", + "ember-rapid-forms": "GCorbel/ember-rapid-forms#26229804a2c430bbdf1ffb6bab8fb53af17bb3a4", "ember-resolver": "^2.0.3", "ember-select-list": "0.9.5", "ember-simple-auth": "^1.1.0", From 2b15be2fc3c9d35c5c4965b959a29f9e85f0512d Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Thu, 29 Sep 2016 12:13:34 -0400 Subject: [PATCH 3/8] Updated to changes made between ember-cli 2.7 and 2.8 --- bower.json | 1 - package.json | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/bower.json b/bower.json index 59c51c00cf..efad648d4c 100644 --- a/bower.json +++ b/bower.json @@ -5,7 +5,6 @@ "bootstrap": "~3.3.5", "ember": "~2.8.0", "ember-cli-shims": "0.1.1", - "ember-qunit-notifications": "0.1.0", "filer.js": "https://github.com/ebidel/filer.js.git#~0.4.3", "idb.filesystem": "https://github.com/ebidel/idb.filesystem.js.git#~0.0.6", "moment": "~2.10.5", diff --git a/package.json b/package.json index c378b1c8fe..16f443841c 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "ember-cli-template-lint": "0.4.12", "ember-cli-test-loader": "^1.1.0", "ember-cli-uglify": "^1.2.0", - "ember-data": "~2.6.2", + "ember-data": "^2.8.0", "ember-export-application-global": "^1.0.5", "ember-i18n": "4.3.2", "ember-keyboard": "2.1.3", From 04aac2be3c30672b2b856b001f64ecaa1630c70f Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Thu, 29 Sep 2016 15:59:02 -0400 Subject: [PATCH 4/8] Replace horrible observes code There was an observer on patient that was causing database is closed errors when testing. --- app/mixins/patient-submodule.js | 38 +++++++++++++++++---------------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/app/mixins/patient-submodule.js b/app/mixins/patient-submodule.js index 62204ea6f8..46a83708b6 100644 --- a/app/mixins/patient-submodule.js +++ b/app/mixins/patient-submodule.js @@ -1,3 +1,4 @@ +import DS from 'ember-data'; import Ember from 'ember'; import PatientVisits from 'hospitalrun/mixins/patient-visits'; import SelectValues from 'hospitalrun/utils/select-values'; @@ -6,6 +7,7 @@ export default Ember.Mixin.create(PatientVisits, { needToUpdateVisit: false, patientList: null, selectedPatient: null, + newVisitAdded: null, actions: { showPatient: function(patient) { @@ -83,11 +85,9 @@ export default Ember.Mixin.create(PatientVisits, { model.set('visit', visit); visit.save().then(function() { visit.reload().then(function(updatedVisit) { - this.getPatientVisits(patient).then(function(visits) { - this.set('patientVisits', visits); - model.set('visit', updatedVisit); - resolve(updatedVisit); - }.bind(this), reject); + this.set('newVisitAdded', updatedVisit); + model.set('visit', updatedVisit); + resolve(updatedVisit); }.bind(this), reject); }.bind(this), reject).catch(function(err) { console.log('Error creating new visit'); @@ -109,20 +109,19 @@ export default Ember.Mixin.create(PatientVisits, { patientId: Ember.computed.alias('model.patient.id'), - patientChanged: function() { - var patient = this.get('model.patient'); + patientVisits: function() { + let patient = this.get('model.patient'); + let visitPromise; + if (!Ember.isEmpty(patient) && this.get('findPatientVisits')) { - this.getPatientVisits(patient).then(function(visits) { - if (Ember.isEmpty(this.get('model.patient'))) { - this.set('patientVisits', []); - } else { - this.set('patientVisits', visits); - } - }.bind(this)); + visitPromise = this.getPatientVisits(patient); } else if (Ember.isEmpty(patient) && this.get('findPatientVisits')) { - this.set('patientVisits', []); + visitPromise = Ember.RSVP.resolve([]); } - }.observes('model.patient'), + return DS.PromiseArray.create({ + promise: visitPromise + }); + }.property('model.patient.id', 'newVisitAdded'), selectedPatientChanged: function() { var selectedPatient = this.get('selectedPatient'); @@ -145,11 +144,14 @@ export default Ember.Mixin.create(PatientVisits, { } }.observes('patientId').on('init'), - patientVisits: [], returnPatientId: null, returnVisitId: null, patientVisitsForSelect: function() { - return this.get('patientVisits').map(SelectValues.selectObjectMap); + return DS.PromiseArray.create({ + promise: this.get('patientVisits').then(function(patientVisits) { + return patientVisits.map(SelectValues.selectObjectMap); + }) + }); }.property('patientVisits.[]'), /** From 20184d56859a31a023083cc7e6fc4a6cb3ff7eb6 Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Thu, 29 Sep 2016 15:59:21 -0400 Subject: [PATCH 5/8] Disable service worker offline sync when testing --- tests/helpers/run-with-pouch-dump.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/helpers/run-with-pouch-dump.js b/tests/helpers/run-with-pouch-dump.js index cc3c0409a6..8c2d7cb0a4 100644 --- a/tests/helpers/run-with-pouch-dump.js +++ b/tests/helpers/run-with-pouch-dump.js @@ -56,7 +56,10 @@ function runWithPouchDumpAsyncHelper(app, dumpName, functionToRun) { return Ember.RSVP.resolve(configDB); }, replicateConfigDB() { - + return configDB.put({ + _id: 'config_disable_offline_sync', + value: true + }); } }); From 9ea7fca247cbeac05bed8aaf1d5ecfd98ae91afe Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Thu, 29 Sep 2016 15:59:37 -0400 Subject: [PATCH 6/8] Upgrade to pouchdb 5.4.5 --- app/serviceworkers/pouchdb-sync.js | 13 +++---------- bower.json | 2 +- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/app/serviceworkers/pouchdb-sync.js b/app/serviceworkers/pouchdb-sync.js index e05c6f2443..c972a1eb8f 100644 --- a/app/serviceworkers/pouchdb-sync.js +++ b/app/serviceworkers/pouchdb-sync.js @@ -1,15 +1,8 @@ -var configDB; + var configs = false; -var localMainDB; var syncingRemote = false; - -new PouchDB('config', function(err, db) { - configDB = db; -}); - -new PouchDB('localMainDB', function(err, db) { - localMainDB = db; -}); +var configDB = new PouchDB('config'); +var localMainDB = new PouchDB('localMainDB'); toolbox.router.get('/db/main/_all_docs', function(request, values, options) { logDebug('request for all docs:', request.url); diff --git a/bower.json b/bower.json index efad648d4c..abf9a5e19d 100644 --- a/bower.json +++ b/bower.json @@ -14,7 +14,7 @@ "typeahead.js": "~0.11.1", "pouchdb-load": "^1.4.0", "pretender": "~0.10.0", - "pouchdb": "5.3.2", + "pouchdb": "^5.4.5", "relational-pouch": "^1.4.4", "pouchdb-find": "^0.10.2" } From 0bb4f11cae6b2b4f9a67f61043d2d5c0c80b6419 Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Thu, 29 Sep 2016 16:16:40 -0400 Subject: [PATCH 7/8] Updated for deprecation warnings. --- app/helpers/html-line-break.js | 4 ++-- app/mixins/progress-dialog.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/helpers/html-line-break.js b/app/helpers/html-line-break.js index 6548762c01..80dfc4df84 100644 --- a/app/helpers/html-line-break.js +++ b/app/helpers/html-line-break.js @@ -1,8 +1,8 @@ import Ember from 'ember'; export default Ember.Helper.helper(function([text]) { if (text !== null && typeof text !== 'undefined') { - return new Ember.Handlebars.SafeString(text.replace(/\n/g, '
')); + return Ember.String.htmlSafe(text.replace(/\n/g, '
')); } else { return null; } -}); \ No newline at end of file +}); diff --git a/app/mixins/progress-dialog.js b/app/mixins/progress-dialog.js index c7e007c02c..583a486182 100644 --- a/app/mixins/progress-dialog.js +++ b/app/mixins/progress-dialog.js @@ -28,7 +28,7 @@ export default Ember.Mixin.create({ progressBarValue = 0; } progressDialog.set('progressBarValue', progressBarValue); - var progressBarStyle = new Ember.Handlebars.SafeString('width: ' + progressBarValue + '%'); + var progressBarStyle = Ember.String.htmlSafe('width: ' + progressBarValue + '%'); progressDialog.set('progressBarStyle', progressBarStyle); }, @@ -39,7 +39,7 @@ export default Ember.Mixin.create({ showProgressModal: function() { var progressDialog = Ember.Object.create(this.get('progressDialogDefaults')); - progressDialog.progressBarStyle = new Ember.Handlebars.SafeString(progressDialog.progressBarStyle); + progressDialog.progressBarStyle = new Ember.String.htmlSafe(progressDialog.progressBarStyle); progressDialog.set('title', this.get('progressTitle')); progressDialog.set('message', this.get('progressMessage')); this.set('progressDialog', progressDialog); From ac714bb357700ddf4d118d593935f7cd805be467 Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Thu, 29 Sep 2016 16:32:13 -0400 Subject: [PATCH 8/8] updated snyk --- .snyk | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.snyk b/.snyk index 14077dd93d..e5a8317bd4 100644 --- a/.snyk +++ b/.snyk @@ -1,9 +1,13 @@ -version: v1.5.0 +version: v1.5.2 failThreshold: high ignore: {} patch: 'npm:minimatch:20160620': - ember-inflector > ember-cli-babel > broccoli-babel-transpiler > babel-core > minimatch: patched: '2016-07-06T20:50:31.952Z' + ember-rapid-forms > ember-cli-babel > broccoli-babel-transpiler > babel-core > minimatch: + patched: '2016-09-29T20:23:59.408Z' - ember-inflector > ember-cli-babel > broccoli-babel-transpiler > babel-core > regenerator > commoner > glob > minimatch: patched: '2016-07-06T20:50:31.952Z' + ember-rapid-forms > ember-validations > ember-cli-babel > broccoli-babel-transpiler > babel-core > minimatch: + patched: '2016-09-29T20:23:59.408Z'