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' 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/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.[]'), /** 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); 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 052408497e..abf9a5e19d 100644 --- a/bower.json +++ b/bower.json @@ -3,9 +3,8 @@ "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", "idb.filesystem": "https://github.com/ebidel/idb.filesystem.js.git#~0.0.6", "moment": "~2.10.5", @@ -15,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" } diff --git a/package.json b/package.json index 116f735275..16f443841c 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", @@ -61,14 +61,14 @@ "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", "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", 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 + }); } });