Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
Merge pull request #15 from HospitalRun/master
Browse files Browse the repository at this point in the history
Merge master from upstream
  • Loading branch information
MatthewDorner committed Oct 3, 2018
2 parents e8d47b7 + 2d24fa9 commit 4b2bebd
Show file tree
Hide file tree
Showing 105 changed files with 2,441 additions and 1,748 deletions.
4 changes: 0 additions & 4 deletions .bowerrc

This file was deleted.

1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module.exports = {
'Bloodhound': true,
'dymo': true,
'Filer': true,
'goog': true,
'logDebug': true,
'Pikaday': true,
'PouchDB': true,
Expand Down
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ In addition, these are descriptions of some extra folders and files in use in th

### Pod directories

This project uses a folder structure called [Pods](http:https://cball.me/organize-your-ember-app-with-pods/) that is better suited for a large scale Ember application.
This project uses a folder structure called [Pods](https:https://www.programwitherik.com/ember-pods/) that is better suited for a large scale Ember application.

The basic folder structure for Ember puts controllers, routes and templates in three different directories. The Pods approach organizes the folders in correlation to the application routes and keeps all three files in the same folder for each view.

Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ newrelic.js

/async-disk-cache
c9-couch.js

.python-version
# ember-try
.node_modules.ember-try/
bower.json.ember-try
Expand Down
15 changes: 7 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ language: node_js
node_js:
- "6"

branches:
only:
- "master"

dist: trusty
sudo: required

Expand All @@ -17,24 +13,27 @@ addons:
packages:
- g++-4.8
cache:
yarn: true
directories:
- $HOME/.npm
- $HOME/.cache # includes bowers cache

before_install:
- npm config set spin false
- npm install -g bower
- bower --version
- "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1024x768x24"
- yarn global add greenkeeper-lockfile@1

install:
- npm install
- bower install
- yarn install
- export DISPLAY=':99.0'

before_script: greenkeeper-lockfile-update

script:
- npm run $COMMAND

after_script: greenkeeper-lockfile-upload

env:
matrix:
- COMMAND=test
Expand Down
6 changes: 1 addition & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,14 @@ RUN apk update && apk add \
wget

# install global npm dependencies
RUN npm install -g ember-cli@latest && npm install -g bower
RUN npm install -g ember-cli@latest

# use changes to package.json to force Docker not to use the cache
# when we change our application's nodejs dependencies:
COPY package*.json /tmp/
RUN cd /tmp && npm install
RUN mkdir -p /usr/src/app && cp -a /tmp/node_modules /usr/src/app

COPY bower.json /tmp/
RUN cd /tmp && bower install --allow-root
RUN cp -a /tmp/bower_components /usr/src/app

# setup folders
WORKDIR /usr/src/app

Expand Down
22 changes: 17 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
HospitalRun frontend
========

[![Greenkeeper badge](https://badges.greenkeeper.io/stukalin/hospitalrun-frontend.svg)](https://greenkeeper.io/)

_Ember frontend for [HospitalRun](http:https://hospitalrun.io/): free software for developing world hospitals_

[![Build Status](https://travis-ci.org/HospitalRun/hospitalrun-frontend.svg?branch=master)](https://travis-ci.org/HospitalRun/hospitalrun-frontend) [![CouchDB](https://img.shields.io/badge/couchdb-1.x-green.svg)](http:https://couchdb.apache.org/)
Expand Down Expand Up @@ -33,14 +35,13 @@ To install the frontend please do the following:

1. Make sure you have installed [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git).
2. Make sure you have installed [Node.js](https://nodejs.org/en/download/). Versions 6.0.0 and higher should work. We recommend that you use the most-recent "Active LTS" version of Node.js.
3. Install [ember-cli latest](https://www.npmjs.org/package/ember-cli): `npm install -g ember-cli@latest`.
3. Make sure you have yarn installed [Yarn](https://yarnpkg.com/)
4. Install [ember-cli latest](https://www.npmjs.org/package/ember-cli): `npm install -g ember-cli@latest`.
Depending on your [npm permissions](https://docs.npmjs.com/getting-started/fixing-npm-permissions) you might need root access to install ember-cli.
4. Install [bower](https://www.npmjs.org/package/bower): `npm install -g bower`.
5. Clone this repo with `git clone https://github.com/HospitalRun/hospitalrun-frontend`, go to the cloned folder and run

```
npm install
bower install
```

- **Note:** *If you just want to use the project, cloning is the best option. However, if you wish to contribute to the project, you will need to fork the project first, and then clone your `hospitalrun-frontend` fork and make your contributions via a branch on your fork.*
Expand All @@ -59,7 +60,7 @@ bower install
1. HospitalRun currently does not fully support CouchDB 2.x, but you are welcome to try using it. Most functionality should work but currently creating and/or editing users does not work in CouchDB 2.x. See https://github.com/HospitalRun/hospitalrun-frontend/issues/953 for more details.
2. If you have just installed CouchDB and have no admin user, please run `./script/initcouch2.sh` in the folder you cloned the HospitalRun repo. A user `hradmin` will be created with password `test`.
3. If you already have a CouchDB admin user, please run `./script/initcouch2.sh USER PASS` in the folder you cloned the HospitalRun repo. `USER` and `PASS` are the CouchDB admin user credentials.
7. Copy the `server/config-example.js` to `server/config.js` in the folder you cloned the HospitalRun repo. If you already had a CouchDB admin user that you passed into the couch script (`./script/initcouch.sh USER PASS`), then you will need to modify the `couchAdminUser` and `couchAdminPassword` values in `server/config.js` to reflect those credentials. (*Note: If on Mac, you need to make sure CouchDB can be run. See [How to open an app from a unidentified developer and exempt it from Gatekeeper](https://support.apple.com/en-us/HT202491).*)
7. Copy the `server/config-example.js` to `server/config.js` in the folder you cloned the HospitalRun repo. If you already had a CouchDB admin user that you passed into the couch script (`./script/initcouch.sh USER PASS`), then you will need to modify the `couchAdminUser` and `couchAdminPassword` values in `server/config.js` to reflect those credentials. (*Note: If on Mac, you need to make sure CouchDB can be run. See [How to open an app from an unidentified developer and exempt it from Gatekeeper](https://support.apple.com/en-us/HT202491).*)
8. Verify that CouchDB is running by visiting: http:https://127.0.0.1:5984/_utils/#login
and logging in with the with the credentials you just created from steps 6 and 7.
- If the page returns an error or 404:
Expand Down Expand Up @@ -113,13 +114,24 @@ Is your server (still) running? Is CouchDB running? If not, that's probably the

Try a browser refresh `cmd + r`.

**ERR! stack python2: command not found**

`npm install` requires Python 2 to build some dependencies.
Make sure `python2` is accessible from the current working directory.

If you're using [pyenv](https://github.com/pyenv/pyenv), you can run the following to override the Python version used in the current working directory:
```
$ pyenv install 2.7.15
$ pyenv local 2.7.15
```

## Loading sample data
If you would like to load sample data, you can do so by navigating to **Load DB** under the Administration menu. You should see the following screen:

![Load DB screenshot](screenshots/load-db.png)


Click on ***Choose File*** and select the file **sample-data.txt** which is included in root directory of the repo at [sample-data.txt](sample-data.txt).
Click on ***Choose File*** and select the file **sample-data.txt** which is included in the root directory of the repo at [sample-data.txt](sample-data.txt).
Next, click on ***Load File***. When the database load is complete a message will appear indicating if the load was successful.

## Testing
Expand Down
6 changes: 4 additions & 2 deletions app/admin/lookup/edit/controller.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
import { isEmpty } from '@ember/utils';
import Controller, { inject as controller } from '@ember/controller';
import IsUpdateDisabled from 'hospitalrun/mixins/is-update-disabled';
import { computed } from '@ember/object';

export default Controller.extend(IsUpdateDisabled, {
editController: controller('admin/lookup'),
showUpdateButton: true,

updateButtonAction: 'update',
updateButtonText: function() {
updateButtonText: computed('model.isNew', function() {
let i18n = this.get('i18n');
if (this.get('model.isNew')) {
return i18n.t('buttons.add');
} else {
return i18n.t('buttons.update');
}
}.property('model.isNew'),
}),

actions: {
cancel() {
Expand Down
10 changes: 6 additions & 4 deletions app/admin/route.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import AbstractModuleRoute from 'hospitalrun/routes/abstract-module-route';
import { computed } from '@ember/object';

export default AbstractModuleRoute.extend({
addCapability: 'add_user',
allowSearch: false,
moduleName: 'admin',
sectionTitle: 'Admin',

editPath: function() {
editPath: computed(function() {
return 'users.edit';
}.property(),
}),

deletePath: function() {
deletePath: computed(function() {
return 'users.delete';
}.property()
})
});
6 changes: 4 additions & 2 deletions app/appointments/delete/controller.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import AbstractDeleteController from 'hospitalrun/controllers/abstract-delete-controller';
import { computed } from '@ember/object';

export default AbstractDeleteController.extend({
title: 'Delete Appointment',

afterDeleteAction: function() {
afterDeleteAction: computed('model.deleteFromPatient', function() {
let deleteFromPatient = this.get('model.deleteFromPatient');
if (deleteFromPatient) {
return 'appointmentDeleted';
} else {
return 'closeModal';
}
}.property('model.deleteFromPatient')
})
});
14 changes: 8 additions & 6 deletions app/appointments/index/controller.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
import AbstractPagedController from 'hospitalrun/controllers/abstract-paged-controller';
import UserSession from 'hospitalrun/mixins/user-session';
import { computed } from '@ember/object';

export default AbstractPagedController.extend(UserSession, {
startKey: [],
canAddVisit: function() {
canAddVisit: computed(function() {
return this.currentUserCan('add_visit');
}.property(),
}),

canEdit: function() {
canEdit: computed(function() {
// Add and edit are the same capability
return this.currentUserCan('add_appointment');
}.property(),
}),

canDelete: function() {
canDelete: computed(function() {
return this.currentUserCan('delete_appointment');
}.property(),
}),

sortProperties: ['startDate', 'endDate'],
sortAscending: true
Expand Down
7 changes: 5 additions & 2 deletions app/appointments/search/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@ import AppointmentIndexController from 'hospitalrun/appointments/index/controlle
import AppointmentStatuses from 'hospitalrun/mixins/appointment-statuses';
import SelectValues from 'hospitalrun/utils/select-values';
import VisitTypes from 'hospitalrun/mixins/visit-types';
import { computed } from '@ember/object';

export default AppointmentIndexController.extend(AppointmentStatuses, VisitTypes, {
appointmentsController: controller('appointments'),
appointmentType: null,
physicians: alias('appointmentsController.physicianList.value'),
physicianList: function() {

physicianList: computed('physicians', function() {
return SelectValues.selectValues(this.get('physicians'), true);
}.property('physicians'),
}),

provider: null,
queryParams: ['appointmentType', 'provider', 'status', 'startKey', 'startDate'],
Expand Down
6 changes: 4 additions & 2 deletions app/components/array-display.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { isArray } from '@ember/array';
import { computed } from '@ember/object';
import Component from '@ember/component';

export default Component.extend({
isArray: function() {
isArray: computed('content', function() {
let content = this.get('content');
return isArray(content);
}.property('content')
})
});
10 changes: 6 additions & 4 deletions app/components/charge-quantity.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { isEmpty } from '@ember/utils';
import { alias } from '@ember/object/computed';
import { inject as service } from '@ember/service';
import Component from '@ember/component';
import { computed } from '@ember/object';

export default Component.extend({
i18n: service(),
classNames: ['col-xs-2', 'form-group'],
Expand All @@ -14,15 +16,15 @@ export default Component.extend({
this.quantitySelected = alias(`model.${this.get('pricingItem.id')}`);
},

hasError: function() {
hasError: computed('quantitySelected', function() {
let quantitySelected = this.get('quantitySelected');
return !isEmpty(quantitySelected) && isNaN(quantitySelected);
}.property('quantitySelected'),
}),

quantityHelp: function() {
quantityHelp: computed('hasError', function() {
if (this.get('hasError')) {
return this.get('i18n').t('errors.invalidNumber');
}
}.property('hasError')
})

});
14 changes: 8 additions & 6 deletions app/components/charges-by-type-tab.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import Component from '@ember/component';
import { computed } from '@ember/object';

export default Component.extend({
attributeBindings: ['role'],
classNameBindings: ['active'],
Expand All @@ -7,17 +9,17 @@ export default Component.extend({
role: 'presentation',
tagName: 'li',

active: function() {
active: computed(function() {
let index = this.get('index');
return (index === 0);
}.property(),
}),

tabId: function() {
tabId: computed('pricingType', function() {
return this.get('pricingType').toLowerCase().dasherize();
}.property('pricingType'),
}),

tabHref: function() {
tabHref: computed('tabId', function() {
let tabId = this.get('tabId');
return `#${tabId}`;
}.property('tabId')
})
});
4 changes: 2 additions & 2 deletions app/components/checkbox-or-typeahead.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default SelectOrTypeahead.extend({
}));
}.on('init'),

checkboxRows: function() {
checkboxRows: computed('content', 'checkboxesPerRow', function() {
let checkboxRows = [];
let checkboxesPerRow = this.get('checkboxesPerRow');
let content = this.get('content');
Expand All @@ -44,7 +44,7 @@ export default SelectOrTypeahead.extend({
checkboxRows.push(checkBoxRowValues);
}
return checkboxRows;
}.property('content', 'checkboxesPerRow'),
}),

actions: {
checkboxChanged(value, checked) {
Expand Down
6 changes: 3 additions & 3 deletions app/components/date-input.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineProperty } from '@ember/object';
import { defineProperty, computed } from '@ember/object';
import { alias } from '@ember/object/computed';
import { isEmpty } from '@ember/utils';
import EmInput from 'ember-rapid-forms/components/em-input';
Expand All @@ -19,14 +19,14 @@ export default EmInput.extend(PikadayComponent, {
}
},

format: function() {
format: computed('showTime', function() {
let showTime = this.get('showTime');
if (showTime) {
return 'l h:mm A';
} else {
return 'l';
}
}.property('showTime'),
}),

showTimeChanged: function() {
let picker = this.get('_picker');
Expand Down
Loading

0 comments on commit 4b2bebd

Please sign in to comment.