author
int64 658
755k
| date
stringlengths 19
19
| timezone
int64 -46,800
43.2k
| hash
stringlengths 40
40
| message
stringlengths 5
490
| mods
list | language
stringclasses 20
values | license
stringclasses 3
values | repo
stringlengths 5
68
| original_message
stringlengths 12
491
|
---|---|---|---|---|---|---|---|---|---|
288,231 | 29.08.2018 15:46:41 | -7,200 | 350501baeeaca06bfef787357a3547214549702d | updated stylelint-config-concentric to 2.0.2 | [
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"pouchdb-users\": \"^1.0.3\",\n\"qunit-dom\": \"^0.7.0\",\n\"stylelint\": \"~9.4.0\",\n- \"stylelint-config-concentric\": \"^2.0.1\",\n+ \"stylelint-config-concentric\": \"^2.0.2\",\n\"stylelint-declaration-use-variable\": \"1.7.0\",\n\"stylelint-scss\": \"3.2.0\",\n\"tosource-polyfill\": \"^0.3.1\",\n"
},
{
"change_type": "MODIFY",
"old_path": "yarn.lock",
"new_path": "yarn.lock",
"diff": "@@ -721,17 +721,6 @@ autoprefixer@^6.3.1:\npostcss \"^5.2.16\"\npostcss-value-parser \"^3.2.3\"\n-autoprefixer@^7.1.2:\n- version \"7.2.6\"\n- resolved \"https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-7.2.6.tgz#256672f86f7c735da849c4f07d008abb056067dc\"\n- dependencies:\n- browserslist \"^2.11.3\"\n- caniuse-lite \"^1.0.30000805\"\n- normalize-range \"^0.1.2\"\n- num2fraction \"^1.2.2\"\n- postcss \"^6.0.17\"\n- postcss-value-parser \"^3.2.3\"\n-\nautoprefixer@^8.0.0:\nversion \"8.2.0\"\nresolved \"https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-8.2.0.tgz#1e49b611b31a5259b86b7a6b2b1b8faf091abe2a\"\n@@ -2706,7 +2695,7 @@ browserslist@^1.3.6, browserslist@^1.4.0, browserslist@^1.5.2, browserslist@^1.7\ncaniuse-db \"^1.0.30000639\"\nelectron-to-chromium \"^1.2.7\"\n-browserslist@^2.1.2, browserslist@^2.11.3:\n+browserslist@^2.1.2:\nversion \"2.11.3\"\nresolved \"https://registry.yarnpkg.com/browserslist/-/browserslist-2.11.3.tgz#fe36167aed1bbcde4827ebfe71347a2cc70b99b2\"\ndependencies:\n@@ -2917,7 +2906,7 @@ caniuse-db@^1.0.30000639:\nversion \"1.0.30000649\"\nresolved \"https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30000649.tgz#1ee1754a6df235450c8b7cd15e0ebf507221a86a\"\n-caniuse-lite@^1.0.30000792, caniuse-lite@^1.0.30000805:\n+caniuse-lite@^1.0.30000792:\nversion \"1.0.30000882\"\nresolved \"https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000882.tgz#0d5066847a11a5af0e50ffce6c062ef0665f68ea\"\n@@ -3662,15 +3651,6 @@ core-util-is@~1.0.0:\nversion \"1.0.2\"\nresolved \"https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7\"\n-cosmiconfig@^3.1.0:\n- version \"3.1.0\"\n- resolved \"https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-3.1.0.tgz#640a94bf9847f321800403cd273af60665c73397\"\n- dependencies:\n- is-directory \"^0.3.1\"\n- js-yaml \"^3.9.0\"\n- parse-json \"^3.0.0\"\n- require-from-string \"^2.0.1\"\n-\ncosmiconfig@^4.0.0:\nversion \"4.0.0\"\nresolved \"https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-4.0.0.tgz#760391549580bbd2df1e562bc177b13c290972dc\"\n@@ -7414,7 +7394,7 @@ gonzales-pe@^3.4.4:\ndependencies:\nminimist \"1.1.x\"\n-gonzales-pe@^4.0.3, gonzales-pe@^4.2.3:\n+gonzales-pe@^4.2.3:\nversion \"4.2.3\"\nresolved \"https://registry.yarnpkg.com/gonzales-pe/-/gonzales-pe-4.2.3.tgz#41091703625433285e0aee3aa47829fc1fbeb6f2\"\ndependencies:\n@@ -8973,10 +8953,6 @@ klaw@^2.1.0:\ndependencies:\ngraceful-fs \"^4.1.9\"\n-known-css-properties@^0.5.0:\n- version \"0.5.0\"\n- resolved \"https://registry.yarnpkg.com/known-css-properties/-/known-css-properties-0.5.0.tgz#6ff66943ed4a5b55657ee095779a91f4536f8084\"\n-\nknown-css-properties@^0.6.0:\nversion \"0.6.1\"\nresolved \"https://registry.yarnpkg.com/known-css-properties/-/known-css-properties-0.6.1.tgz#31b5123ad03d8d1a3f36bd4155459c981173478b\"\n@@ -10902,12 +10878,6 @@ parse-json@^2.1.0, parse-json@^2.2.0:\ndependencies:\nerror-ex \"^1.2.0\"\n-parse-json@^3.0.0:\n- version \"3.0.0\"\n- resolved \"https://registry.yarnpkg.com/parse-json/-/parse-json-3.0.0.tgz#fa6f47b18e23826ead32f263e744d0e1e847fb13\"\n- dependencies:\n- error-ex \"^1.3.1\"\n-\nparse-json@^4.0.0:\nversion \"4.0.0\"\nresolved \"https://registry.yarnpkg.com/parse-json/-/parse-json-4.0.0.tgz#be35f5425be1f7f6c747184f98a788cb99477ee0\"\n@@ -11221,14 +11191,6 @@ postcss-filter-plugins@^2.0.0:\npostcss \"^5.0.4\"\nuniqid \"^4.0.0\"\n-postcss-html@^0.12.0:\n- version \"0.12.0\"\n- resolved \"https://registry.yarnpkg.com/postcss-html/-/postcss-html-0.12.0.tgz#39b6adb4005dfc5464df7999c0f81c95bced7e50\"\n- dependencies:\n- htmlparser2 \"^3.9.2\"\n- remark \"^8.0.0\"\n- unist-util-find-all-after \"^1.0.1\"\n-\npostcss-html@^0.15.0:\nversion \"0.15.0\"\nresolved \"https://registry.yarnpkg.com/postcss-html/-/postcss-html-0.15.0.tgz#11ba3c07c817d0816f091fe40817a8ecd861300f\"\n@@ -11395,13 +11357,6 @@ postcss-safe-parser@^4.0.0:\ndependencies:\npostcss \"^7.0.0\"\n-postcss-sass@^0.2.0:\n- version \"0.2.0\"\n- resolved \"https://registry.yarnpkg.com/postcss-sass/-/postcss-sass-0.2.0.tgz#e55516441e9526ba4b380a730d3a02e9eaa78c7a\"\n- dependencies:\n- gonzales-pe \"^4.0.3\"\n- postcss \"^6.0.6\"\n-\npostcss-sass@^0.3.0:\nversion \"0.3.0\"\nresolved \"https://registry.yarnpkg.com/postcss-sass/-/postcss-sass-0.3.0.tgz#dc2582ee0e61541aa88bafdc5a8aebb53deaae75\"\n@@ -11445,12 +11400,12 @@ postcss-selector-parser@^4.0.0:\nindexes-of \"^1.0.1\"\nuniq \"^1.0.1\"\n-postcss-sorting@^3.0.1:\n- version \"3.1.0\"\n- resolved \"https://registry.yarnpkg.com/postcss-sorting/-/postcss-sorting-3.1.0.tgz#af7c90ee73ad12569a57664eaf06735c2e25bec0\"\n+postcss-sorting@^4.0.0:\n+ version \"4.0.0\"\n+ resolved \"https://registry.yarnpkg.com/postcss-sorting/-/postcss-sorting-4.0.0.tgz#abfdf41ff8f7710f66f5dc7e78a3a3cce3983c21\"\ndependencies:\nlodash \"^4.17.4\"\n- postcss \"^6.0.13\"\n+ postcss \"^7.0.0\"\npostcss-styled@^0.31.0:\nversion \"0.31.0\"\n@@ -11498,7 +11453,7 @@ postcss@^5.0.10, postcss@^5.0.11, postcss@^5.0.12, postcss@^5.0.13, postcss@^5.0\nsource-map \"^0.5.6\"\nsupports-color \"^3.2.3\"\n-postcss@^6.0.13, postcss@^6.0.14, postcss@^6.0.17, postcss@^6.0.23, postcss@^6.0.6, postcss@^6.0.7, postcss@^6.0.8:\n+postcss@^6.0.14, postcss@^6.0.23, postcss@^6.0.6, postcss@^6.0.8:\nversion \"6.0.23\"\nresolved \"https://registry.yarnpkg.com/postcss/-/postcss-6.0.23.tgz#61c82cc328ac60e677645f979054eb98bc0e3324\"\ndependencies:\n@@ -12705,26 +12660,6 @@ relational-pouch@^2.0.0:\npouchdb-promise \"^6.3.4\"\nuniq \"^1.0.1\"\n-remark-parse@^4.0.0:\n- version \"4.0.0\"\n- resolved \"https://registry.yarnpkg.com/remark-parse/-/remark-parse-4.0.0.tgz#99f1f049afac80382366e2e0d0bd55429dd45d8b\"\n- dependencies:\n- collapse-white-space \"^1.0.2\"\n- is-alphabetical \"^1.0.0\"\n- is-decimal \"^1.0.0\"\n- is-whitespace-character \"^1.0.0\"\n- is-word-character \"^1.0.0\"\n- markdown-escapes \"^1.0.0\"\n- parse-entities \"^1.0.2\"\n- repeat-string \"^1.5.4\"\n- state-toggle \"^1.0.0\"\n- trim \"0.0.1\"\n- trim-trailing-lines \"^1.0.0\"\n- unherit \"^1.0.4\"\n- unist-util-remove-position \"^1.0.0\"\n- vfile-location \"^2.0.0\"\n- xtend \"^4.0.1\"\n-\nremark-parse@^5.0.0:\nversion \"5.0.0\"\nresolved \"https://registry.yarnpkg.com/remark-parse/-/remark-parse-5.0.0.tgz#4c077f9e499044d1d5c13f80d7a98cf7b9285d95\"\n@@ -12745,25 +12680,6 @@ remark-parse@^5.0.0:\nvfile-location \"^2.0.0\"\nxtend \"^4.0.1\"\n-remark-stringify@^4.0.0:\n- version \"4.0.0\"\n- resolved \"https://registry.yarnpkg.com/remark-stringify/-/remark-stringify-4.0.0.tgz#4431884c0418f112da44991b4e356cfe37facd87\"\n- dependencies:\n- ccount \"^1.0.0\"\n- is-alphanumeric \"^1.0.0\"\n- is-decimal \"^1.0.0\"\n- is-whitespace-character \"^1.0.0\"\n- longest-streak \"^2.0.1\"\n- markdown-escapes \"^1.0.0\"\n- markdown-table \"^1.1.0\"\n- mdast-util-compact \"^1.0.0\"\n- parse-entities \"^1.0.2\"\n- repeat-string \"^1.5.4\"\n- state-toggle \"^1.0.0\"\n- stringify-entities \"^1.0.1\"\n- unherit \"^1.0.4\"\n- xtend \"^4.0.1\"\n-\nremark-stringify@^5.0.0:\nversion \"5.0.0\"\nresolved \"https://registry.yarnpkg.com/remark-stringify/-/remark-stringify-5.0.0.tgz#336d3a4d4a6a3390d933eeba62e8de4bd280afba\"\n@@ -12783,14 +12699,6 @@ remark-stringify@^5.0.0:\nunherit \"^1.0.4\"\nxtend \"^4.0.1\"\n-remark@^8.0.0:\n- version \"8.0.0\"\n- resolved \"https://registry.yarnpkg.com/remark/-/remark-8.0.0.tgz#287b6df2fe1190e263c1d15e486d3fa835594d6d\"\n- dependencies:\n- remark-parse \"^4.0.0\"\n- remark-stringify \"^4.0.0\"\n- unified \"^6.0.0\"\n-\nremark@^9.0.0:\nversion \"9.0.0\"\nresolved \"https://registry.yarnpkg.com/remark/-/remark-9.0.0.tgz#c5cfa8ec535c73a67c4b0f12bfdbd3a67d8b2f60\"\n@@ -13224,7 +13132,7 @@ s3@^4.4.0:\nrimraf \"~2.2.8\"\nstreamsink \"~1.2.0\"\[email protected], safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@~5.1.0, safe-buffer@~5.1.1:\[email protected], safe-buffer@^5.1.0, safe-buffer@^5.1.1:\nversion \"5.1.1\"\nresolved \"https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853\"\n@@ -13232,7 +13140,7 @@ safe-buffer@^5.0.1:\nversion \"5.0.1\"\nresolved \"https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.0.1.tgz#d263ca54696cd8a306b5ca6551e92de57918fbe7\"\n-safe-buffer@^5.1.2:\n+safe-buffer@^5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1:\nversion \"5.1.2\"\nresolved \"https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d\"\n@@ -14276,10 +14184,10 @@ [email protected]:\nresolved \"https://registry.yarnpkg.com/styled_string/-/styled_string-0.0.1.tgz#d22782bd81295459bc4f1df18c4bad8e94dd124a\"\nstylelint-config-concentric@^2.0.1:\n- version \"2.0.1\"\n- resolved \"https://registry.yarnpkg.com/stylelint-config-concentric/-/stylelint-config-concentric-2.0.1.tgz#d2e92940b62b0b1c9513c3e94336e39fa0dfb63a\"\n+ version \"2.0.2\"\n+ resolved \"https://registry.yarnpkg.com/stylelint-config-concentric/-/stylelint-config-concentric-2.0.2.tgz#8262b677cacb3b5c3f6e6d391c456332891d1556\"\ndependencies:\n- stylelint-order \"^0.6.0\"\n+ stylelint-order \"^1.0.0\"\[email protected]:\nversion \"1.7.0\"\n@@ -14287,14 +14195,13 @@ [email protected]:\ndependencies:\nstylelint \"^9.1.1\"\n-stylelint-order@^0.6.0:\n- version \"0.6.0\"\n- resolved \"https://registry.yarnpkg.com/stylelint-order/-/stylelint-order-0.6.0.tgz#72222be0c64d8782b2fc237d0d9ac974039f968b\"\n+stylelint-order@^1.0.0:\n+ version \"1.0.0\"\n+ resolved \"https://registry.yarnpkg.com/stylelint-order/-/stylelint-order-1.0.0.tgz#089fc3d5cdf7e7d4ac1882f65b60b25db750413c\"\ndependencies:\n- lodash \"^4.17.4\"\n- postcss \"^6.0.7\"\n- postcss-sorting \"^3.0.1\"\n- stylelint \"^8.0.0\"\n+ lodash \"^4.17.10\"\n+ postcss \"^7.0.2\"\n+ postcss-sorting \"^4.0.0\"\[email protected]:\nversion \"3.2.0\"\n@@ -14306,50 +14213,6 @@ [email protected]:\npostcss-selector-parser \"^4.0.0\"\npostcss-value-parser \"^3.3.0\"\n-stylelint@^8.0.0:\n- version \"8.4.0\"\n- resolved \"https://registry.yarnpkg.com/stylelint/-/stylelint-8.4.0.tgz#c2dbaeb17236917819f9206e1c0df5fddf6f83c3\"\n- dependencies:\n- autoprefixer \"^7.1.2\"\n- balanced-match \"^1.0.0\"\n- chalk \"^2.0.1\"\n- cosmiconfig \"^3.1.0\"\n- debug \"^3.0.0\"\n- execall \"^1.0.0\"\n- file-entry-cache \"^2.0.0\"\n- get-stdin \"^5.0.1\"\n- globby \"^7.0.0\"\n- globjoin \"^0.1.4\"\n- html-tags \"^2.0.0\"\n- ignore \"^3.3.3\"\n- imurmurhash \"^0.1.4\"\n- known-css-properties \"^0.5.0\"\n- lodash \"^4.17.4\"\n- log-symbols \"^2.0.0\"\n- mathml-tag-names \"^2.0.1\"\n- meow \"^4.0.0\"\n- micromatch \"^2.3.11\"\n- normalize-selector \"^0.2.0\"\n- pify \"^3.0.0\"\n- postcss \"^6.0.6\"\n- postcss-html \"^0.12.0\"\n- postcss-less \"^1.1.0\"\n- postcss-media-query-parser \"^0.2.3\"\n- postcss-reporter \"^5.0.0\"\n- postcss-resolve-nested-selector \"^0.1.1\"\n- postcss-safe-parser \"^3.0.1\"\n- postcss-sass \"^0.2.0\"\n- postcss-scss \"^1.0.2\"\n- postcss-selector-parser \"^3.1.0\"\n- postcss-value-parser \"^3.3.0\"\n- resolve-from \"^4.0.0\"\n- specificity \"^0.3.1\"\n- string-width \"^2.1.0\"\n- style-search \"^0.1.0\"\n- sugarss \"^1.0.0\"\n- svg-tags \"^1.0.0\"\n- table \"^4.0.1\"\n-\nstylelint@^9.1.1, stylelint@^9.1.3:\nversion \"9.1.3\"\nresolved \"https://registry.yarnpkg.com/stylelint/-/stylelint-9.1.3.tgz#8260f2a221b98e4afafd9b2b8a785d2e38cbb8a4\"\n@@ -14521,18 +14384,12 @@ supports-color@^3.1.0, supports-color@^3.2.3:\ndependencies:\nhas-flag \"^1.0.0\"\n-supports-color@^5.3.0:\n+supports-color@^5.3.0, supports-color@^5.4.0:\nversion \"5.5.0\"\nresolved \"https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f\"\ndependencies:\nhas-flag \"^3.0.0\"\n-supports-color@^5.4.0:\n- version \"5.4.0\"\n- resolved \"https://registry.yarnpkg.com/supports-color/-/supports-color-5.4.0.tgz#1c6b337402c2137605efe19f10fec390f6faab54\"\n- dependencies:\n- has-flag \"^3.0.0\"\n-\nsvg-tags@^1.0.0:\nversion \"1.0.0\"\nresolved \"https://registry.yarnpkg.com/svg-tags/-/svg-tags-1.0.0.tgz#58f71cee3bd519b59d4b2a843b6c7de64ac04764\"\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | updated stylelint-config-concentric to 2.0.2 |
288,280 | 12.09.2018 13:12:10 | 14,400 | 2beb6d27086cf4ec96909a6f12fd393cc9bc8cbc | Vitals fields should not be required. | [
{
"change_type": "MODIFY",
"old_path": "app/models/vital.js",
"new_path": "app/models/vital.js",
"diff": "@@ -14,19 +14,19 @@ export default AbstractModel.extend({\nvalidations: {\ntemperature: {\n- numericality: true\n+ numericality: { allowBlank: true }\n},\nsbp: {\n- numericality: true\n+ numericality: { allowBlank: true }\n},\ndbp: {\n- numericality: true\n+ numericality: { allowBlank: true }\n},\nheartRate: {\n- numericality: true\n+ numericality: { allowBlank: true }\n},\nrespiratoryRate: {\n- numericality: true\n+ numericality: { allowBlank: true }\n}\n}\n});\n"
},
{
"change_type": "MODIFY",
"old_path": "app/visits/vitals/edit/template.hbs",
"new_path": "app/visits/vitals/edit/template.hbs",
"diff": "{{date-picker model=model property=\"dateRecorded\" label=(t \"vitals.labels.dateRecorded\") class=\"col-sm-6\" format=\"l h:mm A\" showTime=true }}\n</div>\n<div class=\"row\">\n- {{number-input model=model class=\"col-sm-3 required temperature-text\" property=\"temperature\" label=temperatureLabel }}\n+ {{number-input model=model class=\"col-sm-3 temperature-text\" property=\"temperature\" label=temperatureLabel }}\n</div>\n<div class=\"row\">\n{{form.input class=\"col-sm-3 weight-text\" property=\"weight\" label=(t \"vitals.labels.weight\")}}\n{{form.input class=\"col-sm-3 height-text\" property=\"height\" label=(t \"vitals.labels.height\")}}\n</div>\n<div class=\"row\">\n- {{form.input class=\"col-sm-3 required sbp-text\" property=\"sbp\" label=(t \"vitals.labels.sbp\")}}\n- {{form.input class=\"col-sm-3 required dbp-text\" property=\"dbp\" label=(t \"vitals.labels.dbp\")}}\n+ {{form.input class=\"col-sm-3 sbp-text\" property=\"sbp\" label=(t \"vitals.labels.sbp\")}}\n+ {{form.input class=\"col-sm-3 dbp-text\" property=\"dbp\" label=(t \"vitals.labels.dbp\")}}\n</div>\n<div class=\"row\">\n- {{number-input model=model class=\"col-sm-3 required heart-rate-text\" property=\"heartRate\" label=(t \"vitals.labels.heartRate\")}}\n- {{number-input model=model class=\"col-sm-3 required respiratory-rate-text\" property=\"respiratoryRate\" label=(t \"vitals.labels.respiratoryRate\")}}\n+ {{number-input model=model class=\"col-sm-3 heart-rate-text\" property=\"heartRate\" label=(t \"vitals.labels.heartRate\")}}\n+ {{number-input model=model class=\"col-sm-3 respiratory-rate-text\" property=\"respiratoryRate\" label=(t \"vitals.labels.respiratoryRate\")}}\n</div>\n{{/em-form}}\n{{/modal-dialog}}\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Vitals fields should not be required. #1509 |
288,328 | 04.10.2018 22:27:24 | 18,000 | f5db265c9413cabe0a0916994542b1d7fbe161d4 | Removed unused lookup lists, fixed pricing/edit controller. | [
{
"change_type": "MODIFY",
"old_path": "app/admin/lookup/controller.js",
"new_path": "app/admin/lookup/controller.js",
"diff": "@@ -112,18 +112,6 @@ export default Controller.extend(BillingCategories, EKMixin,\nmodels: {\ninventory: 'inventoryType'\n}\n- }, {\n- name: this.get('i18n').t('admin.lookup.imagingPricingTypes'),\n- value: 'imaging_pricing_types',\n- models: {\n- pricing: 'pricingType'\n- }\n- }, {\n- name: this.get('i18n').t('admin.lookup.labPricingTypes'),\n- value: 'lab_pricing_types',\n- models: {\n- pricing: 'pricingType'\n- }\n}, {\nname: this.get('i18n').t('admin.lookup.patientStatusList'),\nvalue: 'patient_status_list',\n"
},
{
"change_type": "MODIFY",
"old_path": "app/imaging/route.js",
"new_path": "app/imaging/route.js",
"diff": "@@ -3,9 +3,6 @@ import AbstractModuleRoute from 'hospitalrun/routes/abstract-module-route';\nexport default AbstractModuleRoute.extend({\naddCapability: 'add_imaging',\nadditionalModels: [{\n- name: 'imagingPricingTypes',\n- findArgs: ['lookup', 'imaging_pricing_types']\n- }, {\nname: 'radiologistList',\nfindArgs: ['lookup', 'radiologists']\n}],\n"
},
{
"change_type": "MODIFY",
"old_path": "app/labs/route.js",
"new_path": "app/labs/route.js",
"diff": "@@ -2,10 +2,6 @@ import AbstractModuleRoute from 'hospitalrun/routes/abstract-module-route';\nimport { translationMacro as t } from 'ember-i18n';\nexport default AbstractModuleRoute.extend({\naddCapability: 'add_lab',\n- additionalModels: [{\n- name: 'labPricingTypes',\n- findArgs: ['lookup', 'lab_pricing_types']\n- }],\nallowSearch: false,\nmoduleName: 'labs',\nnewButtonText: t('labs.buttons.newButton'),\n"
},
{
"change_type": "MODIFY",
"old_path": "app/pricing/edit/controller.js",
"new_path": "app/pricing/edit/controller.js",
"diff": "@@ -19,23 +19,6 @@ export default AbstractEditController.extend(ReturnTo, {\nthis.send('update', true);\nthis.send('closeModal');\n},\n- categoryChanged(category) {\n- let model = this.get('model');\n- let pricingType = model.get('pricingType');\n- model.set('category', category);\n- if (!isEmpty(category)) {\n- if (category === 'Imaging') {\n- model.set('pricingType', IMAGING_PRICING_TYPE);\n- } else if (category === 'Lab') {\n- model.set('pricingType', LAB_PRICING_TYPE);\n- } else {\n- let pricingTypeValues = this.get('pricingTypes.value');\n- if (isEmpty(pricingTypeValues) || !pricingTypeValues.includes(pricingType)) {\n- model.set('pricingType');\n- }\n- }\n- }\n- },\ndeleteOverride(model) {\nlet { overrideToDelete } = model;\nlet pricingOverrides = this.get('model.pricingOverrides');\n@@ -100,9 +83,15 @@ export default AbstractEditController.extend(ReturnTo, {\nshowPricingType: computed('model.category', function() {\nlet model = this.get('model');\nlet category = model.get('category');\n- if (category === 'Imaging' || category === 'Lab') {\n+\n+ if (category === 'Imaging') {\n+ model.set('pricingType', IMAGING_PRICING_TYPE);\n+ return false;\n+ } else if (category === 'Lab') {\n+ model.set('pricingType', LAB_PRICING_TYPE);\nreturn false;\n} else {\n+ model.set('pricingType');\nreturn true;\n}\n}),\n"
},
{
"change_type": "MODIFY",
"old_path": "app/pricing/edit/template.hbs",
"new_path": "app/pricing/edit/template.hbs",
"diff": "{{select-or-typeahead form=form model=model property=\"expenseAccount\" label=(t 'labels.expenseTo') list=expenseAccountList selection=model.expenseAccount className=\"col-xs-4 price-department\"}}\n</div>\n<div class=\"row\">\n- <div class=\"required col-xs-4 price-category form-input-group\">\n- <label class=\"control-label\">{{t 'labels.category'}}</label>\n- <select onchange={{action \"categoryChanged\" value=\"target.value\"}} class=\"form-control\">\n- {{#each categories as |category|}}\n- <option value=\"{{category.id}}\"\n- selected={{is-equal category.id model.category}}>\n- {{category.value}}\n- </option>\n- {{/each}}\n- </select>\n- </div>\n+ {{form.select\n+ class='required col-xs-4 price-category form-input-group'\n+ content=categories\n+ optionValuePath='value'\n+ optionLabelPath='id'\n+ property='category'\n+ label=(t 'labels.category')\n+ }}\n{{#if showPricingType}}\n{{select-or-typeahead form=form model=model\nproperty=\"pricingType\" label=(t 'labels.type')\nselection=model.pricingType\nclassName=\"col-xs-4 price-type form-input-group\"\nprompt=\" \"\n+ disabled=false\n+ }}\n+ {{else}}\n+ {{select-or-typeahead form=form model=model\n+ property=\"pricingType\" label=(t 'labels.type')\n+ list=pricingTypes\n+ selection=model.pricingType\n+ className=\"col-xs-4 price-type form-input-group\"\n+ prompt=\" \"\n+ disabled=true\n}}\n{{/if}}\n</div>\n"
},
{
"change_type": "MODIFY",
"old_path": "app/templates/components/render-typeahead.hbs",
"new_path": "app/templates/components/render-typeahead.hbs",
"diff": "+\n{{#if usePricingTypeAhead}}\n{{pricing-typeahead class=className property=property model=model\nlabel=label content=content\n{{else}}\n{{type-ahead class=className property=property model=model\nlabel=label content=content\n- selection=selection setOnBlur=setOnBlur hint=hint\n+ selection=selection setOnBlur=setOnBlur hint=hint disabled=disabled\n}}\n{{/if}}\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Removed unused lookup lists, fixed pricing/edit controller. |
288,328 | 07.10.2018 20:06:56 | 18,000 | 61611bac06c42356d578ee6d227940cb44fd9d43 | Finish removing lookup lists, extra code, rename computed property. | [
{
"change_type": "MODIFY",
"old_path": "app/admin/lookup/controller.js",
"new_path": "app/admin/lookup/controller.js",
"diff": "@@ -19,11 +19,6 @@ export default Controller.extend(BillingCategories, EKMixin,\nfileSystem: service('filesystem'),\nlookupLists: service(),\n- canEditValues: computed('model.lookupType', function() {\n- let lookupType = this.get('model.lookupType');\n- return (lookupType !== 'imaging_pricing_types' && lookupType !== 'lab_pricing_types');\n- }),\n-\nlookupTypes: computed(function() {\nreturn [{\nname: this.get('i18n').t('admin.lookup.anesthesiaTypes'),\n@@ -263,18 +258,6 @@ export default Controller.extend(BillingCategories, EKMixin,\n}\nbreak;\n}\n- case 'lab_pricing_types': {\n- if (value === 'Lab Procedure') {\n- return false;\n- }\n- break;\n- }\n- case 'imaging_pricing_types': {\n- if (value === 'Imaging Procedure') {\n- return false;\n- }\n- break;\n- }\ncase 'visit_types': {\nif (value === 'Admission') {\nreturn false;\n"
},
{
"change_type": "MODIFY",
"old_path": "app/admin/lookup/template.hbs",
"new_path": "app/admin/lookup/template.hbs",
"diff": "<div class=\"panel-heading\">\n<h3 class=\"panel-title\">{{lookupTitle}}</h3>\n</div>\n- {{#if canEditValues}}\n<div class=\"panel-body\">\n<table class=\"table\">\n<tr class=\"table-header\">\n{{/each}}\n</table>\n</div>\n- {{/if}}\n<div class=\"panel-footer\">\n- {{#if canEditValues}}\n<button class=\"btn btn-default neutral\" {{action 'addValue'}}>{{t 'buttons.addValue'}}</button>\n- {{/if}}\n{{#em-form model=lookupTypeList submitButton=false as |form|}}\n<div class=\"row\">\n<div class=\"col-sm-4\">\n"
},
{
"change_type": "MODIFY",
"old_path": "app/pricing/edit/controller.js",
"new_path": "app/pricing/edit/controller.js",
"diff": "@@ -61,8 +61,8 @@ export default AbstractEditController.extend(ReturnTo, {\nproperty: 'model.expenseAccount',\nid: 'expense_account_list'\n}];\n- let showPricingType = this.get('showPricingType');\n- if (showPricingType) {\n+ let pricingTypeEditable = this.get('pricingTypeEditable');\n+ if (pricingTypeEditable) {\nlistsToUpdate.push({\nname: `${category}PricingTypes`,\nproperty: 'model.pricingType',\n@@ -80,8 +80,9 @@ export default AbstractEditController.extend(ReturnTo, {\n}\n}),\n- showPricingType: computed('model.category', function() {\n+ pricingTypeEditable: computed('model.category', function() {\nlet model = this.get('model');\n+ let isNew = model.get('isNew');\nlet category = model.get('category');\nif (category === 'Imaging') {\n@@ -91,7 +92,9 @@ export default AbstractEditController.extend(ReturnTo, {\nmodel.set('pricingType', LAB_PRICING_TYPE);\nreturn false;\n} else {\n+ if (isNew) {\nmodel.set('pricingType');\n+ }\nreturn true;\n}\n}),\n"
},
{
"change_type": "MODIFY",
"old_path": "app/pricing/edit/template.hbs",
"new_path": "app/pricing/edit/template.hbs",
"diff": "property='category'\nlabel=(t 'labels.category')\n}}\n- {{#if showPricingType}}\n+ {{#if pricingTypeEditable}}\n{{select-or-typeahead form=form model=model\nproperty=\"pricingType\" label=(t 'labels.type')\nlist=pricingTypes\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Finish removing lookup lists, extra code, rename computed property. |
288,328 | 11.10.2018 00:21:42 | 18,000 | 6e6737319d7b9607d31a996d3dbce11073f2782b | Better fix for pricing/edit controller. | [
{
"change_type": "MODIFY",
"old_path": "app/pricing/edit/controller.js",
"new_path": "app/pricing/edit/controller.js",
"diff": "@@ -19,6 +19,23 @@ export default AbstractEditController.extend(ReturnTo, {\nthis.send('update', true);\nthis.send('closeModal');\n},\n+ categoryChanged(category) {\n+ let model = this.get('model');\n+ let pricingType = model.get('pricingType');\n+ model.set('category', category);\n+ if (!isEmpty(category)) {\n+ if (category === 'Imaging') {\n+ model.set('pricingType', IMAGING_PRICING_TYPE);\n+ } else if (category === 'Lab') {\n+ model.set('pricingType', LAB_PRICING_TYPE);\n+ } else {\n+ let pricingTypeValues = this.get('pricingTypes.value');\n+ if (isEmpty(pricingTypeValues) || !pricingTypeValues.includes(pricingType)) {\n+ model.set('pricingType');\n+ }\n+ }\n+ }\n+ },\ndeleteOverride(model) {\nlet { overrideToDelete } = model;\nlet pricingOverrides = this.get('model.pricingOverrides');\n@@ -82,19 +99,10 @@ export default AbstractEditController.extend(ReturnTo, {\npricingTypeEditable: computed('model.category', function() {\nlet model = this.get('model');\n- let isNew = model.get('isNew');\nlet category = model.get('category');\n-\n- if (category === 'Imaging') {\n- model.set('pricingType', IMAGING_PRICING_TYPE);\n- return false;\n- } else if (category === 'Lab') {\n- model.set('pricingType', LAB_PRICING_TYPE);\n+ if (category === 'Imaging' || category === 'Lab') {\nreturn false;\n} else {\n- if (isNew) {\n- model.set('pricingType');\n- }\nreturn true;\n}\n}),\n"
},
{
"change_type": "MODIFY",
"old_path": "app/pricing/edit/route.js",
"new_path": "app/pricing/edit/route.js",
"diff": "@@ -14,11 +14,21 @@ export default AbstractEditRoute.extend({\ngetNewData(params) {\nlet newCategory = params.pricing_id.substr(3);\n+ let newPricingType = null;\n+\nif (isEmpty(newCategory)) {\nnewCategory = 'Imaging';\n}\n+\n+ if (newCategory === 'Lab') {\n+ newPricingType = 'Lab Procedure';\n+ } else if (newCategory === 'Imaging') {\n+ newPricingType = 'Imaging Procedure';\n+ }\n+\nreturn resolve({\n- category: newCategory\n+ category: newCategory,\n+ pricingType: newPricingType\n});\n},\n"
},
{
"change_type": "MODIFY",
"old_path": "app/pricing/edit/template.hbs",
"new_path": "app/pricing/edit/template.hbs",
"diff": "optionValuePath='value'\noptionLabelPath='id'\nproperty='category'\n+ action=(action 'categoryChanged')\nlabel=(t 'labels.category')\n}}\n+ {{#if pricingTypeEditable}}\n{{select-or-typeahead form=form model=model\nproperty=\"pricingType\" label=(t 'labels.type')\nlist=pricingTypes\nclassName=\"col-xs-4 price-type form-input-group\"\nprompt=\" \"\n- disabled=(not pricingTypeEditable)\n}}\n+ {{else}}\n+ <div class=\"col-xs-4 price-type form-input-group\">\n+ <label class=\"control-label\">{{t 'labels.type'}}</label>\n+ <p class=\"form-control-static\">{{model.pricingType}}</p>\n+ </div>\n+ {{/if}}\n</div>\n<div class=\"panel\">\n<div class=\"panel-heading\">\n"
},
{
"change_type": "MODIFY",
"old_path": "app/templates/components/render-typeahead.hbs",
"new_path": "app/templates/components/render-typeahead.hbs",
"diff": "-\n{{#if usePricingTypeAhead}}\n{{pricing-typeahead class=className property=property model=model\nlabel=label content=content\n{{else}}\n{{type-ahead class=className property=property model=model\nlabel=label content=content\n- selection=selection setOnBlur=setOnBlur hint=hint disabled=disabled\n+ selection=selection setOnBlur=setOnBlur hint=hint\n}}\n{{/if}}\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Better fix for pricing/edit controller. |
288,323 | 17.10.2018 22:31:39 | 18,000 | 5b3668c23a0dd60e1f670224ae646b9ccfcc1445 | fixes button styling on generate report button (HospitalRun/hospitalrun-frontend/#1527) | [
{
"change_type": "MODIFY",
"old_path": "app/incident/reports/template.hbs",
"new_path": "app/incident/reports/template.hbs",
"diff": "{{/em-form}}\n</div>\n<div class=\"panel-footer\">\n- <button class=\"btn btn-default\" {{action 'generateReport'}}>{{t 'incident.buttons.generateRep'}}</button>\n+ <button class=\"btn btn-primary\" {{action 'generateReport'}}>{{t 'incident.buttons.generateRep'}}</button>\n</div>\n{{/if}}\n</div>\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | fixes button styling on generate report button (HospitalRun/hospitalrun-frontend/#1527) |
288,323 | 18.10.2018 22:26:41 | 18,000 | e77684d3e057d19c8794e2b737a50940f9c7fba4 | fixes issue where generating incident report would result in 'Error: Undefined' in the console (HospitalRun/hospitalrun-frontend/#1527) | [
{
"change_type": "MODIFY",
"old_path": "app/incident/reports/controller.js",
"new_path": "app/incident/reports/controller.js",
"diff": "@@ -70,7 +70,7 @@ export default AbstractReportController.extend(UserSession, NumberFormat, {\nlet maxValue = get(this, 'maxValue');\nreturn new RSVP.Promise(function(resolve, reject) {\nif (isEmpty(filterStartDate)) {\n- reject();\n+ reject('Start date cannot be an empty value.');\n}\nfindParams.options.startkey = [filterStartDate.getTime(), null];\n"
},
{
"change_type": "MODIFY",
"old_path": "app/incident/reports/template.hbs",
"new_path": "app/incident/reports/template.hbs",
"diff": "<div class=\"panel-body\">\n{{#em-form model=this submitButton=false as |form|}}\n<div class=\"row\">\n- {{date-picker model=model property=\"startDate\" label=(t 'incident.labels.startDate') class=\"col-sm-4\"}}\n- {{date-picker model=model property=\"endDate\" label=(t 'incident.labels.endDate') class=\"col-sm-4\"}}\n+ {{date-picker model=this property=\"startDate\" label=(t 'incident.labels.startDate')\n+ class=\"col-sm-4 test-start-date\"}}\n+ {{date-picker model=this property=\"endDate\" label=(t 'incident.labels.endDate')\n+ class=\"col-sm-4 test-end-date\"}}\n</div>\n<div class=\"row\" data-test-selector=\"select-report-type\">\n{{form.select\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/acceptance/incident-test.js",
"new_path": "tests/acceptance/incident-test.js",
"diff": "@@ -6,6 +6,7 @@ import select from 'hospitalrun/tests/helpers/select';\nimport typeAheadFillIn from 'hospitalrun/tests/helpers/typeahead-fillin';\nimport { waitToAppear, waitToDisappear } from 'hospitalrun/tests/helpers/wait-to-appear';\nimport { authenticateUser } from 'hospitalrun/tests/helpers/authenticate-user';\n+import selectDate from 'hospitalrun/tests/helpers/select-date';\nconst DATE_FORMAT = 'l';\nconst DATE_TIME_FORMAT = 'l h:mm A';\n@@ -207,6 +208,32 @@ test('Incident deletion', function(assert) {\n});\n});\n+testSimpleReportForm('Incidents By Department');\n+testSimpleReportForm('Incidents By Category');\n+\n+function testSimpleReportForm(reportName) {\n+ test(`${reportName} report can be generated`, function(assert) {\n+ return runWithPouchDump('default', async function() {\n+ await authenticateUser();\n+ await visit('/incident/reports');\n+ assert.equal(currentURL(), '/incident/reports');\n+\n+ let startDate = moment('2015-10-01');\n+ let endDate = moment('2015-10-31');\n+ await selectDate('.test-start-date input', startDate.toDate());\n+ await selectDate('.test-end-date input', endDate.toDate());\n+ await select('#report-type', `${reportName}`);\n+ await click('button:contains(Generate Report)');\n+ await waitToAppear('.panel-title');\n+\n+ let reportTitle = `${reportName} Report ${startDate.format('l')} - ${endDate.format('l')}`;\n+ assert.dom('.panel-title').hasText(reportTitle, `${reportName} Report generated`);\n+ let exportLink = findWithAssert('a:contains(Export Report)');\n+ assert.equal($(exportLink).attr('download'), `${reportTitle}.csv`);\n+ });\n+ });\n+}\n+\nasync function addItem(assert, itemName) {\nawait click('button:contains(Add Item)');\nawait waitToAppear('.modal-dialog');\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | fixes issue where generating incident report would result in 'Error: Undefined' in the console (HospitalRun/hospitalrun-frontend/#1527) |
288,323 | 18.10.2018 22:28:53 | 18,000 | b7a93e1ea0684729bc705788e67cbffe673fb4ed | fixes button styling on export report button (HospitalRun/hospitalrun-frontend/#1527) | [
{
"change_type": "MODIFY",
"old_path": "app/incident/reports/template.hbs",
"new_path": "app/incident/reports/template.hbs",
"diff": "</table>\n</div>\n<div class=\"panel-footer\">\n- <a href={{csvExport}} target=\"_blank\" download=\"{{reportTitle}}.csv\" class=\"btn btn-default\">{{t 'incident.buttons.export'}}</a>\n+ <a href={{csvExport}} target=\"_blank\" download=\"{{reportTitle}}.csv\" class=\"btn btn-primary\">{{t 'incident.buttons.export'}}</a>\n</div>\n</div>\n{{/if}}\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | fixes button styling on export report button (HospitalRun/hospitalrun-frontend/#1527) |
288,328 | 21.10.2018 01:29:21 | 18,000 | 54306beb4087ca57f35c3edeb35a475dcec3c770 | Update inventory/edit after deleting inv-location. | [
{
"change_type": "MODIFY",
"old_path": "app/inventory/delete/controller.js",
"new_path": "app/inventory/delete/controller.js",
"diff": "import { translationMacro as t } from 'ember-i18n';\n+import { inject as controller } from '@ember/controller';\nimport AbstractDeleteController from 'hospitalrun/controllers/abstract-delete-controller';\nexport default AbstractDeleteController.extend({\n- title: t('inventory.labels.deleteItem')\n+ title: t('inventory.labels.deleteItem'),\n+ editController: controller('inventory/edit'),\n+ afterDeleteAction: 'updateAndCloseModal',\n+\n+ actions: {\n+ updateAndCloseModal() {\n+ this.get('editController').send('update', true);\n+ this.send('closeModal');\n+ }\n+ }\n});\n"
},
{
"change_type": "MODIFY",
"old_path": "app/inventory/transfer/template.hbs",
"new_path": "app/inventory/transfer/template.hbs",
"diff": "<label class=\"control-label\">{{t 'inventory.labels.quantityAvailable'}}</label>\n<p class=\"form-control-static\">{{model.quantity}}</p>\n</div>\n- {{select-or-typeahead form=form model=model class=\"required\" property=\"transferLocation\" label=(t 'inventory.labels.transferTo') list=warehouseList selection=model.transferLocation }}\n+ {{select-or-typeahead form=form model=model class=\"required test-transfer-location\" property=\"transferLocation\" label=(t 'inventory.labels.transferTo') list=warehouseList selection=model.transferLocation }}\n{{select-or-typeahead form=form model=model property=\"transferAisleLocation\" label=(t 'inventory.labels.transferToAisle') list=aisleLocationList selection=model.transferAisleLocation }}\n<div class=\"row\">\n- {{number-input model=model property=\"adjustmentQuantity\" label=(t 'labels.quantity') class=\"col-sm-3 required\"}}\n+ {{number-input model=model class=\"required test-adjustment-quantity col-sm-3\" property=\"adjustmentQuantity\" label=(t 'labels.quantity')}}\n</div>\n<div class=\"row\">\n{{date-picker model=model property=\"dateCompleted\" label=(t 'inventory.labels.dateTransferred') class=\"col-sm-4 required\"}}\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/acceptance/inventory-test.js",
"new_path": "tests/acceptance/inventory-test.js",
"diff": "@@ -5,7 +5,7 @@ import runWithPouchDump from 'hospitalrun/tests/helpers/run-with-pouch-dump';\nimport select from 'hospitalrun/tests/helpers/select';\nimport selectDate from 'hospitalrun/tests/helpers/select-date';\nimport typeAheadFillIn from 'hospitalrun/tests/helpers/typeahead-fillin';\n-import { waitToAppear } from 'hospitalrun/tests/helpers/wait-to-appear';\n+import { waitToAppear, waitToDisappear } from 'hospitalrun/tests/helpers/wait-to-appear';\nimport { authenticateUser } from 'hospitalrun/tests/helpers/authenticate-user';\nmoduleForAcceptance('Acceptance | inventory');\n@@ -102,6 +102,38 @@ test('Items with negative quantites should not be saved', (assert) => {\n});\n});\n+test('Transfer or Delete location should update inventory item', (assert) => {\n+ return runWithPouchDump('inventory', async function() {\n+ await authenticateUser();\n+ await visit('/inventory/listing');\n+ assert.equal(currentURL(), '/inventory/listing');\n+\n+ await click('button:contains(Edit)');\n+ await click('button:contains(Transfer)');\n+\n+ await waitToAppear('.modal-dialog');\n+ await typeAheadFillIn('.test-transfer-location', 'newLocation');\n+ await fillIn('.test-adjustment-quantity input', 1000);\n+ await click('button:contains(Transfer):last');\n+ await waitToDisappear('.modal-dialog');\n+\n+ await click('button:contains(Return)');\n+\n+\n+\n+ assert.dom('tr .btn').exists({count: 4});\n+ await click('button:contains(Edit)');\n+\n+ await click('button:contains(Delete)');\n+ await waitToAppear('.modal-dialog');\n+ await click('button:contains(Delete):last');\n+ await waitToDisappear('.modal-dialog');\n+\n+ await click('button:contains(Return)');\n+ assert.dom('tr .btn').exists({count: 4});\n+ });\n+});\n+\ntest('Visiting /inventory/barcode', (assert) => {\nreturn runWithPouchDump('inventory', async function() {\nawait authenticateUser();\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Update inventory/edit after deleting inv-location. |
288,323 | 28.10.2018 21:40:30 | 18,000 | 5c38292f96bf851055d7111570f5f24c3cd375df | fixes styling on patient export report button (changes from btn-default to btn-primary) | [
{
"change_type": "MODIFY",
"old_path": "app/patients/reports/template.hbs",
"new_path": "app/patients/reports/template.hbs",
"diff": "</table>\n</div>\n<div class=\"panel-footer\">\n- <a href={{csvExport}} target=\"_blank\" download=\"{{reportTitle}}.csv\" class=\"btn btn-default\">{{t 'inventory.reports.export'}}</a>\n+ <a href={{csvExport}} target=\"_blank\" download=\"{{reportTitle}}.csv\" class=\"btn btn-primary\">{{t 'inventory.reports.export'}}</a>\n</div>\n</div>\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | fixes styling on patient export report button (changes from btn-default to btn-primary) |
288,328 | 30.10.2018 14:00:46 | 18,000 | c80e9e3462197973ac1cdfe56f65f3428f2bfa7d | Move date validator to single function, test. | [
{
"change_type": "MODIFY",
"old_path": "app/models/appointment.js",
"new_path": "app/models/appointment.js",
"diff": "@@ -5,6 +5,31 @@ import DS from 'ember-data';\nimport moment from 'moment';\nimport PatientValidation from 'hospitalrun/utils/patient-validation';\n+function dateAcceptance(object) {\n+ if (!object.get('hasDirtyAttributes')) {\n+ return false;\n+ }\n+ let allDay = object.get('allDay');\n+ let startDate = object.get('startDate');\n+ let endDate = object.get('endDate');\n+ if (isEmpty(endDate) || isEmpty(startDate)) {\n+ // force validation to fail\n+ return true;\n+ } else {\n+ if (allDay) {\n+ if (endDate.getTime() < startDate.getTime()) {\n+ return true;\n+ }\n+ } else {\n+ if (endDate.getTime() <= startDate.getTime()) {\n+ return true;\n+ }\n+ }\n+ }\n+ // patient is properly selected; don't do any further validation\n+ return false;\n+}\n+\nexport default AbstractModel.extend({\n// Attributes\nallDay: DS.attr(),\n@@ -89,63 +114,14 @@ export default AbstractModel.extend({\nstartDate: {\nacceptance: {\naccept: true,\n- if(object) {\n- if (!object.get('hasDirtyAttributes')) {\n- return false;\n- }\n- let allDay = object.get('allDay');\n- let startDate = object.get('startDate');\n- let endDate = object.get('endDate');\n- if (isEmpty(startDate)) {\n- // force validation to fail\n- return true;\n- } else if (!isEmpty(endDate)) {\n- // end date is already selected; do further validation\n- if (allDay) {\n- if (endDate.getTime() < startDate.getTime()) {\n- return true;\n- }\n- } else {\n- if (endDate.getTime() <= startDate.getTime()) {\n- return true;\n- }\n- }\n- }\n- // patient is properly selected; don't do any further validation\n- return false;\n-\n- },\n+ if: dateAcceptance,\nmessage: 'Please select a start date earlier than the end date'\n}\n},\nendDate: {\nacceptance: {\naccept: true,\n- if(object) {\n- if (!object.get('hasDirtyAttributes')) {\n- return false;\n- }\n- let allDay = object.get('allDay');\n- let startDate = object.get('startDate');\n- let endDate = object.get('endDate');\n- if (isEmpty(endDate) || isEmpty(startDate)) {\n- // force validation to fail\n- return true;\n- } else {\n- if (allDay) {\n- if (endDate.getTime() < startDate.getTime()) {\n- return true;\n- }\n- } else {\n- if (endDate.getTime() <= startDate.getTime()) {\n- return true;\n- }\n- }\n- }\n- // patient is properly selected; don't do any further validation\n- return false;\n-\n- },\n+ if: dateAcceptance,\nmessage: 'Please select an end date later than the start date'\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/acceptance/appointments-test.js",
"new_path": "tests/acceptance/appointments-test.js",
"diff": "@@ -80,6 +80,32 @@ test('Creating a new appointment', function(assert) {\n});\n});\n+test('Test for appointment validation issue #1484', function(assert) {\n+ return runWithPouchDump('appointments', async function() {\n+ let today = moment().startOf('day');\n+ let tomorrow = moment(today).add(24, 'hours');\n+ let dayAfterTomorrow = moment(tomorrow).add(24, 'hours');\n+\n+ await authenticateUser();\n+ await visit('/appointments/edit/new');\n+\n+ assert.equal(currentURL(), '/appointments/edit/new');\n+ findWithAssert('button:contains(Cancel)');\n+ findWithAssert('button:contains(Add)');\n+\n+ // set end date later than start date\n+ await fillIn('.test-appointment-start input', today.format(DATE_FORMAT));\n+ await fillIn('.test-appointment-end input', tomorrow.format(DATE_FORMAT));\n+\n+ // set start date later than end date\n+ await fillIn('.test-appointment-start input', dayAfterTomorrow.format(DATE_FORMAT));\n+\n+ // confirm error condition exists.\n+ pauseTest();\n+\n+ });\n+});\n+\ntest('Creating a new appointment from patient screen', function(assert) {\nreturn runWithPouchDump('appointments', async function() {\nlet today = moment().startOf('day');\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Move date validator to single function, test. |
288,328 | 30.10.2018 20:38:31 | 18,000 | 2a52aa831f11389a6ce62434d4b81bf46769b394 | Move to unit test instead of acceptance. | [
{
"change_type": "MODIFY",
"old_path": "tests/acceptance/appointments-test.js",
"new_path": "tests/acceptance/appointments-test.js",
"diff": "@@ -80,31 +80,6 @@ test('Creating a new appointment', function(assert) {\n});\n});\n-test('Verify fix for appointment validation issue #1484', function(assert) {\n- return runWithPouchDump('appointments', async function() {\n- let today = moment().startOf('day');\n- let tomorrow = moment(today).add(24, 'hours');\n- let dayAfterTomorrow = moment(tomorrow).add(24, 'hours');\n-\n- await authenticateUser();\n- await visit('/appointments/edit/new');\n-\n- assert.equal(currentURL(), '/appointments/edit/new');\n- findWithAssert('button:contains(Cancel)');\n- findWithAssert('button:contains(Add)');\n-\n- // set end date later than start date\n- await fillIn('.test-appointment-start input', today.format(DATE_FORMAT));\n- await fillIn('.test-appointment-end input', tomorrow.format(DATE_FORMAT));\n-\n- // set start date later than end date\n- await fillIn('.test-appointment-start input', dayAfterTomorrow.format(DATE_FORMAT));\n-\n- assert.equal(find('.help-block:first:contains(Please select a start date earlier than the end date)').length, 1, 'Start date validation error appears');\n- assert.equal(find('.help-block:last:contains(Please select an end date later than the start date)').length, 1, 'End date validation error appears');\n- });\n-});\n-\ntest('Creating a new appointment from patient screen', function(assert) {\nreturn runWithPouchDump('appointments', async function() {\nlet today = moment().startOf('day');\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/unit/models/appointment-test.js",
"new_path": "tests/unit/models/appointment-test.js",
"diff": "import { moduleForModel } from 'ember-qunit';\n+import moment from 'moment';\nimport {\ntestValidPropertyValues,\n@@ -18,5 +19,35 @@ moduleForModel('appointment', 'Unit | Model | appointment', {\ntestValidPropertyValues('appointmentType', ['test']);\ntestInvalidPropertyValues('appointmentType', [undefined]);\n-testValidPropertyValues('startDate', ['test']);\n-testInvalidPropertyValues('startDate', [undefined]);\n+let today = moment().startOf('day').toDate();\n+let tomorrow = moment().startOf('day').add(24, 'hours').toDate();\n+\n+testValidPropertyValues('startDate', [today], function(subject) {\n+ Ember.run(() => { subject.set('endDate', tomorrow) });\n+});\n+\n+testInvalidPropertyValues('startDate', [tomorrow], function(subject) {\n+ Ember.run(() => { subject.set('endDate', today) });\n+});\n+\n+testValidPropertyValues('endDate', [tomorrow], function(subject) {\n+ Ember.run(() => { subject.set('startDate', today) });\n+});\n+\n+testInvalidPropertyValues('endDate', [today], function(subject) {\n+ Ember.run(() => { subject.set('startDate', tomorrow) });\n+});\n+\n+testInvalidPropertyValues('startDate', [today], function(subject) {\n+ Ember.run(() => {\n+ subject.set('allDay', false);\n+ subject.set('endDate', today);\n+ });\n+});\n+\n+testValidPropertyValues('startDate', [today], function(subject) {\n+ Ember.run(() => {\n+ subject.set('allDay', true);\n+ subject.set('endDate', today);\n+ });\n+});\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Move to unit test instead of acceptance. |
288,328 | 30.10.2018 21:32:00 | 18,000 | 06a1e15c571e34bba707179aadc822e1ebb15d81 | Fix for ESLint. | [
{
"change_type": "MODIFY",
"old_path": "tests/unit/models/appointment-test.js",
"new_path": "tests/unit/models/appointment-test.js",
"diff": "import { moduleForModel } from 'ember-qunit';\n+import { run } from '@ember/runloop';\nimport moment from 'moment';\nimport {\n@@ -23,30 +24,38 @@ let today = moment().startOf('day').toDate();\nlet tomorrow = moment().startOf('day').add(24, 'hours').toDate();\ntestValidPropertyValues('startDate', [today], function(subject) {\n- Ember.run(() => { subject.set('endDate', tomorrow) });\n+ run(() => {\n+ subject.set('endDate', tomorrow);\n+ });\n});\ntestInvalidPropertyValues('startDate', [tomorrow], function(subject) {\n- Ember.run(() => { subject.set('endDate', today) });\n+ run(() => {\n+ subject.set('endDate', today);\n+ });\n});\ntestValidPropertyValues('endDate', [tomorrow], function(subject) {\n- Ember.run(() => { subject.set('startDate', today) });\n+ run(() => {\n+ subject.set('startDate', today);\n+ });\n});\ntestInvalidPropertyValues('endDate', [today], function(subject) {\n- Ember.run(() => { subject.set('startDate', tomorrow) });\n+ run(() => {\n+ subject.set('startDate', tomorrow);\n+ });\n});\ntestInvalidPropertyValues('startDate', [today], function(subject) {\n- Ember.run(() => {\n+ run(() => {\nsubject.set('allDay', false);\nsubject.set('endDate', today);\n});\n});\ntestValidPropertyValues('startDate', [today], function(subject) {\n- Ember.run(() => {\n+ run(() => {\nsubject.set('allDay', true);\nsubject.set('endDate', today);\n});\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Fix for ESLint. |
288,323 | 30.10.2018 23:24:24 | 18,000 | 3c11109aeeb798cfedf0c53394edaab2e3a30f68 | fixes issue with incident report not having an end date if no end date was selected (HospitalRun/hospitalrun-frontend#1543) | [
{
"change_type": "MODIFY",
"old_path": "app/incident/reports/controller.js",
"new_path": "app/incident/reports/controller.js",
"diff": "@@ -63,21 +63,23 @@ export default AbstractReportController.extend(UserSession, NumberFormat, {\n_findIncidentsByDate() {\nlet filterEndDate = get(this, 'endDate');\nlet filterStartDate = get(this, 'startDate');\n+\nlet findParams = {\noptions: {},\nmapReduce: 'incident_by_date'\n};\n+\nlet maxValue = get(this, 'maxValue');\n+\nreturn new RSVP.Promise(function(resolve, reject) {\n- if (isEmpty(filterStartDate)) {\n- reject('Start date cannot be an empty value.');\n+ if (isEmpty(filterStartDate) || isEmpty(filterEndDate)) {\n+ reject('Start or End date cannot be an empty value.');\n}\n- findParams.options.startkey = [filterStartDate.getTime(), null];\n- if (!isEmpty(filterEndDate)) {\n+ findParams.options.startkey = [filterStartDate.getTime(), null];\nfilterEndDate = moment(filterEndDate).endOf('day').toDate();\nfindParams.options.endkey = [filterEndDate.getTime(), maxValue];\n- }\n+\nreturn this.store.query('incident', findParams).then(resolve, reject);\n}.bind(this));\n},\n@@ -145,6 +147,12 @@ export default AbstractReportController.extend(UserSession, NumberFormat, {\nactions: {\ngenerateReport() {\n+\n+ if (isEmpty(get(this, 'endDate'))) {\n+ let now = new Date();\n+ this.set('endDate', now);\n+ }\n+\nlet reportRows = get(this, 'reportRows');\nlet reportType = get(this, 'reportType');\nreportRows.clear();\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/acceptance/incident-test.js",
"new_path": "tests/acceptance/incident-test.js",
"diff": "@@ -208,18 +208,20 @@ test('Incident deletion', function(assert) {\n});\n});\n-testSimpleReportForm('Incidents By Department');\n-testSimpleReportForm('Incidents By Category');\n+testSimpleReportForm('Incidents By Department', '2015-10-01', '2015-10-31');\n+testSimpleReportForm('Incidents By Category', '2015-10-01', '2015-10-31');\n+testEmptyEndDate('Incidents By Department', '2015-10-01');\n+testEmptyEndDate('Incidents By Category', '2015-10-01');\n-function testSimpleReportForm(reportName) {\n+function testSimpleReportForm(reportName, start, end) {\ntest(`${reportName} report can be generated`, function(assert) {\nreturn runWithPouchDump('default', async function() {\nawait authenticateUser();\nawait visit('/incident/reports');\nassert.equal(currentURL(), '/incident/reports');\n- let startDate = moment('2015-10-01');\n- let endDate = moment('2015-10-31');\n+ let startDate = moment(start);\n+ let endDate = moment(end);\nawait selectDate('.test-start-date input', startDate.toDate());\nawait selectDate('.test-end-date input', endDate.toDate());\nawait select('#report-type', `${reportName}`);\n@@ -234,6 +236,28 @@ function testSimpleReportForm(reportName) {\n});\n}\n+function testEmptyEndDate(reportName, start) {\n+ test(`${reportName} report can be generated with no end date`, function(assert) {\n+ return runWithPouchDump('default', async function() {\n+ await authenticateUser();\n+ await visit('/incident/reports');\n+ assert.equal(currentURL(), '/incident/reports');\n+\n+ let startDate = moment(start);\n+ await selectDate('.test-start-date input', startDate.toDate());\n+ await select('#report-type', `${reportName}`);\n+ await click('button:contains(Generate Report)');\n+ await waitToAppear('.panel-title');\n+\n+ let endDate = moment(new Date());\n+ let reportTitle = `${reportName} Report ${startDate.format('l')} - ${endDate.format('l')}`;\n+ assert.dom('.panel-title').hasText(reportTitle, `${reportName} Report generated`);\n+ let exportLink = findWithAssert('a:contains(Export Report)');\n+ assert.equal($(exportLink).attr('download'), `${reportTitle}.csv`);\n+ });\n+ });\n+}\n+\nasync function addItem(assert, itemName) {\nawait click('button:contains(Add Item)');\nawait waitToAppear('.modal-dialog');\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | fixes issue with incident report not having an end date if no end date was selected (HospitalRun/hospitalrun-frontend#1543) |
288,323 | 30.10.2018 23:25:56 | 18,000 | e8fafb3b1b4a1288118c6029af55e8307404a074 | fixes issue with patient report not having an end date if no end date was selected (HospitalRun/hospitalrun-frontend#1543) | [
{
"change_type": "MODIFY",
"old_path": "app/patients/reports/controller.js",
"new_path": "app/patients/reports/controller.js",
"diff": "@@ -855,6 +855,11 @@ export default AbstractReportController.extend(PatientDiagnosis, PatientVisits,\nactions: {\ngenerateReport() {\n+ if (isEmpty(this.get('endDate'))) {\n+ let now = new Date();\n+ this.set('endDate', now);\n+ }\n+\nif (this._validateDates()) {\nlet reportRows = this.get('reportRows');\nlet reportType = this.get('reportType');\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/acceptance/patients-test.js",
"new_path": "tests/acceptance/patients-test.js",
"diff": "+import moment from 'moment';\nimport { test } from 'qunit';\nimport moduleForAcceptance from 'hospitalrun/tests/helpers/module-for-acceptance';\nimport runWithPouchDump from 'hospitalrun/tests/helpers/run-with-pouch-dump';\n@@ -48,6 +49,7 @@ let reportNames = [\nreportNames.forEach((reportName) => {\ntestSimpleReportForm(reportName);\ntestExportReportName(reportName);\n+ testReportWithEmptyEndDate(reportName);\n});\ntest('View reports tab | Patient Status', function(assert) {\n@@ -166,19 +168,39 @@ function testSimpleReportForm(reportName) {\n});\n}\n-function testExportReportName(reportName) {\n- test(`View reports tab | Export reports name for ${reportName} shows report name, start and end dates`, (assert) => {\n- return runWithPouchDump('default', async function() {\n+async function generateReport(reportName, startDate, endDate) {\nawait authenticateUser();\nawait visit('/patients/reports');\nawait select('[data-test-selector=\"select-report-type\"] select', reportName);\n- assert.equal(currentURL(), '/patients/reports');\n- await fillIn('[data-test-selector=\"select-report-start-date\"] input', '12/11/2016');\n- await fillIn('[data-test-selector=\"select-report-end-date\"] input', '12/31/2016');\n+ await fillIn('[data-test-selector=\"select-report-start-date\"] input', startDate);\n+ await fillIn('[data-test-selector=\"select-report-end-date\"] input', endDate);\nawait click('button:contains(Generate Report)');\nawait waitToAppear('.panel-title');\n+}\n+\n+function testReportWithEmptyEndDate(reportName) {\n+ test('View reports tab | Report with empty end date should show the current date', (assert) => {\n+ return runWithPouchDump('default', async function() {\n+ let startDate = '12/11/2016';\n+ await generateReport(reportName, startDate, '');\n+\n+ let endDate = moment(new Date());\n+ let reportTitle = `${reportName} Report ${moment(startDate).format('l')} - ${endDate.format('l')}`;\n+ assert.dom('.panel-title').hasText(reportTitle, `${reportName} Report generated`);\n+ let exportLink = findWithAssert('a:contains(Export Report)');\n+ assert.equal($(exportLink).attr('download'), `${reportTitle}.csv`);\n+ });\n+\n+ });\n+}\n+\n+function testExportReportName(reportName) {\n+ test(`View reports tab | Export reports name for ${reportName} shows report name, start and end dates`, (assert) => {\n+ return runWithPouchDump('default', async function() {\n+ await generateReport(reportName, '12/11/2016', '12/31/2016');\n+ assert.equal(currentURL(), '/patients/reports');\nlet exportReportButton = findWithAssert('a:contains(Export Report)');\nassert.equal($(exportReportButton).attr('download'), `${reportName} Report 12/11/2016 - 12/31/2016.csv`);\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | fixes issue with patient report not having an end date if no end date was selected (HospitalRun/hospitalrun-frontend#1543) |
288,323 | 30.10.2018 23:31:12 | 18,000 | ee9bcc0fb3b2c2ae13c3ee90e1c7c937f01ef938 | makes inventory report end date autofill consistent with incident and patient reports (HospitalRun/hospitalrun-frontend#1543) | [
{
"change_type": "MODIFY",
"old_path": "app/inventory/reports/controller.js",
"new_path": "app/inventory/reports/controller.js",
"diff": "@@ -1295,6 +1295,11 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number\nactions: {\ngenerateReport() {\nlet endDate = this.get('endDate');\n+ if (isEmpty(endDate)) {\n+ let now = new Date();\n+ this.set('endDate', now);\n+ }\n+\nlet reportRows = this.get('reportRows');\nlet reportType = this.get('reportType');\nlet startDate = this.get('startDate');\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/acceptance/inventory-test.js",
"new_path": "tests/acceptance/inventory-test.js",
"diff": "@@ -5,7 +5,7 @@ import runWithPouchDump from 'hospitalrun/tests/helpers/run-with-pouch-dump';\nimport select from 'hospitalrun/tests/helpers/select';\nimport selectDate from 'hospitalrun/tests/helpers/select-date';\nimport typeAheadFillIn from 'hospitalrun/tests/helpers/typeahead-fillin';\n-import { waitToAppear, waitToDisappear } from 'hospitalrun/tests/helpers/wait-to-appear';\n+import { waitToAppear } from 'hospitalrun/tests/helpers/wait-to-appear';\nimport { authenticateUser } from 'hospitalrun/tests/helpers/authenticate-user';\nmoduleForAcceptance('Acceptance | inventory');\n@@ -102,45 +102,6 @@ test('Items with negative quantites should not be saved', (assert) => {\n});\n});\n-test('Transfer or Delete location should update inventory item', (assert) => {\n- return runWithPouchDump('inventory', async function() {\n- await authenticateUser();\n- await visit('/inventory/listing');\n- assert.equal(currentURL(), '/inventory/listing');\n-\n- // transfer all units to a new location\n- await click('button:contains(Edit)');\n- await click('button:contains(Transfer)');\n- await waitToAppear('.modal-dialog');\n- await typeAheadFillIn('.test-transfer-location', 'newLocation');\n- await fillIn('.test-adjustment-quantity input', 1000);\n- await click('button:contains(Transfer):last');\n- await waitToDisappear('.modal-dialog');\n- await click('button:contains(Return)');\n-\n- // verify new location appears correctly along with default location\n- assert.dom('tr .btn').exists({ count: 4 });\n- await click('button:contains(Edit)');\n- assert.dom('.test-location-quantity').exists({ count: 2 });\n- assert.equal(find('.test-location-location:last:contains(newLocation)').length, 1, 'newLocation appears');\n- assert.equal(find('.test-location-quantity:last:contains(1000)').length, 1, 'Has correct quantity in newLocation');\n-\n- // delete default location\n- await click('button:contains(Delete)');\n- await waitToAppear('.modal-dialog');\n- await click('button:contains(Delete):last');\n- await waitToDisappear('.modal-dialog');\n- await click('button:contains(Return)');\n-\n- // verify default location is gone and new location w/ all units is still there\n- assert.dom('tr .btn').exists({ count: 4 });\n- await click('button:contains(Edit)');\n- assert.dom('.test-location-quantity').exists({ count: 1 });\n- assert.equal(find('.test-location-location:last:contains(newLocation)').length, 1, 'newLocation appears');\n- assert.equal(find('.test-location-quantity:last:contains(1000)').length, 1, 'Has correct quantity in newLocation');\n- });\n-});\n-\ntest('Visiting /inventory/barcode', (assert) => {\nreturn runWithPouchDump('inventory', async function() {\nawait authenticateUser();\n@@ -296,19 +257,34 @@ test('Searching inventory', function(assert) {\n});\n});\n-testSimpleReportForm('Detailed Adjustment');\n-testSimpleReportForm('Detailed Purchase');\n-testSimpleReportForm('Detailed Stock Usage');\n-testSimpleReportForm('Detailed Stock Transfer');\n-testSimpleReportForm('Detailed Expenses');\n-testSimpleReportForm('Expiration Date');\n-testSimpleReportForm('Summary Expenses');\n-testSimpleReportForm('Summary Purchase');\n-testSimpleReportForm('Summary Stock Usage');\n-testSimpleReportForm('Summary Stock Transfer');\n-testSimpleReportForm('Finance Summary');\n-testSingleDateReportForm('Inventory By Location');\n-testSingleDateReportForm('Inventory Valuation');\n+const startAndEndDateReportTypes = [\n+ 'Days Supply Left In Stock',\n+ 'Detailed Adjustment',\n+ 'Detailed Purchase',\n+ 'Detailed Stock Usage',\n+ 'Detailed Stock Transfer',\n+ 'Detailed Expenses',\n+ 'Expiration Date',\n+ 'Summary Expenses',\n+ 'Summary Purchase',\n+ 'Summary Stock Usage',\n+ 'Summary Stock Transfer',\n+ 'Finance Summary'\n+];\n+\n+const singleDateReportTypes = [\n+ 'Inventory By Location',\n+ 'Inventory Valuation'\n+];\n+\n+startAndEndDateReportTypes.forEach((reportName) => {\n+ testSimpleReportForm(reportName);\n+ testReportWithEmptyEndDate(reportName);\n+});\n+\n+singleDateReportTypes.forEach((reportName) => {\n+ testSingleDateReportForm(reportName);\n+});\nfunction testSimpleReportForm(reportName) {\ntest(`${reportName} report can be generated`, function(assert) {\n@@ -333,18 +309,48 @@ function testSimpleReportForm(reportName) {\n});\n}\n-function testSingleDateReportForm(reportName) {\n- test(`${reportName} report can be generated`, function(assert) {\n- return runWithPouchDump('default', async function() {\n+async function generateReport(reportName, startDate, endDate) {\nawait authenticateUser();\nawait visit('/inventory/reports');\n- assert.equal(currentURL(), '/inventory/reports');\n+\n+ if (startDate) {\n+ await selectDate('.test-start-date input', moment(startDate).toDate());\n+ }\n+\n+ if (endDate) {\n+ await selectDate('.test-end-date input', moment(endDate).toDate());\n+ }\nawait select('#report-type', `${reportName}`);\nawait click('button:contains(Generate Report)');\nawait waitToAppear('.panel-title');\n+}\n+\n+function testReportWithEmptyEndDate(reportName) {\n+ test(`${reportName} report can be generated with empty end date`, function(assert) {\n+ return runWithPouchDump('default', async function() {\n+\n+ let startDate = '12/11/2016';\n+ let endDate = new Date();\n+ await generateReport(reportName, startDate, null);\n+ assert.equal(currentURL(), '/inventory/reports');\n+\n+ let reportTitle = `${reportName} Report ${moment(startDate).format('l')} - ${moment(endDate).format('l')}`;\n+ assert.dom('.panel-title').hasText(reportTitle, `${reportName} Report generated`);\n+ let exportLink = findWithAssert('a:contains(Export Report)');\n+ assert.equal($(exportLink).attr('download'), `${reportTitle}.csv`);\n+ });\n+ });\n+}\n- let reportTitle = `${reportName} Report ${moment().format('l')}`;\n+function testSingleDateReportForm(reportName) {\n+ test(`${reportName} report can be generated`, function(assert) {\n+ return runWithPouchDump('default', async function() {\n+ let startDate = new Date();\n+ await generateReport(reportName, null, null);\n+\n+ assert.equal(currentURL(), '/inventory/reports');\n+ let reportTitle = `${reportName} Report ${moment(startDate).format('l')}`;\nassert.dom('.panel-title').hasText(reportTitle, `${reportName} Report generated`);\nlet exportLink = findWithAssert('a:contains(Export Report)');\nassert.equal($(exportLink).attr('download'), `${reportTitle}.csv`);\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | makes inventory report end date autofill consistent with incident and patient reports (HospitalRun/hospitalrun-frontend#1543) |
288,323 | 07.11.2018 22:24:42 | 21,600 | c0f50184c3fb1db6967101d10107f06c8e6da2e9 | adds error message to incident report generation (HospitalRun/hospitalrun-frontend#1543) | [
{
"change_type": "MODIFY",
"old_path": "app/incident/reports/controller.js",
"new_path": "app/incident/reports/controller.js",
"diff": "@@ -72,10 +72,6 @@ export default AbstractReportController.extend(UserSession, NumberFormat, {\nlet maxValue = get(this, 'maxValue');\nreturn new RSVP.Promise(function(resolve, reject) {\n- if (isEmpty(filterStartDate) || isEmpty(filterEndDate)) {\n- reject('Start or End date cannot be an empty value.');\n- }\n-\nfindParams.options.startkey = [filterStartDate.getTime(), null];\nfilterEndDate = moment(filterEndDate).endOf('day').toDate();\nfindParams.options.endkey = [filterEndDate.getTime(), maxValue];\n@@ -145,14 +141,36 @@ export default AbstractReportController.extend(UserSession, NumberFormat, {\nreturn types;\n},\n- actions: {\n- generateReport() {\n+ _validateDates() {\n+ let alertMessage;\n+ let isValid = true;\n+ let startDate = this.get('startDate');\n+ let endDate = this.get('endDate');\n- if (isEmpty(get(this, 'endDate'))) {\n+ if (isEmpty(startDate)) {\n+ alertMessage = 'Please enter a start date.';\n+ isValid = false;\n+ } else {\n+ if (isEmpty(endDate)) {\nlet now = new Date();\nthis.set('endDate', now);\n+ endDate = this.get('endDate');\n}\n+ if (endDate.getTime() < startDate.getTime()) {\n+ alertMessage = 'Please enter an end date after the start date.';\n+ isValid = false;\n+ }\n+ }\n+ if (!isValid) {\n+ this.displayAlert('Error Generating Report', alertMessage);\n+ }\n+ return isValid;\n+ },\n+\n+ actions: {\n+ generateReport() {\n+ if (this._validateDates()) {\nlet reportRows = get(this, 'reportRows');\nlet reportType = get(this, 'reportType');\nreportRows.clear();\n@@ -171,4 +189,5 @@ export default AbstractReportController.extend(UserSession, NumberFormat, {\n}\n}\n}\n+ }\n});\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/acceptance/incident-test.js",
"new_path": "tests/acceptance/incident-test.js",
"diff": "@@ -212,6 +212,10 @@ testSimpleReportForm('Incidents By Department', '2015-10-01', '2015-10-31');\ntestSimpleReportForm('Incidents By Category', '2015-10-01', '2015-10-31');\ntestEmptyEndDate('Incidents By Department', '2015-10-01');\ntestEmptyEndDate('Incidents By Category', '2015-10-01');\n+testEmptyStartDate('Incidents By Department');\n+testEmptyStartDate('Incidents By Category');\n+testEndDateBeforeStartDate('Incidents By Department');\n+testEndDateBeforeStartDate('Incidents By Category');\nfunction testSimpleReportForm(reportName, start, end) {\ntest(`${reportName} report can be generated`, function(assert) {\n@@ -258,6 +262,42 @@ function testEmptyEndDate(reportName, start) {\n});\n}\n+function testEmptyStartDate(reportName) {\n+ test(`${reportName} report cannot be generated without a start date`, function(assert) {\n+ return runWithPouchDump('default', async function() {\n+ let endDate = moment('2015-10-01');\n+ await authenticateUser();\n+ await visit('/incident/reports');\n+ assert.equal(currentURL(), '/incident/reports');\n+ await selectDate('.test-end-date input', endDate);\n+ await select('#report-type', `${reportName}`);\n+ await click('button:contains(Generate Report)');\n+ await waitToAppear('.modal-dialog');\n+ assert.dom('.modal-title').hasText('Error Generating Report', 'Error Generating Report');\n+ assert.dom('.modal-body').hasText('Please enter a start date.');\n+ });\n+ });\n+}\n+\n+function testEndDateBeforeStartDate(reportName) {\n+ test(`${reportName} report cannot be generatedwith an end date before a start date`, function(assert) {\n+ return runWithPouchDump('default', async function() {\n+ let startDate = moment('2015-10-02');\n+ let endDate = moment('2015-10-01');\n+ await authenticateUser();\n+ await visit('/incident/reports');\n+ assert.equal(currentURL(), '/incident/reports');\n+ await selectDate('.test-start-date input', startDate);\n+ await selectDate('.test-end-date input', endDate);\n+ await select('#report-type', `${reportName}`);\n+ await click('button:contains(Generate Report)');\n+ await waitToAppear('.modal-dialog');\n+ assert.dom('.modal-title').hasText('Error Generating Report', 'Error Generating Report');\n+ assert.dom('.modal-body').hasText('Please enter an end date after the start date.');\n+ });\n+ });\n+}\n+\nasync function addItem(assert, itemName) {\nawait click('button:contains(Add Item)');\nawait waitToAppear('.modal-dialog');\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | adds error message to incident report generation (HospitalRun/hospitalrun-frontend#1543) |
288,323 | 08.11.2018 22:22:05 | 21,600 | 9a4f67f40cbf67b3195328297b04544c1ac7e2cc | adds error message to patient report generation (HospitalRun/hospitalrun-frontend#1543) | [
{
"change_type": "MODIFY",
"old_path": "app/patients/reports/controller.js",
"new_path": "app/patients/reports/controller.js",
"diff": "@@ -838,15 +838,29 @@ export default AbstractReportController.extend(PatientDiagnosis, PatientVisits,\nlet reportType = this.get('reportType');\nlet startDate = this.get('startDate');\nif (reportType === 'status') {\n+ if (isEmpty(endDate)) {\n+ let now = new Date();\n+ this.set('endDate', now);\n+ endDate = this.get('endDate');\n+ }\nreturn true;\n}\nif (isEmpty(startDate)) {\nalertMessage = 'Please enter a start date.';\nisValid = false;\n- } else if (!isEmpty(endDate) && endDate.getTime() < startDate.getTime()) {\n+ } else {\n+ if (isEmpty(endDate)) {\n+ let now = new Date();\n+ this.set('endDate', now);\n+ endDate = this.get('endDate');\n+ }\n+\n+ if (endDate.getTime() < startDate.getTime()) {\nalertMessage = 'Please enter an end date after the start date.';\nisValid = false;\n}\n+\n+ }\nif (!isValid) {\nthis.displayAlert('Error Generating Report', alertMessage);\n}\n@@ -855,11 +869,6 @@ export default AbstractReportController.extend(PatientDiagnosis, PatientVisits,\nactions: {\ngenerateReport() {\n- if (isEmpty(this.get('endDate'))) {\n- let now = new Date();\n- this.set('endDate', now);\n- }\n-\nif (this._validateDates()) {\nlet reportRows = this.get('reportRows');\nlet reportType = this.get('reportType');\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/acceptance/patients-test.js",
"new_path": "tests/acceptance/patients-test.js",
"diff": "@@ -50,6 +50,8 @@ reportNames.forEach((reportName) => {\ntestSimpleReportForm(reportName);\ntestExportReportName(reportName);\ntestReportWithEmptyEndDate(reportName);\n+ testReportWithEmptyStartDate(reportName);\n+ testReportWithEmptyEndDateBeforeStartDate(reportName);\n});\ntest('View reports tab | Patient Status', function(assert) {\n@@ -177,22 +179,43 @@ async function generateReport(reportName, startDate, endDate) {\nawait fillIn('[data-test-selector=\"select-report-end-date\"] input', endDate);\nawait click('button:contains(Generate Report)');\n- await waitToAppear('.panel-title');\n}\n+function testReportWithEmptyStartDate(reportName) {\n+ test('View reports tab | Report with empty start date should display an error', (assert) => {\n+ return runWithPouchDump('default', async function() {\n+ await generateReport(reportName, '', '');\n+ await waitToAppear('.modal-dialog');\n+ assert.dom('.modal-title').hasText('Error Generating Report', 'Error Generating Report');\n+ assert.dom('.modal-body').hasText('Please enter a start date.');\n+ });\n+ });\n+}\n+\n+function testReportWithEmptyEndDateBeforeStartDate(reportName) {\n+ test('View reports tab | Report with end date before start date should display an error', (assert) => {\n+ return runWithPouchDump('default', async function() {\n+ let endDate = '12/10/2016';\n+ let startDate = '12/11/2016';\n+ await generateReport(reportName, startDate, endDate);\n+ await waitToAppear('.modal-dialog');\n+ assert.dom('.modal-title').hasText('Error Generating Report', 'Error Generating Report');\n+ assert.dom('.modal-body').hasText('Please enter an end date after the start date.');\n+ });\n+ });\n+}\nfunction testReportWithEmptyEndDate(reportName) {\ntest('View reports tab | Report with empty end date should show the current date', (assert) => {\nreturn runWithPouchDump('default', async function() {\nlet startDate = '12/11/2016';\nawait generateReport(reportName, startDate, '');\n-\n+ await waitToAppear('.panel-title');\nlet endDate = moment(new Date());\nlet reportTitle = `${reportName} Report ${moment(startDate).format('l')} - ${endDate.format('l')}`;\nassert.dom('.panel-title').hasText(reportTitle, `${reportName} Report generated`);\nlet exportLink = findWithAssert('a:contains(Export Report)');\nassert.equal($(exportLink).attr('download'), `${reportTitle}.csv`);\n});\n-\n});\n}\n@@ -200,6 +223,7 @@ function testExportReportName(reportName) {\ntest(`View reports tab | Export reports name for ${reportName} shows report name, start and end dates`, (assert) => {\nreturn runWithPouchDump('default', async function() {\nawait generateReport(reportName, '12/11/2016', '12/31/2016');\n+ await waitToAppear('.panel-title');\nassert.equal(currentURL(), '/patients/reports');\nlet exportReportButton = findWithAssert('a:contains(Export Report)');\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | adds error message to patient report generation (HospitalRun/hospitalrun-frontend#1543) |
288,323 | 08.11.2018 23:10:34 | 21,600 | db8b07cc1af66e85f8f6f09acbd73903f2acf2c1 | adds error message to inventory report generation (HospitalRun/hospitalrun-frontend#1543) | [
{
"change_type": "MODIFY",
"old_path": "app/inventory/reports/controller.js",
"new_path": "app/inventory/reports/controller.js",
"diff": "@@ -1292,20 +1292,43 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number\n}\n},\n- actions: {\n- generateReport() {\n+ _validateDates() {\n+ let alertMessage;\nlet endDate = this.get('endDate');\n+ let isValid = true;\n+ let reportType = this.get('reportType');\n+ let startDate = this.get('startDate');\n+ if (reportType === 'byLocation' || reportType === 'valuation') {\n+ return true;\n+ }\n+\n+ if (isEmpty(startDate)) {\n+ alertMessage = 'Please enter a start date.';\n+ isValid = false;\n+ } else {\nif (isEmpty(endDate)) {\nlet now = new Date();\nthis.set('endDate', now);\n+ endDate = this.get('endDate');\n+ }\n+\n+ if (endDate.getTime() < startDate.getTime()) {\n+ alertMessage = 'Please enter an end date after the start date.';\n+ isValid = false;\n}\n+ }\n+ if (!isValid) {\n+ this.displayAlert('Error Generating Report', alertMessage);\n+ }\n+ return isValid;\n+ },\n+\n+ actions: {\n+ generateReport() {\nlet reportRows = this.get('reportRows');\nlet reportType = this.get('reportType');\n- let startDate = this.get('startDate');\n- if (isEmpty(startDate) && isEmpty(endDate)) {\n- return;\n- }\n+ if (this._validateDates()) {\nreportRows.clear();\nthis.showProgressModal();\nswitch (reportType) {\n@@ -1336,6 +1359,7 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number\nbreak;\n}\n}\n+ }\n},\nviewInventory(id) {\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/acceptance/inventory-test.js",
"new_path": "tests/acceptance/inventory-test.js",
"diff": "@@ -280,6 +280,7 @@ const singleDateReportTypes = [\nstartAndEndDateReportTypes.forEach((reportName) => {\ntestSimpleReportForm(reportName);\ntestReportWithEmptyEndDate(reportName);\n+ testReportWithEmptyEndDateBeforeStartDate(reportName);\n});\nsingleDateReportTypes.forEach((reportName) => {\n@@ -300,7 +301,6 @@ function testSimpleReportForm(reportName) {\nawait select('#report-type', `${reportName}`);\nawait click('button:contains(Generate Report)');\nawait waitToAppear('.panel-title');\n-\nlet reportTitle = `${reportName} Report ${startDate.format('l')} - ${endDate.format('l')}`;\nassert.dom('.panel-title').hasText(reportTitle, `${reportName} Report generated`);\nlet exportLink = findWithAssert('a:contains(Export Report)');\n@@ -323,7 +323,19 @@ async function generateReport(reportName, startDate, endDate) {\nawait select('#report-type', `${reportName}`);\nawait click('button:contains(Generate Report)');\n- await waitToAppear('.panel-title');\n+}\n+\n+function testReportWithEmptyEndDateBeforeStartDate(reportName) {\n+ test('${reportName} report with end date before start date should display an error', (assert) => {\n+ return runWithPouchDump('default', async function() {\n+ let endDate = '12/10/2016';\n+ let startDate = '12/11/2016';\n+ await generateReport(reportName, startDate, endDate);\n+ await waitToAppear('.modal-dialog');\n+ assert.dom('.modal-title').hasText('Error Generating Report', 'Error Generating Report');\n+ assert.dom('.modal-body').hasText('Please enter an end date after the start date.');\n+ });\n+ });\n}\nfunction testReportWithEmptyEndDate(reportName) {\n@@ -333,8 +345,8 @@ function testReportWithEmptyEndDate(reportName) {\nlet startDate = '12/11/2016';\nlet endDate = new Date();\nawait generateReport(reportName, startDate, null);\n+ await waitToAppear('.panel-title');\nassert.equal(currentURL(), '/inventory/reports');\n-\nlet reportTitle = `${reportName} Report ${moment(startDate).format('l')} - ${moment(endDate).format('l')}`;\nassert.dom('.panel-title').hasText(reportTitle, `${reportName} Report generated`);\nlet exportLink = findWithAssert('a:contains(Export Report)');\n@@ -348,7 +360,7 @@ function testSingleDateReportForm(reportName) {\nreturn runWithPouchDump('default', async function() {\nlet startDate = new Date();\nawait generateReport(reportName, null, null);\n-\n+ await waitToAppear('.panel-title');\nassert.equal(currentURL(), '/inventory/reports');\nlet reportTitle = `${reportName} Report ${moment(startDate).format('l')}`;\nassert.dom('.panel-title').hasText(reportTitle, `${reportName} Report generated`);\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | adds error message to inventory report generation (HospitalRun/hospitalrun-frontend#1543) |
288,323 | 08.11.2018 23:19:58 | 21,600 | 82a1f8b6e738baee3cb364734db32e00514c8da4 | refactors date validations to use the same validation (HospitalRun/hospitalrun-frontend#1543) | [
{
"change_type": "MODIFY",
"old_path": "app/controllers/abstract-report-controller.js",
"new_path": "app/controllers/abstract-report-controller.js",
"diff": "@@ -167,6 +167,34 @@ export default Controller.extend(DateFormat, ModalHelper, NumberFormat, Paginati\n}\n},\n+ _validateDateInputs() {\n+ let isValid = true;\n+ let startDate = this.get('startDate');\n+ let endDate = this.get('endDate');\n+ let alertMessage;\n+\n+ if (isEmpty(startDate)) {\n+ alertMessage = 'Please enter a start date.';\n+ isValid = false;\n+ } else {\n+ if (isEmpty(endDate)) {\n+ let now = new Date();\n+ this.set('endDate', now);\n+ endDate = this.get('endDate');\n+ }\n+\n+ if (endDate.getTime() < startDate.getTime()) {\n+ alertMessage = 'Please enter an end date after the start date.';\n+ isValid = false;\n+ }\n+\n+ }\n+ if (!isValid) {\n+ this.displayAlert('Error Generating Report', alertMessage);\n+ }\n+ return isValid;\n+ },\n+\nactions: {\nfirstPage() {\nthis.set('offset', 0);\n"
},
{
"change_type": "MODIFY",
"old_path": "app/incident/reports/controller.js",
"new_path": "app/incident/reports/controller.js",
"diff": "@@ -142,30 +142,7 @@ export default AbstractReportController.extend(UserSession, NumberFormat, {\n},\n_validateDates() {\n- let alertMessage;\n- let isValid = true;\n- let startDate = this.get('startDate');\n- let endDate = this.get('endDate');\n-\n- if (isEmpty(startDate)) {\n- alertMessage = 'Please enter a start date.';\n- isValid = false;\n- } else {\n- if (isEmpty(endDate)) {\n- let now = new Date();\n- this.set('endDate', now);\n- endDate = this.get('endDate');\n- }\n-\n- if (endDate.getTime() < startDate.getTime()) {\n- alertMessage = 'Please enter an end date after the start date.';\n- isValid = false;\n- }\n- }\n- if (!isValid) {\n- this.displayAlert('Error Generating Report', alertMessage);\n- }\n- return isValid;\n+ return this._validateDateInputs();\n},\nactions: {\n"
},
{
"change_type": "MODIFY",
"old_path": "app/inventory/reports/controller.js",
"new_path": "app/inventory/reports/controller.js",
"diff": "@@ -1293,35 +1293,12 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number\n},\n_validateDates() {\n- let alertMessage;\n- let endDate = this.get('endDate');\n- let isValid = true;\nlet reportType = this.get('reportType');\n- let startDate = this.get('startDate');\nif (reportType === 'byLocation' || reportType === 'valuation') {\nreturn true;\n}\n- if (isEmpty(startDate)) {\n- alertMessage = 'Please enter a start date.';\n- isValid = false;\n- } else {\n- if (isEmpty(endDate)) {\n- let now = new Date();\n- this.set('endDate', now);\n- endDate = this.get('endDate');\n- }\n-\n- if (endDate.getTime() < startDate.getTime()) {\n- alertMessage = 'Please enter an end date after the start date.';\n- isValid = false;\n- }\n-\n- }\n- if (!isValid) {\n- this.displayAlert('Error Generating Report', alertMessage);\n- }\n- return isValid;\n+ return this._validateDateInputs();\n},\nactions: {\n"
},
{
"change_type": "MODIFY",
"old_path": "app/patients/reports/controller.js",
"new_path": "app/patients/reports/controller.js",
"diff": "@@ -832,11 +832,8 @@ export default AbstractReportController.extend(PatientDiagnosis, PatientVisits,\n},\n_validateDates() {\n- let alertMessage;\nlet endDate = this.get('endDate');\n- let isValid = true;\nlet reportType = this.get('reportType');\n- let startDate = this.get('startDate');\nif (reportType === 'status') {\nif (isEmpty(endDate)) {\nlet now = new Date();\n@@ -845,26 +842,8 @@ export default AbstractReportController.extend(PatientDiagnosis, PatientVisits,\n}\nreturn true;\n}\n- if (isEmpty(startDate)) {\n- alertMessage = 'Please enter a start date.';\n- isValid = false;\n- } else {\n- if (isEmpty(endDate)) {\n- let now = new Date();\n- this.set('endDate', now);\n- endDate = this.get('endDate');\n- }\n-\n- if (endDate.getTime() < startDate.getTime()) {\n- alertMessage = 'Please enter an end date after the start date.';\n- isValid = false;\n- }\n- }\n- if (!isValid) {\n- this.displayAlert('Error Generating Report', alertMessage);\n- }\n- return isValid;\n+ return this._validateDateInputs();\n},\nactions: {\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | refactors date validations to use the same validation (HospitalRun/hospitalrun-frontend#1543) |
288,323 | 08.11.2018 23:35:32 | 21,600 | 6c54be4f5c02738809164b9d41678d9e5aea42f3 | removes code that is not needed (HospitalRun/hospitalrun-frontend#1543) | [
{
"change_type": "MODIFY",
"old_path": "app/patients/reports/controller.js",
"new_path": "app/patients/reports/controller.js",
"diff": "@@ -832,14 +832,8 @@ export default AbstractReportController.extend(PatientDiagnosis, PatientVisits,\n},\n_validateDates() {\n- let endDate = this.get('endDate');\nlet reportType = this.get('reportType');\nif (reportType === 'status') {\n- if (isEmpty(endDate)) {\n- let now = new Date();\n- this.set('endDate', now);\n- endDate = this.get('endDate');\n- }\nreturn true;\n}\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | removes code that is not needed (HospitalRun/hospitalrun-frontend#1543) |
288,323 | 09.11.2018 00:21:02 | 21,600 | 9ca022369b18103157ea329189c8d513f77c8f1a | fixes issue with status report showing start and end date in report title if one was selected via another report (HospitalRun/hospitalrun-frontend#1543) | [
{
"change_type": "MODIFY",
"old_path": "app/patients/reports/controller.js",
"new_path": "app/patients/reports/controller.js",
"diff": "@@ -276,7 +276,13 @@ export default AbstractReportController.extend(PatientDiagnosis, PatientVisits,\nisStatusReport: computed('reportType', function() {\nlet reportType = this.get('reportType');\n- return reportType === 'status';\n+ if (reportType === 'status') {\n+ this.set('startDate', null);\n+ this.set('endDate', null);\n+ return true;\n+ }\n+\n+ return false;\n}),\nisVisitReport: computed('reportType', function() {\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | fixes issue with status report showing start and end date in report title if one was selected via another report (HospitalRun/hospitalrun-frontend#1543) |
288,323 | 17.11.2018 02:36:24 | 21,600 | 842d0976b57931e96fc895ce58d1387f89602d38 | fixes issue with warning messages rendering with HTML text inside of them instead of styling them properly (HospitalRun/hospitalrun-frontend#1561) | [
{
"change_type": "MODIFY",
"old_path": "app/inventory/edit/template.hbs",
"new_path": "app/inventory/edit/template.hbs",
"diff": "<button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\" class=\"octicon octicon-x\"></span><span class=\"sr-only\">{{t 'buttons.close'}}</span></button>\n<p>\n<span class=\"glyphicon glyphicon-warning-sign\"></span>\n- {{t 'inventory.messages.quantity' quantity=model.quantity locationQuantity=locationQuantityTotal}}\n+ {{t 'inventory.messages.quantity' quantity=model.quantity locationQuantity=locationQuantityTotal htmlSafe=true}}\n</p>\n<p>{{t 'inventory.messages.adjust' difference=quantityDifferential}}</p>\n</div>\n"
},
{
"change_type": "MODIFY",
"old_path": "app/inventory/quick-add/template.hbs",
"new_path": "app/inventory/quick-add/template.hbs",
"diff": "title=(t 'inventory.titles.quickAddTitle')\nupdateButtonAction=updateButtonAction\nupdateButtonText=updateButtonText }}\n- <div class=\"alert alert-warning\" role=\"alert\">{{t 'inventory.messages.itemNotFound' item=model.name}}</div>\n+ <div class=\"alert alert-warning\" role=\"alert\">{{t 'inventory.messages.itemNotFound' item=model.name htmlSafe=true}}</div>\n{{#em-form model=model submitButton=false as |form|}}\n{{partial 'inventory-basic'}}\n{{/em-form}}\n"
},
{
"change_type": "MODIFY",
"old_path": "app/patients/quick-add/template.hbs",
"new_path": "app/patients/quick-add/template.hbs",
"diff": "updateButtonAction=updateButtonAction\nupdateButtonText=updateButtonText }}\n<div class=\"alert alert-warning\" role=\"alert\">\n- {{t 'patients.messages.notFoundQuickAdd' patientFullName=model.shortDisplayName}}\n+ {{t 'patients.messages.notFoundQuickAdd' patientFullName=model.shortDisplayName htmlSafe=true}}\n</div>\n{{#em-form model=model submitButton=false as |form|}}\n<div class=\"row\">\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | fixes issue with warning messages rendering with HTML text inside of them instead of styling them properly (HospitalRun/hospitalrun-frontend#1561) |
288,323 | 17.11.2018 02:38:38 | 21,600 | bf90057ee6a363e7af9ad0f0604d6c9dd8867827 | fixes an issue where the test title was not printing the report name | [
{
"change_type": "MODIFY",
"old_path": "tests/acceptance/inventory-test.js",
"new_path": "tests/acceptance/inventory-test.js",
"diff": "@@ -326,7 +326,7 @@ async function generateReport(reportName, startDate, endDate) {\n}\nfunction testReportWithEmptyEndDateBeforeStartDate(reportName) {\n- test('${reportName} report with end date before start date should display an error', (assert) => {\n+ test(`${reportName} report with end date before start date should display an error`, (assert) => {\nreturn runWithPouchDump('default', async function() {\nlet endDate = '12/10/2016';\nlet startDate = '12/11/2016';\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | fixes an issue where the test title was not printing the report name |
288,323 | 18.11.2018 21:37:37 | 21,600 | 5dadaffd50b626b07c8e62cfa862d2cc90b30f75 | fixes issue with welcome message showing HTML in message instead of rendering the format (HospitalRun/hospitalrun-frontend#1561) | [
{
"change_type": "MODIFY",
"old_path": "app/templates/index.hbs",
"new_path": "app/templates/index.hbs",
"diff": "</div>\n{{#if standAlone }}\n<div class=\"panel-body\">\n- {{t \"dashboard.standalone_welcome\" }}\n+ {{t \"dashboard.standalone_welcome\" htmlSafe=true}}\n{{#if needsUserSetup }}\n<p>{{t \"dashboard.needs_user_setup\"}}</p>\n<button type=\"button\" class=\"btn btn-primary align-left\" {{action \"newUser\" }}>\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | fixes issue with welcome message showing HTML in message instead of rendering the format (HospitalRun/hospitalrun-frontend#1561) |
288,328 | 05.12.2018 17:47:39 | 21,600 | 9e32c17fdc5ce7ba06c747cc7c727d565b5af54e | More fixes for tests. | [
{
"change_type": "MODIFY",
"old_path": "tests/unit/services/language-preference-test.js",
"new_path": "tests/unit/services/language-preference-test.js",
"diff": "@@ -44,7 +44,7 @@ module('Unit | Service | Language preference', function(hooks) {\nconfigDb.put.reset();\ncurrentUser.reset();\n- // in case of any leftover tests that have modified the direction\n+ // in case of any leftover tests that have modified the direction1\ndocument.body.dir = 'auto';\n});\n@@ -54,7 +54,7 @@ module('Unit | Service | Language preference', function(hooks) {\nlet subject = this.owner.lookup('service:language-preference');\nreturn subject.loadUserLanguagePreference().then(function(lang) {\nassert.equal(lang, 'fr');\n- assert.equal(subject.get('intl.locale'), [lang, DEFAULT_LANGUAGE], 'intl service was not updated');\n+ assert.deepEqual(subject.get('intl.locale'), [lang, DEFAULT_LANGUAGE], 'intl service was not updated');\n});\n});\n@@ -64,7 +64,7 @@ module('Unit | Service | Language preference', function(hooks) {\nlet subject = this.owner.lookup('service:language-preference');\nreturn subject.loadUserLanguagePreference().then(function(lang) {\nassert.equal(lang, DEFAULT_LANGUAGE);\n- assert.equal(subject.get('intl.locale'), [DEFAULT_LANGUAGE], 'intl service was not updated');\n+ assert.deepEqual(subject.get('intl.locale'), [DEFAULT_LANGUAGE], 'intl service was not updated');\n});\n});\n@@ -74,7 +74,7 @@ module('Unit | Service | Language preference', function(hooks) {\nlet subject = this.owner.lookup('service:language-preference');\nreturn subject.loadUserLanguagePreference().then(function(lang) {\nassert.equal(lang, DEFAULT_LANGUAGE);\n- assert.equal(subject.get('intl.locale'), [DEFAULT_LANGUAGE], 'intl service was not updated');\n+ assert.deepEqual(subject.get('intl.locale'), [DEFAULT_LANGUAGE], 'intl service was not updated');\n});\n});\n@@ -86,7 +86,7 @@ module('Unit | Service | Language preference', function(hooks) {\nlet subject = this.owner.lookup('service:language-preference');\nreturn subject.loadUserLanguagePreference().then(function(lang) {\nassert.equal(lang, DEFAULT_LANGUAGE);\n- assert.equal(subject.get('intl.locale'), lang, 'intl service was not updated');\n+ assert.deepEqual(subject.get('intl.locale'), [DEFAULT_LANGUAGE], 'intl service was not updated');\n});\n});\n@@ -100,7 +100,7 @@ module('Unit | Service | Language preference', function(hooks) {\nreturn subject.saveUserLanguagePreference('ru').then(function() {\nsinon.assert.calledOnce(configDb.put);\nsinon.assert.calledWith(configDb.put, expectedPreferences);\n- assert.equal(subject.get('intl.locale'), ['ru', DEFAULT_LANGUAGE], 'intl service was not updated');\n+ assert.deepEqual(subject.get('intl.locale'), ['ru', DEFAULT_LANGUAGE], 'intl service was not updated');\n});\n});\n@@ -117,7 +117,7 @@ module('Unit | Service | Language preference', function(hooks) {\nreturn subject.saveUserLanguagePreference('ru').then(function() {\nsinon.assert.calledOnce(configDb.put);\nsinon.assert.calledWith(configDb.put, expectedPreferences);\n- assert.equal(subject.get('intl.locale'), 'ru', 'intl service was not updated');\n+ assert.deepEqual(subject.get('intl.locale'), ['ru', DEFAULT_LANGUAGE], 'intl service was not updated');\n});\n});\n@@ -136,13 +136,22 @@ module('Unit | Service | Language preference', function(hooks) {\nreturn subject.saveUserLanguagePreference('ru').then(function() {\nsinon.assert.calledOnce(configDb.put);\nsinon.assert.calledWith(configDb.put, expectedPreferences);\n- assert.equal(subject.get('intl.locale'), ['ru', DEFAULT_LANGUAGE], 'intl service was not updated');\n+ assert.deepEqual(subject.get('intl.locale'), ['ru', DEFAULT_LANGUAGE], 'intl service was not updated');\n});\n});\ntest('setApplicationLanguage should update intl', function(assert) {\nlet subject = this.owner.lookup('service:language-preference');\nsubject.setApplicationLanguage('ru');\n- assert.equal(subject.get('intl.locale'), ['ru', DEFAULT_LANGUAGE], 'intl service was not updated');\n+ assert.deepEqual(subject.get('intl.locale'), ['ru', DEFAULT_LANGUAGE], 'intl service was not updated');\n+ });\n+\n+ test('setting a rtl language sets the direction on the body tag', function(assert) {\n+ let subject = this.owner.lookup('service:language-preference');\n+ subject.setApplicationLanguage('ar');\n+ assert.equal(document.body.dir, 'rtl', 'arabic sets dir attribute to right to left');\n+\n+ subject.setApplicationLanguage('en');\n+ assert.equal(document.body.dir, 'auto', 'english sets dir attribute back to auto');\n});\n});\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | More fixes for tests. |
288,334 | 06.08.2019 23:23:11 | -7,200 | d07cf6bed51a44fa99270c9ccb8b9fab7f05eae3 | Adds FUNDING and CODE_OF_CONDUCT | [
{
"change_type": "ADD",
"old_path": null,
"new_path": ".github/CODE_OF_CONDUCT.md",
"diff": "+# Contributor Covenant Code of Conduct\n+\n+## Our Pledge\n+\n+In the interest of fostering an open and welcoming environment, we as\n+contributors and maintainers pledge to making participation in our project and\n+our community a harassment-free experience for everyone, regardless of age, body\n+size, disability, ethnicity, sex characteristics, gender identity and expression,\n+level of experience, education, socio-economic status, nationality, personal\n+appearance, race, religion, or sexual identity and orientation.\n+\n+## Our Standards\n+\n+Examples of behavior that contributes to creating a positive environment\n+include:\n+\n+- Using welcoming and inclusive language\n+- Being respectful of differing viewpoints and experiences\n+- Gracefully accepting constructive criticism\n+- Focusing on what is best for the community\n+- Showing empathy towards other community members\n+\n+Examples of unacceptable behavior by participants include:\n+\n+- The use of sexualized language or imagery and unwelcome sexual attention or\n+ advances\n+- Trolling, insulting/derogatory comments, and personal or political attacks\n+- Public or private harassment\n+- Publishing others' private information, such as a physical or electronic\n+ address, without explicit permission\n+- Other conduct which could reasonably be considered inappropriate in a\n+ professional setting\n+\n+## Our Responsibilities\n+\n+Project maintainers are responsible for clarifying the standards of acceptable\n+behavior and are expected to take appropriate and fair corrective action in\n+response to any instances of unacceptable behavior.\n+\n+Project maintainers have the right and responsibility to remove, edit, or\n+reject comments, commits, code, wiki edits, issues, and other contributions\n+that are not aligned to this Code of Conduct, or to ban temporarily or\n+permanently any contributor for other behaviors that they deem inappropriate,\n+threatening, offensive, or harmful.\n+\n+## Scope\n+\n+This Code of Conduct applies both within project spaces and in public spaces\n+when an individual is representing the project or its community. Examples of\n+representing a project or community include using an official project e-mail\n+address, posting via an official social media account, or acting as an appointed\n+representative at an online or offline event. Representation of a project may be\n+further defined and clarified by project maintainers.\n+\n+## Enforcement\n+\n+Instances of abusive, harassing, or otherwise unacceptable behavior may be\n+reported by contacting the project team at [email protected]. All\n+complaints will be reviewed and investigated and will result in a response that\n+is deemed necessary and appropriate to the circumstances. The project team is\n+obligated to maintain confidentiality with regard to the reporter of an incident.\n+Further details of specific enforcement policies may be posted separately.\n+\n+Project maintainers who do not follow or enforce the Code of Conduct in good\n+faith may face temporary or permanent repercussions as determined by other\n+members of the project's leadership.\n+\n+## Attribution\n+\n+This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,\n+available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html\n+\n+[homepage]: https://www.contributor-covenant.org\n+\n+For answers to common questions about this code of conduct, see\n+https://www.contributor-covenant.org/faq\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": ".github/FUNDING.yml",
"diff": "+# These are supported funding model platforms\n+\n+github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]\n+patreon: # Replace with a single Patreon username\n+open_collective: hospitalrun\n+ko_fi: # Replace with a single Ko-fi username\n+tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel\n+community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry\n+liberapay: # Replace with a single Liberapay username\n+issuehunt: hospitalrun\n+otechie: # Replace with a single Otechie username\n+custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']\n\\ No newline at end of file\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Adds FUNDING and CODE_OF_CONDUCT |
288,334 | 07.08.2019 22:41:22 | -7,200 | 53776bb20b28743742282abfd53094c2ba9dc945 | Adds new issue templates | [
{
"change_type": "DELETE",
"old_path": ".github/PULL_REQUEST_TEMPLATE.md",
"new_path": null,
"diff": "-Fixes #[replace brackets with the issue number that your pull request addresses].\n-\n-**Changes proposed in this pull request:**\n-- [list out summary of changes here]\n-- [list out summary of changes here]\n-- [list out summary of changes here]\n-- [etc]\n-\n-*Note: pull requests without proper descriptions may simply be closed without further discussion. We appreciate your contributions, but need to know what you are offering in clearly described format. Thanks! (you can delete this text)*\n-\n-cc @HospitalRun/core-maintainers\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Adds new issue templates |
288,334 | 06.09.2019 18:42:41 | -7,200 | ab508d2a3dc55f7d21a96ae1eec1367ddc1b9052 | docs: adds saucelab credits | [
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "<div align=\"center\">\n[](https://img.shields.io/github/release) [](https://dev.azure.com/hospitalrun/hospitalrun-frontend/_build/latest?definitionId=1) [](https://travis-ci.com/HospitalRun/hospitalrun-frontend) [](https://codeclimate.com/github/HospitalRun/hospitalrun-frontend/maintainability) [](https://coveralls.io/github/HospitalRun/hospitalrun-frontend?branch=master) [](https://github.com/HospitalRun/hospitalrun-frontend/graphs/contributors)\n-\n-[](./LICENSE) [](https://nucleode.com) [](https://spectrum.chat/hospitalrun)\n+[](./LICENSE) [](https://nucleode.com) [](https://hospitalrun-slackin.herokuapp.com) [](https://spectrum.chat/hospitalrun)\n</div>\n@@ -31,6 +30,12 @@ React frontend for [HospitalRun](http://hospitalrun.io/): free software for deve\n[](https://opencollective.com/hospitalrun/contribute/sponsors-336/checkout)\n+### Big Thanks\n+\n+Cross-browser Testing Platform and Open Source <3 Provided by [Sauce Labs][homepage]\n+\n+[homepage]: https://saucelabs.com\n+\n## Backers\n[](https://opencollective.com/hospitalrun/contribute/backers-335/checkout)\n@@ -41,8 +46,8 @@ React frontend for [HospitalRun](http://hospitalrun.io/): free software for deve\n## Core Team\n<!-- prettier-ignore -->\n-|[<img src=\"https://avatars1.githubusercontent.com/u/11684?s=460&v=4\" width=\"100px;\"/><br /><sub><b>Travis Boudreaux</b></sub>](https://github.com/tjboudreaux) | [<img src=\"https://avatars3.githubusercontent.com/u/25089405?s=460&v=4\" width=\"100px;\"/><br /><sub><b>Stefano Casasola</b></sub>](https://github.com/irvelervel) | [<img src=\"https://avatars3.githubusercontent.com/u/3400442?s=460&v=4\" width=\"100px;\"/><br /><sub><b>Michael J Feher</b></sub>](https://github.com/PhearZero) | [<img src=\"https://avatars1.githubusercontent.com/u/25009192?s=460&v=4\" width=\"100px;\"/><br /><sub><b>Riccardo Gulin</b></sub>](https://github.com/bazuzu666) | [<img src=\"https://avatars0.githubusercontent.com/u/6388707?s=460&v=4\" width=\"100px;\"/><br /><sub><b>Matteo Vivona</b></sub>](https://github.com/tehKapa) |\n-|---|---|---|---|---|\n+|[<img src=\"https://avatars1.githubusercontent.com/u/11684?s=460&v=4\" width=\"100px;\"/><br /><sub><b>Travis Boudreaux</b></sub>](https://github.com/tjboudreaux) | [<img src=\"https://avatars3.githubusercontent.com/u/25089405?s=460&v=4\" width=\"100px;\"/><br /><sub><b>Stefano Casasola</b></sub>](https://github.com/irvelervel) | [<img src=\"https://avatars3.githubusercontent.com/u/3400442?s=460&v=4\" width=\"100px;\"/><br /><sub><b>Michael J Feher</b></sub>](https://github.com/PhearZero) | [<img src=\"https://avatars1.githubusercontent.com/u/25009192?s=460&v=4\" width=\"100px;\"/><br /><sub><b>Riccardo Gulin</b></sub>](https://github.com/bazuzu666) | [<img src=\"https://avatars3.githubusercontent.com/u/18731800?s=460&v=4\" width=\"100px;\"/><br /><sub><b>Jack Meyer</b></sub>](https://github.com/jackcmeyer) | [<img src=\"https://avatars0.githubusercontent.com/u/6388707?s=460&v=4\" width=\"100px;\"/><br /><sub><b>Matteo Vivona</b></sub>](https://github.com/tehKapa) |\n+|---|---|---|---|---|---|\n## Medical Supervisor\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | docs: adds saucelab credits |
288,323 | 08.09.2019 19:04:34 | 18,000 | 4b4c75889b7ad051a7eae9042de5a9303182c649 | sparkles: (lifecycle) Adds husky and commitizen | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "commitlint.config.js",
"diff": "+module.exports = {\n+ extends: [\"gitmoji\"],\n+ parserPreset: {\n+ parserOpts: {\n+ headerPattern: /^(:\\w*:)(?:\\s)(?:\\((.*?)\\))?\\s((?:.*(?=\\())|.*)(?:\\(#(\\d*)\\))?/,\n+ headerCorrespondence: [\"type\", \"scope\", \"subject\", \"ticket\"]\n+ }\n+ }\n+};\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"react-scripts\": \"3.1.1\",\n\"typescript\": \"3.6.2\"\n},\n+ \"devDependencies\": {\n+ \"@commitlint/cli\": \"^8.1.0\",\n+ \"@commitlint/core\": \"^8.1.0\",\n+ \"commitlint-config-gitmoji\": \"^1.0.1\",\n+ \"cross-env\": \"^5.2.1\",\n+ \"cz-emoji\": \"^1.1.2\",\n+ \"dateformat\": \"^3.0.3\",\n+ \"husky\": \"^3.0.5\"\n+ },\n\"scripts\": {\n\"start\": \"react-scripts start\",\n\"build\": \"react-scripts build\",\n\"last 1 firefox version\",\n\"last 1 safari version\"\n]\n+ },\n+ \"husky\": {\n+ \"hooks\": {\n+ \"commit-msg\": \"commitlint -E HUSKY_GIT_PARAMS\"\n+ }\n+ },\n+ \"config\": {\n+ \"commitizen\": {\n+ \"path\": \"cz-emoji\"\n+ }\n}\n}\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | :sparkles: (lifecycle) Adds husky and commitizen |
288,323 | 08.09.2019 21:23:12 | 18,000 | 7eeff258c8d0187214ca2d1d4fc4b4b32fbfcc33 | wrench: (package) Updates namespace | [
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "{\n- \"name\": \"hospitalrun-frontend\",\n+ \"name\": \"@hospitalrun-org/frontend\",\n\"version\": \"0.1.0\",\n- \"private\": true,\n+ \"private\": false,\n\"dependencies\": {\n\"@types/jest\": \"24.0.18\",\n\"@types/node\": \"12.7.4\",\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | :wrench: (package) Updates namespace |
288,323 | 08.09.2019 21:25:53 | 18,000 | c9bfadf6cc756c708f4dfd1d789ef190a189d604 | wrench: (lifecycle) Adds precommit hook | [
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"start\": \"react-scripts start\",\n\"build\": \"react-scripts build\",\n\"test\": \"react-scripts test\",\n+ \"test:ci\": \"cross-env CI=true react-scripts test\",\n\"eject\": \"react-scripts eject\"\n},\n\"eslintConfig\": {\n},\n\"husky\": {\n\"hooks\": {\n- \"commit-msg\": \"commitlint -E HUSKY_GIT_PARAMS\"\n+ \"commit-msg\": \"commitlint -E HUSKY_GIT_PARAMS\",\n+ \"pre-commit\": \"npm run test:ci\"\n}\n},\n\"config\": {\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | :wrench: (lifecycle) Adds precommit hook |
288,334 | 09.09.2019 12:50:48 | -7,200 | 932ee814c3b4de3178c03de6656576c0046cd15e | chore: updates package.json | [
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "{\n\"name\": \"@hospitalrun-org/frontend\",\n\"version\": \"0.1.0\",\n+ \"description\": \"React frontend for HospitalRun\",\n\"private\": false,\n+ \"license\": \"MIT\",\n\"dependencies\": {\n\"@types/jest\": \"24.0.18\",\n\"@types/node\": \"12.7.4\",\n\"react-scripts\": \"3.1.1\",\n\"typescript\": \"3.6.2\"\n},\n+ \"repository\": {\n+ \"type\": \"git\",\n+ \"url\": \"[email protected]:HospitalRun/hospitalrun-frontend\"\n+ },\n+ \"author\": \"Jack Meyer\",\n+ \"contributors\": [\n+ \"Maksim Sinik\",\n+ \"Michael J Feher\",\n+ \"Stefano Casasola\"\n+ ],\n\"devDependencies\": {\n\"@commitlint/cli\": \"^8.1.0\",\n\"@commitlint/core\": \"^8.1.0\",\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | chore: updates package.json |
288,334 | 09.09.2019 14:57:07 | -7,200 | 3d8a9c61e85b9684fad9ae87388d6903a47678e4 | Create minimum-reviews.yml | [
{
"change_type": "ADD",
"old_path": null,
"new_path": ".github/minimum-reviews.yml",
"diff": "+# Number of reviews required to mark the pull request as valid\n+reviewsUntilReady: 2\n+\n+# Number of changes in the pull request to start enforcing the reviewsUntilReady rule\n+changesThreshold: 100\n+\n+# Message to display when the commit status passes\n+readyMessage: 'No pending reviews'\n+\n+# Message to display when the commit status fails\n+notReadyMessage: 'Pending review approvals'\n+\n+# Status to set the commit to when waiting for reviews\n+# 'failure, error, and pending' are the suggested options\n+notReadyState: 'pending'\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Create minimum-reviews.yml |
288,334 | 09.09.2019 14:59:07 | -7,200 | 048d379868921914e5f894cae5c6e987fb63f911 | Delete minimum-reviews.yml | [
{
"change_type": "DELETE",
"old_path": ".github/minimum-reviews.yml",
"new_path": null,
"diff": "-# Number of reviews required to mark the pull request as valid\n-reviewsUntilReady: 2\n-\n-# Number of changes in the pull request to start enforcing the reviewsUntilReady rule\n-changesThreshold: 100\n-\n-# Message to display when the commit status passes\n-readyMessage: 'No pending reviews'\n-\n-# Message to display when the commit status fails\n-notReadyMessage: 'Pending review approvals'\n-\n-# Status to set the commit to when waiting for reviews\n-# 'failure, error, and pending' are the suggested options\n-notReadyState: 'pending'\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Delete minimum-reviews.yml |
288,323 | 09.09.2019 22:20:23 | 18,000 | 3e35d33d6dee9d2b755760ba05225bace2f4f94c | chore: updates tsconfig to match components library | [
{
"change_type": "MODIFY",
"old_path": "tsconfig.json",
"new_path": "tsconfig.json",
"diff": "{\n+ \"include\": [\n+ \"src\",\n+ \"types\"\n+ ],\n+ \"exclude\": [\n+ \"node_modules\",\n+ \"dist\"\n+ ],\n\"compilerOptions\": {\n\"target\": \"es5\",\n+ \"module\": \"esnext\",\n\"lib\": [\n\"dom\",\n- \"dom.iterable\",\n\"esnext\"\n],\n- \"allowJs\": true,\n- \"skipLibCheck\": true,\n+ \"importHelpers\": true,\n+ \"sourceMap\": true,\n+ \"rootDir\": \"./\",\n+ \"strict\": true,\n+ \"pretty\": true,\n+ \"removeComments\": true,\n+ \"noImplicitAny\": true,\n+ \"strictNullChecks\": true,\n+ \"strictFunctionTypes\": true,\n+ \"strictPropertyInitialization\": true,\n+ \"noImplicitThis\": true,\n+ \"alwaysStrict\": true,\n+ \"noUnusedLocals\": true,\n+ \"noUnusedParameters\": true,\n+ \"noImplicitReturns\": true,\n+ \"noFallthroughCasesInSwitch\": true,\n+ \"emitDecoratorMetadata\": false,\n+ \"experimentalDecorators\": false,\n+ \"moduleResolution\": \"node\",\n+ \"jsx\": \"react\",\n\"esModuleInterop\": true,\n\"allowSyntheticDefaultImports\": true,\n- \"strict\": true,\n+ \"baseUrl\": \"./src\",\n+ \"allowJs\": true,\n+ \"skipLibCheck\": true,\n\"forceConsistentCasingInFileNames\": true,\n- \"module\": \"esnext\",\n- \"moduleResolution\": \"node\",\n\"resolveJsonModule\": true,\n- \"isolatedModules\": true,\n\"noEmit\": true,\n- \"jsx\": \"react\"\n- },\n- \"include\": [\n- \"src\"\n- ]\n+ \"isolatedModules\": true\n+ }\n}\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | chore: updates tsconfig to match components library |
288,323 | 09.09.2019 22:43:33 | 18,000 | d198de23cadbcf9de602147103341d4c6c08ed71 | chore: removes react branding and adds hospital run branding | [
{
"change_type": "MODIFY",
"old_path": "public/favicon.ico",
"new_path": "public/favicon.ico",
"diff": "Binary files a/public/favicon.ico and b/public/favicon.ico differ\n"
},
{
"change_type": "MODIFY",
"old_path": "public/index.html",
"new_path": "public/index.html",
"diff": "<meta name=\"theme-color\" content=\"#000000\" />\n<meta\nname=\"description\"\n- content=\"Web site created using create-react-app\"\n+ content=\"HospitalRun\"\n/>\n- <link rel=\"apple-touch-icon\" href=\"logo192.png\" />\n+ <link rel=\"apple-touch-icon\" href=\"logo.png\" />\n<!--\nmanifest.json provides metadata used when your web app is installed on a\nuser's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/\nwork correctly both with client-side routing and a non-root public URL.\nLearn how to configure a non-root public URL by running `npm run build`.\n-->\n- <title>React App</title>\n+ <title>HospitalRun</title>\n</head>\n<body>\n<noscript>You need to enable JavaScript to run this app.</noscript>\n"
},
{
"change_type": "ADD",
"old_path": "public/logo.png",
"new_path": "public/logo.png",
"diff": "Binary files /dev/null and b/public/logo.png differ\n"
},
{
"change_type": "DELETE",
"old_path": "public/logo192.png",
"new_path": "public/logo192.png",
"diff": "Binary files a/public/logo192.png and /dev/null differ\n"
},
{
"change_type": "DELETE",
"old_path": "public/logo512.png",
"new_path": "public/logo512.png",
"diff": "Binary files a/public/logo512.png and /dev/null differ\n"
},
{
"change_type": "MODIFY",
"old_path": "src/App.css",
"new_path": "src/App.css",
"diff": "}\n.App-logo {\n- animation: App-logo-spin infinite 20s linear;\nheight: 40vmin;\npointer-events: none;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/App.tsx",
"new_path": "src/App.tsx",
"diff": "import React from 'react';\n-import logo from './logo.svg';\n+import logo from './hospitalrun-icon-transparent.png';\nimport './App.css';\nconst App: React.FC = () => {\n@@ -7,17 +7,6 @@ const App: React.FC = () => {\n<div className=\"App\">\n<header className=\"App-header\">\n<img src={logo} className=\"App-logo\" alt=\"logo\" />\n- <p>\n- Edit <code>src/App.tsx</code> and save to reload.\n- </p>\n- <a\n- className=\"App-link\"\n- href=\"https://reactjs.org\"\n- target=\"_blank\"\n- rel=\"noopener noreferrer\"\n- >\n- Learn React\n- </a>\n</header>\n</div>\n);\n"
},
{
"change_type": "ADD",
"old_path": "src/hospitalrun-icon-transparent.png",
"new_path": "src/hospitalrun-icon-transparent.png",
"diff": "Binary files /dev/null and b/src/hospitalrun-icon-transparent.png differ\n"
},
{
"change_type": "DELETE",
"old_path": "src/logo.svg",
"new_path": null,
"diff": "-<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 841.9 595.3\">\n- <g fill=\"#61DAFB\">\n- <path d=\"M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z\"/>\n- <circle cx=\"420.9\" cy=\"296.5\" r=\"45.7\"/>\n- <path d=\"M520.5 78.1z\"/>\n- </g>\n-</svg>\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | chore: removes react branding and adds hospital run branding |
288,360 | 11.09.2019 13:01:13 | 18,000 | 36a4980e505664efc35729e6d8d2ab58c424dcfb | whale: (devops) Adding Basic Dockerfile | [
{
"change_type": "ADD",
"old_path": null,
"new_path": ".dockerignore",
"diff": "+node_modules\n"
},
{
"change_type": "MODIFY",
"old_path": ".gitignore",
"new_path": ".gitignore",
"diff": "+build\n# Logs\nlogs\n*.log\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "Dockerfile",
"diff": "+FROM node:lts-alpine\n+\n+RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app\n+\n+WORKDIR /home/node/app\n+\n+COPY package*.json /home/node/app\n+\n+USER node\n+\n+RUN yarn\n+\n+COPY --chown=node:node . /home/node/app\n+\n+EXPOSE 3000\n+\n+CMD [ \"yarn\", \"start\" ]\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | :whale: (devops) Adding Basic Dockerfile |
288,334 | 12.09.2019 15:14:34 | -7,200 | 57b809f8e8707b21a000970fde7a089c609c59c5 | whale: (devops) Updates Dockerfile
Closes | [
{
"change_type": "MODIFY",
"old_path": "Dockerfile",
"new_path": "Dockerfile",
"diff": "-FROM node:lts-alpine\n+FROM node:10-alpine as build\n+LABEL maintainer=\"Michael Feher, Matteo Vivona, Maksim Sinik\"\n-RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app\n+# set app basepath\n+ENV HOME=/home/app\n-WORKDIR /home/node/app\n+# copy all app files\n+COPY . $HOME/node/\n-COPY package*.json /home/node/app\n+# change workgin dir and install deps in quiet mode\n+WORKDIR $HOME/node\n+RUN npm ci -q\n-USER node\n+# compile typescript and build all production stuff\n+RUN npm run build\n-RUN yarn\n+# remove dev dependencies that are not needed in production\n+RUN npm prune --production\n-COPY --chown=node:node . /home/node/app\n+# start new image for lower size\n+FROM node:10-alpine\n+\n+# create use with no permissions\n+RUN addgroup -g 101 -S app && adduser -u 100 -S -G app -s /bin/false app\n+\n+# set app basepath\n+ENV HOME=/home/app\n+\n+# copy production complied node app to the new image\n+COPY --from=build $HOME/node/ $HOME/node/\n+RUN chown -R app:app $HOME/*\n+\n+# run app with low permissions level user\n+USER app\n+WORKDIR $HOME/node\nEXPOSE 3000\n+ENV NODE_ENV=production\n+\nCMD [ \"yarn\", \"start\" ]\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | :whale: (devops) Updates Dockerfile
Closes #1621 |
288,297 | 27.09.2019 12:24:35 | -7,200 | 4b0096b8a25ef800cfa68dfbc66cd0543f88b848 | bug: (dep) Uses ~ for all deps | [
{
"change_type": "ADD",
"old_path": null,
"new_path": ".npmrc",
"diff": "+save-prefix='~'\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "{\n- \"name\": \"@hospitalrun-org/frontend\",\n+ \"name\": \"@hospitalrun/frontend\",\n\"version\": \"0.1.0\",\n\"description\": \"React frontend for HospitalRun\",\n\"private\": false,\n\"license\": \"MIT\",\n\"dependencies\": {\n- \"react\": \"^16.9.0\",\n- \"react-dom\": \"^16.9.0\",\n- \"react-scripts\": \"3.1.1\",\n- \"typescript\": \"3.6.2\"\n+ \"react\": \"~16.9.0\",\n+ \"react-dom\": \"~16.9.0\",\n+ \"react-scripts\": \"~3.1.2\",\n+ \"typescript\": \"~3.6.3\"\n},\n\"repository\": {\n\"type\": \"git\",\n\"Stefano Casasola\"\n],\n\"devDependencies\": {\n- \"@commitlint/cli\": \"^8.1.0\",\n- \"@commitlint/core\": \"^8.1.0\",\n- \"@types/jest\": \"24.0.18\",\n- \"@types/node\": \"12.7.4\",\n- \"@types/react\": \"16.9.2\",\n- \"@types/react-dom\": \"16.9.0\",\n- \"commitlint-config-gitmoji\": \"^1.0.1\",\n- \"cross-env\": \"^5.2.1\",\n- \"cz-emoji\": \"^1.1.2\",\n- \"dateformat\": \"^3.0.3\",\n- \"husky\": \"^3.0.5\"\n+ \"@commitlint/cli\": \"~8.1.0\",\n+ \"@commitlint/core\": \"~8.1.0\",\n+ \"@types/jest\": \"~24.0.18\",\n+ \"@types/node\": \"~12.7.8\",\n+ \"@types/react\": \"~16.9.3\",\n+ \"@types/react-dom\": \"~16.9.1\",\n+ \"commitlint-config-gitmoji\": \"~1.0.1\",\n+ \"cross-env\": \"~5.2.1\",\n+ \"cz-emoji\": \"~1.1.2\",\n+ \"dateformat\": \"~3.0.3\",\n+ \"husky\": \"~3.0.5\"\n},\n\"scripts\": {\n\"start\": \"react-scripts start\",\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | :bug: (dep) Uses ~ for all deps |
288,297 | 27.09.2019 12:28:21 | -7,200 | bd032aa6c22552519bef637cc3d25b9083a36e04 | bug: (dep) Adds commitizen as devDep | [
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"@types/node\": \"~12.7.8\",\n\"@types/react\": \"~16.9.3\",\n\"@types/react-dom\": \"~16.9.1\",\n+ \"commitizen\": \"^4.0.3\",\n\"commitlint-config-gitmoji\": \"~1.0.1\",\n\"cross-env\": \"~5.2.1\",\n\"cz-emoji\": \"~1.1.2\",\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | :bug: (dep) Adds commitizen as devDep |
288,334 | 27.09.2019 18:11:54 | -7,200 | 27bf0997172347b85fb61c542eb24bdf6b9f2864 | ci(commit): removes gitmoji and adds commitizen plugins
closes | [
{
"change_type": "ADD",
"old_path": null,
"new_path": ".releaserc",
"diff": "+{\n+ \"plugins\": [\n+ \"@semantic-release/commit-analyzer\",\n+ \"@semantic-release/release-notes-generator\",\n+ \"@semantic-release/changelog\",\n+ [\"@semantic-release/git\", {\n+ \"assets\": [\"package.json\", \"CHANGELOG.md\"],\n+ \"message\": \"chore(release): ${nextRelease.version} [skip ci]\\n\\n${nextRelease.notes}\"\n+ }],\n+ \"@semantic-release/github\"\n+ ]\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "commitlint.config.js",
"new_path": "commitlint.config.js",
"diff": "-module.exports = {\n- extends: [\"gitmoji\"],\n- parserPreset: {\n- parserOpts: {\n- headerPattern: /^(:\\w*:)(?:\\s)(?:\\((.*?)\\))?\\s((?:.*(?=\\())|.*)(?:\\(#(\\d*)\\))?/,\n- headerCorrespondence: [\"type\", \"scope\", \"subject\", \"ticket\"]\n- }\n- }\n-};\n\\ No newline at end of file\n+module.exports = { extends: [\"@commitlint/config-conventional\"] };\n"
},
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "{\n\"name\": \"@hospitalrun/frontend\",\n- \"version\": \"0.1.0\",\n+ \"version\": \"0.0.0-development\",\n\"description\": \"React frontend for HospitalRun\",\n\"private\": false,\n\"license\": \"MIT\",\n},\n\"repository\": {\n\"type\": \"git\",\n- \"url\": \"[email protected]:HospitalRun/hospitalrun-frontend\"\n+ \"url\": \"https://github.com/HospitalRun/hospitalrun-frontend.git\"\n},\n\"author\": \"Jack Meyer\",\n\"contributors\": [\n\"Stefano Casasola\"\n],\n\"devDependencies\": {\n- \"@commitlint/cli\": \"~8.1.0\",\n+ \"@commitlint/cli\": \"^8.2.0\",\n+ \"@commitlint/config-conventional\": \"^8.2.0\",\n\"@commitlint/core\": \"~8.1.0\",\n+ \"@commitlint/prompt\": \"^8.2.0\",\n+ \"@semantic-release/changelog\": \"^3.0.4\",\n+ \"@semantic-release/commit-analyzer\": \"^6.3.0\",\n+ \"@semantic-release/git\": \"^7.0.16\",\n+ \"@semantic-release/github\": \"^5.4.3\",\n+ \"@semantic-release/release-notes-generator\": \"^7.3.0\",\n\"@types/jest\": \"~24.0.18\",\n\"@types/node\": \"~12.7.8\",\n\"@types/react\": \"~16.9.3\",\n\"@types/react-dom\": \"~16.9.1\",\n\"commitizen\": \"^4.0.3\",\n- \"commitlint-config-gitmoji\": \"~1.0.1\",\n+ \"commitlint-config-cz\": \"^0.12.1\",\n\"cross-env\": \"~5.2.1\",\n- \"cz-emoji\": \"~1.1.2\",\n+ \"cz-conventional-changelog\": \"^3.0.2\",\n\"dateformat\": \"~3.0.3\",\n- \"husky\": \"~3.0.5\"\n+ \"husky\": \"^3.0.5\",\n+ \"semantic-release\": \"^15.13.24\"\n},\n\"scripts\": {\n\"start\": \"react-scripts start\",\n\"build\": \"react-scripts build\",\n\"test\": \"react-scripts test\",\n\"test:ci\": \"cross-env CI=true react-scripts test\",\n- \"eject\": \"react-scripts eject\"\n+ \"eject\": \"react-scripts eject\",\n+ \"semantic-release\": \"semantic-release\"\n},\n\"eslintConfig\": {\n\"extends\": \"react-app\"\n},\n\"config\": {\n\"commitizen\": {\n- \"path\": \"./node_modules/cz-emoji\"\n+ \"path\": \"./node_modules/cz-conventional-changelog\"\n}\n}\n}\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | ci(commit): removes gitmoji and adds commitizen plugins
closes #1624 |
288,334 | 15.10.2019 18:04:30 | -7,200 | 8674b843c2efe85ffc037c89b4a223e9c1976fe8 | test(jest): adds jest | [
{
"change_type": "ADD",
"old_path": null,
"new_path": ".travis.yml",
"diff": "+language: node_js\n+\n+node_js:\n+ - \"12\"\n+ - \"11\"\n+ - \"10\"\n+\n+branches:\n+ only:\n+ - master\n+\n+install:\n+ - travis_retry npm install\n+\n+before_script:\n+ - npm run lint\n+script:\n+ - npm run build\n+after_script:\n+ - npm run test\n+after_success:\n+ - jest --coverage && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage\n+\n+jobs:\n+ include:\n+ - stage: release\n+ node_js: lts/*\n+ script:\n+ - npm run semantic-release\n+\n+notifications:\n+ email:\n+ on_success: never\n+ on_failure: always\n"
},
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"cz-conventional-changelog\": \"^3.0.2\",\n\"dateformat\": \"~3.0.3\",\n\"husky\": \"^3.0.5\",\n+ \"jest\": \"^24.9.0\",\n\"semantic-release\": \"^15.13.24\"\n},\n\"scripts\": {\n\"test\": \"react-scripts test\",\n\"test:ci\": \"cross-env CI=true react-scripts test\",\n\"eject\": \"react-scripts eject\",\n+ \"coveralls\": \"jest --coverage --coverageReporters=text-lcov | coveralls\",\n\"semantic-release\": \"semantic-release\"\n},\n\"eslintConfig\": {\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | test(jest): adds jest |
288,334 | 15.10.2019 18:11:21 | -7,200 | b5184d72fd9d8332a2db265091f7b3ad7684186a | chore(github): updates issue template and add ci action | [
{
"change_type": "ADD",
"old_path": null,
"new_path": ".github/workflows/ci.yml",
"diff": "+name: GitHub CI\n+\n+on: [push, pull_request]\n+\n+jobs:\n+ npm:\n+ runs-on: ${{ matrix.os }}\n+\n+ strategy:\n+ matrix:\n+ node-version: [10.x, 12.x]\n+ os: [ubuntu-18.04]\n+\n+ steps:\n+ - uses: actions/checkout@v1\n+\n+ - name: Use Node.js\n+ uses: actions/setup-node@v1\n+ with:\n+ node-version: ${{ matrix.node-version }}\n+\n+ - name: Install with npm\n+ run: |\n+ npm install\n+ - name: Lint code\n+ run: |\n+ npm run lint\n+ - name: Build\n+ run: |\n+ npm run build\n+ - name: Run tests\n+ run: |\n+ npm run test\n+ yarn:\n+ runs-on: ${{ matrix.os }}\n+\n+ strategy:\n+ matrix:\n+ node-version: [10.x, 12.x]\n+ os: [ubuntu-18.04]\n+\n+ steps:\n+ - uses: actions/checkout@v1\n+\n+ - name: Use Node.js\n+ uses: actions/setup-node@v1\n+ with:\n+ node-version: ${{ matrix.node-version }}\n+\n+ - name: Install with yarn\n+ run: |\n+ curl -o- -L https://yarnpkg.com/install.sh | bash\n+ yarn install\n+ - name: Lint code\n+ run: |\n+ yarn lint\n+ - name: Build\n+ run: |\n+ yarn build\n+ - name: Run tests\n+ run: |\n+ yarn test\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | chore(github): updates issue template and add ci action |
288,334 | 15.10.2019 18:29:10 | -7,200 | b942e51dc1b478b7323338d22257e3345f8be450 | chore(github): adds lint and azure ci toolchain | [
{
"change_type": "ADD",
"old_path": null,
"new_path": ".editorconfig",
"diff": "+root = true\n+\n+[*]\n+indent_style = space\n+indent_size = 2\n+charset = utf-8\n+trim_trailing_whitespace = true\n+insert_final_newline = true\n+end_of_line = lf\n+# editorconfig-tools is unable to ignore longs strings or urls\n+max_line_length = 100\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": ".eslintrc.js",
"diff": "+module.exports = {\n+ parser: '@typescript-eslint/parser',\n+ parserOptions: {\n+ project: './tsconfig.json',\n+ tsconfigRootDir: './',\n+ // TODO: we need this because of an issue with @typescript-eslint/parser: https://github.com/typescript-eslint/typescript-eslint/issues/864\n+ createDefaultProgram: true,\n+ },\n+ extends: [\n+ 'react-app',\n+ 'plugin:@typescript-eslint/recommended',\n+ 'prettier',\n+ 'prettier/@typescript-eslint',\n+ ],\n+ plugins: ['@typescript-eslint'],\n+ rules: {\n+ '@typescript-eslint/explicit-function-return-type': 'off',\n+ '@typescript-eslint/no-explicit-any': 'off',\n+ },\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": ".vscode/settings.json",
"diff": "+{\n+ \"typescript.tsdk\": \"node_modules/typescript/lib\",\n+ \"eslint.autoFixOnSave\": true,\n+ \"eslint.validate\": [\n+ {\n+ \"autoFix\": true,\n+ \"language\": \"typescript\"\n+ },\n+ {\n+ \"autoFix\": true,\n+ \"language\": \"typescriptreact\"\n+ }\n+ ],\n+ \"eslint.workingDirectories\": [\n+ {\n+ \"directory\": \"packages/components\",\n+ \"changeProcessCWD\": true\n+ },\n+ {\n+ \"directory\": \"packages/server\",\n+ \"changeProcessCWD\": true\n+ }\n+ ]\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "azure-pipeline.yml",
"diff": "+trigger:\n+ branches:\n+ include:\n+ - master\n+\n+jobs:\n+ - template: azure/azure-pipelines-npm.yml\n+ parameters:\n+ name: Linux_npm\n+ vmImage: ubuntu-16.04\n+ - template: azure/azure-pipelines-npm.yml\n+ parameters:\n+ name: Windows_npm\n+ vmImage: vs2017-win2016\n+ - template: azure/azure-pipelines-npm.yml\n+ parameters:\n+ name: macOs_npm\n+ vmImage: macOS-10.14\n+ - template: azure/azure-pipelines-yarn.yml\n+ parameters:\n+ name: Linux_yarn\n+ vmImage: ubuntu-16.04\n+ - template: azure/azure-pipelines-yarn.yml\n+ parameters:\n+ name: Windows_yarn\n+ vmImage: vs2017-win2016\n+ - template: azure/azure-pipelines-yarn.yml\n+ parameters:\n+ name: macOS_yarn\n+ vmImage: macOS-10.14\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "azure/azure-pipelines-npm.yml",
"diff": "+jobs:\n+ - job: ${{ parameters.name }}\n+ pool:\n+ vmImage: ${{ parameters.vmImage }}\n+\n+ strategy:\n+ matrix:\n+ node_12_x:\n+ node_version: 12.x\n+ node_10_x:\n+ node_version: 10.x\n+ maxParallel: 5\n+\n+ steps:\n+ - task: NodeTool@0\n+ inputs:\n+ versionSpec: $(node_version)\n+ displayName: Install Node.js\n+\n+ - bash: npm i\n+ displayName: Install dependencies\n+\n+ - bash: npm run build\n+ displayName: Lint and Build\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "azure/azure-pipelines-yarn.yml",
"diff": "+jobs:\n+ - job: ${{ parameters.name }}\n+ pool:\n+ vmImage: ${{ parameters.vmImage }}\n+\n+ strategy:\n+ matrix:\n+ node_12_x:\n+ node_version: 12.x\n+ node_10_x:\n+ node_version: 10.x\n+ maxParallel: 5\n+\n+ steps:\n+ - task: NodeTool@0\n+ inputs:\n+ versionSpec: $(node_version)\n+ displayName: Install Node.js\n+\n+ - bash: yarn install\n+ displayName: Install dependencies\n+\n+ - bash: yarn build\n+ displayName: Lint and Build\n"
},
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"commitlint-config-cz\": \"^0.12.1\",\n\"cross-env\": \"~6.0.3\",\n\"cz-conventional-changelog\": \"^3.0.2\",\n+ \"eslint-config-react-app\": \"~5.0.2\",\n\"dateformat\": \"~3.0.3\",\n\"husky\": \"^3.0.5\",\n+ \"prettier\": \"~1.18.2\",\n\"jest\": \"^24.9.0\",\n\"semantic-release\": \"^15.13.24\"\n},\n\"commit\": \"npx git-cz\",\n\"start\": \"react-scripts start\",\n\"build\": \"react-scripts build\",\n+ \"prepublishOnly\": \"npm run build\",\n+ \"pretest\": \"npm run lint && npm run build\",\n\"test\": \"react-scripts test\",\n\"test:ci\": \"cross-env CI=true react-scripts test\",\n- \"eject\": \"react-scripts eject\",\n+ \"lint\": \"prettier --write --loglevel warn \\\"src/**/*\\\" \\\"stories/**/*\\\" \\\"test/**/*\\\" \\\"README.md\\\" \\\"docs/**/*\\\" && tsdx lint --fix \\\"src/**/*.{ts,tsx}\\\" \\\"test/**/*.{ts,tsx}\\\" \\\"stories/**/*.{ts,tsx}\\\"\",\n\"coveralls\": \"jest --coverage --coverageReporters=text-lcov | coveralls\",\n\"semantic-release\": \"semantic-release\"\n},\n\"commitizen\": {\n\"path\": \"./node_modules/cz-conventional-changelog\"\n}\n+ },\n+ \"lint-staged\": {\n+ \"**/*.{ts,tsx}\": [\n+ \"npm run lint\",\n+ \"git add\"\n+ ]\n+ },\n+ \"jest\": {\n+ \"setupFiles\": [\n+ \"jest-canvas-mock\",\n+ \"<rootDir>test-setup.ts\"\n+ ]\n+ },\n+ \"eslint\": {\n+ \"parser\": \"@typescript-eslint/parser\",\n+ \"parserOptions\": {\n+ \"project\": \"./tsconfig.json\",\n+ \"tsconfigRootDir\": \"./\",\n+ \"createDefaultProgram\": true\n+ },\n+ \"prettier\": {\n+ \"printWidth\": 100,\n+ \"tabWidth\": 2,\n+ \"semi\": false,\n+ \"singleQuote\": true,\n+ \"trailingComma\": \"all\",\n+ \"bracketSpacing\": true,\n+ \"jsxBracketSameLine\": false,\n+ \"arrowParens\": \"avoid\"\n+ },\n+ \"extends\": [\n+ \"react-app\",\n+ \"plugin:@typescript-eslint/recommended\",\n+ \"prettier\",\n+ \"prettier/@typescript-eslint\"\n+ ],\n+ \"plugins\": [\n+ \"@typescript-eslint\"\n+ ],\n+ \"rules\": {\n+ \"@typescript-eslint/explicit-function-return-type\": \"off\",\n+ \"@typescript-eslint/no-explicit-any\": \"off\"\n+ }\n}\n}\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | chore(github): adds lint and azure ci toolchain |
288,334 | 15.10.2019 18:52:00 | -7,200 | c8a227a5495f3e680115c3cd68871ea86bd1a470 | chore(test): updates travis and github yaml | [
{
"change_type": "MODIFY",
"old_path": ".github/workflows/ci.yml",
"new_path": ".github/workflows/ci.yml",
"diff": "@@ -30,7 +30,7 @@ jobs:\nnpm run build\n- name: Run tests\nrun: |\n- npm run test\n+ npm run test:ci\nyarn:\nruns-on: ${{ matrix.os }}\n"
},
{
"change_type": "MODIFY",
"old_path": ".travis.yml",
"new_path": ".travis.yml",
"diff": "@@ -17,7 +17,7 @@ before_script:\nscript:\n- npm run build\nafter_script:\n- - npm run test\n+ - npm run test:ci\nafter_success:\n- jest --coverage && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | chore(test): updates travis and github yaml |
288,334 | 15.10.2019 19:06:55 | -7,200 | ddc4cdfd674c19b042eeb25456f0b88d69d8d64c | docs(readme): updates badges | [
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "<div align=\"center\">\n-[](https://img.shields.io/github/release) [](https://dev.azure.com/hospitalrun/hospitalrun-frontend/_build/latest?definitionId=1) [](https://travis-ci.com/HospitalRun/hospitalrun-frontend) [](https://codeclimate.com/github/HospitalRun/hospitalrun-frontend/maintainability) [](https://coveralls.io/github/HospitalRun/hospitalrun-frontend?branch=master) [](https://github.com/HospitalRun/hospitalrun-frontend/graphs/contributors)\n-[](./LICENSE) [](https://nucleode.com) [](https://hospitalrun-slackin.herokuapp.com) [](https://spectrum.chat/hospitalrun)\n+[](https://img.shields.io/github/release) [](https://github.com/HospitalRun/frontend/actions) [](https://dev.azure.com/HospitalRun/hospitalrun-frontend/_build/latest?definitionId=3&branchName=master) [](https://travis-ci.com/HospitalRun/hospitalrun-frontend) [](https://coveralls.io/github/HospitalRun/hospitalrun-frontend?branch=master) [](https://github.com/HospitalRun/hospitalrun-frontend/graphs/contributors)\n+[](./LICENSE)  [](https://hospitalrun-slackin.herokuapp.com) [](https://spectrum.chat/hospitalrun)\n</div>\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | docs(readme): updates badges |
288,334 | 15.10.2019 19:23:23 | -7,200 | db127b6b3d4587fdb49fe568b74841fbdf3e74f3 | fix(docs): fixes badge url on readme | [
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "<div align=\"center\">\n-[](https://img.shields.io/github/release) [](https://github.com/HospitalRun/frontend/actions) [](https://dev.azure.com/HospitalRun/hospitalrun-frontend/_build/latest?definitionId=3&branchName=master) [](https://travis-ci.com/HospitalRun/hospitalrun-frontend) [](https://coveralls.io/github/HospitalRun/hospitalrun-frontend?branch=master) [](https://github.com/HospitalRun/hospitalrun-frontend/graphs/contributors)\n-[](./LICENSE)  [](https://hospitalrun-slackin.herokuapp.com) [](https://spectrum.chat/hospitalrun)\n+[](https://img.shields.io/github/release) [](https://github.com/HospitalRun/frontend/actions) [](https://dev.azure.com/HospitalRun/hospitalrun-frontend/_build/latest?definitionId=3&branchName=master) [](https://travis-ci.com/HospitalRun/hospitalrun-frontend) [](https://coveralls.io/github/HospitalRun/hospitalrun-frontend?branch=master) [](./LICENSE)  [](https://hospitalrun-slackin.herokuapp.com) [](https://spectrum.chat/hospitalrun)\n</div>\n<div align=\"center\">\n### Free, easy-to-use software for developing world healthcare.\n+\nReact frontend for [HospitalRun](http://hospitalrun.io/): free software for developing world hospitals.\n</div>\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | fix(docs): fixes badge url on readme |
288,323 | 23.10.2019 23:32:29 | 18,000 | afb5e3122f7ac5a7ae317b7d241528f01c0efb48 | chore(package): fix broken lint script | [
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"pretest\": \"npm run lint && npm run build\",\n\"test\": \"react-scripts test\",\n\"test:ci\": \"cross-env CI=true react-scripts test\",\n- \"lint\": \"eslint './src/**/*.{ts,tsx}'\",\n+ \"lint\": \"eslint ./src/**/*.{ts,tsx}\",\n\"coveralls\": \"jest --coverage --coverageReporters=text-lcov | coveralls\",\n\"semantic-release\": \"semantic-release\"\n},\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | chore(package): fix broken lint script |
288,334 | 29.10.2019 14:41:34 | -3,600 | 6317d62fe443c595805a8496326baeec200fd85f | chore(slack): updates slacking url | [
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "<div align=\"center\">\n[](https://img.shields.io/github/release) [](https://github.com/HospitalRun/frontend/actions) [](https://dev.azure.com/HospitalRun/hospitalrun-frontend/_build/latest?definitionId=3&branchName=master) [](https://travis-ci.com/HospitalRun/hospitalrun-frontend) [](https://coveralls.io/github/HospitalRun/hospitalrun-frontend?branch=master) [](https://app.fossa.io/projects/git%2Bgithub.com%2FHospitalRun%2Fhospitalrun-frontend?ref=badge_large) [](http://commitizen.github.io/cz-cli/)\n-[](https://github.com/semantic-release/semantic-release)  [](https://hospitalrun-slackin.herokuapp.com) [](https://spectrum.chat/hospitalrun)\n+[](https://github.com/semantic-release/semantic-release)  [](https://hospitalrun-slack.herokuapp.com) [](https://spectrum.chat/hospitalrun)\n</div>\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | chore(slack): updates slacking url |
288,399 | 05.11.2019 17:24:43 | -3,600 | 4c2fb5a8aee1845c33d04285e3af972ae53eef6e | chore(deps): adds eslint dev dependency | [
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"cross-env\": \"~6.0.3\",\n\"cz-conventional-changelog\": \"^3.0.2\",\n\"dateformat\": \"~3.0.3\",\n+ \"eslint\": \"^6.6.0\",\n\"eslint-config-airbnb\": \"^18.0.1\",\n\"eslint-config-prettier\": \"^6.5.0\",\n\"eslint-plugin-import\": \"^2.18.2\",\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | chore(deps): adds eslint dev dependency |
288,399 | 05.11.2019 19:00:00 | -3,600 | 75e175665ef744cac1d6ea639e0a732a4c566d7b | fix(lint): fixes eslint | [
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"private\": false,\n\"license\": \"MIT\",\n\"dependencies\": {\n+ \"@semantic-release/changelog\": \"~3.0.4\",\n+ \"@semantic-release/git\": \"~7.0.16\",\n+ \"@semantic-release/release-notes-generator\": \"~7.3.0\",\n\"react\": \"~16.10.2\",\n\"react-dom\": \"~16.10.2\",\n\"react-scripts\": \"~3.2.0\",\n\"pretest\": \"npm run lint && npm run build\",\n\"test\": \"react-scripts test\",\n\"test:ci\": \"cross-env CI=true react-scripts test\",\n- \"lint\": \"eslint \\\"src/**/*.{js,jsx,ts,tsx}\\\" \\\"test/**/*.{js,jsx,ts,tsx}\\\" \\\"stories/**/*.{js,jsx,ts,tsx}\\\" --fix\",\n+ \"lint\": \"eslint \\\"src/**/*.{js,jsx,ts,tsx}\\\" --fix\",\n\"coveralls\": \"jest --coverage --coverageReporters=text-lcov | coveralls\",\n\"semantic-release\": \"semantic-release\"\n},\n"
},
{
"change_type": "MODIFY",
"old_path": "src/App.test.tsx",
"new_path": "src/App.test.tsx",
"diff": "-import React from 'react';\n-import ReactDOM from 'react-dom';\n-import App from './App';\n+import React from \"react\";\n+import ReactDOM from \"react-dom\";\n+import App from \"./App\";\n-it('renders without crashing', () => {\n- const div = document.createElement('div');\n+it(\"renders without crashing\", () => {\n+ const div = document.createElement(\"div\");\nReactDOM.render(<App />, div);\nReactDOM.unmountComponentAtNode(div);\n});\n"
},
{
"change_type": "MODIFY",
"old_path": "src/App.tsx",
"new_path": "src/App.tsx",
"diff": "-import React from 'react';\n-import logo from './hospitalrun-icon-transparent.png';\n-import './App.css';\n+import React from \"react\";\n+import logo from \"./hospitalrun-icon-transparent.png\";\n+import \"./App.css\";\n-const App: React.FC = () => {\n- return (\n+const App: React.FC = () => (\n<div className=\"App\">\n<header className=\"App-header\">\n<img src={logo} className=\"App-logo\" alt=\"logo\" />\n</header>\n</div>\n);\n-}\nexport default App;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/index.tsx",
"new_path": "src/index.tsx",
"diff": "-import React from 'react';\n-import ReactDOM from 'react-dom';\n-import './index.css';\n-import App from './App';\n-import * as serviceWorker from './serviceWorker';\n+import React from \"react\";\n+import ReactDOM from \"react-dom\";\n+import \"./index.css\";\n+import App from \"./App\";\n+import * as serviceWorker from \"./serviceWorker\";\n-ReactDOM.render(<App />, document.getElementById('root'));\n+ReactDOM.render(<App />, document.getElementById(\"root\"));\n// If you want your app to work offline and load faster, you can change\n// unregister() to register() below. Note this comes with some pitfalls.\n"
},
{
"change_type": "MODIFY",
"old_path": "src/serviceWorker.ts",
"new_path": "src/serviceWorker.ts",
"diff": "+/* eslint-disable */\n// This optional code is used to register a service worker.\n// register() is not called by default.\n// opt-in, read https://bit.ly/CRA-PWA\nconst isLocalhost = Boolean(\n- window.location.hostname === 'localhost' ||\n+ window.location.hostname === \"localhost\" ||\n// [::1] is the IPv6 localhost address.\n- window.location.hostname === '[::1]' ||\n+ window.location.hostname === \"[::1]\" ||\n// 127.0.0.1/8 is considered localhost for IPv4.\n- window.location.hostname.match(\n- /^127(?:\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/\n- )\n+ window.location.hostname.match(/^127(?:\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/)\n);\ntype Config = {\n@@ -26,7 +25,7 @@ type Config = {\n};\nexport function register(config?: Config) {\n- if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {\n+ if (process.env.NODE_ENV === \"production\" && \"serviceWorker\" in navigator) {\n// The URL constructor is available in all browsers that support SW.\nconst publicUrl = new URL(\n(process as { env: { [key: string]: string } }).env.PUBLIC_URL,\n@@ -39,7 +38,7 @@ export function register(config?: Config) {\nreturn;\n}\n- window.addEventListener('load', () => {\n+ window.addEventListener(\"load\", () => {\nconst swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;\nif (isLocalhost) {\n@@ -50,8 +49,8 @@ export function register(config?: Config) {\n// service worker/PWA documentation.\nnavigator.serviceWorker.ready.then(() => {\nconsole.log(\n- 'This web app is being served cache-first by a service ' +\n- 'worker. To learn more, visit https://bit.ly/CRA-PWA'\n+ \"This web app is being served cache-first by a service \" +\n+ \"worker. To learn more, visit https://bit.ly/CRA-PWA\"\n);\n});\n} else {\n@@ -72,14 +71,14 @@ function registerValidSW(swUrl: string, config?: Config) {\nreturn;\n}\ninstallingWorker.onstatechange = () => {\n- if (installingWorker.state === 'installed') {\n+ if (installingWorker.state === \"installed\") {\nif (navigator.serviceWorker.controller) {\n// At this point, the updated precached content has been fetched,\n// but the previous service worker will still serve the older\n// content until all client tabs are closed.\nconsole.log(\n- 'New content is available and will be used when all ' +\n- 'tabs for this page are closed. See https://bit.ly/CRA-PWA.'\n+ \"New content is available and will be used when all \" +\n+ \"tabs for this page are closed. See https://bit.ly/CRA-PWA.\"\n);\n// Execute callback\n@@ -90,7 +89,7 @@ function registerValidSW(swUrl: string, config?: Config) {\n// At this point, everything has been precached.\n// It's the perfect time to display a\n// \"Content is cached for offline use.\" message.\n- console.log('Content is cached for offline use.');\n+ console.log(\"Content is cached for offline use.\");\n// Execute callback\nif (config && config.onSuccess) {\n@@ -102,7 +101,7 @@ function registerValidSW(swUrl: string, config?: Config) {\n};\n})\n.catch(error => {\n- console.error('Error during service worker registration:', error);\n+ console.error(\"Error during service worker registration:\", error);\n});\n}\n@@ -111,10 +110,10 @@ function checkValidServiceWorker(swUrl: string, config?: Config) {\nfetch(swUrl)\n.then(response => {\n// Ensure service worker exists, and that we really are getting a JS file.\n- const contentType = response.headers.get('content-type');\n+ const contentType = response.headers.get(\"content-type\");\nif (\nresponse.status === 404 ||\n- (contentType != null && contentType.indexOf('javascript') === -1)\n+ (contentType != null && contentType.indexOf(\"javascript\") === -1)\n) {\n// No service worker found. Probably a different app. Reload the page.\nnavigator.serviceWorker.ready.then(registration => {\n@@ -128,14 +127,12 @@ function checkValidServiceWorker(swUrl: string, config?: Config) {\n}\n})\n.catch(() => {\n- console.log(\n- 'No internet connection found. App is running in offline mode.'\n- );\n+ console.log(\"No internet connection found. App is running in offline mode.\");\n});\n}\nexport function unregister() {\n- if ('serviceWorker' in navigator) {\n+ if (\"serviceWorker\" in navigator) {\nnavigator.serviceWorker.ready.then(registration => {\nregistration.unregister();\n});\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | fix(lint): fixes eslint |
288,334 | 17.11.2019 14:08:10 | -3,600 | 90a116af9e251344e3c758c142e555952e46df2e | docs(readme): updates file structure | [
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "-<div align=\"center\">\n-\n-\n-\n-</div>\n+# HospitalRun Frontend\n<div align=\"center\">\n</div>\n-<div align=\"center\">\n-\n-### Free, easy-to-use software for developing world healthcare.\nReact frontend for [HospitalRun](http://hospitalrun.io/): free software for developing world hospitals.\n-</div>\n+---\n<hr />\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | docs(readme): updates file structure |
288,297 | 18.11.2019 16:31:52 | -3,600 | 94499219947bc331cca27d64806c378fb57cb0ed | Updates core-team members | [
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "@@ -41,8 +41,8 @@ Cross-browser Testing Platform and Open Source <3 Provided by [Sauce Labs][homep\n## Core Team\n<!-- prettier-ignore -->\n-| [<img src=\"https://avatars3.githubusercontent.com/u/25089405?s=460&v=4\" width=\"100px;\"/><br /><sub><b>Stefano Casasola</b></sub>](https://github.com/irvelervel) | [<img src=\"https://avatars3.githubusercontent.com/u/3400442?s=460&v=4\" width=\"100px;\"/><br /><sub><b>Michael J Feher</b></sub>](https://github.com/PhearZero) | [<img src=\"https://avatars1.githubusercontent.com/u/25009192?s=460&v=4\" width=\"100px;\"/><br /><sub><b>Riccardo Gulin</b></sub>](https://github.com/bazuzu666) | [<img src=\"https://avatars3.githubusercontent.com/u/18731800?s=460&v=4\" width=\"100px;\"/><br /><sub><b>Jack Meyer</b></sub>](https://github.com/jackcmeyer) | [<img src=\"https://avatars0.githubusercontent.com/u/6388707?s=460&v=4\" width=\"100px;\"/><br /><sub><b>Matteo Vivona</b></sub>](https://github.com/tehKapa) |\n-|---|---|---|---|---|\n+| [<img src=\"https://avatars3.githubusercontent.com/u/25089405?s=460&v=4\" width=\"100px;\"/><br /><sub><b>Stefano Casasola</b></sub>](https://github.com/irvelervel) |[<img src=\"https://avatars1.githubusercontent.com/u/25009192?s=460&v=4\" width=\"100px;\"/><br /><sub><b>Riccardo Gulin</b></sub>](https://github.com/bazuzu666) | [<img src=\"https://avatars3.githubusercontent.com/u/18731800?s=460&v=4\" width=\"100px;\"/><br /><sub><b>Jack Meyer</b></sub>](https://github.com/jackcmeyer) | [<img src=\"https://avatars0.githubusercontent.com/u/6388707?s=460&v=4\" width=\"100px;\"/><br /><sub><b>Matteo Vivona</b></sub>](https://github.com/tehKapa) | [<img src=\"https://avatars3.githubusercontent.com/u/603924?s=460&v=4\" width=\"100px;\"/><br /><sub><b>Grace Lau</b></sub>](https://github.com/lauggh) | [<img src=\"https://avatars2.githubusercontent.com/u/8914893?s=460&v=4\" width=\"100px;\"/><br /><sub><b>Michael Daly</b></sub>](https://github.com/MichaelDalyDev) |\n+|---|---|---|---|---|---|\n## Medical Supervisor\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Updates core-team members |
288,334 | 19.11.2019 12:13:34 | -3,600 | bd9a1a1c35b2a7b3f6e31951bbf83e242677f174 | ci(lint): adds new lint stage on pre-commit | [
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"eslint-plugin-react\": \"^7.16.0\",\n\"eslint-plugin-react-hooks\": \"^2.2.0\",\n\"husky\": \"^3.0.5\",\n+ \"lint-staged\": \"~9.4.3\",\n\"jest\": \"^24.9.0\",\n\"prettier\": \"~1.19.1\",\n\"semantic-release\": \"^15.13.24\"\n\"husky\": {\n\"hooks\": {\n\"commit-msg\": \"commitlint -E HUSKY_GIT_PARAMS\",\n- \"pre-commit\": \"npm run test:ci\"\n+ \"pre-commit\": \"lint-staged\"\n}\n},\n\"config\": {\n\"lint-staged\": {\n\"**/*.{js,jsx,ts,tsx}\": [\n\"npm run lint\",\n- \"git add\"\n+ \"npm run test:ci\",\n+ \"git add .\"\n]\n}\n}\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | ci(lint): adds new lint stage on pre-commit |
288,334 | 19.11.2019 14:31:55 | -3,600 | 665a00eb4fd71ddb71e49fcdc79d547294579d94 | chore(deps): updates devdependency | [
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"@types/jest\": \"~24.0.18\",\n\"@types/node\": \"~12.12.9\",\n\"@types/react\": \"~16.9.6\",\n- \"@types/react-dom\": \"~16.9.1\",\n+ \"@types/react-dom\": \"~16.9.4\",\n\"@typescript-eslint/eslint-plugin\": \"~2.8.0\",\n\"@typescript-eslint/parser\": \"~2.8.0\",\n\"commitizen\": \"^4.0.3\",\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | chore(deps): updates devdependency |
288,323 | 22.10.2019 22:43:20 | 18,000 | c6d712b6bd2fb74adc61d9de88e58673418bdcb4 | feat(init): creates a very simple pouchdb client | [
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"@semantic-release/changelog\": \"~3.0.4\",\n\"@semantic-release/git\": \"~7.0.16\",\n\"@semantic-release/release-notes-generator\": \"~7.3.0\",\n- \"react\": \"~16.12.0\",\n- \"react-dom\": \"~16.12.0\",\n+ \"pouchdb\": \"~7.1.1\",\n+ \"react\": \"~16.10.2\",\n+ \"react-dom\": \"~16.10.2\",\n\"react-scripts\": \"~3.2.0\",\n\"typescript\": \"~3.7.2\"\n},\n\"@semantic-release/github\": \"^5.4.3\",\n\"@semantic-release/release-notes-generator\": \"~7.3.0\",\n\"@types/jest\": \"~24.0.18\",\n+<<<<<<< HEAD\n\"@types/node\": \"~12.12.9\",\n+=======\n+ \"@types/node\": \"~12.7.8\",\n+ \"@types/pouchdb\": \"~6.4.0\",\n+>>>>>>> feat(init): creates a very simple pouchdb client\n\"@types/react\": \"~16.9.6\",\n\"@types/react-dom\": \"~16.9.4\",\n\"@typescript-eslint/eslint-plugin\": \"~2.8.0\",\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/client/pouchdb.ts",
"diff": "+import PouchDB from 'pouchdb';\n+\n+const db = new PouchDB('hospitalrun');\n+\n+export async function deleteDocument(document: any) {\n+ return db.remove(document);\n+}\n+\n+export async function deleteDocumentById(id: string, revId: string) {\n+ return db.remove(id, revId);\n+}\n+\n+export async function saveOrUpdate(document: any) {\n+ try {\n+ const existingDocument = await get(document._id);\n+ const updatedDcoument = {\n+ _id: existingDocument._id,\n+ _rev: existingDocument._rev,\n+ ...document\n+ }\n+ return db.put(updatedDcoument)\n+ } catch(error) {\n+ if(error.status === 404) {\n+ return save(document)\n+ }\n+ }\n+}\n+\n+export async function save(document: any) {\n+ await db.post(document);\n+}\n+\n+export async function get(id: string) {\n+ const document = await db.get(id);\n+ return document;\n+}\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | feat(init): creates a very simple pouchdb client |
288,323 | 23.10.2019 23:30:15 | 18,000 | c220b9667bf25569a73b9859c622d2cfd39fe5e2 | feat(init): add basic routing | [
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"@semantic-release/git\": \"~7.0.16\",\n\"@semantic-release/release-notes-generator\": \"~7.3.0\",\n\"pouchdb\": \"~7.1.1\",\n+ \"bootstrap\": \"^4.3.1\",\n\"react\": \"~16.10.2\",\n\"react-dom\": \"~16.10.2\",\n+ \"react-router\": \"~5.1.2\",\n+ \"react-router-dom\": \"~5.1.2\",\n\"react-scripts\": \"~3.2.0\",\n\"typescript\": \"~3.7.2\"\n},\n\"@semantic-release/github\": \"^5.4.3\",\n\"@semantic-release/release-notes-generator\": \"~7.3.0\",\n\"@types/jest\": \"~24.0.18\",\n-<<<<<<< HEAD\n- \"@types/node\": \"~12.12.9\",\n-=======\n\"@types/node\": \"~12.7.8\",\n\"@types/pouchdb\": \"~6.4.0\",\n->>>>>>> feat(init): creates a very simple pouchdb client\n\"@types/react\": \"~16.9.6\",\n- \"@types/react-dom\": \"~16.9.4\",\n- \"@typescript-eslint/eslint-plugin\": \"~2.8.0\",\n- \"@typescript-eslint/parser\": \"~2.8.0\",\n+ \"@types/react-dom\": \"~16.9.1\",\n+ \"@types/react-router\": \"~5.1.2\",\n+ \"@types/react-router-dom\": \"~5.1.0\",\n+ \"@typescript-eslint/eslint-plugin\": \"~2.4.0\",\n+ \"@typescript-eslint/parser\": \"~2.4.0\",\n\"commitizen\": \"^4.0.3\",\n\"commitlint-config-cz\": \"^0.12.1\",\n\"cross-env\": \"~6.0.3\",\n"
},
{
"change_type": "DELETE",
"old_path": "src/App.css",
"new_path": null,
"diff": "-.App {\n- text-align: center;\n-}\n-\n-.App-logo {\n- height: 40vmin;\n- pointer-events: none;\n-}\n-\n-.App-header {\n- background-color: #282c34;\n- min-height: 100vh;\n- display: flex;\n- flex-direction: column;\n- align-items: center;\n- justify-content: center;\n- font-size: calc(10px + 2vmin);\n- color: white;\n-}\n-\n-.App-link {\n- color: #61dafb;\n-}\n-\n-@keyframes App-logo-spin {\n- from {\n- transform: rotate(0deg);\n- }\n- to {\n- transform: rotate(360deg);\n- }\n-}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/components/Dashboard.tsx",
"diff": "+import React, { Component } from 'react';\n+\n+class Dashboard extends Component {\n+ render() {\n+ return (\n+ <h1>Hello Dashboard</h1>\n+ );\n+ }\n+}\n+\n+export default Dashboard;\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/components/HospitalRun.tsx",
"diff": "+import React, { Component } from 'react';\n+import { Switch, Route, withRouter, RouteComponentProps } from 'react-router-dom';\n+import { Navbar } from '@hospitalrun/components';\n+import Dashboard from './Dashboard';\n+import Patient from './Patient';\n+import Patients from './Patients';\n+import NewPatient from './NewPatient';\n+\n+class HospitalRun extends Component<RouteComponentProps, {}> {\n+ constructor(props: RouteComponentProps) {\n+ super(props);\n+ this.noOpHandler = this.noOpHandler.bind(this);\n+ }\n+\n+ noOpHandler() {\n+ console.log('no op');\n+ }\n+\n+ navigate(route: string) {\n+ this.props.history.push(route);\n+ }\n+\n+ render() {\n+ return (\n+ <div>\n+ <Navbar\n+ brand={{\n+ label: 'HospitalRun',\n+ onClick: () => {this.navigate('/')}\n+ }}\n+ bg=\"light\"\n+ variant=\"light\"\n+ onSeachButtonClick={this.noOpHandler}\n+ onSearchTextBoxChange={this.noOpHandler}\n+ navLinks={[{ label: 'Patients', onClick: () => {this.navigate('/patients')}, children: [] }]}\n+ />\n+ <div>\n+ <Switch>\n+ <Route exact path=\"/\" component={Dashboard} />\n+ <Route exact path=\"/patients\" component={Patients} />\n+ <Route exact path=\"/new/patient\" component={NewPatient} />\n+ <Route exact path=\"/patients/:id\" component={Patient} />\n+ </Switch>\n+ </div>\n+ </div>\n+ )\n+ }\n+}\n+\n+export default withRouter(HospitalRun);\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/components/NewPatient.tsx",
"diff": "+import React, { Component } from 'react';\n+\n+class NewPatient extends Component {\n+ render() {\n+ return (\n+ <h1>New Patient</h1>\n+ );\n+ }\n+}\n+\n+export default NewPatient;\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/components/Patient.tsx",
"diff": "+import React, { Component } from 'react';\n+\n+class Patient extends Component {\n+ render() {\n+ return (\n+ <h1>Patient</h1>\n+ );\n+ }\n+}\n+\n+export default Patient;\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/components/Patients.tsx",
"diff": "+import React, { Component } from 'react';\n+\n+class Patients extends Component {\n+ render() {\n+ return (\n+ <div>\n+ <h1>Patients</h1>\n+ </div>\n+\n+ );\n+ }\n+}\n+\n+export default Patients;\n\\ No newline at end of file\n"
},
{
"change_type": "DELETE",
"old_path": "src/hospitalrun-icon-transparent.png",
"new_path": "src/hospitalrun-icon-transparent.png",
"diff": "Binary files a/src/hospitalrun-icon-transparent.png and /dev/null differ\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | feat(init): add basic routing |
288,323 | 29.10.2019 21:55:39 | 18,000 | bb94ef0cf5e4461a4d84515cc695db66fd229fc7 | feat(patients): add very simple create patient page | [
{
"change_type": "RENAME",
"old_path": "src/client/pouchdb.ts",
"new_path": "src/clients/db/patients-db.ts",
"diff": "-import PouchDB from 'pouchdb';\n+import { patients } from '../../config/pouchdb';\n-const db = new PouchDB('hospitalrun');\n+export async function getAll() {\n+ return patients.allDocs();\n+}\nexport async function deleteDocument(document: any) {\n- return db.remove(document);\n+ return patients.remove(document);\n}\nexport async function deleteDocumentById(id: string, revId: string) {\n- return db.remove(id, revId);\n+ return patients.remove(id, revId);\n}\nexport async function saveOrUpdate(document: any) {\n@@ -18,19 +20,21 @@ export async function saveOrUpdate(document: any) {\n_rev: existingDocument._rev,\n...document\n}\n- return db.put(updatedDcoument)\n+ return patients.put(updatedDcoument)\n} catch(error) {\nif(error.status === 404) {\nreturn save(document)\n}\n}\n+\n+ return null;\n}\nexport async function save(document: any) {\n- await db.post(document);\n+ return patients.post(document);\n}\nexport async function get(id: string) {\n- const document = await db.get(id);\n+ const document = await patients.get(id);\nreturn document;\n}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "src/components/NewPatient.tsx",
"new_path": "src/components/NewPatient.tsx",
"diff": "import React, { Component } from 'react';\n+import { withRouter, RouteComponentProps } from 'react-router-dom';\n+import { TextInput, Button } from '@hospitalrun/components';\n+import * as patientsDb from '../clients/db/patients-db';\n+\n+interface Props extends RouteComponentProps {\n+\n+}\n+\n+interface State {\n+ firstName: string\n+ lastName: string\n+}\n+\n+\n+class NewPatient extends Component<Props, State> {\n+\n+ constructor(props: Props) {\n+ super(props);\n+ this.onFirstNameChange = this.onFirstNameChange.bind(this)\n+ this.onLastNameChange = this.onLastNameChange.bind(this);\n+ this.onSaveButtonClick = this.onSaveButtonClick.bind(this);\n+\n+ this.state = {\n+ firstName: '',\n+ lastName: '',\n+ };\n+ }\n+\n+\n+ onFirstNameChange(event: any) {\n+ this.setState({\n+ firstName: event.target.value,\n+ })\n+ }\n+\n+ onLastNameChange(event: any) {\n+ this.setState({\n+ lastName: event.target.value,\n+ })\n+ }\n+\n+ async onSaveButtonClick() {\n+ const newPatient = (await patientsDb.save(this.state)) as any\n+ this.props.history.push(`/patients/${newPatient.id}`);\n+ }\n-class NewPatient extends Component {\nrender() {\nreturn (\n+ <div>\n<h1>New Patient</h1>\n+ <div className=\"container\">\n+ <form>\n+ <div className=\"row\">\n+ <h3>First Name:</h3>\n+ <TextInput onChange={this.onFirstNameChange}/>\n+ </div>\n+ <div className=\"row\">\n+ <h3>Last Name:</h3>\n+ <TextInput onChange={this.onLastNameChange}/>\n+ </div>\n+ <Button onClick={this.onSaveButtonClick}>Save</Button>\n+ </form>\n+ </div>\n+ </div>\n);\n}\n}\n-export default NewPatient;\n\\ No newline at end of file\n+export default withRouter(NewPatient);\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "src/components/Patients.tsx",
"new_path": "src/components/Patients.tsx",
"diff": "import React, { Component } from 'react';\n+import * as patientsDb from '../clients/db/patients-db';\nclass Patients extends Component {\n+\n+ async componentDidMount() {\n+ const patients = await patientsDb.getAll();\n+ console.log(patients);\n+ }\n+\nrender() {\nreturn (\n<div>\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/config/pouchdb.ts",
"diff": "+import PouchDB from 'pouchdb';\n+\n+export const patients = new PouchDB('patients');\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "src/index.tsx",
"new_path": "src/index.tsx",
"diff": "+<<<<<<< HEAD\nimport React from 'react'\nimport ReactDOM from 'react-dom'\nimport './index.css'\nimport App from './App'\nimport * as serviceWorker from './serviceWorker'\n+=======\n+import React from 'react';\n+import ReactDOM from 'react-dom';\n+import './index.css';\n+import App from './App';\n+// import './client/pouchdb';\n+import * as serviceWorker from './serviceWorker';\n+>>>>>>> feat(patients): add very simple create patient page\nReactDOM.render(<App />, document.getElementById('root'))\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | feat(patients): add very simple create patient page |
288,323 | 29.10.2019 22:10:01 | 18,000 | 927b5bc8ea606ad8a70c2603d2afbcae99744643 | feat(patients): add very simple way of displaying all patients | [
{
"change_type": "MODIFY",
"old_path": "src/clients/db/patients-db.ts",
"new_path": "src/clients/db/patients-db.ts",
"diff": "import { patients } from '../../config/pouchdb';\nexport async function getAll() {\n- return patients.allDocs();\n+ return patients.allDocs({ include_docs: true});\n}\nexport async function deleteDocument(document: any) {\n"
},
{
"change_type": "MODIFY",
"old_path": "src/components/Patients.tsx",
"new_path": "src/components/Patients.tsx",
"diff": "import React, { Component } from 'react';\nimport * as patientsDb from '../clients/db/patients-db';\n+import { Link } from 'react-router-dom';\n-class Patients extends Component {\n+interface Props {\n+\n+}\n+\n+interface State {\n+ patients: any[],\n+}\n+\n+\n+class Patients extends Component<Props, State> {\n+\n+ constructor(props: Props) {\n+ super(props);\n+ this.state = {\n+ patients: [],\n+ }\n+ }\nasync componentDidMount() {\nconst patients = await patientsDb.getAll();\n- console.log(patients);\n+ this.setState({\n+ patients: patients.rows,\n+ })\n}\nrender() {\n+ const list = (\n+ <ul>\n+ {this.state.patients.map((patient) =>\n+ <Link to={`/patients/${patient.id}`}>\n+ <li key={patient.id}>\n+ {patient.doc.firstName} {patient.doc.lastName}\n+ </li>\n+ </Link>\n+ )}\n+ </ul>\n+ );\n+\nreturn (\n<div>\n<h1>Patients</h1>\n+ <div className=\"container\">\n+ <ul>\n+ {list}\n+ </ul>\n</div>\n+ </div>\n);\n}\n}\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | feat(patients): add very simple way of displaying all patients |
288,323 | 30.10.2019 22:17:58 | 18,000 | e48e2484633470f5cb52bd7eaee3d7b324df2d92 | feat(patients) seperate containers and components, add edit/view | [
{
"change_type": "MODIFY",
"old_path": "src/clients/db/patients-db.ts",
"new_path": "src/clients/db/patients-db.ts",
"diff": "@@ -14,7 +14,7 @@ export async function deleteDocumentById(id: string, revId: string) {\nexport async function saveOrUpdate(document: any) {\ntry {\n- const existingDocument = await get(document._id);\n+ const existingDocument = await patients.get(document.id);\nconst updatedDcoument = {\n_id: existingDocument._id,\n_rev: existingDocument._rev,\n@@ -36,5 +36,10 @@ export async function save(document: any) {\nexport async function get(id: string) {\nconst document = await patients.get(id);\n- return document;\n+ const patient = document as any;\n+ return {\n+ id: patient._id,\n+ firstName: patient.firstName,\n+ lastName: patient.lastName\n+ };\n}\n\\ No newline at end of file\n"
},
{
"change_type": "DELETE",
"old_path": "src/components/Patient.tsx",
"new_path": null,
"diff": "-import React, { Component } from 'react';\n-\n-class Patient extends Component {\n- render() {\n- return (\n- <h1>Patient</h1>\n- );\n- }\n-}\n-\n-export default Patient;\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/components/PatientForm.tsx",
"diff": "+\n+import React from 'react';\n+import { TextInput, Button } from '@hospitalrun/components';\n+\n+interface Props {\n+ isEditable?: boolean,\n+ patient?: { firstName: string, lastName: string }\n+ onFieldChange: (key: string, value: string) => void,\n+ onSaveButtonClick: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n+ onCancelButtonClick: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n+}\n+\n+const PatientForm: React.FC<Props> = (props: Props) => {\n+ const handleChange = (event: any, fieldName: string) => {\n+ const htmlInputEvent = event as React.FormEvent<HTMLInputElement>\n+ props.onFieldChange(fieldName, htmlInputEvent.currentTarget.value)\n+ }\n+\n+ let firstName = '';\n+ let lastName = '';\n+ if(props.patient) {\n+ firstName = props.patient.firstName;\n+ lastName = props.patient.lastName;\n+ }\n+\n+ return (\n+ <div>\n+ <form>\n+ <div className=\"row\">\n+ <h3>First Name:</h3>\n+ <TextInput value={firstName} disabled={!props.isEditable} onChange={(event) => handleChange(event, 'firstName')} />\n+ </div>\n+ <div className=\"row\">\n+ <h3>Last Name:</h3>\n+ <TextInput value={lastName} disabled={!props.isEditable} onChange={(event) => handleChange(event, 'lastName')} />\n+ </div>\n+ {props.isEditable &&\n+ <div className=\"row\">\n+ <Button onClick={props.onSaveButtonClick}>Save</Button>\n+ <Button color=\"danger\" onClick={props.onCancelButtonClick} >Cancel</Button>\n+ </div>\n+ }\n+ </form>\n+ </div>\n+ );\n+}\n+\n+PatientForm.defaultProps = {\n+ isEditable: true,\n+ patient: {firstName: '', lastName: ''},\n+}\n+\n+export default PatientForm;\n"
},
{
"change_type": "RENAME",
"old_path": "src/components/Dashboard.tsx",
"new_path": "src/containers/Dashboard.tsx",
"diff": ""
},
{
"change_type": "RENAME",
"old_path": "src/components/HospitalRun.tsx",
"new_path": "src/containers/HospitalRun.tsx",
"diff": "@@ -2,9 +2,9 @@ import React, { Component } from 'react';\nimport { Switch, Route, withRouter, RouteComponentProps } from 'react-router-dom';\nimport { Navbar } from '@hospitalrun/components';\nimport Dashboard from './Dashboard';\n-import Patient from './Patient';\nimport Patients from './Patients';\nimport NewPatient from './NewPatient';\n+import ViewPatient from 'containers/ViewPatient';\nclass HospitalRun extends Component<RouteComponentProps, {}> {\nconstructor(props: RouteComponentProps) {\n@@ -39,7 +39,7 @@ class HospitalRun extends Component<RouteComponentProps, {}> {\n<Route exact path=\"/\" component={Dashboard} />\n<Route exact path=\"/patients\" component={Patients} />\n<Route exact path=\"/new/patient\" component={NewPatient} />\n- <Route exact path=\"/patients/:id\" component={Patient} />\n+ <Route exact path=\"/patients/:id\" component={ViewPatient} />\n</Switch>\n</div>\n</div>\n"
},
{
"change_type": "RENAME",
"old_path": "src/components/NewPatient.tsx",
"new_path": "src/containers/NewPatient.tsx",
"diff": "import React, { Component } from 'react';\nimport { withRouter, RouteComponentProps } from 'react-router-dom';\n-import { TextInput, Button } from '@hospitalrun/components';\nimport * as patientsDb from '../clients/db/patients-db';\n+import PatientForm from 'components/PatientForm';\ninterface Props extends RouteComponentProps {\n@@ -17,9 +17,9 @@ class NewPatient extends Component<Props, State> {\nconstructor(props: Props) {\nsuper(props);\n- this.onFirstNameChange = this.onFirstNameChange.bind(this)\n- this.onLastNameChange = this.onLastNameChange.bind(this);\n+ this.onFieldChange = this.onFieldChange.bind(this);\nthis.onSaveButtonClick = this.onSaveButtonClick.bind(this);\n+ this.onCancelButtonClick = this.onCancelButtonClick.bind(this);\nthis.state = {\nfirstName: '',\n@@ -28,16 +28,10 @@ class NewPatient extends Component<Props, State> {\n}\n- onFirstNameChange(event: any) {\n- this.setState({\n- firstName: event.target.value,\n- })\n- }\n-\n- onLastNameChange(event: any) {\n- this.setState({\n- lastName: event.target.value,\n- })\n+ onFieldChange(key: string, value: string) {\n+ this.setState((prevState) => {\n+ (prevState as any)[key] = value;\n+ });\n}\nasync onSaveButtonClick() {\n@@ -45,22 +39,20 @@ class NewPatient extends Component<Props, State> {\nthis.props.history.push(`/patients/${newPatient.id}`);\n}\n+ onCancelButtonClick() {\n+ this.props.history.push(`/patients`);\n+ }\n+\nrender() {\nreturn (\n<div>\n<h1>New Patient</h1>\n<div className=\"container\">\n- <form>\n- <div className=\"row\">\n- <h3>First Name:</h3>\n- <TextInput onChange={this.onFirstNameChange}/>\n- </div>\n- <div className=\"row\">\n- <h3>Last Name:</h3>\n- <TextInput onChange={this.onLastNameChange}/>\n- </div>\n- <Button onClick={this.onSaveButtonClick}>Save</Button>\n- </form>\n+ <PatientForm\n+ onFieldChange={this.onFieldChange}\n+ onSaveButtonClick={this.onSaveButtonClick}\n+ onCancelButtonClick={this.onCancelButtonClick}\n+ />\n</div>\n</div>\n);\n"
},
{
"change_type": "RENAME",
"old_path": "src/components/Patients.tsx",
"new_path": "src/containers/Patients.tsx",
"diff": ""
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/containers/ViewPatient.tsx",
"diff": "+import React, { Component } from 'react';\n+import { withRouter, RouteComponentProps } from 'react-router-dom';\n+import { Button, Alert } from '@hospitalrun/components';\n+import * as patientsDb from '../clients/db/patients-db';\n+import PatientForm from 'components/PatientForm';\n+\n+interface Props extends RouteComponentProps {\n+ patient: { firstName: string, lastName: string, id: string,}\n+}\n+\n+interface State {\n+ isEditable: boolean,\n+ showSuccess: boolean,\n+ patient: { firstName: string, lastName: string, id: string }\n+}\n+\n+class ViewPatient extends Component<Props, State> {\n+ constructor(props: Props) {\n+ super(props);\n+ this.onFieldChange = this.onFieldChange.bind(this);\n+ this.onSaveButtonClick = this.onSaveButtonClick.bind(this);\n+ this.onEditButtonClick = this.onEditButtonClick.bind(this);\n+ this.onCancelButtonClick = this.onCancelButtonClick.bind(this);\n+\n+ this.state ={\n+ showSuccess: false,\n+ isEditable: false,\n+ patient: props.patient,\n+ }\n+ }\n+\n+ async componentDidMount() {\n+ const { id } = this.props.match.params as any;\n+ const patient = await patientsDb.get(id) as any;\n+ this.setState({\n+ patient: patient\n+ })\n+ }\n+\n+ onFieldChange(key: string, value: string) {\n+ this.setState((prevState) => {\n+ (prevState.patient as any)[key] = value;\n+ });\n+ }\n+\n+ onEditButtonClick() {\n+ this.setState(prevState => ({\n+ isEditable: !prevState.isEditable\n+ }));\n+ }\n+\n+ async onSaveButtonClick() {\n+ const newPatient = (await patientsDb.saveOrUpdate(this.state.patient)) as any\n+ const patient = await patientsDb.get(newPatient.id) as any;\n+ this.setState({\n+ showSuccess: true,\n+ patient: patient,\n+ isEditable: false,\n+ })\n+ }\n+\n+ onCancelButtonClick() {\n+ this.props.history.push(`/patients`);\n+ }\n+\n+ render() {\n+ const { isEditable, patient, showSuccess } = this.state;\n+ return (\n+ <div className=\"container\">\n+ <Button onClick={this.onEditButtonClick}>Edit</Button>\n+\n+ {showSuccess &&\n+ <Alert color=\"success\" title=\"Successfully Updated\" message={`Successfully updated ${patient.firstName} ${patient.lastName}`} />\n+ }\n+\n+ <PatientForm\n+ isEditable={isEditable}\n+ onFieldChange={this.onFieldChange}\n+ onSaveButtonClick={this.onSaveButtonClick}\n+ onCancelButtonClick={this.onCancelButtonClick}\n+ patient={patient}\n+ />\n+ </div>\n+ );\n+ }\n+}\n+\n+export default withRouter(ViewPatient);\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "src/index.tsx",
"new_path": "src/index.tsx",
"diff": "-<<<<<<< HEAD\nimport React from 'react'\nimport ReactDOM from 'react-dom'\nimport './index.css'\nimport App from './App'\nimport * as serviceWorker from './serviceWorker'\n-=======\n-import React from 'react';\n-import ReactDOM from 'react-dom';\n-import './index.css';\n-import App from './App';\n-// import './client/pouchdb';\n-import * as serviceWorker from './serviceWorker';\n->>>>>>> feat(patients): add very simple create patient page\nReactDOM.render(<App />, document.getElementById('root'))\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | feat(patients) seperate containers and components, add edit/view |
288,323 | 18.11.2019 21:22:41 | 21,600 | 273b000537ca45825f7c1c71236431a74c9ad7b6 | feat(init): update to use models | [
{
"change_type": "MODIFY",
"old_path": "src/App.tsx",
"new_path": "src/App.tsx",
"diff": "import React from 'react'\n-import logo from './hospitalrun-icon-transparent.png'\n-import './App.css'\n+import { BrowserRouter } from 'react-router-dom'\n+import HospitalRun from './containers/HospitalRun'\nconst App: React.FC = () => (\n<div>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/clients/db/patients-db.ts",
"new_path": "src/clients/db/patients-db.ts",
"diff": "-import { patients } from \"../../config/pouchdb\";\n+import { patients } from '../../config/pouchdb'\n+import Patient from 'model/Patient';\n-export async function getAll() {\n- return patients.allDocs({ include_docs: true });\n+function mapRowToPatient(row: any): Patient {\n+ return new Patient(row.id, row.value.rev, row.doc.firstName, row.doc.lastName);\n+}\n+\n+function mapDocumentToPatient(document: any): Patient {\n+ return new Patient(document._id, document._rev, document.firstName, document.lastName);\n+}\n+\n+export async function getAll(): Promise<Patient[]> {\n+ const allPatients = await patients.allDocs({\n+ include_docs: true,\n+ });\n+\n+ return allPatients.rows.map(r => {\n+ const row = r as any;\n+ return mapRowToPatient(row)\n+ });\n}\nexport async function deleteDocument(document: any) {\n- return patients.remove(document);\n+ return patients.remove(document)\n}\nexport async function deleteDocumentById(id: string, revId: string) {\n- return patients.remove(id, revId);\n+ return patients.remove(id, revId)\n}\n-export async function saveOrUpdate(document: any) {\n+export async function saveOrUpdate(patient: Patient) {\ntry {\n- const existingDocument = await patients.get(document.id);\n+ // try and get a patient, if the patient is missing it will throw an error\n+ // and have a status of 404.\n+ await patients.get(patient.id)\n+ const { id, rev, ...restOfPatient} = patient;\nconst updatedDcoument = {\n- _id: existingDocument._id,\n- _rev: existingDocument._rev,\n- ...document\n- };\n- return patients.put(updatedDcoument);\n- } catch (error) {\n- if (error.status === 404) {\n- return save(document);\n+ _id: id,\n+ _rev: rev,\n+ ...restOfPatient,\n}\n+\n+ return patients.put(updatedDcoument)\n+ } catch (error) {\n+ if (error.status !== 404) {\n+ throw Error(error);\n}\n- return null;\n+ return save(patient)\n+ }\n}\n-export async function save(document: any) {\n- return patients.post(document);\n+export async function save(patient: Patient): Promise<Patient> {\n+ const newPatient = await patients.post(patient)\n+ return get(newPatient.id);\n}\n-export async function get(id: string) {\n- const document = await patients.get(id);\n- const patient = document as any;\n- return {\n- id: patient._id,\n- firstName: patient.firstName,\n- lastName: patient.lastName\n- };\n+export async function get(id: string): Promise<Patient> {\n+ const document = await patients.get(id)\n+ return mapDocumentToPatient(document as any);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/components/PatientForm.tsx",
"new_path": "src/components/PatientForm.tsx",
"diff": "-import React from \"react\";\n-import { TextInput, Button } from \"@hospitalrun/components\";\n+import React from 'react'\n+import { TextInput, Button } from '@hospitalrun/components'\ninterface Props {\n- isEditable?: boolean;\n- patient?: { firstName: string; lastName: string };\n- onFieldChange: (key: string, value: string) => void;\n- onSaveButtonClick: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n- onCancelButtonClick: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n+ isEditable?: boolean\n+ patient?: { firstName: string; lastName: string }\n+ onFieldChange: (key: string, value: string) => void\n+ onSaveButtonClick: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void\n+ onCancelButtonClick: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void\n}\nconst PatientForm: React.FC<Props> = (props: Props) => {\nconst handleChange = (event: any, fieldName: string) => {\n- const htmlInputEvent = event as React.FormEvent<HTMLInputElement>;\n- props.onFieldChange(fieldName, htmlInputEvent.currentTarget.value);\n- };\n+ const htmlInputEvent = event as React.FormEvent<HTMLInputElement>\n+ props.onFieldChange(fieldName, htmlInputEvent.currentTarget.value)\n+ }\n- const { patient, isEditable, onSaveButtonClick, onCancelButtonClick } = props;\n+ const { patient, isEditable, onSaveButtonClick, onCancelButtonClick } = props\n- let firstName = \"\";\n- let lastName = \"\";\n+ let firstName = ''\n+ let lastName = ''\nif (patient) {\n- firstName = patient.firstName;\n- lastName = patient.lastName;\n+ firstName = patient.firstName\n+ lastName = patient.lastName\n}\nreturn (\n@@ -32,7 +32,7 @@ const PatientForm: React.FC<Props> = (props: Props) => {\n<TextInput\nvalue={firstName}\ndisabled={!isEditable}\n- onChange={event => handleChange(event, \"firstName\")}\n+ onChange={(event) => handleChange(event, 'firstName')}\n/>\n</div>\n<div className=\"row\">\n@@ -40,7 +40,7 @@ const PatientForm: React.FC<Props> = (props: Props) => {\n<TextInput\nvalue={lastName}\ndisabled={!isEditable}\n- onChange={event => handleChange(event, \"lastName\")}\n+ onChange={(event) => handleChange(event, 'lastName')}\n/>\n</div>\n{isEditable && (\n@@ -53,12 +53,12 @@ const PatientForm: React.FC<Props> = (props: Props) => {\n)}\n</form>\n</div>\n- );\n-};\n+ )\n+}\nPatientForm.defaultProps = {\nisEditable: true,\n- patient: { firstName: \"\", lastName: \"\" }\n-};\n+ patient: { firstName: '', lastName: '' },\n+}\n-export default PatientForm;\n+export default PatientForm\n"
},
{
"change_type": "MODIFY",
"old_path": "src/config/pouchdb.ts",
"new_path": "src/config/pouchdb.ts",
"diff": "-import PouchDB from \"pouchdb\";\n+import PouchDB from 'pouchdb'\n-export const patients = new PouchDB(\"patients\");\n+export const patients = new PouchDB('patients')\n"
},
{
"change_type": "MODIFY",
"old_path": "src/containers/Dashboard.tsx",
"new_path": "src/containers/Dashboard.tsx",
"diff": "-import React from \"react\";\n+import React from 'react'\n-const Dashboard: React.FC = () => <h1>Hello Dashboard</h1>;\n+const Dashboard: React.FC = () => <h1>Hello Dashboard</h1>\n-export default Dashboard;\n+export default Dashboard\n"
},
{
"change_type": "MODIFY",
"old_path": "src/containers/HospitalRun.tsx",
"new_path": "src/containers/HospitalRun.tsx",
"diff": "-import React, { Component } from \"react\";\n-import { Switch, Route, withRouter, RouteComponentProps } from \"react-router-dom\";\n-import { Navbar } from \"@hospitalrun/components\";\n-import ViewPatient from \"./ViewPatient\";\n-import Dashboard from \"./Dashboard\";\n-import Patients from \"./Patients\";\n-import NewPatient from \"./NewPatient\";\n+import React, { Component } from 'react'\n+import { Switch, Route, withRouter, RouteComponentProps } from 'react-router-dom'\n+import { Navbar } from '@hospitalrun/components'\n+import ViewPatient from './ViewPatient'\n+import Dashboard from './Dashboard'\n+import Patients from './Patients'\n+import NewPatient from './NewPatient'\nclass HospitalRun extends Component<RouteComponentProps, {}> {\nnavigate(route: string) {\n- const { history } = this.props;\n- history.push(route);\n+ const { history } = this.props\n+ history.push(route)\n}\nrender() {\n@@ -17,23 +17,23 @@ class HospitalRun extends Component<RouteComponentProps, {}> {\n<div>\n<Navbar\nbrand={{\n- label: \"HospitalRun\",\n+ label: 'HospitalRun',\nonClick: () => {\n- this.navigate(\"/\");\n- }\n+ this.navigate('/')\n+ },\n}}\nbg=\"light\"\nvariant=\"light\"\n- onSeachButtonClick={() => console.log(\"hello\")}\n- onSearchTextBoxChange={() => console.log(\"hello\")}\n+ onSeachButtonClick={() => console.log('hello')}\n+ onSearchTextBoxChange={() => console.log('hello')}\nnavLinks={[\n{\n- label: \"Patients\",\n+ label: 'Patients',\nonClick: () => {\n- this.navigate(\"/patients\");\n+ this.navigate('/patients')\n+ },\n+ children: [],\n},\n- children: []\n- }\n]}\n/>\n<div>\n@@ -45,8 +45,8 @@ class HospitalRun extends Component<RouteComponentProps, {}> {\n</Switch>\n</div>\n</div>\n- );\n+ )\n}\n}\n-export default withRouter(HospitalRun);\n+export default withRouter(HospitalRun)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/containers/NewPatient.tsx",
"new_path": "src/containers/NewPatient.tsx",
"diff": "-import React, { Component } from \"react\";\n-import { withRouter, RouteComponentProps } from \"react-router-dom\";\n-import PatientForm from \"../components/PatientForm\";\n-import * as patientsDb from \"../clients/db/patients-db\";\n+import React, { Component } from 'react'\n+import { withRouter, RouteComponentProps } from 'react-router-dom'\n+import PatientForm from '../components/PatientForm'\n+import * as patientsDb from '../clients/db/patients-db'\n+import Patient from 'model/Patient'\ninterface Props extends RouteComponentProps {}\ninterface State {\n- firstName: string;\n- lastName: string;\n+ firstName: string\n+ lastName: string\n}\nclass NewPatient extends Component<Props, State> {\nconstructor(props: Props) {\n- super(props);\n- this.onFieldChange = this.onFieldChange.bind(this);\n- this.onSaveButtonClick = this.onSaveButtonClick.bind(this);\n- this.onCancelButtonClick = this.onCancelButtonClick.bind(this);\n+ super(props)\n+ this.onFieldChange = this.onFieldChange.bind(this)\n+ this.onSaveButtonClick = this.onSaveButtonClick.bind(this)\n+ this.onCancelButtonClick = this.onCancelButtonClick.bind(this)\nthis.state = {\n- firstName: \"\",\n- lastName: \"\"\n- };\n+ firstName: '',\n+ lastName: '',\n+ }\n}\nonFieldChange(key: string, value: string) {\n- this.setState(prevState => {\n- (prevState as any)[key] = value;\n- });\n+ this.setState((prevState) => {\n+ (prevState as any)[key] = value\n+ })\n}\nasync onSaveButtonClick() {\n- const { history } = this.props;\n- const newPatient = (await patientsDb.save(this.state)) as any;\n- history.push(`/patients/${newPatient.id}`);\n+ const { history } = this.props\n+ const createdPatient = await patientsDb.save(this.state as Patient)\n+ history.push(`/patients/${createdPatient.id}`)\n}\nonCancelButtonClick() {\n- const { history } = this.props;\n- history.push(`/patients`);\n+ const { history } = this.props\n+ history.push(`/patients`)\n}\nrender() {\n@@ -52,8 +53,8 @@ class NewPatient extends Component<Props, State> {\n/>\n</div>\n</div>\n- );\n+ )\n}\n}\n-export default withRouter(NewPatient);\n+export default withRouter(NewPatient)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/containers/Patients.tsx",
"new_path": "src/containers/Patients.tsx",
"diff": "-import React, { Component } from \"react\";\n-import { Link } from \"react-router-dom\";\n-import * as patientsDb from \"../clients/db/patients-db\";\n+import React, { Component } from 'react'\n+import { Link } from 'react-router-dom'\n+import * as patientsDb from '../clients/db/patients-db'\n+import Patient from 'model/Patient'\ninterface Props {}\ninterface State {\n- patients: any[];\n+ patients: Patient[]\n}\nclass Patients extends Component<Props, State> {\nconstructor(props: Props) {\n- super(props);\n+ super(props)\nthis.state = {\n- patients: []\n- };\n+ patients: [],\n+ }\n}\nasync componentDidMount() {\n- const patients = await patientsDb.getAll();\n+ const patients = await patientsDb.getAll()\nthis.setState({\n- patients: patients.rows\n- });\n+ patients: patients,\n+ })\n}\nrender() {\n- const { patients } = this.state;\n+ const { patients } = this.state\nconst list = (\n<ul>\n- {patients.map(patient => (\n- <Link to={`/patients/${patient.id}`}>\n- <li key={patient.id}>\n- {patient.doc.firstName} {patient.doc.lastName}\n+ {patients.map((p) => (\n+ <Link to={`/patients/${p.id}`}>\n+ <li key={p.id}>\n+ {p.firstName} {p.lastName}\n</li>\n</Link>\n))}\n</ul>\n- );\n+ )\nreturn (\n<div>\n@@ -44,8 +45,8 @@ class Patients extends Component<Props, State> {\n<ul>{list}</ul>\n</div>\n</div>\n- );\n+ )\n}\n}\n-export default Patients;\n+export default Patients\n"
},
{
"change_type": "MODIFY",
"old_path": "src/containers/ViewPatient.tsx",
"new_path": "src/containers/ViewPatient.tsx",
"diff": "-import React, { Component } from \"react\";\n-import { withRouter, RouteComponentProps } from \"react-router-dom\";\n-import { Button, Alert } from \"@hospitalrun/components\";\n-import PatientForm from \"../components/PatientForm\";\n-import * as patientsDb from \"../clients/db/patients-db\";\n+import React, { Component } from 'react'\n+import { withRouter, RouteComponentProps } from 'react-router-dom'\n+import { Button, Alert } from '@hospitalrun/components'\n+import PatientForm from '../components/PatientForm'\n+import * as patientsDb from '../clients/db/patients-db'\n+import Patient from 'model/Patient'\ninterface Props extends RouteComponentProps {\n- patient: { firstName: string; lastName: string; id: string };\n+ patient: Patient\n}\ninterface State {\n- isEditable: boolean;\n- showSuccess: boolean;\n- patient: { firstName: string; lastName: string; id: string };\n+ isEditable: boolean\n+ showSuccess: boolean\n+ patient: Patient\n}\nclass ViewPatient extends Component<Props, State> {\nconstructor(props: Props) {\n- super(props);\n- this.onFieldChange = this.onFieldChange.bind(this);\n- this.onSaveButtonClick = this.onSaveButtonClick.bind(this);\n- this.onEditButtonClick = this.onEditButtonClick.bind(this);\n- this.onCancelButtonClick = this.onCancelButtonClick.bind(this);\n+ super(props)\n+ this.onFieldChange = this.onFieldChange.bind(this)\n+ this.onSaveButtonClick = this.onSaveButtonClick.bind(this)\n+ this.onEditButtonClick = this.onEditButtonClick.bind(this)\n+ this.onCancelButtonClick = this.onCancelButtonClick.bind(this)\nthis.state = {\nshowSuccess: false,\nisEditable: false,\n- patient: props.patient\n- };\n+ patient: props.patient,\n+ }\n}\nasync componentDidMount() {\n- const { match } = this.props;\n- let { patient } = this.state;\n-\n- const { id } = match.params as any;\n- patient = (await patientsDb.get(id)) as any;\n+ const { match } = this.props\n+ const { id } = match.params as any\n+ const patient = await patientsDb.get(id);\nthis.setState({\n- patient\n- });\n+ patient,\n+ })\n}\nonFieldChange(key: string, value: string) {\n- this.setState(prevState => {\n- (prevState.patient as any)[key] = value;\n- });\n+ this.setState((prevState) => {\n+ (prevState.patient as any)[key] = value\n+ })\n}\nonEditButtonClick() {\n- this.setState(prevState => ({\n- isEditable: !prevState.isEditable\n- }));\n+ this.setState((prevState) => ({\n+ isEditable: !prevState.isEditable,\n+ }))\n}\nasync onSaveButtonClick() {\n- let { patient } = this.state;\n- const newPatient = (await patientsDb.saveOrUpdate(patient)) as any;\n- patient = (await patientsDb.get(newPatient.id)) as any;\n+ let { patient } = this.state\n+ const newPatient = (await patientsDb.saveOrUpdate(patient)) as any\n+ patient = (await patientsDb.get(newPatient.id)) as any\nthis.setState({\nshowSuccess: true,\npatient,\n- isEditable: false\n- });\n+ isEditable: false,\n+ })\n}\nonCancelButtonClick() {\n- const { history } = this.props;\n- history.push(`/patients`);\n+ const { history } = this.props\n+ history.push(`/patients`)\n}\nrender() {\n- const { isEditable, patient, showSuccess } = this.state;\n+ const { isEditable, patient, showSuccess } = this.state\nreturn (\n<div className=\"container\">\n<Button onClick={this.onEditButtonClick}>Edit</Button>\n@@ -90,8 +89,8 @@ class ViewPatient extends Component<Props, State> {\npatient={patient}\n/>\n</div>\n- );\n+ )\n}\n}\n-export default withRouter(ViewPatient);\n+export default withRouter(ViewPatient)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/index.tsx",
"new_path": "src/index.tsx",
"diff": "import React from 'react'\nimport ReactDOM from 'react-dom'\n-import './index.css'\n+import 'bootstrap/dist/css/bootstrap.min.css'\nimport App from './App'\nimport * as serviceWorker from './serviceWorker'\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/model/AbstractDBModel.ts",
"diff": "+class AbstractDBModel {\n+ id: string;\n+ rev: string;\n+\n+ constructor(id: string, rev: string) {\n+ this.id = id;\n+ this.rev = rev;\n+ }\n+}\n+\n+export default AbstractDBModel;\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/model/Patient.ts",
"diff": "+import AbstractDBModel from './AbstractDBModel';\n+\n+export default class Patient extends AbstractDBModel {\n+ firstName: string;\n+ lastName: string;\n+\n+ constructor(id: string, rev: string, firstName: string, lastName: string) {\n+ super(id, rev);\n+ this.firstName = firstName;\n+ this.lastName = lastName;\n+ }\n+}\n\\ No newline at end of file\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | feat(init): update to use models |
288,323 | 19.11.2019 00:37:19 | 21,600 | 183d65cc837e2fb8539564dbf06c474b242cf611 | feat(init): add redux | [
{
"change_type": "MODIFY",
"old_path": ".eslintrc.js",
"new_path": ".eslintrc.js",
"diff": "@@ -44,6 +44,8 @@ module.exports = {\n'arrow-body-style': ['warn', 'as-needed'],\n'no-param-reassign': ['error', { props: false }],\n'import/prefer-default-export': 'off',\n+ 'import/no-extraneous-dependencies': 'off',\n+ 'import/no-unresolved': 'off',\n'no-console': 'off',\n'eol-last': ['error', 'always'],\n'no-debugger': 'error',\n"
},
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"private\": false,\n\"license\": \"MIT\",\n\"dependencies\": {\n+ \"@reduxjs/toolkit\": \"^1.0.4\",\n\"@semantic-release/changelog\": \"~3.0.4\",\n\"@semantic-release/git\": \"~7.0.16\",\n\"@semantic-release/release-notes-generator\": \"~7.3.0\",\n+ \"@types/react-redux\": \"^7.1.5\",\n+ \"@types/redux-logger\": \"^3.0.7\",\n\"bootstrap\": \"^4.3.1\",\n\"pouchdb\": \"~7.1.1\",\n\"react\": \"~16.10.2\",\n\"react-router-dom\": \"~5.1.2\",\n\"react-scripts\": \"~3.2.0\",\n\"redux\": \"^4.0.4\",\n+ \"redux-logger\": \"^3.0.6\",\n+ \"redux-thunk\": \"^2.3.0\",\n\"typescript\": \"~3.6.3\"\n},\n\"repository\": {\n"
},
{
"change_type": "MODIFY",
"old_path": "src/App.tsx",
"new_path": "src/App.tsx",
"diff": "import React from 'react'\nimport { BrowserRouter } from 'react-router-dom'\n+import { Provider } from 'react-redux'\nimport HospitalRun from './containers/HospitalRun'\n+import store from './store/store'\n+\nconst App: React.FC = () => (\n<div>\n+ <Provider store={store}>\n<BrowserRouter>\n<HospitalRun />\n</BrowserRouter>\n+ </Provider>\n</div>\n)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/clients/db/patients-db.ts",
"new_path": "src/clients/db/patients-db.ts",
"diff": "+/* eslint-disable no-underscore-dangle, @typescript-eslint/camelcase */\n+import Patient from '../../model/Patient'\nimport { patients } from '../../config/pouchdb'\n-import Patient from 'model/Patient';\nfunction mapRowToPatient(row: any): Patient {\n- return new Patient(row.id, row.value.rev, row.doc.firstName, row.doc.lastName);\n+ return new Patient(row.id, row.value.rev, row.doc.firstName, row.doc.lastName)\n}\nfunction mapDocumentToPatient(document: any): Patient {\n- return new Patient(document._id, document._rev, document.firstName, document.lastName);\n+ return new Patient(document._id, document._rev, document.firstName, document.lastName)\n+}\n+\n+export async function get(id: string): Promise<Patient> {\n+ const document = await patients.get(id)\n+ return mapDocumentToPatient(document as any)\n}\nexport async function getAll(): Promise<Patient[]> {\nconst allPatients = await patients.allDocs({\ninclude_docs: true,\n- });\n+ })\n- return allPatients.rows.map(r => {\n- const row = r as any;\n+ return allPatients.rows.map((r) => {\n+ const row = r as any\nreturn mapRowToPatient(row)\n- });\n-}\n-\n-export async function deleteDocument(document: any) {\n- return patients.remove(document)\n+ })\n}\n-export async function deleteDocumentById(id: string, revId: string) {\n- return patients.remove(id, revId)\n+export async function save(patient: Patient): Promise<Patient> {\n+ const newPatient = await patients.post(patient)\n+ return get(newPatient.id)\n}\nexport async function saveOrUpdate(patient: Patient) {\n@@ -33,29 +36,28 @@ export async function saveOrUpdate(patient: Patient) {\n// try and get a patient, if the patient is missing it will throw an error\n// and have a status of 404.\nawait patients.get(patient.id)\n- const { id, rev, ...restOfPatient} = patient;\n+ const { id, rev, ...restOfPatient } = patient\nconst updatedDcoument = {\n_id: id,\n_rev: rev,\n...restOfPatient,\n}\n- return patients.put(updatedDcoument)\n+ await patients.put(updatedDcoument)\n+ return get(patient.id)\n} catch (error) {\nif (error.status !== 404) {\n- throw Error(error);\n+ throw Error(error)\n}\nreturn save(patient)\n}\n}\n-export async function save(patient: Patient): Promise<Patient> {\n- const newPatient = await patients.post(patient)\n- return get(newPatient.id);\n+export async function deleteDocument(document: any) {\n+ return patients.remove(document)\n}\n-export async function get(id: string): Promise<Patient> {\n- const document = await patients.get(id)\n- return mapDocumentToPatient(document as any);\n+export async function deleteDocumentById(id: string, revId: string) {\n+ return patients.remove(id, revId)\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/containers/NewPatient.tsx",
"new_path": "src/containers/NewPatient.tsx",
"diff": "-import React, { Component } from 'react'\n-import { withRouter, RouteComponentProps } from 'react-router-dom'\n+import React from 'react'\n+import { withRouter, RouteComponentProps, Redirect } from 'react-router-dom'\n+import { useDispatch, useSelector } from 'react-redux'\n+import { createPatient } from '../slices/patient-slice'\n+import { RootState } from '../store/store'\nimport PatientForm from '../components/PatientForm'\n-import * as patientsDb from '../clients/db/patients-db'\n-import Patient from 'model/Patient'\n-interface Props extends RouteComponentProps {}\n+const NewPatient = (props: RouteComponentProps) => {\n+ const dispatch = useDispatch()\n+ const { patient, isCreated } = useSelector((state: RootState) => state.patient)\n-interface State {\n- firstName: string\n- lastName: string\n+ const onSaveButtonClick = async () => {\n+ dispatch(createPatient(patient))\n}\n-class NewPatient extends Component<Props, State> {\n- constructor(props: Props) {\n- super(props)\n- this.onFieldChange = this.onFieldChange.bind(this)\n- this.onSaveButtonClick = this.onSaveButtonClick.bind(this)\n- this.onCancelButtonClick = this.onCancelButtonClick.bind(this)\n-\n- this.state = {\n- firstName: '',\n- lastName: '',\n- }\n- }\n-\n- onFieldChange(key: string, value: string) {\n- this.setState((prevState) => {\n- (prevState as any)[key] = value\n- })\n+ const onCancelButtonClick = () => {\n+ const { history } = props\n+ history.push(`/patients`)\n}\n- async onSaveButtonClick() {\n- const { history } = this.props\n- const createdPatient = await patientsDb.save(this.state as Patient)\n- history.push(`/patients/${createdPatient.id}`)\n+ const onFieldChange = (key: string, value: string) => {\n+ ;(patient as any)[key] = value\n}\n- onCancelButtonClick() {\n- const { history } = this.props\n- history.push(`/patients`)\n+ if (isCreated) {\n+ return <Redirect to={`/patients/${patient.id}`} />\n}\n- render() {\nreturn (\n<div>\n<h1>New Patient</h1>\n<div className=\"container\">\n<PatientForm\n- onFieldChange={this.onFieldChange}\n- onSaveButtonClick={this.onSaveButtonClick}\n- onCancelButtonClick={this.onCancelButtonClick}\n+ onFieldChange={onFieldChange}\n+ onSaveButtonClick={onSaveButtonClick}\n+ onCancelButtonClick={onCancelButtonClick}\n/>\n</div>\n</div>\n)\n}\n-}\nexport default withRouter(NewPatient)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/containers/Patients.tsx",
"new_path": "src/containers/Patients.tsx",
"diff": "-import React, { Component } from 'react'\n+import React, { useEffect } from 'react'\n+import { useSelector, useDispatch } from 'react-redux'\nimport { Link } from 'react-router-dom'\n-import * as patientsDb from '../clients/db/patients-db'\n-import Patient from 'model/Patient'\n+import { RootState } from '../store/store'\n+import { fetchPatients } from '../slices/patients-slice'\n-interface Props {}\n+const Patients = () => {\n+ const dispatch = useDispatch()\n+ const { patients, isLoading } = useSelector((state: RootState) => state.patients)\n-interface State {\n- patients: Patient[]\n-}\n+ useEffect(() => {\n+ dispatch(fetchPatients())\n+ }, [dispatch])\n-class Patients extends Component<Props, State> {\n- constructor(props: Props) {\n- super(props)\n- this.state = {\n- patients: [],\n- }\n+ if (isLoading) {\n+ return <h3>Loading...</h3>\n}\n- async componentDidMount() {\n- const patients = await patientsDb.getAll()\n- this.setState({\n- patients: patients,\n- })\n- }\n-\n- render() {\n- const { patients } = this.state\nconst list = (\n<ul>\n{patients.map((p) => (\n@@ -47,6 +37,5 @@ class Patients extends Component<Props, State> {\n</div>\n)\n}\n-}\nexport default Patients\n"
},
{
"change_type": "MODIFY",
"old_path": "src/containers/ViewPatient.tsx",
"new_path": "src/containers/ViewPatient.tsx",
"diff": "-import React, { Component } from 'react'\n+import React, { useState, useEffect } from 'react'\n+import { useDispatch, useSelector } from 'react-redux'\nimport { withRouter, RouteComponentProps } from 'react-router-dom'\nimport { Button, Alert } from '@hospitalrun/components'\n+import { fetchPatient, updatePatient } from '../slices/patient-slice'\n+import { RootState } from '../store/store'\n+import Patient from '../model/Patient'\nimport PatientForm from '../components/PatientForm'\n-import * as patientsDb from '../clients/db/patients-db'\n-import Patient from 'model/Patient'\ninterface Props extends RouteComponentProps {\npatient: Patient\n}\n-interface State {\n- isEditable: boolean\n- showSuccess: boolean\n- patient: Patient\n-}\n-\n-class ViewPatient extends Component<Props, State> {\n- constructor(props: Props) {\n- super(props)\n- this.onFieldChange = this.onFieldChange.bind(this)\n- this.onSaveButtonClick = this.onSaveButtonClick.bind(this)\n- this.onEditButtonClick = this.onEditButtonClick.bind(this)\n- this.onCancelButtonClick = this.onCancelButtonClick.bind(this)\n+const ViewPatient = (props: Props) => {\n+ const { match } = props\n+ const { id } = match.params as any\n+ const dispatch = useDispatch()\n+ const [isEditable, setIsEditable] = useState(false)\n+ const { patient, isLoading, isUpdated } = useSelector((state: RootState) => state.patient)\n- this.state = {\n- showSuccess: false,\n- isEditable: false,\n- patient: props.patient,\n- }\n+ const onSaveButtonClick = async () => {\n+ dispatch(updatePatient(patient))\n+ setIsEditable(false)\n}\n- async componentDidMount() {\n- const { match } = this.props\n- const { id } = match.params as any\n- const patient = await patientsDb.get(id);\n- this.setState({\n- patient,\n- })\n+ const onCancelButtonClick = () => {\n+ const { history } = props\n+ history.push(`/patients`)\n}\n- onFieldChange(key: string, value: string) {\n- this.setState((prevState) => {\n- (prevState.patient as any)[key] = value\n- })\n+ const onEditButtonClick = () => {\n+ setIsEditable(true)\n}\n- onEditButtonClick() {\n- this.setState((prevState) => ({\n- isEditable: !prevState.isEditable,\n- }))\n+ const onFieldChange = (key: string, value: string) => {\n+ ;(patient as any)[key] = value\n}\n- async onSaveButtonClick() {\n- let { patient } = this.state\n- const newPatient = (await patientsDb.saveOrUpdate(patient)) as any\n- patient = (await patientsDb.get(newPatient.id)) as any\n- this.setState({\n- showSuccess: true,\n- patient,\n- isEditable: false,\n- })\n- }\n+ useEffect(() => {\n+ dispatch(fetchPatient(id))\n+ }, [dispatch, id])\n- onCancelButtonClick() {\n- const { history } = this.props\n- history.push(`/patients`)\n+ if (isLoading) {\n+ return <h3>Loading...</h3>\n}\n- render() {\n- const { isEditable, patient, showSuccess } = this.state\nreturn (\n<div className=\"container\">\n- <Button onClick={this.onEditButtonClick}>Edit</Button>\n+ <Button onClick={onEditButtonClick}>Edit</Button>\n- {showSuccess && (\n+ {isUpdated && (\n<Alert\ncolor=\"success\"\ntitle=\"Successfully Updated\"\n@@ -83,14 +58,13 @@ class ViewPatient extends Component<Props, State> {\n<PatientForm\nisEditable={isEditable}\n- onFieldChange={this.onFieldChange}\n- onSaveButtonClick={this.onSaveButtonClick}\n- onCancelButtonClick={this.onCancelButtonClick}\n+ onFieldChange={onFieldChange}\n+ onSaveButtonClick={onSaveButtonClick}\n+ onCancelButtonClick={onCancelButtonClick}\npatient={patient}\n/>\n</div>\n)\n}\n-}\nexport default withRouter(ViewPatient)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/model/AbstractDBModel.ts",
"new_path": "src/model/AbstractDBModel.ts",
"diff": "class AbstractDBModel {\n- id: string;\n- rev: string;\n+ id: string\n+\n+ rev: string\nconstructor(id: string, rev: string) {\n- this.id = id;\n- this.rev = rev;\n+ this.id = id\n+ this.rev = rev\n}\n}\n-export default AbstractDBModel;\n\\ No newline at end of file\n+export default AbstractDBModel\n"
},
{
"change_type": "MODIFY",
"old_path": "src/model/Patient.ts",
"new_path": "src/model/Patient.ts",
"diff": "-import AbstractDBModel from './AbstractDBModel';\n+import AbstractDBModel from './AbstractDBModel'\nexport default class Patient extends AbstractDBModel {\n- firstName: string;\n- lastName: string;\n+ firstName: string\n+\n+ lastName: string\nconstructor(id: string, rev: string, firstName: string, lastName: string) {\n- super(id, rev);\n- this.firstName = firstName;\n- this.lastName = lastName;\n+ super(id, rev)\n+ this.firstName = firstName\n+ this.lastName = lastName\n}\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/slices/patient-slice.ts",
"diff": "+import { createSlice, PayloadAction } from '@reduxjs/toolkit'\n+import Patient from '../model/Patient'\n+import * as patientsDb from '../clients/db/patients-db'\n+import { AppThunk } from '../store/store'\n+\n+interface PatientState {\n+ isLoading: boolean\n+ isUpdated: boolean\n+ isCreated: boolean\n+ patient: Patient\n+}\n+\n+const initialState: PatientState = {\n+ isLoading: false,\n+ isUpdated: false,\n+ isCreated: false,\n+ patient: new Patient('', '', '', ''),\n+}\n+\n+function startLoading(state: PatientState) {\n+ state.isLoading = true\n+}\n+\n+const patientSlice = createSlice({\n+ name: 'patient',\n+ initialState,\n+ reducers: {\n+ getPatientStart: startLoading,\n+ getPatientSuccess(state, { payload }: PayloadAction<Patient>) {\n+ state.isLoading = false\n+ state.patient = payload\n+ },\n+ createPatientSuccess(state, { payload }: PayloadAction<Patient>) {\n+ state.isCreated = true\n+ state.patient = payload\n+ },\n+ updateStart: startLoading,\n+ updatePatientSuccess(state, { payload }: PayloadAction<Patient>) {\n+ state.isUpdated = true\n+ state.isLoading = false\n+ state.patient = payload\n+ },\n+ },\n+})\n+\n+export const {\n+ getPatientStart,\n+ getPatientSuccess,\n+ updateStart,\n+ updatePatientSuccess,\n+ createPatientSuccess,\n+} = patientSlice.actions\n+\n+export const fetchPatient = (id: string): AppThunk => async (dispatch) => {\n+ try {\n+ dispatch(getPatientStart())\n+ const patient = await patientsDb.get(id)\n+ dispatch(getPatientSuccess(patient))\n+ } catch (error) {\n+ console.log(error)\n+ }\n+}\n+\n+export const updatePatient = (patient: Patient): AppThunk => async (dispatch) => {\n+ try {\n+ const updatedPatient = await patientsDb.saveOrUpdate(patient)\n+ dispatch(updatePatientSuccess(updatedPatient))\n+ } catch (error) {\n+ console.log(error)\n+ }\n+}\n+\n+export const createPatient = (patient: Patient): AppThunk => async (dispatch) => {\n+ try {\n+ const newPatient = await patientsDb.save(patient)\n+ dispatch(createPatientSuccess(newPatient))\n+ } catch (error) {\n+ console.log(error)\n+ }\n+}\n+\n+export default patientSlice.reducer\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/slices/patients-slice.ts",
"diff": "+import { createSlice, PayloadAction } from '@reduxjs/toolkit'\n+import Patient from '../model/Patient'\n+import * as patientsDb from '../clients/db/patients-db'\n+import { AppThunk } from '../store/store'\n+\n+interface PatientsState {\n+ isLoading: boolean\n+ patients: Patient[]\n+}\n+\n+const initialState: PatientsState = {\n+ isLoading: false,\n+ patients: [],\n+}\n+\n+function startLoading(state: PatientsState) {\n+ state.isLoading = true\n+}\n+\n+const patientsSlice = createSlice({\n+ name: 'patients',\n+ initialState,\n+ reducers: {\n+ getPatientsStart: startLoading,\n+ getAllPatientsSuccess(state, { payload }: PayloadAction<Patient[]>) {\n+ state.isLoading = false\n+ state.patients = payload\n+ },\n+ },\n+})\n+\n+export const { getPatientsStart, getAllPatientsSuccess } = patientsSlice.actions\n+\n+export const fetchPatients = (): AppThunk => async (dispatch) => {\n+ try {\n+ dispatch(getPatientsStart())\n+ const patients = await patientsDb.getAll()\n+ dispatch(getAllPatientsSuccess(patients))\n+ } catch (error) {\n+ console.log(error)\n+ }\n+}\n+\n+export default patientsSlice.reducer\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/store/store.ts",
"diff": "+import { configureStore, combineReducers, Action } from '@reduxjs/toolkit'\n+import ReduxThunk, { ThunkAction } from 'redux-thunk'\n+import { createLogger } from 'redux-logger'\n+\n+import patient from '../slices/patient-slice'\n+import patients from '../slices/patients-slice'\n+\n+const reducer = combineReducers({\n+ patient,\n+ patients,\n+})\n+\n+const store = configureStore({\n+ reducer,\n+ middleware: [ReduxThunk, createLogger()],\n+})\n+\n+export type AppDispatch = typeof store.dispatch\n+export type AppThunk = ThunkAction<void, RootState, null, Action<string>>\n+export type RootState = ReturnType<typeof reducer>\n+\n+export default store\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | feat(init): add redux |
288,297 | 19.11.2019 17:56:57 | -3,600 | fbc748e22494122053e2683e30ab79d1c66b18d2 | chore(deps): updates deps to match components repository | [
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"private\": false,\n\"license\": \"MIT\",\n\"dependencies\": {\n- \"@reduxjs/toolkit\": \"^1.0.4\",\n+ \"@reduxjs/toolkit\": \"~1.0.4\",\n\"@semantic-release/changelog\": \"~3.0.4\",\n\"@semantic-release/git\": \"~7.0.16\",\n\"@semantic-release/release-notes-generator\": \"~7.3.0\",\n- \"@types/react-redux\": \"^7.1.5\",\n- \"@types/redux-logger\": \"^3.0.7\",\n- \"bootstrap\": \"^4.3.1\",\n+ \"@types/react-redux\": \"~7.1.5\",\n+ \"@types/redux-logger\": \"~3.0.7\",\n+ \"bootstrap\": \"~4.3.1\",\n\"pouchdb\": \"~7.1.1\",\n- \"react\": \"~16.10.2\",\n- \"react-dom\": \"~16.10.2\",\n- \"react-redux\": \"^7.1.3\",\n+ \"react\": \"~16.12.0\",\n+ \"react-dom\": \"~16.12.0\",\n+ \"react-redux\": \"~7.1.3\",\n\"react-router\": \"~5.1.2\",\n\"react-router-dom\": \"~5.1.2\",\n\"react-scripts\": \"~3.2.0\",\n- \"redux\": \"^4.0.4\",\n- \"redux-logger\": \"^3.0.6\",\n- \"redux-thunk\": \"^2.3.0\",\n+ \"redux\": \"~4.0.4\",\n+ \"redux-logger\": \"~3.0.6\",\n+ \"redux-thunk\": \"~2.3.0\",\n\"typescript\": \"~3.6.3\"\n},\n\"repository\": {\n\"Stefano Casasola\"\n],\n\"devDependencies\": {\n- \"@commitlint/cli\": \"^8.2.0\",\n- \"@commitlint/config-conventional\": \"^8.2.0\",\n+ \"@commitlint/cli\": \"~8.2.0\",\n+ \"@commitlint/config-conventional\": \"~8.2.0\",\n\"@commitlint/core\": \"~8.2.0\",\n- \"@commitlint/prompt\": \"^8.2.0\",\n+ \"@commitlint/prompt\": \"~8.2.0\",\n\"@semantic-release/changelog\": \"~3.0.4\",\n- \"@semantic-release/commit-analyzer\": \"^6.3.0\",\n+ \"@semantic-release/commit-analyzer\": \"~6.3.0\",\n\"@semantic-release/git\": \"~7.0.16\",\n- \"@semantic-release/github\": \"^5.4.3\",\n+ \"@semantic-release/github\": \"~5.4.3\",\n\"@semantic-release/release-notes-generator\": \"~7.3.0\",\n\"@types/jest\": \"~24.0.18\",\n\"@types/node\": \"~12.7.8\",\n\"@types/react-router-dom\": \"~5.1.0\",\n\"@typescript-eslint/eslint-plugin\": \"~2.4.0\",\n\"@typescript-eslint/parser\": \"~2.4.0\",\n- \"commitizen\": \"^4.0.3\",\n- \"commitlint-config-cz\": \"^0.12.1\",\n+ \"commitizen\": \"~4.0.3\",\n+ \"commitlint-config-cz\": \"~0.12.1\",\n\"cross-env\": \"~6.0.3\",\n- \"cz-conventional-changelog\": \"^3.0.2\",\n+ \"cz-conventional-changelog\": \"~3.0.2\",\n\"dateformat\": \"~3.0.3\",\n- \"eslint\": \"^6.6.0\",\n- \"eslint-config-airbnb\": \"^18.0.1\",\n- \"eslint-config-prettier\": \"^6.5.0\",\n- \"eslint-plugin-import\": \"^2.18.2\",\n- \"eslint-plugin-jest\": \"^23.0.2\",\n- \"eslint-plugin-jsx-a11y\": \"^6.2.3\",\n- \"eslint-plugin-prettier\": \"^3.1.1\",\n- \"eslint-plugin-react\": \"^7.16.0\",\n- \"eslint-plugin-react-hooks\": \"^2.2.0\",\n- \"husky\": \"^3.0.5\",\n- \"lint-staged\": \"~9.4.3\",\n- \"jest\": \"^24.9.0\",\n- \"prettier\": \"~1.19.1\",\n- \"semantic-release\": \"^15.13.24\"\n+ \"eslint\": \"~6.6.0\",\n+ \"eslint-config-airbnb\": \"~18.0.1\",\n+ \"eslint-config-prettier\": \"~6.5.0\",\n+ \"eslint-plugin-import\": \"~2.18.2\",\n+ \"eslint-plugin-jest\": \"~23.0.2\",\n+ \"eslint-plugin-jsx-a11y\": \"~6.2.3\",\n+ \"eslint-plugin-prettier\": \"~3.1.1\",\n+ \"eslint-plugin-react\": \"~7.16.0\",\n+ \"eslint-plugin-react-hooks\": \"~2.2.0\",\n+ \"husky\": \"~3.0.5\",\n+ \"jest\": \"~24.9.0\",\n+ \"prettier\": \"~1.18.2\",\n+ \"semantic-release\": \"~15.13.24\"\n},\n\"scripts\": {\n\"commit\": \"npx git-cz\",\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | chore(deps): updates deps to match components repository |
288,297 | 19.11.2019 19:40:00 | -3,600 | d8e7a55b51170ca4484bcc252d7b5177c2a0172d | feat(db): adds remote couchdb | [
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "},\n\"husky\": {\n\"hooks\": {\n- \"commit-msg\": \"commitlint -E HUSKY_GIT_PARAMS\",\n- \"pre-commit\": \"lint-staged\"\n+ \"commit-msg\": \"commitlint -E HUSKY_GIT_PARAMS\"\n}\n},\n\"config\": {\n"
},
{
"change_type": "MODIFY",
"old_path": "src/config/pouchdb.ts",
"new_path": "src/config/pouchdb.ts",
"diff": "import PouchDB from 'pouchdb'\nexport const patients = new PouchDB('patients')\n+PouchDB.sync(\n+ 'patients',\n+ 'https://a27fa3db-db4d-4456-8465-da953aee0f5b-bluemix:cd6f332d39f24d2b7cfc89d82f6836d46012ef3188698319b0d5fff177cb2ddc@a27fa3db-db4d-4456-8465-da953aee0f5b-bluemix.cloudantnosqldb.appdomain.cloud/patients',\n+ {\n+ live: true,\n+ retry: true,\n+ },\n+).on('change', (info) => {\n+ // handle change\n+ console.log(info)\n+})\n"
},
{
"change_type": "MODIFY",
"old_path": "src/containers/HospitalRun.tsx",
"new_path": "src/containers/HospitalRun.tsx",
"diff": "@@ -29,10 +29,21 @@ class HospitalRun extends Component<RouteComponentProps, {}> {\nnavLinks={[\n{\nlabel: 'Patients',\n+ onClick: () => {},\n+ children: [\n+ {\n+ label: 'List',\nonClick: () => {\nthis.navigate('/patients')\n},\n- children: [],\n+ },\n+ {\n+ label: 'New',\n+ onClick: () => {\n+ this.navigate('/patients/new')\n+ },\n+ },\n+ ],\n},\n]}\n/>\n@@ -40,7 +51,7 @@ class HospitalRun extends Component<RouteComponentProps, {}> {\n<Switch>\n<Route exact path=\"/\" component={Dashboard} />\n<Route exact path=\"/patients\" component={Patients} />\n- <Route exact path=\"/new/patient\" component={NewPatient} />\n+ <Route exact path=\"/patients/new\" component={NewPatient} />\n<Route exact path=\"/patients/:id\" component={ViewPatient} />\n</Switch>\n</div>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/containers/ViewPatient.tsx",
"new_path": "src/containers/ViewPatient.tsx",
"diff": "@@ -47,7 +47,6 @@ const ViewPatient = (props: Props) => {\nreturn (\n<div className=\"container\">\n<Button onClick={onEditButtonClick}>Edit</Button>\n-\n{isUpdated && (\n<Alert\ncolor=\"success\"\n@@ -55,7 +54,8 @@ const ViewPatient = (props: Props) => {\nmessage={`Successfully updated ${patient.firstName} ${patient.lastName}`}\n/>\n)}\n-\n+ <br />\n+ {patient.id}\n<PatientForm\nisEditable={isEditable}\nonFieldChange={onFieldChange}\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | feat(db): adds remote couchdb |
288,323 | 19.11.2019 22:33:51 | 21,600 | 24940b4e80315f94cb92bfcbf34300cf8ddc30ec | feat(init): creates a generic repository class and refactors patient db | [
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"@semantic-release/changelog\": \"~3.0.4\",\n\"@semantic-release/git\": \"~7.0.16\",\n\"@semantic-release/release-notes-generator\": \"~7.3.0\",\n- \"@types/react-redux\": \"~7.1.5\",\n- \"@types/redux-logger\": \"~3.0.7\",\n\"bootstrap\": \"~4.3.1\",\n\"pouchdb\": \"~7.1.1\",\n\"react\": \"~16.12.0\",\n\"@types/pouchdb\": \"~6.4.0\",\n\"@types/react\": \"~16.9.6\",\n\"@types/react-dom\": \"~16.9.1\",\n+ \"@types/react-redux\": \"^7.1.5\",\n\"@types/react-router\": \"~5.1.2\",\n\"@types/react-router-dom\": \"~5.1.0\",\n+ \"@types/redux-logger\": \"^3.0.7\",\n\"@typescript-eslint/eslint-plugin\": \"~2.4.0\",\n\"@typescript-eslint/parser\": \"~2.4.0\",\n\"commitizen\": \"~4.0.3\",\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/clients/db/PatientRepository.ts",
"diff": "+import Patient from 'model/Patient'\n+import Repository from './Repository'\n+import { patients } from '../../config/pouchdb'\n+\n+export class PatientRepsitory extends Repository<Patient> {\n+ constructor() {\n+ super(patients)\n+ }\n+}\n+\n+export default new PatientRepsitory()\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/clients/db/Repository.ts",
"diff": "+/* eslint \"@typescript-eslint/camelcase\": \"off\" */\n+\n+import AbstractDBModel from 'model/AbstractDBModel'\n+\n+function mapRow(row: any): any {\n+ const { value, doc } = row\n+ const { id, _rev, _id, rev, ...restOfDoc } = doc\n+ return {\n+ id: _id,\n+ rev: value.rev,\n+ ...restOfDoc,\n+ }\n+}\n+\n+function mapDocument(document: any): any {\n+ const { _id, _rev, ...values } = document\n+ return {\n+ id: _id,\n+ rev: _rev,\n+ ...values,\n+ }\n+}\n+\n+export default class Repository<T extends AbstractDBModel> {\n+ db: PouchDB.Database\n+\n+ constructor(db: PouchDB.Database) {\n+ this.db = db\n+ }\n+\n+ async find(id: string): Promise<T> {\n+ const document = await this.db.get(id)\n+ return mapDocument(document)\n+ }\n+\n+ async findAll(): Promise<T[]> {\n+ const allPatients = await this.db.allDocs({\n+ include_docs: true,\n+ })\n+\n+ return allPatients.rows.map(mapRow)\n+ }\n+\n+ async save(entity: T): Promise<T> {\n+ const { id, rev, ...valuesToSave } = entity\n+ const savedEntity = await this.db.post({ ...valuesToSave })\n+ return this.find(savedEntity.id)\n+ }\n+\n+ async saveOrUpdate(entity: T): Promise<T> {\n+ const e = entity as any\n+ try {\n+ // try and get a patient, if the patient is missing it will throw an error\n+ // and have a status of 404.\n+ await this.db.get(e.id)\n+ const { id, rev, ...restOfDocument } = e\n+ const updatedDcoument = {\n+ _id: id,\n+ _rev: rev,\n+ ...restOfDocument,\n+ }\n+\n+ await this.db.put(updatedDcoument)\n+ return this.find(e.id)\n+ } catch (error) {\n+ if (error.status !== 404) {\n+ throw Error(error)\n+ }\n+\n+ return this.save(e)\n+ }\n+ }\n+\n+ async delete(entity: T): Promise<T> {\n+ const e = entity as any\n+ return mapDocument(this.db.remove(e.id, e.rev))\n+ }\n+}\n"
},
{
"change_type": "DELETE",
"old_path": "src/clients/db/patients-db.ts",
"new_path": null,
"diff": "-/* eslint-disable no-underscore-dangle, @typescript-eslint/camelcase */\n-import Patient from '../../model/Patient'\n-import { patients } from '../../config/pouchdb'\n-\n-function mapRowToPatient(row: any): Patient {\n- return new Patient(row.id, row.value.rev, row.doc.firstName, row.doc.lastName)\n-}\n-\n-function mapDocumentToPatient(document: any): Patient {\n- return new Patient(document._id, document._rev, document.firstName, document.lastName)\n-}\n-\n-export async function get(id: string): Promise<Patient> {\n- const document = await patients.get(id)\n- return mapDocumentToPatient(document as any)\n-}\n-\n-export async function getAll(): Promise<Patient[]> {\n- const allPatients = await patients.allDocs({\n- include_docs: true,\n- })\n-\n- return allPatients.rows.map((r) => {\n- const row = r as any\n- return mapRowToPatient(row)\n- })\n-}\n-\n-export async function save(patient: Patient): Promise<Patient> {\n- const newPatient = await patients.post(patient)\n- return get(newPatient.id)\n-}\n-\n-export async function saveOrUpdate(patient: Patient) {\n- try {\n- // try and get a patient, if the patient is missing it will throw an error\n- // and have a status of 404.\n- await patients.get(patient.id)\n- const { id, rev, ...restOfPatient } = patient\n- const updatedDcoument = {\n- _id: id,\n- _rev: rev,\n- ...restOfPatient,\n- }\n-\n- await patients.put(updatedDcoument)\n- return get(patient.id)\n- } catch (error) {\n- if (error.status !== 404) {\n- throw Error(error)\n- }\n-\n- return save(patient)\n- }\n-}\n-\n-export async function deleteDocument(document: any) {\n- return patients.remove(document)\n-}\n-\n-export async function deleteDocumentById(id: string, revId: string) {\n- return patients.remove(id, revId)\n-}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/containers/Patients.tsx",
"new_path": "src/containers/Patients.tsx",
"diff": "@@ -19,7 +19,7 @@ const Patients = () => {\nconst list = (\n<ul>\n{patients.map((p) => (\n- <Link to={`/patients/${p.id}`}>\n+ <Link to={`/patients/${p.id}`} key={p.id}>\n<li key={p.id}>\n{p.firstName} {p.lastName}\n</li>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/containers/ViewPatient.tsx",
"new_path": "src/containers/ViewPatient.tsx",
"diff": "@@ -12,6 +12,7 @@ interface Props extends RouteComponentProps {\n}\nconst ViewPatient = (props: Props) => {\n+ const [currentPatient, setCurrentPatient] = useState(new Patient('', '', '', ''))\nconst { match } = props\nconst { id } = match.params as any\nconst dispatch = useDispatch()\n@@ -19,7 +20,9 @@ const ViewPatient = (props: Props) => {\nconst { patient, isLoading, isUpdated } = useSelector((state: RootState) => state.patient)\nconst onSaveButtonClick = async () => {\n- dispatch(updatePatient(patient))\n+ currentPatient.id = patient.id\n+ currentPatient.rev = patient.rev\n+ dispatch(updatePatient(currentPatient))\nsetIsEditable(false)\n}\n@@ -33,7 +36,8 @@ const ViewPatient = (props: Props) => {\n}\nconst onFieldChange = (key: string, value: string) => {\n- ;(patient as any)[key] = value\n+ ;(currentPatient as any)[key] = value\n+ setCurrentPatient(currentPatient)\n}\nuseEffect(() => {\n"
},
{
"change_type": "MODIFY",
"old_path": "src/slices/patient-slice.ts",
"new_path": "src/slices/patient-slice.ts",
"diff": "import { createSlice, PayloadAction } from '@reduxjs/toolkit'\nimport Patient from '../model/Patient'\n-import * as patientsDb from '../clients/db/patients-db'\n+import PatientRepository from '../clients/db/PatientRepository'\nimport { AppThunk } from '../store/store'\ninterface PatientState {\n@@ -54,7 +54,7 @@ export const {\nexport const fetchPatient = (id: string): AppThunk => async (dispatch) => {\ntry {\ndispatch(getPatientStart())\n- const patient = await patientsDb.get(id)\n+ const patient = await PatientRepository.find(id)\ndispatch(getPatientSuccess(patient))\n} catch (error) {\nconsole.log(error)\n@@ -63,7 +63,7 @@ export const fetchPatient = (id: string): AppThunk => async (dispatch) => {\nexport const updatePatient = (patient: Patient): AppThunk => async (dispatch) => {\ntry {\n- const updatedPatient = await patientsDb.saveOrUpdate(patient)\n+ const updatedPatient = await PatientRepository.saveOrUpdate(patient)\ndispatch(updatePatientSuccess(updatedPatient))\n} catch (error) {\nconsole.log(error)\n@@ -72,7 +72,7 @@ export const updatePatient = (patient: Patient): AppThunk => async (dispatch) =>\nexport const createPatient = (patient: Patient): AppThunk => async (dispatch) => {\ntry {\n- const newPatient = await patientsDb.save(patient)\n+ const newPatient = await PatientRepository.save(patient)\ndispatch(createPatientSuccess(newPatient))\n} catch (error) {\nconsole.log(error)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/slices/patients-slice.ts",
"new_path": "src/slices/patients-slice.ts",
"diff": "import { createSlice, PayloadAction } from '@reduxjs/toolkit'\nimport Patient from '../model/Patient'\n-import * as patientsDb from '../clients/db/patients-db'\n+import PatientRepository from '../clients/db/PatientRepository'\nimport { AppThunk } from '../store/store'\ninterface PatientsState {\n@@ -34,7 +34,7 @@ export const { getPatientsStart, getAllPatientsSuccess } = patientsSlice.actions\nexport const fetchPatients = (): AppThunk => async (dispatch) => {\ntry {\ndispatch(getPatientsStart())\n- const patients = await patientsDb.getAll()\n+ const patients = await PatientRepository.findAll()\ndispatch(getAllPatientsSuccess(patients))\n} catch (error) {\nconsole.log(error)\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | feat(init): creates a generic repository class and refactors patient db |
288,323 | 19.11.2019 23:12:41 | 21,600 | 1dca9249c1d440cabb79784e8570d21ef106c70c | feat(init): fix warnings comming from manifest | [
{
"change_type": "MODIFY",
"old_path": "public/manifest.json",
"new_path": "public/manifest.json",
"diff": "{\n- \"short_name\": \"React App\",\n- \"name\": \"Create React App Sample\",\n+ \"short_name\": \"HospitalRun\",\n+ \"name\": \"HospitalRun\",\n\"icons\": [\n{\n\"src\": \"favicon.ico\",\n\"type\": \"image/x-icon\"\n},\n{\n- \"src\": \"logo192.png\",\n+ \"src\": \"logo.png\",\n\"type\": \"image/png\",\n\"sizes\": \"192x192\"\n},\n{\n- \"src\": \"logo512.png\",\n+ \"src\": \"logo.png\",\n\"type\": \"image/png\",\n\"sizes\": \"512x512\"\n}\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | feat(init): fix warnings comming from manifest |
288,323 | 20.11.2019 21:46:01 | 21,600 | c4ced2c157264089f69c6f53b3f89ced69b50f78 | feat(init): update NewPatient to not use Patient slice | [
{
"change_type": "MODIFY",
"old_path": "src/containers/NewPatient.tsx",
"new_path": "src/containers/NewPatient.tsx",
"diff": "-import React from 'react'\n-import { withRouter, RouteComponentProps, Redirect } from 'react-router-dom'\n-import { useDispatch, useSelector } from 'react-redux'\n-import { createPatient } from '../slices/patient-slice'\n-import { RootState } from '../store/store'\n-import PatientForm from '../components/PatientForm'\n+import React, { useState } from 'react'\n+import { useDispatch } from 'react-redux'\n+import { withRouter, useHistory } from 'react-router-dom'\n+import { createPatient } from 'slices/patients-slice'\n+import Patient from 'model/Patient'\n+import PatientForm from 'components/PatientForm'\n-const NewPatient = (props: RouteComponentProps) => {\n+const NewPatient = () => {\nconst dispatch = useDispatch()\n- const { patient, isCreated } = useSelector((state: RootState) => state.patient)\n+ const history = useHistory()\n+ const [patient, setPatient] = useState({ firstName: '', lastName: '' })\nconst onSaveButtonClick = async () => {\n- dispatch(createPatient(patient))\n+ dispatch(createPatient(patient as Patient, history))\n}\nconst onCancelButtonClick = () => {\n- const { history } = props\nhistory.push(`/patients`)\n}\nconst onFieldChange = (key: string, value: string) => {\n- ;(patient as any)[key] = value\n- }\n-\n- if (isCreated) {\n- return <Redirect to={`/patients/${patient.id}`} />\n+ setPatient({\n+ ...patient,\n+ [key]: value,\n+ })\n}\nreturn (\n"
},
{
"change_type": "MODIFY",
"old_path": "src/slices/patient-slice.ts",
"new_path": "src/slices/patient-slice.ts",
"diff": "@@ -30,10 +30,6 @@ const patientSlice = createSlice({\nstate.isLoading = false\nstate.patient = payload\n},\n- createPatientSuccess(state, { payload }: PayloadAction<Patient>) {\n- state.isCreated = true\n- state.patient = payload\n- },\nupdateStart: startLoading,\nupdatePatientSuccess(state, { payload }: PayloadAction<Patient>) {\nstate.isUpdated = true\n@@ -48,7 +44,6 @@ export const {\ngetPatientSuccess,\nupdateStart,\nupdatePatientSuccess,\n- createPatientSuccess,\n} = patientSlice.actions\nexport const fetchPatient = (id: string): AppThunk => async (dispatch) => {\n@@ -70,13 +65,4 @@ export const updatePatient = (patient: Patient): AppThunk => async (dispatch) =>\n}\n}\n-export const createPatient = (patient: Patient): AppThunk => async (dispatch) => {\n- try {\n- const newPatient = await PatientRepository.save(patient)\n- dispatch(createPatientSuccess(newPatient))\n- } catch (error) {\n- console.log(error)\n- }\n-}\n-\nexport default patientSlice.reducer\n"
},
{
"change_type": "MODIFY",
"old_path": "src/slices/patients-slice.ts",
"new_path": "src/slices/patients-slice.ts",
"diff": "@@ -22,14 +22,33 @@ const patientsSlice = createSlice({\ninitialState,\nreducers: {\ngetPatientsStart: startLoading,\n+ createPatientStart: startLoading,\ngetAllPatientsSuccess(state, { payload }: PayloadAction<Patient[]>) {\nstate.isLoading = false\nstate.patients = payload\n},\n+ createPatientSuccess(state) {\n+ state.isLoading = true\n+ },\n},\n})\n-export const { getPatientsStart, getAllPatientsSuccess } = patientsSlice.actions\n+export const {\n+ getPatientsStart,\n+ getAllPatientsSuccess,\n+ createPatientStart,\n+ createPatientSuccess,\n+} = patientsSlice.actions\n+\n+export const createPatient = (patient: Patient, history: any): AppThunk => async (dispatch) => {\n+ try {\n+ dispatch(createPatientStart())\n+ const newPatient = await PatientRepository.save(patient)\n+ history.push(newPatient.id)\n+ } catch (error) {\n+ console.log(error)\n+ }\n+}\nexport const fetchPatients = (): AppThunk => async (dispatch) => {\ntry {\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | feat(init): update NewPatient to not use Patient slice |
288,323 | 20.11.2019 22:12:35 | 21,600 | d6ab6222395c93fa9cd5db2e483c81110f5d6295 | feat(init): cleans up update patient code | [
{
"change_type": "MODIFY",
"old_path": "src/containers/ViewPatient.tsx",
"new_path": "src/containers/ViewPatient.tsx",
"diff": "import React, { useState, useEffect } from 'react'\nimport { useDispatch, useSelector } from 'react-redux'\n-import { withRouter, RouteComponentProps } from 'react-router-dom'\n+import { withRouter, useHistory, useParams } from 'react-router-dom'\nimport { Button, Alert } from '@hospitalrun/components'\nimport { fetchPatient, updatePatient } from '../slices/patient-slice'\nimport { RootState } from '../store/store'\nimport Patient from '../model/Patient'\nimport PatientForm from '../components/PatientForm'\n-interface Props extends RouteComponentProps {\n- patient: Patient\n-}\n-\n-const ViewPatient = (props: Props) => {\n- const [currentPatient, setCurrentPatient] = useState(new Patient('', '', '', ''))\n- const { match } = props\n- const { id } = match.params as any\n+const ViewPatient = () => {\nconst dispatch = useDispatch()\n+ const { patient, isLoading, isUpdatedSuccessfully } = useSelector(\n+ (state: RootState) => state.patient,\n+ )\nconst [isEditable, setIsEditable] = useState(false)\n- const { patient, isLoading, isUpdated } = useSelector((state: RootState) => state.patient)\n+ const [currentPatientDetails, setCurrentPatientDetails] = useState({\n+ firstName: '',\n+ lastName: '',\n+ })\n+ const history = useHistory()\n+ const { id } = useParams()\nconst onSaveButtonClick = async () => {\n- currentPatient.id = patient.id\n- currentPatient.rev = patient.rev\n- dispatch(updatePatient(currentPatient))\n+ dispatch(\n+ updatePatient(\n+ new Patient(\n+ patient.id,\n+ patient.rev,\n+ currentPatientDetails.firstName,\n+ currentPatientDetails.lastName,\n+ ),\n+ ),\n+ )\nsetIsEditable(false)\n}\nconst onCancelButtonClick = () => {\n- const { history } = props\nhistory.push(`/patients`)\n}\n@@ -36,12 +43,16 @@ const ViewPatient = (props: Props) => {\n}\nconst onFieldChange = (key: string, value: string) => {\n- ;(currentPatient as any)[key] = value\n- setCurrentPatient(currentPatient)\n+ setCurrentPatientDetails({\n+ ...currentPatientDetails,\n+ [key]: value,\n+ })\n}\nuseEffect(() => {\n+ if (id) {\ndispatch(fetchPatient(id))\n+ }\n}, [dispatch, id])\nif (isLoading) {\n@@ -51,7 +62,7 @@ const ViewPatient = (props: Props) => {\nreturn (\n<div className=\"container\">\n<Button onClick={onEditButtonClick}>Edit</Button>\n- {isUpdated && (\n+ {isUpdatedSuccessfully && (\n<Alert\ncolor=\"success\"\ntitle=\"Successfully Updated\"\n"
},
{
"change_type": "MODIFY",
"old_path": "src/slices/patient-slice.ts",
"new_path": "src/slices/patient-slice.ts",
"diff": "@@ -5,15 +5,13 @@ import { AppThunk } from '../store/store'\ninterface PatientState {\nisLoading: boolean\n- isUpdated: boolean\n- isCreated: boolean\n+ isUpdatedSuccessfully: boolean\npatient: Patient\n}\nconst initialState: PatientState = {\nisLoading: false,\n- isUpdated: false,\n- isCreated: false,\n+ isUpdatedSuccessfully: false,\npatient: new Patient('', '', '', ''),\n}\n@@ -32,7 +30,7 @@ const patientSlice = createSlice({\n},\nupdateStart: startLoading,\nupdatePatientSuccess(state, { payload }: PayloadAction<Patient>) {\n- state.isUpdated = true\n+ state.isUpdatedSuccessfully = true\nstate.isLoading = false\nstate.patient = payload\n},\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | feat(init): cleans up update patient code |
288,323 | 20.11.2019 22:16:10 | 21,600 | 2063b20b60b44f42ae9c92a1a17a69d4b94fac26 | feat(init): cleans up interfaces for PatientForm | [
{
"change_type": "MODIFY",
"old_path": "src/components/PatientForm.tsx",
"new_path": "src/components/PatientForm.tsx",
"diff": "@@ -10,9 +10,8 @@ interface Props {\n}\nconst PatientForm: React.FC<Props> = (props: Props) => {\n- const handleChange = (event: any, fieldName: string) => {\n- const htmlInputEvent = event as React.FormEvent<HTMLInputElement>\n- props.onFieldChange(fieldName, htmlInputEvent.currentTarget.value)\n+ const handleChange = (event: React.FormEvent<HTMLInputElement>, fieldName: string) => {\n+ props.onFieldChange(fieldName, event.currentTarget.value)\n}\nconst { patient, isEditable, onSaveButtonClick, onCancelButtonClick } = props\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | feat(init): cleans up interfaces for PatientForm |
288,323 | 25.11.2019 21:02:59 | 21,600 | d3835d69e2753eaa539fc61c789b4969178edf23 | feat(init): add dashboard view, and useTitle hook | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/components/Navbar.tsx",
"diff": "+import React from 'react'\n+import { useHistory } from 'react-router'\n+import { Navbar as HospitalRunNavbar } from '@hospitalrun/components'\n+\n+const Navbar = () => {\n+ const history = useHistory()\n+ return (\n+ <HospitalRunNavbar\n+ brand={{\n+ label: 'HospitalRun',\n+ onClick: () => {\n+ history.push('/')\n+ },\n+ }}\n+ bg=\"dark\"\n+ variant=\"dark\"\n+ onSeachButtonClick={() => console.log('hello')}\n+ onSearchTextBoxChange={() => console.log('hello')}\n+ navLinks={[\n+ {\n+ label: 'Patients',\n+ onClick: () => {},\n+ children: [\n+ {\n+ label: 'List',\n+ onClick: () => {\n+ history.push('/patients')\n+ },\n+ },\n+ {\n+ label: 'New',\n+ onClick: () => {\n+ history.push('/patients/new')\n+ },\n+ },\n+ ],\n+ },\n+ ]}\n+ />\n+ )\n+}\n+\n+export default Navbar\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/components/Sidebar.tsx",
"diff": "+import React from 'react'\n+import { Link, useLocation } from 'react-router-dom'\n+import { Icon } from '@hospitalrun/components'\n+\n+const Sidebar = () => {\n+ const path = useLocation()\n+ return (\n+ <nav className=\"col-md-2 d-none d-md-block bg-light sidebar\">\n+ <div className=\"sidebar-sticky\">\n+ <ul className=\"nav flex-column\">\n+ <li className=\"nav-item\">\n+ <Link to=\"/\" className={`nav-link ${path.pathname === '/' ? ' active' : ''}`}>\n+ Dashboard\n+ </Link>\n+ </li>\n+ <li className=\"nav-item\">\n+ <Link\n+ to=\"/patients\"\n+ className={`nav-link ${path.pathname.includes('patient') ? ' active' : ''}`}\n+ >\n+ <Icon icon=\"patients\" />\n+ {' '}\n+ Patients\n+ </Link>\n+ </li>\n+ </ul>\n+ </div>\n+ </nav>\n+ )\n+}\n+\n+export default Sidebar\n"
},
{
"change_type": "MODIFY",
"old_path": "src/containers/Dashboard.tsx",
"new_path": "src/containers/Dashboard.tsx",
"diff": "import React from 'react'\n+import useTitle from 'util/useTitle'\n-const Dashboard: React.FC = () => <h1>Hello Dashboard</h1>\n+const Dashboard: React.FC = () => {\n+ useTitle('Dashboard')\n+ return <h3>This is where the content would go.</h3>\n+}\nexport default Dashboard\n"
},
{
"change_type": "MODIFY",
"old_path": "src/containers/HospitalRun.tsx",
"new_path": "src/containers/HospitalRun.tsx",
"diff": "-import React, { Component } from 'react'\n-import { Switch, Route, withRouter, RouteComponentProps } from 'react-router-dom'\n-import { Navbar } from '@hospitalrun/components'\n-import ViewPatient from './ViewPatient'\n+import React from 'react'\n+import { Switch, Route } from 'react-router-dom'\n+import { useSelector } from 'react-redux'\n+import Sidebar from 'components/Sidebar'\nimport Dashboard from './Dashboard'\nimport Patients from './Patients'\nimport NewPatient from './NewPatient'\n+import ViewPatient from './ViewPatient'\n+import { RootState } from '../store/store'\n+import Navbar from '../components/Navbar'\n-class HospitalRun extends Component<RouteComponentProps, {}> {\n- navigate(route: string) {\n- const { history } = this.props\n- history.push(route)\n- }\n-\n- render() {\n+const HospitalRun = () => {\n+ const { title } = useSelector((state: RootState) => state.title)\nreturn (\n<div>\n- <Navbar\n- brand={{\n- label: 'HospitalRun',\n- onClick: () => {\n- this.navigate('/')\n- },\n- }}\n- bg=\"light\"\n- variant=\"light\"\n- onSeachButtonClick={() => console.log('hello')}\n- onSearchTextBoxChange={() => console.log('hello')}\n- navLinks={[\n- {\n- label: 'Patients',\n- onClick: () => {},\n- children: [\n- {\n- label: 'List',\n- onClick: () => {\n- this.navigate('/patients')\n- },\n- },\n- {\n- label: 'New',\n- onClick: () => {\n- this.navigate('/patients/new')\n- },\n- },\n- ],\n- },\n- ]}\n- />\n+ <Navbar />\n+ <div className=\"container-fluid\">\n+ <Sidebar />\n+ <div className=\"row\">\n+ <main role=\"main\" className=\"col-md-9 ml-sm-auto col-lg-10 px-4\">\n+ <div className=\"d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom\">\n+ <h1 className=\"h2\">{title}</h1>\n+ </div>\n<div>\n<Switch>\n<Route exact path=\"/\" component={Dashboard} />\n@@ -55,9 +29,11 @@ class HospitalRun extends Component<RouteComponentProps, {}> {\n<Route exact path=\"/patients/:id\" component={ViewPatient} />\n</Switch>\n</div>\n+ </main>\n+ </div>\n+ </div>\n</div>\n)\n}\n-}\n-export default withRouter(HospitalRun)\n+export default HospitalRun\n"
},
{
"change_type": "MODIFY",
"old_path": "src/containers/NewPatient.tsx",
"new_path": "src/containers/NewPatient.tsx",
"diff": "@@ -4,8 +4,10 @@ import { withRouter, useHistory } from 'react-router-dom'\nimport { createPatient } from 'slices/patients-slice'\nimport Patient from 'model/Patient'\nimport PatientForm from 'components/PatientForm'\n+import useTitle from 'util/useTitle'\nconst NewPatient = () => {\n+ useTitle('New Patient')\nconst dispatch = useDispatch()\nconst history = useHistory()\nconst [patient, setPatient] = useState({ firstName: '', lastName: '' })\n@@ -27,7 +29,6 @@ const NewPatient = () => {\nreturn (\n<div>\n- <h1>New Patient</h1>\n<div className=\"container\">\n<PatientForm\nonFieldChange={onFieldChange}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/containers/Patients.tsx",
"new_path": "src/containers/Patients.tsx",
"diff": "import React, { useEffect } from 'react'\nimport { useSelector, useDispatch } from 'react-redux'\nimport { Link } from 'react-router-dom'\n+import useTitle from 'util/useTitle'\nimport { RootState } from '../store/store'\nimport { fetchPatients } from '../slices/patients-slice'\nconst Patients = () => {\n+ useTitle('Patients')\nconst dispatch = useDispatch()\nconst { patients, isLoading } = useSelector((state: RootState) => state.patients)\n@@ -30,7 +32,6 @@ const Patients = () => {\nreturn (\n<div>\n- <h1>Patients</h1>\n<div className=\"container\">\n<ul>{list}</ul>\n</div>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/containers/ViewPatient.tsx",
"new_path": "src/containers/ViewPatient.tsx",
"diff": "@@ -2,12 +2,14 @@ import React, { useState, useEffect } from 'react'\nimport { useDispatch, useSelector } from 'react-redux'\nimport { withRouter, useHistory, useParams } from 'react-router-dom'\nimport { Button, Alert } from '@hospitalrun/components'\n+import useTitle from 'util/useTitle'\nimport { fetchPatient, updatePatient } from '../slices/patient-slice'\nimport { RootState } from '../store/store'\nimport Patient from '../model/Patient'\nimport PatientForm from '../components/PatientForm'\nconst ViewPatient = () => {\n+ useTitle('View Patient')\nconst dispatch = useDispatch()\nconst { patient, isLoading, isUpdatedSuccessfully } = useSelector(\n(state: RootState) => state.patient,\n"
},
{
"change_type": "MODIFY",
"old_path": "src/index.css",
"new_path": "src/index.css",
"diff": "@@ -11,3 +11,80 @@ code {\nfont-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',\nmonospace;\n}\n+\n+.feather {\n+ width: 16px;\n+ height: 16px;\n+ vertical-align: text-bottom;\n+}\n+\n+.sidebar {\n+ position: fixed;\n+ top: 0;\n+ bottom: 0;\n+ left: 0;\n+ z-index: 0; /* Behind the navbar */\n+ padding: 48px 0 0; /* Height of navbar */\n+ box-shadow: inset -1px 0 0 rgba(0, 0, 0, .1);\n+}\n+\n+.sidebar-sticky {\n+ position: relative;\n+ top: 0;\n+ height: calc(100vh - 48px);\n+ padding-top: .5rem;\n+ overflow-x: hidden;\n+ overflow-y: auto; /* Scrollable contents if viewport is shorter than content. */\n+}\n+\n+@supports ((position: -webkit-sticky) or (position: sticky)) {\n+ .sidebar-sticky {\n+ position: -webkit-sticky;\n+ position: sticky;\n+ }\n+}\n+\n+.sidebar .nav-link {\n+ font-weight: 500;\n+ color: #333;\n+}\n+\n+.sidebar .nav-link .feather {\n+ margin-right: 4px;\n+ color: #999;\n+}\n+\n+.sidebar .nav-link.active {\n+ color: #007bff;\n+}\n+\n+.sidebar .nav-link:hover .feather,\n+.sidebar .nav-link.active .feather {\n+ color: inherit;\n+}\n+\n+.sidebar-heading {\n+ font-size: .75rem;\n+ text-transform: uppercase;\n+}\n+\n+.navbar {\n+ z-index: 1000;\n+}\n+\n+.navbar .form-control {\n+ padding: .75rem 1rem;\n+ border-width: 0;\n+ border-radius: 0;\n+}\n+\n+.form-control-dark {\n+ color: #fff;\n+ background-color: rgba(255, 255, 255, .1);\n+ border-color: rgba(255, 255, 255, .1);\n+}\n+\n+.form-control-dark:focus {\n+ border-color: transparent;\n+ box-shadow: 0 0 0 3px rgba(255, 255, 255, .25);\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/index.tsx",
"new_path": "src/index.tsx",
"diff": "import React from 'react'\nimport ReactDOM from 'react-dom'\nimport 'bootstrap/dist/css/bootstrap.min.css'\n+import './index.css'\nimport App from './App'\nimport * as serviceWorker from './serviceWorker'\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/slices/title-slice.ts",
"diff": "+import { createSlice, PayloadAction } from '@reduxjs/toolkit'\n+import { AppThunk } from '../store/store'\n+\n+interface TitleState {\n+ title: string\n+}\n+\n+const initialState: TitleState = {\n+ title: '',\n+}\n+\n+const titleSlice = createSlice({\n+ name: 'title',\n+ initialState,\n+ reducers: {\n+ changeTitle(state, { payload }: PayloadAction<string>) {\n+ state.title = payload\n+ },\n+ },\n+})\n+\n+export const { changeTitle } = titleSlice.actions\n+\n+export const updateTitle = (title: string): AppThunk => async (dispatch) => {\n+ try {\n+ dispatch(changeTitle(title))\n+ } catch (error) {\n+ console.log(error)\n+ }\n+}\n+\n+export default titleSlice.reducer\n"
},
{
"change_type": "MODIFY",
"old_path": "src/store/store.ts",
"new_path": "src/store/store.ts",
"diff": "@@ -4,10 +4,12 @@ import { createLogger } from 'redux-logger'\nimport patient from '../slices/patient-slice'\nimport patients from '../slices/patients-slice'\n+import title from '../slices/title-slice'\nconst reducer = combineReducers({\npatient,\npatients,\n+ title,\n})\nconst store = configureStore({\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/util/useTitle.tsx",
"diff": "+import { useEffect } from 'react'\n+import { useDispatch } from 'react-redux'\n+import { updateTitle } from 'slices/title-slice'\n+\n+export default function useTitle(title: string): void {\n+ const dispatch = useDispatch()\n+\n+ useEffect(() => {\n+ dispatch(updateTitle(title))\n+ })\n+}\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | feat(init): add dashboard view, and useTitle hook |
288,323 | 26.11.2019 21:33:54 | 21,600 | 7a19200c2f6640d72737b156e3c994d1595cfdcd | feat(init): add permissions for routes | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Permissions.ts",
"diff": "+enum Permissions {\n+ ReadPatients = 'read:patients',\n+ WritePatients = 'write:patients'\n+}\n+\n+export default Permissions\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/components/PrivateRoute.tsx",
"diff": "+import React from 'react'\n+import { Route, Redirect } from 'react-router-dom'\n+\n+const PrivateRoute = ({ component, isAuthenticated, ...rest }: any) => {\n+ const routeComponent = (props: any) =>\n+ isAuthenticated ? React.createElement(component, props) : <Redirect to={{ pathname: '/' }} />\n+ return <Route {...rest} render={routeComponent} />\n+}\n+\n+export default PrivateRoute\n"
},
{
"change_type": "MODIFY",
"old_path": "src/containers/HospitalRun.tsx",
"new_path": "src/containers/HospitalRun.tsx",
"diff": "@@ -2,15 +2,18 @@ import React from 'react'\nimport { Switch, Route } from 'react-router-dom'\nimport { useSelector } from 'react-redux'\nimport Sidebar from 'components/Sidebar'\n+import Permissions from 'Permissions'\nimport Dashboard from './Dashboard'\nimport Patients from './Patients'\nimport NewPatient from './NewPatient'\nimport ViewPatient from './ViewPatient'\nimport { RootState } from '../store/store'\nimport Navbar from '../components/Navbar'\n+import PrivateRoute from '../components/PrivateRoute'\nconst HospitalRun = () => {\nconst { title } = useSelector((state: RootState) => state.title)\n+ const { permissions } = useSelector((state: RootState) => state.user)\nreturn (\n<div>\n<Navbar />\n@@ -24,9 +27,24 @@ const HospitalRun = () => {\n<div>\n<Switch>\n<Route exact path=\"/\" component={Dashboard} />\n- <Route exact path=\"/patients\" component={Patients} />\n- <Route exact path=\"/patients/new\" component={NewPatient} />\n- <Route exact path=\"/patients/:id\" component={ViewPatient} />\n+ <PrivateRoute\n+ isAuthenticated={permissions.includes(Permissions.ReadPatients)}\n+ exact\n+ path=\"/patients\"\n+ component={Patients}\n+ />\n+ <PrivateRoute\n+ isAuthenticated={permissions.includes(Permissions.WritePatients)}\n+ exact\n+ path=\"/patients/new\"\n+ component={NewPatient}\n+ />\n+ <PrivateRoute\n+ isAuthenticated={permissions.includes(Permissions.ReadPatients)}\n+ exact\n+ path=\"/patients/:id\"\n+ component={ViewPatient}\n+ />\n</Switch>\n</div>\n</main>\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/slices/user-slice.ts",
"diff": "+import { createSlice, PayloadAction } from '@reduxjs/toolkit'\n+import Permissions from 'Permissions'\n+\n+interface UserState {\n+ permissions: Permissions[]\n+}\n+\n+const initialState: UserState = {\n+ permissions: [Permissions.ReadPatients, Permissions.WritePatients],\n+}\n+\n+const userSlice = createSlice({\n+ name: 'user',\n+ initialState,\n+ reducers: {\n+ fetchPermissions(state, { payload }: PayloadAction<Permissions[]>) {\n+ state.permissions = payload\n+ },\n+ },\n+})\n+\n+export const { fetchPermissions } = userSlice.actions\n+\n+export default userSlice.reducer\n"
},
{
"change_type": "MODIFY",
"old_path": "src/store/store.ts",
"new_path": "src/store/store.ts",
"diff": "@@ -5,11 +5,13 @@ import { createLogger } from 'redux-logger'\nimport patient from '../slices/patient-slice'\nimport patients from '../slices/patients-slice'\nimport title from '../slices/title-slice'\n+import user from '../slices/user-slice'\nconst reducer = combineReducers({\npatient,\npatients,\ntitle,\n+ user,\n})\nconst store = configureStore({\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | feat(init): add permissions for routes |
288,323 | 26.11.2019 22:32:05 | 21,600 | 0f69f8466855ea5435ba31d24a93d7d44c39ea83 | feat(i18n): add internationalization | [
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"@semantic-release/git\": \"~7.0.16\",\n\"@semantic-release/release-notes-generator\": \"~7.3.0\",\n\"bootstrap\": \"~4.3.1\",\n+ \"i18next\": \"^19.0.1\",\n+ \"i18next-browser-languagedetector\": \"^4.0.1\",\n+ \"i18next-xhr-backend\": \"^3.2.2\",\n\"pouchdb\": \"~7.1.1\",\n\"react\": \"~16.12.0\",\n\"react-dom\": \"~16.12.0\",\n+ \"react-i18next\": \"^11.2.2\",\n\"react-redux\": \"~7.1.3\",\n\"react-router\": \"~5.1.2\",\n\"react-router-dom\": \"~5.1.2\",\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "public/locales/en/translation.json",
"diff": "+{\n+ \"dashboard\": {\n+ \"label\": \"Dashboard\"\n+ },\n+ \"patients\": {\n+ \"label\": \"Patients\",\n+ \"viewPatients\": \"View Patients\",\n+ \"viewPatient\": \"View Patient\",\n+ \"newPatient\": \"New Patient\"\n+ },\n+ \"patient\": {\n+ \"firstName\": \"First Name\",\n+ \"lastName\": \"Last Name\"\n+ },\n+ \"actions\": {\n+ \"edit\": \"Edit\",\n+ \"save\": \"Save\",\n+ \"cancel\": \"Cancel\",\n+ \"new\": \"New\",\n+ \"list\": \"List\"\n+ }\n+}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "src/App.tsx",
"new_path": "src/App.tsx",
"diff": "-import React from 'react'\n+import React, { Suspense } from 'react'\nimport { BrowserRouter } from 'react-router-dom'\nimport { Provider } from 'react-redux'\nimport HospitalRun from './containers/HospitalRun'\nimport store from './store/store'\n+import { Spinner } from '@hospitalrun/components'\nconst App: React.FC = () => (\n<div>\n<Provider store={store}>\n+ <Suspense fallback={<Spinner color=\"blue\" loading size={[10, 25]} type=\"ScaleLoader\" />}>\n<BrowserRouter>\n<HospitalRun />\n</BrowserRouter>\n+ </Suspense>\n</Provider>\n</div>\n)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/components/Navbar.tsx",
"new_path": "src/components/Navbar.tsx",
"diff": "import React from 'react'\nimport { useHistory } from 'react-router'\nimport { Navbar as HospitalRunNavbar } from '@hospitalrun/components'\n+import { useTranslation } from 'react-i18next'\nconst Navbar = () => {\n+ const { t } = useTranslation()\nconst history = useHistory()\nreturn (\n<HospitalRunNavbar\n@@ -18,17 +20,17 @@ const Navbar = () => {\nonSearchTextBoxChange={() => console.log('hello')}\nnavLinks={[\n{\n- label: 'Patients',\n+ label: t('patients.label'),\nonClick: () => {},\nchildren: [\n{\n- label: 'List',\n+ label: t('actions.list'),\nonClick: () => {\nhistory.push('/patients')\n},\n},\n{\n- label: 'New',\n+ label: t('actions.new'),\nonClick: () => {\nhistory.push('/patients/new')\n},\n"
},
{
"change_type": "MODIFY",
"old_path": "src/components/PatientForm.tsx",
"new_path": "src/components/PatientForm.tsx",
"diff": "import React from 'react'\nimport { TextInput, Button } from '@hospitalrun/components'\n+import { useTranslation } from 'react-i18next'\ninterface Props {\nisEditable?: boolean\n@@ -10,6 +11,7 @@ interface Props {\n}\nconst PatientForm: React.FC<Props> = (props: Props) => {\n+ const { t } = useTranslation()\nconst handleChange = (event: React.FormEvent<HTMLInputElement>, fieldName: string) => {\nprops.onFieldChange(fieldName, event.currentTarget.value)\n}\n@@ -27,7 +29,7 @@ const PatientForm: React.FC<Props> = (props: Props) => {\n<div>\n<form>\n<div className=\"row\">\n- <h3>First Name:</h3>\n+ <h3>{t('patient.firstName')}:</h3>\n<TextInput\nvalue={firstName}\ndisabled={!isEditable}\n@@ -35,7 +37,7 @@ const PatientForm: React.FC<Props> = (props: Props) => {\n/>\n</div>\n<div className=\"row\">\n- <h3>Last Name:</h3>\n+ <h3>{t('patient.lastName')}:</h3>\n<TextInput\nvalue={lastName}\ndisabled={!isEditable}\n@@ -44,9 +46,9 @@ const PatientForm: React.FC<Props> = (props: Props) => {\n</div>\n{isEditable && (\n<div className=\"row\">\n- <Button onClick={onSaveButtonClick}>Save</Button>\n+ <Button onClick={onSaveButtonClick}> {t('actions.save')}</Button>\n<Button color=\"danger\" onClick={onCancelButtonClick}>\n- Cancel\n+ {t('actions.cancel')}\n</Button>\n</div>\n)}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/components/Sidebar.tsx",
"new_path": "src/components/Sidebar.tsx",
"diff": "import React from 'react'\nimport { Link, useLocation } from 'react-router-dom'\nimport { Icon } from '@hospitalrun/components'\n+import { useTranslation } from 'react-i18next'\nconst Sidebar = () => {\n+ const { t } = useTranslation()\nconst path = useLocation()\nreturn (\n<nav className=\"col-md-2 d-none d-md-block bg-light sidebar\">\n@@ -10,7 +12,7 @@ const Sidebar = () => {\n<ul className=\"nav flex-column\">\n<li className=\"nav-item\">\n<Link to=\"/\" className={`nav-link ${path.pathname === '/' ? ' active' : ''}`}>\n- Dashboard\n+ {t('dashboard.label')}\n</Link>\n</li>\n<li className=\"nav-item\">\n@@ -19,8 +21,7 @@ const Sidebar = () => {\nclassName={`nav-link ${path.pathname.includes('patient') ? ' active' : ''}`}\n>\n<Icon icon=\"patients\" />\n- {' '}\n- Patients\n+ {` ${t('patients.label')}`}\n</Link>\n</li>\n</ul>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/containers/Dashboard.tsx",
"new_path": "src/containers/Dashboard.tsx",
"diff": "import React from 'react'\nimport useTitle from 'util/useTitle'\n+import { useTranslation } from 'react-i18next'\nconst Dashboard: React.FC = () => {\n- useTitle('Dashboard')\n+ const { t } = useTranslation()\n+ useTitle(t('dashboard.label'))\nreturn <h3>This is where the content would go.</h3>\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/containers/NewPatient.tsx",
"new_path": "src/containers/NewPatient.tsx",
"diff": "@@ -5,9 +5,11 @@ import { createPatient } from 'slices/patients-slice'\nimport Patient from 'model/Patient'\nimport PatientForm from 'components/PatientForm'\nimport useTitle from 'util/useTitle'\n+import { useTranslation } from 'react-i18next'\nconst NewPatient = () => {\n- useTitle('New Patient')\n+ const { t } = useTranslation()\n+ useTitle(t('patients.newPatient'))\nconst dispatch = useDispatch()\nconst history = useHistory()\nconst [patient, setPatient] = useState({ firstName: '', lastName: '' })\n"
},
{
"change_type": "MODIFY",
"old_path": "src/containers/Patients.tsx",
"new_path": "src/containers/Patients.tsx",
"diff": "@@ -4,9 +4,12 @@ import { Link } from 'react-router-dom'\nimport useTitle from 'util/useTitle'\nimport { RootState } from '../store/store'\nimport { fetchPatients } from '../slices/patients-slice'\n+import { useTranslation } from 'react-i18next'\n+import { Spinner } from '@hospitalrun/components'\nconst Patients = () => {\n- useTitle('Patients')\n+ const { t } = useTranslation()\n+ useTitle(t('patients.label'))\nconst dispatch = useDispatch()\nconst { patients, isLoading } = useSelector((state: RootState) => state.patients)\n@@ -15,7 +18,7 @@ const Patients = () => {\n}, [dispatch])\nif (isLoading) {\n- return <h3>Loading...</h3>\n+ return <Spinner color=\"blue\" loading size={[10, 25]} type=\"ScaleLoader\" />\n}\nconst list = (\n"
},
{
"change_type": "MODIFY",
"old_path": "src/containers/ViewPatient.tsx",
"new_path": "src/containers/ViewPatient.tsx",
"diff": "import React, { useState, useEffect } from 'react'\nimport { useDispatch, useSelector } from 'react-redux'\nimport { withRouter, useHistory, useParams } from 'react-router-dom'\n-import { Button, Alert } from '@hospitalrun/components'\n+import { Button, Alert, Spinner } from '@hospitalrun/components'\nimport useTitle from 'util/useTitle'\nimport { fetchPatient, updatePatient } from '../slices/patient-slice'\nimport { RootState } from '../store/store'\nimport Patient from '../model/Patient'\nimport PatientForm from '../components/PatientForm'\n+import { useTranslation } from 'react-i18next'\nconst ViewPatient = () => {\n- useTitle('View Patient')\n+ const { t } = useTranslation()\n+ useTitle(t('patients.viewPatient'))\nconst dispatch = useDispatch()\nconst { patient, isLoading, isUpdatedSuccessfully } = useSelector(\n(state: RootState) => state.patient,\n@@ -58,12 +60,12 @@ const ViewPatient = () => {\n}, [dispatch, id])\nif (isLoading) {\n- return <h3>Loading...</h3>\n+ return <Spinner color=\"blue\" loading size={[10, 25]} type=\"ScaleLoader\" />\n}\nreturn (\n<div className=\"container\">\n- <Button onClick={onEditButtonClick}>Edit</Button>\n+ <Button onClick={onEditButtonClick}>{t('actions.edit')}</Button>\n{isUpdatedSuccessfully && (\n<Alert\ncolor=\"success\"\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/i18n.js",
"diff": "+import i18n from 'i18next';\n+import Backend from 'i18next-xhr-backend';\n+import LanguageDetector from 'i18next-browser-languagedetector';\n+import { initReactI18next } from 'react-i18next';\n+\n+i18n\n+ // load translation using xhr -> see /public/locales\n+ // learn more: https://github.com/i18next/i18next-xhr-backend\n+ .use(Backend)\n+ // detect user language\n+ // learn more: https://github.com/i18next/i18next-browser-languageDetector\n+ .use(LanguageDetector)\n+ // pass the i18n instance to react-i18next.\n+ .use(initReactI18next)\n+ // init i18next\n+ // for all options read: https://www.i18next.com/overview/configuration-options\n+ .init({\n+ fallbackLng: 'en',\n+ debug: true,\n+\n+ interpolation: {\n+ escapeValue: false, // not needed for react as it escapes by default\n+ },\n+ });\n+\n+export default i18n\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "src/index.tsx",
"new_path": "src/index.tsx",
"diff": "@@ -4,6 +4,7 @@ import 'bootstrap/dist/css/bootstrap.min.css'\nimport './index.css'\nimport App from './App'\nimport * as serviceWorker from './serviceWorker'\n+import './i18n'\nReactDOM.render(<App />, document.getElementById('root'))\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | feat(i18n): add internationalization |
288,323 | 27.11.2019 06:46:57 | 21,600 | deb075680b55d410e8b6be63c83afafc473f60c7 | style(init): fix lint errors | [
{
"change_type": "MODIFY",
"old_path": "src/App.tsx",
"new_path": "src/App.tsx",
"diff": "import React, { Suspense } from 'react'\nimport { BrowserRouter } from 'react-router-dom'\nimport { Provider } from 'react-redux'\n+import { Spinner } from '@hospitalrun/components'\nimport HospitalRun from './containers/HospitalRun'\nimport store from './store/store'\n-import { Spinner } from '@hospitalrun/components'\nconst App: React.FC = () => (\n<div>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/containers/Dashboard.tsx",
"new_path": "src/containers/Dashboard.tsx",
"diff": "@@ -5,7 +5,7 @@ import { useTranslation } from 'react-i18next'\nconst Dashboard: React.FC = () => {\nconst { t } = useTranslation()\nuseTitle(t('dashboard.label'))\n- return <h3>This is where the content would go.</h3>\n+ return <h3>Example</h3>\n}\nexport default Dashboard\n"
},
{
"change_type": "MODIFY",
"old_path": "src/containers/HospitalRun.tsx",
"new_path": "src/containers/HospitalRun.tsx",
"diff": "@@ -2,7 +2,7 @@ import React from 'react'\nimport { Switch, Route } from 'react-router-dom'\nimport { useSelector } from 'react-redux'\nimport Sidebar from 'components/Sidebar'\n-import Permissions from 'Permissions'\n+import Permissions from 'util/Permissions'\nimport Dashboard from './Dashboard'\nimport Patients from './Patients'\nimport NewPatient from './NewPatient'\n"
},
{
"change_type": "MODIFY",
"old_path": "src/containers/Patients.tsx",
"new_path": "src/containers/Patients.tsx",
"diff": "@@ -2,10 +2,10 @@ import React, { useEffect } from 'react'\nimport { useSelector, useDispatch } from 'react-redux'\nimport { Link } from 'react-router-dom'\nimport useTitle from 'util/useTitle'\n-import { RootState } from '../store/store'\n-import { fetchPatients } from '../slices/patients-slice'\nimport { useTranslation } from 'react-i18next'\nimport { Spinner } from '@hospitalrun/components'\n+import { RootState } from '../store/store'\n+import { fetchPatients } from '../slices/patients-slice'\nconst Patients = () => {\nconst { t } = useTranslation()\n"
},
{
"change_type": "MODIFY",
"old_path": "src/containers/ViewPatient.tsx",
"new_path": "src/containers/ViewPatient.tsx",
"diff": "@@ -3,11 +3,11 @@ import { useDispatch, useSelector } from 'react-redux'\nimport { withRouter, useHistory, useParams } from 'react-router-dom'\nimport { Button, Alert, Spinner } from '@hospitalrun/components'\nimport useTitle from 'util/useTitle'\n+import { useTranslation } from 'react-i18next'\nimport { fetchPatient, updatePatient } from '../slices/patient-slice'\nimport { RootState } from '../store/store'\nimport Patient from '../model/Patient'\nimport PatientForm from '../components/PatientForm'\n-import { useTranslation } from 'react-i18next'\nconst ViewPatient = () => {\nconst { t } = useTranslation()\n"
},
{
"change_type": "MODIFY",
"old_path": "src/i18n.js",
"new_path": "src/i18n.js",
"diff": "-import i18n from 'i18next';\n-import Backend from 'i18next-xhr-backend';\n-import LanguageDetector from 'i18next-browser-languagedetector';\n-import { initReactI18next } from 'react-i18next';\n+import i18n from 'i18next'\n+import Backend from 'i18next-xhr-backend'\n+import LanguageDetector from 'i18next-browser-languagedetector'\n+import { initReactI18next } from 'react-i18next'\ni18n\n// load translation using xhr -> see /public/locales\n@@ -21,6 +21,6 @@ i18n\ninterpolation: {\nescapeValue: false, // not needed for react as it escapes by default\n},\n- });\n+ })\nexport default i18n\n"
},
{
"change_type": "MODIFY",
"old_path": "src/slices/user-slice.ts",
"new_path": "src/slices/user-slice.ts",
"diff": "import { createSlice, PayloadAction } from '@reduxjs/toolkit'\n-import Permissions from 'Permissions'\n+import Permissions from 'util/Permissions'\ninterface UserState {\npermissions: Permissions[]\n"
},
{
"change_type": "RENAME",
"old_path": "src/Permissions.ts",
"new_path": "src/util/Permissions.ts",
"diff": "enum Permissions {\nReadPatients = 'read:patients',\n- WritePatients = 'write:patients'\n+ WritePatients = 'write:patients',\n}\nexport default Permissions\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | style(init): fix lint errors |
288,323 | 27.11.2019 06:47:23 | 21,600 | 89af6090b4fd4c67659c542faa755b6d8b750adf | docs(readme): add project status | [
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "<div align=\"center\">\n-[](https://img.shields.io/github/release) [](https://github.com/HospitalRun/frontend/actions) [](https://dev.azure.com/HospitalRun/hospitalrun-frontend/_build/latest?definitionId=3&branchName=master) [](https://travis-ci.com/HospitalRun/hospitalrun-frontend) [](https://coveralls.io/github/HospitalRun/hospitalrun-frontend?branch=master) [](https://app.fossa.io/projects/git%2Bgithub.com%2FHospitalRun%2Fhospitalrun-frontend?ref=badge_large) [](http://commitizen.github.io/cz-cli/)\n+[](https://img.shields.io/github/release)  [](https://github.com/HospitalRun/frontend/actions) [](https://dev.azure.com/HospitalRun/hospitalrun-frontend/_build/latest?definitionId=3&branchName=master) [](https://travis-ci.com/HospitalRun/hospitalrun-frontend) [](https://coveralls.io/github/HospitalRun/hospitalrun-frontend?branch=master) [](https://app.fossa.io/projects/git%2Bgithub.com%2FHospitalRun%2Fhospitalrun-frontend?ref=badge_large) [](http://commitizen.github.io/cz-cli/)\n[](https://github.com/semantic-release/semantic-release)  [](https://hospitalrun-slack.herokuapp.com) [](https://spectrum.chat/hospitalrun)\n</div>\nReact frontend for [HospitalRun](http://hospitalrun.io/): free software for developing world hospitals.\n+Current Status:\n+\n---\n<hr />\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | docs(readme): add project status |
288,323 | 28.11.2019 10:04:25 | 21,600 | 078dcf9d7b2611fc4ea8546479194664a88c3276 | feat(init): add hospitalrun/components to package.json | [
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"private\": false,\n\"license\": \"MIT\",\n\"dependencies\": {\n+ \"@hospitalrun/components\": \"^0.19.0\",\n\"@reduxjs/toolkit\": \"~1.0.4\",\n\"@semantic-release/changelog\": \"~3.0.4\",\n\"@semantic-release/git\": \"~7.0.16\",\n\"eslint-plugin-react\": \"~7.16.0\",\n\"eslint-plugin-react-hooks\": \"~2.2.0\",\n\"husky\": \"~3.0.5\",\n- \"lint-staged\": \"~9.5.0\",\n\"jest\": \"~24.9.0\",\n+ \"lint-staged\": \"~9.5.0\",\n\"prettier\": \"~1.19.1\",\n\"semantic-release\": \"~15.13.24\"\n},\n"
},
{
"change_type": "MODIFY",
"old_path": "src/components/Navbar.tsx",
"new_path": "src/components/Navbar.tsx",
"diff": "@@ -16,7 +16,7 @@ const Navbar = () => {\n}}\nbg=\"dark\"\nvariant=\"dark\"\n- onSeachButtonClick={() => console.log('hello')}\n+ onSearchButtonClick={() => console.log('hello')}\nonSearchTextBoxChange={() => console.log('hello')}\nnavLinks={[\n{\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | feat(init): add hospitalrun/components to package.json |
288,323 | 28.11.2019 10:07:29 | 21,600 | 999173022e3b6b55a6a5d670176e19b111888c69 | style(lint): removed unnecessary eslint configurations | [
{
"change_type": "MODIFY",
"old_path": ".eslintrc.js",
"new_path": ".eslintrc.js",
"diff": "@@ -44,8 +44,6 @@ module.exports = {\n'arrow-body-style': ['warn', 'as-needed'],\n'no-param-reassign': ['error', { props: false }],\n'import/prefer-default-export': 'off',\n- 'import/no-extraneous-dependencies': 'off',\n- 'import/no-unresolved': 'off',\n'no-console': 'off',\n'eol-last': ['error', 'always'],\n'no-debugger': 'error',\n"
},
{
"change_type": "MODIFY",
"old_path": "src/clients/db/PatientRepository.ts",
"new_path": "src/clients/db/PatientRepository.ts",
"diff": "-import Patient from 'model/Patient'\n+import Patient from '../../model/Patient'\nimport Repository from './Repository'\nimport { patients } from '../../config/pouchdb'\n"
},
{
"change_type": "MODIFY",
"old_path": "src/clients/db/Repository.ts",
"new_path": "src/clients/db/Repository.ts",
"diff": "/* eslint \"@typescript-eslint/camelcase\": \"off\" */\n-import AbstractDBModel from 'model/AbstractDBModel'\n+import AbstractDBModel from '../../model/AbstractDBModel'\nfunction mapRow(row: any): any {\nconst { value, doc } = row\n"
},
{
"change_type": "MODIFY",
"old_path": "src/containers/Dashboard.tsx",
"new_path": "src/containers/Dashboard.tsx",
"diff": "import React from 'react'\n-import useTitle from 'util/useTitle'\nimport { useTranslation } from 'react-i18next'\n+import useTitle from '../util/useTitle'\nconst Dashboard: React.FC = () => {\nconst { t } = useTranslation()\n"
},
{
"change_type": "MODIFY",
"old_path": "src/containers/HospitalRun.tsx",
"new_path": "src/containers/HospitalRun.tsx",
"diff": "import React from 'react'\nimport { Switch, Route } from 'react-router-dom'\nimport { useSelector } from 'react-redux'\n-import Sidebar from 'components/Sidebar'\n-import Permissions from 'util/Permissions'\n+import Sidebar from '../components/Sidebar'\n+import Permissions from '../util/Permissions'\nimport Dashboard from './Dashboard'\nimport Patients from './Patients'\nimport NewPatient from './NewPatient'\n"
},
{
"change_type": "MODIFY",
"old_path": "src/containers/NewPatient.tsx",
"new_path": "src/containers/NewPatient.tsx",
"diff": "import React, { useState } from 'react'\nimport { useDispatch } from 'react-redux'\nimport { withRouter, useHistory } from 'react-router-dom'\n-import { createPatient } from 'slices/patients-slice'\n-import Patient from 'model/Patient'\n-import PatientForm from 'components/PatientForm'\n-import useTitle from 'util/useTitle'\nimport { useTranslation } from 'react-i18next'\n+import { createPatient } from '../slices/patients-slice'\n+import Patient from '../model/Patient'\n+import PatientForm from '../components/PatientForm'\n+import useTitle from '../util/useTitle'\nconst NewPatient = () => {\nconst { t } = useTranslation()\n"
},
{
"change_type": "MODIFY",
"old_path": "src/containers/Patients.tsx",
"new_path": "src/containers/Patients.tsx",
"diff": "import React, { useEffect } from 'react'\nimport { useSelector, useDispatch } from 'react-redux'\nimport { Link } from 'react-router-dom'\n-import useTitle from 'util/useTitle'\nimport { useTranslation } from 'react-i18next'\nimport { Spinner } from '@hospitalrun/components'\n+import useTitle from '../util/useTitle'\nimport { RootState } from '../store/store'\nimport { fetchPatients } from '../slices/patients-slice'\n"
},
{
"change_type": "MODIFY",
"old_path": "src/containers/ViewPatient.tsx",
"new_path": "src/containers/ViewPatient.tsx",
"diff": "@@ -2,8 +2,8 @@ import React, { useState, useEffect } from 'react'\nimport { useDispatch, useSelector } from 'react-redux'\nimport { withRouter, useHistory, useParams } from 'react-router-dom'\nimport { Button, Alert, Spinner } from '@hospitalrun/components'\n-import useTitle from 'util/useTitle'\nimport { useTranslation } from 'react-i18next'\n+import useTitle from '../util/useTitle'\nimport { fetchPatient, updatePatient } from '../slices/patient-slice'\nimport { RootState } from '../store/store'\nimport Patient from '../model/Patient'\n"
},
{
"change_type": "MODIFY",
"old_path": "src/slices/user-slice.ts",
"new_path": "src/slices/user-slice.ts",
"diff": "import { createSlice, PayloadAction } from '@reduxjs/toolkit'\n-import Permissions from 'util/Permissions'\n+import Permissions from '../util/Permissions'\ninterface UserState {\npermissions: Permissions[]\n"
},
{
"change_type": "MODIFY",
"old_path": "src/util/useTitle.tsx",
"new_path": "src/util/useTitle.tsx",
"diff": "import { useEffect } from 'react'\nimport { useDispatch } from 'react-redux'\n-import { updateTitle } from 'slices/title-slice'\n+import { updateTitle } from '../slices/title-slice'\nexport default function useTitle(title: string): void {\nconst dispatch = useDispatch()\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | style(lint): removed unnecessary eslint configurations |
288,323 | 28.11.2019 10:08:51 | 21,600 | cd861e3adb2c15ce53ce3c69676f7e5c0eeff6ec | feat(init): rename store/store.ts to store/index.ts | [
{
"change_type": "MODIFY",
"old_path": "src/App.tsx",
"new_path": "src/App.tsx",
"diff": "@@ -4,7 +4,7 @@ import { Provider } from 'react-redux'\nimport { Spinner } from '@hospitalrun/components'\nimport HospitalRun from './containers/HospitalRun'\n-import store from './store/store'\n+import store from './store'\nconst App: React.FC = () => (\n<div>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/containers/HospitalRun.tsx",
"new_path": "src/containers/HospitalRun.tsx",
"diff": "@@ -7,7 +7,7 @@ import Dashboard from './Dashboard'\nimport Patients from './Patients'\nimport NewPatient from './NewPatient'\nimport ViewPatient from './ViewPatient'\n-import { RootState } from '../store/store'\n+import { RootState } from '../store'\nimport Navbar from '../components/Navbar'\nimport PrivateRoute from '../components/PrivateRoute'\n"
},
{
"change_type": "MODIFY",
"old_path": "src/containers/Patients.tsx",
"new_path": "src/containers/Patients.tsx",
"diff": "@@ -4,7 +4,7 @@ import { Link } from 'react-router-dom'\nimport { useTranslation } from 'react-i18next'\nimport { Spinner } from '@hospitalrun/components'\nimport useTitle from '../util/useTitle'\n-import { RootState } from '../store/store'\n+import { RootState } from '../store'\nimport { fetchPatients } from '../slices/patients-slice'\nconst Patients = () => {\n"
},
{
"change_type": "MODIFY",
"old_path": "src/containers/ViewPatient.tsx",
"new_path": "src/containers/ViewPatient.tsx",
"diff": "@@ -5,7 +5,7 @@ import { Button, Alert, Spinner } from '@hospitalrun/components'\nimport { useTranslation } from 'react-i18next'\nimport useTitle from '../util/useTitle'\nimport { fetchPatient, updatePatient } from '../slices/patient-slice'\n-import { RootState } from '../store/store'\n+import { RootState } from '../store'\nimport Patient from '../model/Patient'\nimport PatientForm from '../components/PatientForm'\n"
},
{
"change_type": "MODIFY",
"old_path": "src/slices/patient-slice.ts",
"new_path": "src/slices/patient-slice.ts",
"diff": "import { createSlice, PayloadAction } from '@reduxjs/toolkit'\nimport Patient from '../model/Patient'\nimport PatientRepository from '../clients/db/PatientRepository'\n-import { AppThunk } from '../store/store'\n+import { AppThunk } from '../store'\ninterface PatientState {\nisLoading: boolean\n"
},
{
"change_type": "MODIFY",
"old_path": "src/slices/patients-slice.ts",
"new_path": "src/slices/patients-slice.ts",
"diff": "import { createSlice, PayloadAction } from '@reduxjs/toolkit'\nimport Patient from '../model/Patient'\nimport PatientRepository from '../clients/db/PatientRepository'\n-import { AppThunk } from '../store/store'\n+import { AppThunk } from '../store'\ninterface PatientsState {\nisLoading: boolean\n"
},
{
"change_type": "MODIFY",
"old_path": "src/slices/title-slice.ts",
"new_path": "src/slices/title-slice.ts",
"diff": "import { createSlice, PayloadAction } from '@reduxjs/toolkit'\n-import { AppThunk } from '../store/store'\n+import { AppThunk } from '../store'\ninterface TitleState {\ntitle: string\n"
},
{
"change_type": "RENAME",
"old_path": "src/store/store.ts",
"new_path": "src/store/index.ts",
"diff": ""
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | feat(init): rename store/store.ts to store/index.ts |
288,323 | 28.11.2019 10:25:54 | 21,600 | 500c680795a3b98c7b3e99a3b35058848c8c3a5e | fix(dep): fix missing react-bootstrap dependency | [
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"i18next-xhr-backend\": \"^3.2.2\",\n\"pouchdb\": \"~7.1.1\",\n\"react\": \"~16.12.0\",\n+ \"react-bootstrap\": \"^1.0.0-beta.16\",\n\"react-dom\": \"~16.12.0\",\n\"react-i18next\": \"^11.2.2\",\n\"react-redux\": \"~7.1.3\",\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | fix(dep): fix missing react-bootstrap dependency |
288,323 | 28.11.2019 11:03:06 | 21,600 | 2edfe1b247ec5d0e5d5e372e0facb82be535af3f | fix(tests): fix matchMediaMock issue when running tests | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/__mocks__/matchMediaMock.js",
"diff": "+window.matchMedia = jest.fn().mockImplementation((query) => ({\n+ matches: false,\n+ media: query,\n+ onchange: null,\n+ addListener: jest.fn(), // deprecated\n+ removeListener: jest.fn(), // deprecated\n+ addEventListener: jest.fn(),\n+ removeEventListener: jest.fn(),\n+ dispatchEvent: jest.fn(),\n+}))\n"
},
{
"change_type": "RENAME",
"old_path": "src/App.test.tsx",
"new_path": "src/__tests__/App.test.tsx",
"diff": "+import '../__mocks__/matchMediaMock'\nimport React from 'react'\nimport ReactDOM from 'react-dom'\n-import App from './App'\n+import App from '../App'\nit('renders without crashing', () => {\nconst div = document.createElement('div')\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | fix(tests): fix matchMediaMock issue when running tests |
288,323 | 28.11.2019 19:49:22 | 21,600 | 3d7be47d1d691b9ef547937a4391c8da1cc39894 | feat(init): remove warnings in tests | [
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"react-router-dom\": \"~5.1.2\",\n\"react-scripts\": \"~3.2.0\",\n\"redux\": \"~4.0.4\",\n- \"redux-logger\": \"~3.0.6\",\n\"redux-thunk\": \"~2.3.0\",\n\"typescript\": \"~3.6.3\"\n},\n\"@types/react-redux\": \"^7.1.5\",\n\"@types/react-router\": \"~5.1.2\",\n\"@types/react-router-dom\": \"~5.1.0\",\n- \"@types/redux-logger\": \"^3.0.7\",\n\"@typescript-eslint/eslint-plugin\": \"~2.9.0\",\n\"@typescript-eslint/parser\": \"~2.9.0\",\n\"commitizen\": \"~4.0.3\",\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/__mocks__/react-i18next.js",
"diff": "+/* eslint-disable */\n+const React = require('react')\n+const reactI18next = require('react-i18next')\n+\n+const hasChildren = (node) => node && (node.children || (node.props && node.props.children))\n+\n+const getChildren = (node) =>\n+ node && node.children ? node.children : node.props && node.props.children\n+\n+const renderNodes = (reactNodes) => {\n+ if (typeof reactNodes === 'string') {\n+ return reactNodes\n+ }\n+\n+ return Object.keys(reactNodes).map((key, i) => {\n+ const child = reactNodes[key]\n+ const isElement = React.isValidElement(child)\n+\n+ if (typeof child === 'string') {\n+ return child\n+ }\n+ if (hasChildren(child)) {\n+ const inner = renderNodes(getChildren(child))\n+ return React.cloneElement(child, { ...child.props, key: i }, inner)\n+ }\n+ if (typeof child === 'object' && !isElement) {\n+ return Object.keys(child).reduce((str, childKey) => `${str}${child[childKey]}`, '')\n+ }\n+\n+ return child\n+ })\n+}\n+\n+const useMock = [(k) => k, {}]\n+useMock.t = (k) => k\n+useMock.i18n = {}\n+\n+module.exports = {\n+ // this mock makes sure any components using the translate HoC receive the t function as a prop\n+ withTranslation: () => (Component) => (props) => <Component t={(k) => k} {...props} />,\n+ Trans: ({ children }) => renderNodes(children),\n+ Translation: ({ children }) => children((k) => k, { i18n: {} }),\n+ useTranslation: () => useMock,\n+\n+ // mock if needed\n+ I18nextProvider: reactI18next.I18nextProvider,\n+ initReactI18next: reactI18next.initReactI18next,\n+ setDefaults: reactI18next.setDefaults,\n+ getDefaults: reactI18next.getDefaults,\n+ setI18n: reactI18next.setI18n,\n+ getI18n: reactI18next.getI18n,\n+}\n+\n"
},
{
"change_type": "MODIFY",
"old_path": "src/store/index.ts",
"new_path": "src/store/index.ts",
"diff": "import { configureStore, combineReducers, Action } from '@reduxjs/toolkit'\nimport ReduxThunk, { ThunkAction } from 'redux-thunk'\n-import { createLogger } from 'redux-logger'\n-\nimport patient from '../slices/patient-slice'\nimport patients from '../slices/patients-slice'\nimport title from '../slices/title-slice'\n@@ -16,7 +14,7 @@ const reducer = combineReducers({\nconst store = configureStore({\nreducer,\n- middleware: [ReduxThunk, createLogger()],\n+ middleware: [ReduxThunk],\n})\nexport type AppDispatch = typeof store.dispatch\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | feat(init): remove warnings in tests |
288,323 | 30.11.2019 14:50:34 | 21,600 | 7373e8de447e79d6a8998736436a1c8396241f0b | feat(init): mock pouchdb | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "jest.config.js",
"diff": "+module.exports = {\n+ roots: ['<rootDir>/src'],\n+ testMatch: ['**/__tests__/**/*.+(ts|tsx|js)', '**/?(*.)+(spec|test).+(ts|tsx|js)'],\n+ transform: {\n+ '^.+\\\\.(ts|tsx)$': 'ts-jest',\n+ },\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"i18next-browser-languagedetector\": \"^4.0.1\",\n\"i18next-xhr-backend\": \"^3.2.2\",\n\"pouchdb\": \"~7.1.1\",\n+ \"pouchdb-adapter-memory\": \"^7.1.1\",\n\"react\": \"~16.12.0\",\n\"react-bootstrap\": \"^1.0.0-beta.16\",\n\"react-dom\": \"~16.12.0\",\n\"cross-env\": \"~6.0.3\",\n\"cz-conventional-changelog\": \"~3.0.2\",\n\"dateformat\": \"~3.0.3\",\n+ \"enzyme\": \"^3.10.0\",\n+ \"enzyme-adapter-react-16\": \"^1.15.1\",\n\"eslint\": \"~6.6.0\",\n\"eslint-config-airbnb\": \"~18.0.1\",\n\"eslint-config-prettier\": \"~6.5.0\",\n\"husky\": \"~3.0.5\",\n\"jest\": \"~24.9.0\",\n\"lint-staged\": \"~9.5.0\",\n+ \"memdown\": \"^5.1.0\",\n\"prettier\": \"~1.19.1\",\n- \"semantic-release\": \"~15.13.24\"\n+ \"semantic-release\": \"~15.13.24\",\n+ \"ts-jest\": \"^24.2.0\"\n},\n\"scripts\": {\n\"commit\": \"npx git-cz\",\n\"start\": \"react-scripts start\",\n\"build\": \"react-scripts build\",\n\"prepublishOnly\": \"npm run build\",\n- \"pretest\": \"npm run lint && npm run build\",\n- \"test\": \"react-scripts test\",\n+ \"test\": \"react-scripts test --detectOpenHandles\",\n\"test:ci\": \"cross-env CI=true react-scripts test\",\n\"lint\": \"eslint \\\"src/**/*.{js,jsx,ts,tsx}\\\" --fix\",\n\"coveralls\": \"jest --coverage --coverageReporters=text-lcov | coveralls\",\n"
},
{
"change_type": "MODIFY",
"old_path": "src/__tests__/App.test.tsx",
"new_path": "src/__tests__/App.test.tsx",
"diff": "import '../__mocks__/matchMediaMock'\nimport React from 'react'\n-import ReactDOM from 'react-dom'\n+import { mount } from 'enzyme'\n+import HospitalRun from '../containers/HospitalRun'\nimport App from '../App'\nit('renders without crashing', () => {\n- const div = document.createElement('div')\n- ReactDOM.render(<App />, div)\n- ReactDOM.unmountComponentAtNode(div)\n+ const wrapper = mount(<App />)\n+ expect(wrapper.find(HospitalRun)).toHaveLength(1)\n})\n"
},
{
"change_type": "MODIFY",
"old_path": "src/config/pouchdb.ts",
"new_path": "src/config/pouchdb.ts",
"diff": "import PouchDB from 'pouchdb'\n-export const patients = new PouchDB('patients')\n-PouchDB.sync(\n- 'patients',\n- 'https://a27fa3db-db4d-4456-8465-da953aee0f5b-bluemix:cd6f332d39f24d2b7cfc89d82f6836d46012ef3188698319b0d5fff177cb2ddc@a27fa3db-db4d-4456-8465-da953aee0f5b-bluemix.cloudantnosqldb.appdomain.cloud/patients',\n- // IBM Cloudant testing and developing database\n+// eslint-disable-next-line\n+const memoryAdapter = require('pouchdb-adapter-memory')\n+\n+PouchDB.plugin(memoryAdapter)\n+\n+function createDb(name: string) {\n+ if (process.env.NODE_ENV === 'test') {\n+ return new PouchDB(name, { adapter: 'memory' })\n+ }\n+\n+ const db = new PouchDB(name)\n+ db.sync(\n+ `https://a27fa3db-db4d-4456-8465-da953aee0f5b-bluemix:cd6f332d39f24d2b7cfc89d82f6836d46012ef3188698319b0d5fff177cb2ddc@a27fa3db-db4d-4456-8465-da953aee0f5b-bluemix.cloudantnosqldb.appdomain.cloud/${name}`,\n{\nlive: true,\nretry: true,\n},\n).on('change', (info) => {\n- // handle change\nconsole.log(info)\n})\n+\n+ return db\n+}\n+\n+export const patients = createDb('patients')\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/setupTests.js",
"diff": "+/* eslint-disable import/no-extraneous-dependencies */\n+import Enzyme from 'enzyme'\n+import Adapter from 'enzyme-adapter-react-16'\n+\n+Enzyme.configure({ adapter: new Adapter() })\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | feat(init): mock pouchdb |
288,336 | 11.12.2019 01:47:05 | 0 | 595a887ff097320b02c38a0b1e560e44d1f1060e | Add run on repl.it badge to README
This pull request configures this repository to be run on Repl.it. It adds a `.replit` configuration file and a Repl.it badge to the `README`.
You can read more about running repos on Repl.it [here](https://docs.repl.it/repls/dot-replit), or view the Repl [here](https://repl.it/@Kognise/hospitalrun-frontend-5). | [
{
"change_type": "ADD",
"old_path": null,
"new_path": ".replit",
"diff": "+language = \"nodejs\"\n+run = \"npm start\"\n"
},
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "<div align=\"center\">\n[](https://img.shields.io/github/release)  [](https://github.com/HospitalRun/frontend/actions) [](https://dev.azure.com/HospitalRun/hospitalrun-frontend/_build/latest?definitionId=3&branchName=master) [](https://travis-ci.com/HospitalRun/hospitalrun-frontend) [](https://coveralls.io/github/HospitalRun/hospitalrun-frontend?branch=master) [](https://app.fossa.io/projects/git%2Bgithub.com%2FHospitalRun%2Fhospitalrun-frontend?ref=badge_large) [](http://commitizen.github.io/cz-cli/)\n-[](https://github.com/semantic-release/semantic-release)  [](https://hospitalrun-slack.herokuapp.com) [](https://spectrum.chat/hospitalrun)\n+[](https://github.com/semantic-release/semantic-release)  [](https://hospitalrun-slack.herokuapp.com) [](https://spectrum.chat/hospitalrun) [](https://repl.it/github/HospitalRun/hospitalrun-frontend)\n</div>\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Add run on repl.it badge to README
This pull request configures this repository to be run on Repl.it. It adds a `.replit` configuration file and a Repl.it badge to the `README`.
You can read more about running repos on Repl.it [here](https://docs.repl.it/repls/dot-replit), or view the Repl [here](https://repl.it/@Kognise/hospitalrun-frontend-5). |
288,326 | 11.12.2019 19:27:10 | 10,800 | 03729e5edd919d1e8e392daac2581d7a4b2c8edb | feat(i18n): add translation resources
Add 8 other most used languages on the internet to static i18n translation resources with initial
rough translations from google tranlsate. | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "public/locales/de/translation.json",
"diff": "+{\n+ \"dashboard\": {\n+ \"label\": \"Dashboard\"\n+ },\n+ \"patients\": {\n+ \"label\": \"Patienten\",\n+ \"viewPatients\": \"Patienten anzeigen\",\n+ \"viewPatient\": \"Patient anzeigen\",\n+ \"newPatient\": \"Neuer Patient\"\n+ },\n+ \"patient\": {\n+ \"firstName\": \"Vorname\",\n+ \"lastName\": \"Nachname\"\n+ },\n+ \"actions\": {\n+ \"edit\": \"Bearbeiten\",\n+ \"save\": \"speichern\",\n+ \"cancel\": \"Stornieren\",\n+ \"new\": \"Neu\",\n+ \"list\": \"Liste\"\n+ }\n+}\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "public/locales/es/translation.json",
"diff": "+{\n+ \"dashboard\": {\n+ \"label\": \"Panel\"\n+ },\n+ \"patients\": {\n+ \"label\": \"Pacientes\",\n+ \"viewPatients\": \"Ver pacientes\",\n+ \"viewPatient\": \"Ver pacientes\",\n+ \"newPatient\": \"Nuevo paciente\"\n+ },\n+ \"patient\": {\n+ \"firstName\": \"Nombre de pila\",\n+ \"lastName\": \"Apellido\"\n+ },\n+ \"actions\": {\n+ \"edit\": \"Editar\",\n+ \"save\": \"Guardar\",\n+ \"cancel\": \"Cancelar\",\n+ \"new\": \"Nuevo\",\n+ \"list\": \"Lista\"\n+ }\n+}\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "public/locales/in/translation.json",
"diff": "+{\n+ \"dashboard\": {\n+ \"label\": \"Dasbor\"\n+ },\n+ \"patients\": {\n+ \"label\": \"Pasien\",\n+ \"viewPatients\": \"Lihat Pasien\",\n+ \"viewPatient\": \"Lihat Pasien\",\n+ \"newPatient\": \"Pasien Baru\"\n+ },\n+ \"patient\": {\n+ \"firstName\": \"Nama depan\",\n+ \"lastName\": \"Nama keluarga\"\n+ },\n+ \"actions\": {\n+ \"edit\": \"Edit\",\n+ \"save\": \"Menyimpan\",\n+ \"cancel\": \"Membatalkan\",\n+ \"new\": \"Baru\",\n+ \"list\": \"Daftar\"\n+ }\n+}\n\\ No newline at end of file\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | feat(i18n): add translation resources
Add 8 other most used languages on the internet to static i18n translation resources with initial
rough translations from google tranlsate. |
288,326 | 13.12.2019 13:34:02 | 10,800 | b1e830c256a5667e39dd198f6cc09aa9eedcf51b | refactor: improve-translation-resources-structure
fix | [
{
"change_type": "RENAME",
"old_path": "public/locales/ar/translation.json",
"new_path": "public/app-sections/languages/ar/translation.json",
"diff": ""
},
{
"change_type": "RENAME",
"old_path": "public/locales/de/translation.json",
"new_path": "public/app-sections/languages/de/translation.json",
"diff": ""
},
{
"change_type": "RENAME",
"old_path": "public/locales/en/translation.json",
"new_path": "public/app-sections/languages/en/translation.json",
"diff": ""
},
{
"change_type": "RENAME",
"old_path": "public/locales/es/translation.json",
"new_path": "public/app-sections/languages/es/translation.json",
"diff": ""
},
{
"change_type": "RENAME",
"old_path": "public/locales/in/translation.json",
"new_path": "public/app-sections/languages/in/translation.json",
"diff": ""
},
{
"change_type": "RENAME",
"old_path": "public/locales/ja/translation.json",
"new_path": "public/app-sections/languages/ja/translation.json",
"diff": ""
},
{
"change_type": "RENAME",
"old_path": "public/locales/pt/translation.json",
"new_path": "public/app-sections/languages/pt/translation.json",
"diff": ""
},
{
"change_type": "RENAME",
"old_path": "public/locales/ru/translation.json",
"new_path": "public/app-sections/languages/ru/translation.json",
"diff": ""
},
{
"change_type": "RENAME",
"old_path": "public/locales/zr/translation.json",
"new_path": "public/app-sections/languages/zr/translation.json",
"diff": ""
},
{
"change_type": "MODIFY",
"old_path": "src/i18n.js",
"new_path": "src/i18n.js",
"diff": "@@ -4,7 +4,7 @@ import LanguageDetector from 'i18next-browser-languagedetector'\nimport { initReactI18next } from 'react-i18next'\ni18n\n- // load translation using xhr -> see /public/locales\n+ // load translation using xhr -> see /public/app-sections/languages\n// learn more: https://github.com/i18next/i18next-xhr-backend\n.use(Backend)\n// detect user language\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | refactor: improve-translation-resources-structure
fix #1668 |
288,323 | 16.12.2019 22:12:48 | 21,600 | c2ef440425b15baa64a262f64d0d81d355856294 | feat(patients): add tests for patients-slice and move files | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/__tests__/patients/patients-slice.test.ts",
"diff": "+import * as patientsSlice from '../../patients/patients-slice'\n+import { AnyAction } from 'redux'\n+import { createMemoryHistory } from 'history'\n+import Patient from '../../model/Patient'\n+import PatientRepository from '../../clients/db/PatientRepository'\n+import { mocked } from 'ts-jest/utils'\n+\n+describe('patients slice', () => {\n+ beforeEach(() => {\n+ jest.resetAllMocks()\n+ })\n+\n+ describe('patients reducer', () => {\n+ it('should create the proper initial state with empty patients array', () => {\n+ const patientsStore = patientsSlice.default(undefined, {} as AnyAction)\n+ expect(patientsStore.isLoading).toBeFalsy()\n+ expect(patientsStore.patients).toHaveLength(0)\n+ })\n+\n+ it('should handle the CREATE_PATIENT_START action', () => {\n+ const patientsStore = patientsSlice.default(undefined, {\n+ type: patientsSlice.createPatientStart.type,\n+ })\n+\n+ expect(patientsStore.isLoading).toBeTruthy()\n+ })\n+\n+ it('should handle the CREATE_PATIENT_SUCCESS actions', () => {\n+ const patientsStore = patientsSlice.default(undefined, {\n+ type: patientsSlice.createPatientSuccess().type,\n+ })\n+\n+ expect(patientsStore.isLoading).toBeFalsy()\n+ })\n+ })\n+\n+ describe('createPatient()', () => {\n+ it('should dispatch the CREATE_PATIENT_START action', async () => {\n+ const dispatch = jest.fn()\n+ const getState = jest.fn()\n+ const expectedPatient = {\n+ id: 'id',\n+ } as Patient\n+\n+ await patientsSlice.createPatient(expectedPatient, createMemoryHistory())(\n+ dispatch,\n+ getState,\n+ null,\n+ )\n+\n+ expect(dispatch).toHaveBeenCalledWith({ type: patientsSlice.createPatientStart.type })\n+ })\n+\n+ it('should call the PatientRepository save method with the correct patient', async () => {\n+ const dispatch = jest.fn()\n+ const getState = jest.fn()\n+ jest.spyOn(PatientRepository, 'save')\n+ const expectedPatient = {\n+ id: 'id',\n+ } as Patient\n+\n+ await patientsSlice.createPatient(expectedPatient, createMemoryHistory())(\n+ dispatch,\n+ getState,\n+ null,\n+ )\n+\n+ expect(PatientRepository.save).toHaveBeenCalledWith(expectedPatient)\n+ })\n+\n+ it('should dispatch the CREATE_PATIENT_SUCCESS action', async () => {\n+ const dispatch = jest.fn()\n+ const getState = jest.fn()\n+ const mockedPatientRepository = mocked(PatientRepository, true)\n+ mockedPatientRepository.save.mockResolvedValue({ id: '12345' } as Patient)\n+ const expectedPatient = {\n+ id: 'id',\n+ } as Patient\n+\n+ await patientsSlice.createPatient(expectedPatient, createMemoryHistory())(\n+ dispatch,\n+ getState,\n+ null,\n+ )\n+\n+ expect(dispatch).toHaveBeenCalledWith({ type: patientsSlice.createPatientSuccess().type })\n+ })\n+\n+ it('should navigate to the /patients/:id where id is the new patient id', async () => {\n+ const expectedPatientId = '12345'\n+ const mockedPatientRepository = mocked(PatientRepository, true)\n+ mockedPatientRepository.save.mockResolvedValue({ id: expectedPatientId } as Patient)\n+ const history = createMemoryHistory()\n+\n+ const dispatch = jest.fn()\n+ const getState = jest.fn()\n+ const expectedPatient = {} as Patient\n+\n+ await patientsSlice.createPatient(expectedPatient, history)(dispatch, getState, null)\n+\n+ expect(history.entries[1].pathname).toEqual(`/patients/${expectedPatientId}`)\n+ })\n+ })\n+})\n"
},
{
"change_type": "MODIFY",
"old_path": "src/containers/ViewPatient.tsx",
"new_path": "src/containers/ViewPatient.tsx",
"diff": "@@ -4,7 +4,7 @@ import { withRouter, useParams } from 'react-router-dom'\nimport { Spinner } from '@hospitalrun/components'\nimport { useTranslation } from 'react-i18next'\nimport useTitle from '../util/useTitle'\n-import { fetchPatient } from '../slices/patient-slice'\n+import { fetchPatient } from '../patients/patient-slice'\nimport { RootState } from '../store'\nconst ViewPatient = () => {\n"
},
{
"change_type": "MODIFY",
"old_path": "src/patients/patients-slice.ts",
"new_path": "src/patients/patients-slice.ts",
"diff": "@@ -28,11 +28,10 @@ const patientsSlice = createSlice({\nstate.patients = payload\n},\ncreatePatientSuccess(state) {\n- state.isLoading = true\n+ state.isLoading = false\n},\n},\n})\n-\nexport const {\ngetPatientsStart,\ngetAllPatientsSuccess,\n@@ -44,7 +43,8 @@ export const createPatient = (patient: Patient, history: any): AppThunk => async\ntry {\ndispatch(createPatientStart())\nconst newPatient = await PatientRepository.save(patient)\n- history.push(newPatient.id)\n+ dispatch(createPatientSuccess())\n+ history.push(`patients/${newPatient.id}`)\n} catch (error) {\nconsole.log(error)\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/patients/patients/Patients.tsx",
"new_path": "src/patients/patients/Patients.tsx",
"diff": "@@ -4,7 +4,7 @@ import { Link } from 'react-router-dom'\nimport { useTranslation } from 'react-i18next'\nimport { Spinner } from '@hospitalrun/components'\nimport { RootState } from '../../store'\n-import { fetchPatients } from '../../slices/patients-slice'\n+import { fetchPatients } from '../patients-slice'\nimport useTitle from '../../util/useTitle'\nconst Patients = () => {\n"
},
{
"change_type": "MODIFY",
"old_path": "src/store/index.ts",
"new_path": "src/store/index.ts",
"diff": "import { configureStore, combineReducers, Action } from '@reduxjs/toolkit'\nimport ReduxThunk, { ThunkAction } from 'redux-thunk'\n-import patient from '../slices/patient-slice'\n-import patients from '../slices/patients-slice'\n+import patient from '../patients/patient-slice'\n+import patients from '../patients/patients-slice'\nimport title from '../slices/title-slice'\nimport user from '../slices/user-slice'\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | feat(patients): add tests for patients-slice and move files |
288,323 | 16.12.2019 22:35:48 | 21,600 | 66c1f00a704a77f17b83d7f957ac56814cc14150 | style(patients): fix eslint issues | [
{
"change_type": "MODIFY",
"old_path": "src/__tests__/patients/new/NewPatientForm.test.tsx",
"new_path": "src/__tests__/patients/new/NewPatientForm.test.tsx",
"diff": "import '../../../__mocks__/matchMediaMock'\nimport React from 'react'\n-import NewPatientForm from \"../../../patients/new/NewPatientForm\"\nimport { shallow, mount } from 'enzyme'\n-import TextInputWithLabelFormGroup from \"../../../components/input/TextInputWithLabelFormGroup\"\n-import SelectWithLabelFormGroup from \"../../../components/input/SelectWithLableFormGroup\";\n-import DatePickerWithLabelFormGroup from \"../../../components/input/DatePickerWithLabelFormGroup\";\n-import TextFieldWithLabelFormGroup from \"../../../components/input/TextFieldWithLabelFormGroup\";\n-import {Button} from \"@hospitalrun/components\";\n+import { Button } from '@hospitalrun/components'\nimport { render, act, fireEvent } from '@testing-library/react'\n-import Patient from \"../../../model/Patient\";\n-import Name from \"../../../model/Name\";\n+import NewPatientForm from '../../../patients/new/NewPatientForm'\n+import TextInputWithLabelFormGroup from '../../../components/input/TextInputWithLabelFormGroup'\n+import SelectWithLabelFormGroup from '../../../components/input/SelectWithLableFormGroup'\n+import DatePickerWithLabelFormGroup from '../../../components/input/DatePickerWithLabelFormGroup'\n+import TextFieldWithLabelFormGroup from '../../../components/input/TextFieldWithLabelFormGroup'\n+import Patient from '../../../model/Patient'\n+import Name from '../../../model/Name'\nconst onSave = jest.fn()\nconst onCancel = jest.fn()\n@@ -17,7 +17,6 @@ const onCancel = jest.fn()\ndescribe('New Patient Form', () => {\ndescribe('layout', () => {\nit('should have a \"Basic Information\" header', () => {\n- // eslint-disable-next-line import/no-unresolved\nconst wrapper = shallow(<NewPatientForm onCancel={onCancel} onSave={onSave} />)\nconst basicInformationHeader = wrapper.find('h3').at(0)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/__tests__/patients/patients-slice.test.ts",
"new_path": "src/__tests__/patients/patients-slice.test.ts",
"diff": "-import * as patientsSlice from '../../patients/patients-slice'\nimport { AnyAction } from 'redux'\nimport { createMemoryHistory } from 'history'\n+import { mocked } from 'ts-jest/utils'\n+import * as patientsSlice from '../../patients/patients-slice'\nimport Patient from '../../model/Patient'\nimport PatientRepository from '../../clients/db/PatientRepository'\n-import { mocked } from 'ts-jest/utils'\ndescribe('patients slice', () => {\nbeforeEach(() => {\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | style(patients): fix eslint issues |
288,323 | 16.12.2019 22:59:50 | 21,600 | c6159af39afb6aa325191e06229908d5e9479479 | feat(patients): adds functionality to save patient | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/__tests__/patients/new/NewPatient.test.tsx",
"diff": "+import '../../../__mocks__/matchMediaMock'\n+import React from 'react'\n+import { mount } from 'enzyme'\n+import { MemoryRouter } from 'react-router'\n+import { Provider } from 'react-redux'\n+import NewPatient from '../../../patients/new/NewPatient'\n+import NewPatientForm from '../../../patients/new/NewPatientForm'\n+import store from '../../../store'\n+import Patient from '../../../model/Patient'\n+import Name from '../../../model/Name'\n+import * as patientSlice from '../../../patients/patients-slice'\n+import * as titleUtil from '../../../util/useTitle'\n+\n+describe('New Patient', () => {\n+ it('should render a new patient form', () => {\n+ const wrapper = mount(\n+ <Provider store={store}>\n+ <MemoryRouter>\n+ <NewPatient />\n+ </MemoryRouter>\n+ </Provider>,\n+ )\n+\n+ expect(wrapper.find(NewPatientForm)).toHaveLength(1)\n+ })\n+\n+ it('should use \"New Patient\" as the header', () => {\n+ jest.spyOn(titleUtil, 'default')\n+ mount(\n+ <Provider store={store}>\n+ <MemoryRouter>\n+ <NewPatient />\n+ </MemoryRouter>\n+ </Provider>,\n+ )\n+\n+ expect(titleUtil.default).toHaveBeenCalledWith('patients.newPatient')\n+ })\n+\n+ it('should call create patient when save button is clicked', async () => {\n+ jest.spyOn(patientSlice, 'createPatient')\n+ const expectedName = new Name('prefix', 'given', 'family', 'suffix')\n+ const expectedPatient = {\n+ name: expectedName,\n+ } as Patient\n+\n+ const wrapper = mount(\n+ <Provider store={store}>\n+ <MemoryRouter>\n+ <NewPatient />\n+ </MemoryRouter>\n+ </Provider>,\n+ )\n+\n+ const newPatientForm = wrapper.find(NewPatientForm)\n+\n+ await newPatientForm.prop('onSave')(expectedPatient)\n+\n+ expect(patientSlice.createPatient).toHaveBeenCalledWith(expectedPatient, expect.anything())\n+ })\n+})\n"
},
{
"change_type": "MODIFY",
"old_path": "src/patients/new/NewPatient.tsx",
"new_path": "src/patients/new/NewPatient.tsx",
"diff": "import React from 'react'\nimport { useHistory } from 'react-router'\nimport { useTranslation } from 'react-i18next'\n+import { useDispatch } from 'react-redux'\nimport NewPatientForm from './NewPatientForm'\nimport useTitle from '../../util/useTitle'\nimport Patient from '../../model/Patient'\n+import { createPatient } from '../patients-slice'\nconst NewPatient = () => {\nconst { t } = useTranslation()\nconst history = useHistory()\n+ const dispatch = useDispatch()\nuseTitle(t('patients.newPatient'))\nconst onCancel = () => {\n@@ -15,7 +18,7 @@ const NewPatient = () => {\n}\nconst onSave = (patient: Patient) => {\n- console.log(patient)\n+ dispatch(createPatient(patient, history))\n}\nreturn <NewPatientForm onCancel={onCancel} onSave={onSave} />\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | feat(patients): adds functionality to save patient |
288,323 | 16.12.2019 23:00:38 | 21,600 | e4cf64d44ce1c6b9baabff08cb86d557f7a5688c | fix(navbar): fixes broken link to new patients in navbar | [
{
"change_type": "MODIFY",
"old_path": "src/components/Navbar.tsx",
"new_path": "src/components/Navbar.tsx",
"diff": "@@ -31,7 +31,7 @@ const Navbar = () => {\n{\nlabel: t('actions.new'),\nonClick: () => {\n- history.push('/patients/new')\n+ history.push('/new/patients')\n},\n},\n],\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | fix(navbar): fixes broken link to new patients in navbar |
288,323 | 16.12.2019 23:12:39 | 21,600 | 8ff0ac913f0cee0f8d738a7cfaee57b2722c350f | fix(patients): fix broken name display in view patient adn lsit patient | [
{
"change_type": "MODIFY",
"old_path": "src/containers/HospitalRun.tsx",
"new_path": "src/containers/HospitalRun.tsx",
"diff": "@@ -4,9 +4,9 @@ import { useSelector } from 'react-redux'\nimport Sidebar from '../components/Sidebar'\nimport Permissions from '../util/Permissions'\nimport Dashboard from './Dashboard'\n-import Patients from '../patients/patients/Patients'\n+import Patients from '../patients/list/Patients'\nimport NewPatient from '../patients/new/NewPatient'\n-import ViewPatient from './ViewPatient'\n+import ViewPatient from '../patients/view/ViewPatient'\nimport { RootState } from '../store'\nimport Navbar from '../components/Navbar'\nimport PrivateRoute from '../components/PrivateRoute'\n"
},
{
"change_type": "RENAME",
"old_path": "src/patients/patients/Patients.tsx",
"new_path": "src/patients/list/Patients.tsx",
"diff": "@@ -25,7 +25,9 @@ const Patients = () => {\n<ul>\n{patients.map((p) => (\n<Link to={`/patients/${p.id}`} key={p.id}>\n- <li key={p.id}>{p.name}</li>\n+ <li key={p.id}>\n+ {p.name.given} {p.name.family}\n+ </li>\n</Link>\n))}\n</ul>\n"
},
{
"change_type": "RENAME",
"old_path": "src/containers/ViewPatient.tsx",
"new_path": "src/patients/view/ViewPatient.tsx",
"diff": "@@ -3,9 +3,9 @@ import { useDispatch, useSelector } from 'react-redux'\nimport { withRouter, useParams } from 'react-router-dom'\nimport { Spinner } from '@hospitalrun/components'\nimport { useTranslation } from 'react-i18next'\n-import useTitle from '../util/useTitle'\n-import { fetchPatient } from '../patients/patient-slice'\n-import { RootState } from '../store'\n+import useTitle from '../../util/useTitle'\n+import { fetchPatient } from '../patient-slice'\n+import { RootState } from '../../store'\nconst ViewPatient = () => {\nconst { t } = useTranslation()\n@@ -26,8 +26,7 @@ const ViewPatient = () => {\nreturn (\n<div className=\"container\">\n- {patient.id}\n- <h1>{`${patient.name}`}</h1>\n+ <h1>{`${patient.name.given} ${patient.name.family}`}</h1>\n</div>\n)\n}\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | fix(patients): fix broken name display in view patient adn lsit patient |
288,323 | 17.12.2019 16:52:42 | 21,600 | 0688530ca6d19e16f590be894f0fda2e6c5a05a6 | Add stories template | [
{
"change_type": "ADD",
"old_path": null,
"new_path": ".github/ISSUE_TEMPLATE/story.md",
"diff": "+---\n+name: Story\n+about: Creates a stubbed story\n+title: ''\n+labels: ''\n+assignees: ''\n+\n+---\n+\n+## Scenario\n+**AS**\n+**SO**\n+**THAT**\n+\n+## Acceptance Criteria\n+**GIVEN**\n+**WHEN**\n+**THEN**\n+\n+## Related Issues\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Add stories template |
288,323 | 17.12.2019 21:56:22 | 21,600 | c8eba48017f6dc27de32f3096a45037fa775c046 | feat(patients): adds ability to approximate age when creating patient | [
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"eslint-plugin-prettier\": \"~3.1.1\",\n\"eslint-plugin-react\": \"~7.17.0\",\n\"eslint-plugin-react-hooks\": \"~2.3.0\",\n+ \"history\": \"~4.10.1\",\n\"husky\": \"~3.1.0\",\n\"jest\": \"~24.9.0\",\n\"lint-staged\": \"~9.5.0\",\n"
},
{
"change_type": "MODIFY",
"old_path": "public/locales/en/translation.json",
"new_path": "public/locales/en/translation.json",
"diff": "\"preferredLanguage\": \"Preferred Language\",\n\"basicInformation\": \"Basic Information\",\n\"contactInformation\": \"Contact Information\",\n+ \"approximateAge\": \"Approximate Age\",\n+ \"unknownDateOfBirth\": \"Unknown\",\n\"types\": {\n\"charity\": \"Charity\",\n\"private\": \"Private\"\n"
},
{
"change_type": "MODIFY",
"old_path": "src/__tests__/patients/new/NewPatientForm.test.tsx",
"new_path": "src/__tests__/patients/new/NewPatientForm.test.tsx",
"diff": "import '../../../__mocks__/matchMediaMock'\n-import React from 'react'\n+import React, { ChangeEvent } from 'react'\nimport { shallow, mount } from 'enzyme'\n-import { Button } from '@hospitalrun/components'\n+import { Button, Checkbox } from '@hospitalrun/components'\nimport { render, act, fireEvent } from '@testing-library/react'\n+import { DateTime } from 'luxon'\nimport NewPatientForm from '../../../patients/new/NewPatientForm'\nimport TextInputWithLabelFormGroup from '../../../components/input/TextInputWithLabelFormGroup'\nimport SelectWithLabelFormGroup from '../../../components/input/SelectWithLableFormGroup'\n@@ -98,6 +99,14 @@ describe('New Patient Form', () => {\nexpect(dateOfBirthTextInput.prop('label')).toEqual('patient.dateOfBirth')\n})\n+ it('should have a unknown checkbox', () => {\n+ const wrapper = shallow(<NewPatientForm onCancel={onCancel} onSave={onSave} />)\n+ const unknownCheckbox = wrapper.find(Checkbox)\n+ expect(unknownCheckbox).toHaveLength(1)\n+ expect(unknownCheckbox.prop('name')).toEqual('unknown')\n+ expect(unknownCheckbox.prop('label')).toEqual('patient.unknownDateOfBirth')\n+ })\n+\nit('should have a patient type dropdown with the proper options', () => {\nconst wrapper = shallow(<NewPatientForm onCancel={onCancel} onSave={onSave} />)\nconst patientTypeDropdown = wrapper.findWhere((w) => w.prop('name') === 'type')\n@@ -194,6 +203,59 @@ describe('New Patient Form', () => {\n})\n})\n+ describe('calculate approximate date of birth', () => {\n+ it('should calculate the approximate date of birth on change and store the value in the date of birth input', () => {\n+ const wrapper = shallow(<NewPatientForm onCancel={onCancel} onSave={onSave} />)\n+ const unknownCheckbox = wrapper.find(Checkbox)\n+\n+ act(() => {\n+ if (unknownCheckbox) {\n+ unknownCheckbox.prop('onChange')!({ target: { checked: true } } as ChangeEvent<\n+ HTMLInputElement\n+ >)\n+ }\n+ })\n+\n+ const approximateAgeInput = wrapper.findWhere((w) => w.prop('name') === 'approximateAge')\n+ act(() => {\n+ approximateAgeInput.prop('onChange')({ target: { value: 5 } })\n+ })\n+\n+ const dateOfBirthTextInput = wrapper.findWhere((w) => w.prop('name') === 'dateOfBirth')\n+\n+ expect(dateOfBirthTextInput.prop('value')).toEqual(\n+ DateTime.local()\n+ .minus({ year: 5 })\n+ .toISODate(),\n+ )\n+ })\n+ })\n+\n+ describe('on unknown checkbox click', () => {\n+ it('should show a approximate age input box when checkbox is checked', () => {\n+ const wrapper = shallow(<NewPatientForm onCancel={onCancel} onSave={onSave} />)\n+ const approximateAgeInputBefore = wrapper.findWhere(\n+ (w) => w.prop('name') === 'approximateAge',\n+ )\n+ expect(approximateAgeInputBefore).toHaveLength(0)\n+\n+ const unknownCheckbox = wrapper.find(Checkbox)\n+\n+ act(() => {\n+ if (unknownCheckbox) {\n+ unknownCheckbox.prop('onChange')!({ target: { checked: true } } as ChangeEvent<\n+ HTMLInputElement\n+ >)\n+ }\n+ })\n+\n+ const approximateAgeInputerAfter = wrapper.findWhere(\n+ (w) => w.prop('name') === 'approximateAge',\n+ )\n+ expect(approximateAgeInputerAfter).toHaveLength(1)\n+ })\n+ })\n+\ndescribe('save button', () => {\nit('should call the onSave prop with the Patient data', async () => {\nconst wrapper = render(<NewPatientForm onCancel={onCancel} onSave={onSave} />)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/components/input/TextInputWithLabelFormGroup.tsx",
"new_path": "src/components/input/TextInputWithLabelFormGroup.tsx",
"diff": "@@ -6,7 +6,7 @@ interface Props {\nlabel: string\nname: string\nisEditable: boolean\n- type: 'text' | 'email'\n+ type: 'text' | 'email' | 'number'\nplaceholder?: string\nonChange: (event: React.ChangeEvent<HTMLInputElement>) => void\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/model/Patient.ts",
"new_path": "src/model/Patient.ts",
"diff": "@@ -8,6 +8,8 @@ export default class Patient extends AbstractDBModel {\ndateOfBirth?: string\n+ isApproximateDateOfBirth?: boolean\n+\nphoneNumber?: string\nemail?: string\n@@ -26,6 +28,7 @@ export default class Patient extends AbstractDBModel {\nname: Name,\nsex: string,\ndateOfBirth?: string,\n+ isApproximateDateOfBirth?: boolean,\nphoneNumber?: string,\nemail?: string,\naddress?: string,\n@@ -37,6 +40,7 @@ export default class Patient extends AbstractDBModel {\nthis.name = name\nthis.sex = sex\nthis.dateOfBirth = dateOfBirth\n+ this.isApproximateDateOfBirth = isApproximateDateOfBirth\nthis.phoneNumber = phoneNumber\nthis.email = email\nthis.address = address\n"
},
{
"change_type": "MODIFY",
"old_path": "src/patients/new/NewPatientForm.tsx",
"new_path": "src/patients/new/NewPatientForm.tsx",
"diff": "import React, { useState } from 'react'\nimport { useTranslation } from 'react-i18next'\n-import { Button } from '@hospitalrun/components'\n+import { Button, Checkbox } from '@hospitalrun/components'\n+import { DateTime } from 'luxon'\nimport SelectWithLabelFormGroup from '../../components/input/SelectWithLableFormGroup'\nimport TextFieldWithLabelFormGroup from '../../components/input/TextFieldWithLabelFormGroup'\nimport TextInputWithLabelFormGroup from '../../components/input/TextInputWithLabelFormGroup'\n@@ -17,13 +18,14 @@ const NewPatientForm = (props: Props) => {\nconst { t } = useTranslation()\nconst [isEditable] = useState(true)\nconst { onCancel, onSave } = props\n+ const [approximateAge, setApproximateAge] = useState(0)\nconst [patient, setPatient] = useState({\ngivenName: '',\nfamilyName: '',\nsuffix: '',\nprefix: '',\ndateOfBirth: '',\n- placeOfBirth: '',\n+ isApproximateDateOfBirth: false,\nsex: '',\nphoneNumber: '',\nemail: '',\n@@ -64,6 +66,21 @@ const NewPatientForm = (props: Props) => {\nonFieldChange(fieldName, event.target.value)\n}\n+ const onApproximateAgeChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n+ let approximateAgeNumber\n+ if (Number.isNaN(parseFloat(event.target.value))) {\n+ approximateAgeNumber = 0\n+ } else {\n+ approximateAgeNumber = parseFloat(event.target.value)\n+ }\n+\n+ setApproximateAge(approximateAgeNumber)\n+ const approximateDateOfBirth = DateTime.local().minus({\n+ years: approximateAgeNumber,\n+ })\n+ setPatient({ ...patient, dateOfBirth: approximateDateOfBirth.toISODate() })\n+ }\n+\nreturn (\n<div>\n<form>\n@@ -133,17 +150,6 @@ const NewPatientForm = (props: Props) => {\n}}\n/>\n</div>\n- <div className=\"col\">\n- <DatePickerWithLabelFormGroup\n- name=\"dateOfBirth\"\n- label={t('patient.dateOfBirth')}\n- isEditable={isEditable}\n- value={patient.dateOfBirth}\n- onChange={(event: React.ChangeEvent<HTMLInputElement>) => {\n- onInputElementChange(event, 'dateOfBirth')\n- }}\n- />\n- </div>\n<div className=\"col\">\n<SelectWithLabelFormGroup\nname=\"type\"\n@@ -161,7 +167,7 @@ const NewPatientForm = (props: Props) => {\n</div>\n</div>\n<div className=\"row\">\n- <div className=\"col-md-4\">\n+ <div className=\"col-md-6\">\n<TextInputWithLabelFormGroup\nlabel={t('patient.occupation')}\nname=\"occupation\"\n@@ -172,7 +178,7 @@ const NewPatientForm = (props: Props) => {\n}}\n/>\n</div>\n- <div className=\"col-md-4\">\n+ <div className=\"col-md-6\">\n<TextInputWithLabelFormGroup\nlabel={t('patient.preferredLanguage')}\nname=\"preferredLanguage\"\n@@ -184,7 +190,42 @@ const NewPatientForm = (props: Props) => {\n/>\n</div>\n</div>\n-\n+ <div className=\"row\">\n+ <div className=\"col-md-4\">\n+ <DatePickerWithLabelFormGroup\n+ name=\"dateOfBirth\"\n+ label={t('patient.dateOfBirth')}\n+ isEditable={isEditable && !patient.isApproximateDateOfBirth}\n+ value={patient.dateOfBirth}\n+ onChange={(event: React.ChangeEvent<HTMLInputElement>) => {\n+ onInputElementChange(event, 'dateOfBirth')\n+ }}\n+ />\n+ </div>\n+ <div className=\"col-md-2\">\n+ <div className=\"form-group\">\n+ <Checkbox\n+ label={t('patient.unknownDateOfBirth')}\n+ name=\"unknown\"\n+ onChange={(event) => {\n+ setPatient({ ...patient, isApproximateDateOfBirth: event.target.checked })\n+ }}\n+ />\n+ </div>\n+ </div>\n+ {patient.isApproximateDateOfBirth && (\n+ <div className=\"col-md-3\">\n+ <TextInputWithLabelFormGroup\n+ label={t('patient.approximateAge')}\n+ name=\"approximateAge\"\n+ type=\"number\"\n+ value={`${approximateAge}`}\n+ isEditable={isEditable}\n+ onChange={onApproximateAgeChange}\n+ />\n+ </div>\n+ )}\n+ </div>\n<h3>{t('patient.contactInformation')}</h3>\n<div className=\"row\">\n<div className=\"col\">\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | feat(patients): adds ability to approximate age when creating patient |
288,323 | 17.12.2019 22:50:37 | 21,600 | bf45cce152ec633efcc60bab12cdd46768ef3d99 | feat(patients): move date of birth information up a line | [
{
"change_type": "MODIFY",
"old_path": "src/patients/new/NewPatientForm.tsx",
"new_path": "src/patients/new/NewPatientForm.tsx",
"diff": "@@ -166,30 +166,6 @@ const NewPatientForm = (props: Props) => {\n/>\n</div>\n</div>\n- <div className=\"row\">\n- <div className=\"col-md-6\">\n- <TextInputWithLabelFormGroup\n- label={t('patient.occupation')}\n- name=\"occupation\"\n- value={patient.occupation}\n- isEditable={isEditable}\n- onChange={(event: React.ChangeEvent<HTMLInputElement>) => {\n- onInputElementChange(event, 'occupation')\n- }}\n- />\n- </div>\n- <div className=\"col-md-6\">\n- <TextInputWithLabelFormGroup\n- label={t('patient.preferredLanguage')}\n- name=\"preferredLanguage\"\n- value={patient.preferredLanguage}\n- isEditable={isEditable}\n- onChange={(event: React.ChangeEvent<HTMLInputElement>) => {\n- onInputElementChange(event, 'preferredLanguage')\n- }}\n- />\n- </div>\n- </div>\n<div className=\"row\">\n<div className=\"col-md-4\">\n<DatePickerWithLabelFormGroup\n@@ -226,6 +202,31 @@ const NewPatientForm = (props: Props) => {\n</div>\n)}\n</div>\n+ <div className=\"row\">\n+ <div className=\"col-md-6\">\n+ <TextInputWithLabelFormGroup\n+ label={t('patient.occupation')}\n+ name=\"occupation\"\n+ value={patient.occupation}\n+ isEditable={isEditable}\n+ onChange={(event: React.ChangeEvent<HTMLInputElement>) => {\n+ onInputElementChange(event, 'occupation')\n+ }}\n+ />\n+ </div>\n+ <div className=\"col-md-6\">\n+ <TextInputWithLabelFormGroup\n+ label={t('patient.preferredLanguage')}\n+ name=\"preferredLanguage\"\n+ value={patient.preferredLanguage}\n+ isEditable={isEditable}\n+ onChange={(event: React.ChangeEvent<HTMLInputElement>) => {\n+ onInputElementChange(event, 'preferredLanguage')\n+ }}\n+ />\n+ </div>\n+ </div>\n+\n<h3>{t('patient.contactInformation')}</h3>\n<div className=\"row\">\n<div className=\"col\">\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | feat(patients): move date of birth information up a line |
288,323 | 18.12.2019 21:26:51 | 21,600 | 97589861aa4fc5e98052f7946befcff8b9c718fb | feat(patients): use hospital run date picker | [
{
"change_type": "MODIFY",
"old_path": "src/__tests__/components/input/DatePickerWithLabelFormGroup.test.tsx",
"new_path": "src/__tests__/components/input/DatePickerWithLabelFormGroup.test.tsx",
"diff": "import '../../../__mocks__/matchMediaMock'\n-import React from 'react'\n-import { Label } from '@hospitalrun/components'\n+import React, { ChangeEvent } from 'react'\n+import { DateTimePicker, Label } from '@hospitalrun/components'\nimport { shallow } from 'enzyme'\nimport DatePickerWithLabelFormGroup from '../../../components/input/DatePickerWithLabelFormGroup'\n@@ -12,7 +12,7 @@ describe('date picker with label form group', () => {\n<DatePickerWithLabelFormGroup\nname={expectedName}\nlabel=\"test\"\n- value=\"\"\n+ value={new Date()}\nisEditable\nonChange={jest.fn()}\n/>,\n@@ -24,22 +24,20 @@ describe('date picker with label form group', () => {\nexpect(label.prop('text')).toEqual(expectedName)\n})\n- it('should render and input box', () => {\n+ it('should render and date time picker', () => {\nconst expectedName = 'test'\nconst wrapper = shallow(\n<DatePickerWithLabelFormGroup\nname={expectedName}\nlabel=\"test\"\n- value=\"\"\n+ value={new Date()}\nisEditable\nonChange={jest.fn()}\n/>,\n)\n- const input = wrapper.find('input')\n+ const input = wrapper.find(DateTimePicker)\nexpect(input).toHaveLength(1)\n- expect(input.prop('id')).toEqual(`${expectedName}DatePicker`)\n- expect(input.prop('type')).toEqual('date')\n})\nit('should render disabled is isDisable disabled is true', () => {\n@@ -48,20 +46,20 @@ describe('date picker with label form group', () => {\n<DatePickerWithLabelFormGroup\nname={expectedName}\nlabel=\"test\"\n- value=\"\"\n+ value={new Date()}\nisEditable={false}\nonChange={jest.fn()}\n/>,\n)\n- const input = wrapper.find('input')\n+ const input = wrapper.find(DateTimePicker)\nexpect(input).toHaveLength(1)\nexpect(input.prop('disabled')).toBeTruthy()\n})\nit('should render the proper value', () => {\nconst expectedName = 'test'\n- const expectedValue = 'expected value'\n+ const expectedValue = new Date()\nconst wrapper = shallow(\n<DatePickerWithLabelFormGroup\nname={expectedName}\n@@ -72,16 +70,16 @@ describe('date picker with label form group', () => {\n/>,\n)\n- const input = wrapper.find('input')\n+ const input = wrapper.find(DateTimePicker)\nexpect(input).toHaveLength(1)\n- expect(input.prop('value')).toEqual(expectedValue)\n+ expect(input.prop('selected')).toEqual(expectedValue)\n})\n})\ndescribe('change handler', () => {\nit('should call the change handler on change', () => {\nconst expectedName = 'test'\n- const expectedValue = 'expected value'\n+ const expectedValue = new Date()\nconst handler = jest.fn()\nconst wrapper = shallow(\n<DatePickerWithLabelFormGroup\n@@ -93,8 +91,10 @@ describe('date picker with label form group', () => {\n/>,\n)\n- const input = wrapper.find('input')\n- input.simulate('change')\n+ const input = wrapper.find(DateTimePicker)\n+ input.prop('onChange')(new Date(), {\n+ target: { value: new Date().toISOString() },\n+ } as ChangeEvent<HTMLInputElement>)\nexpect(handler).toHaveBeenCalledTimes(1)\n})\n})\n"
},
{
"change_type": "MODIFY",
"old_path": "src/__tests__/patients/new/NewPatientForm.test.tsx",
"new_path": "src/__tests__/patients/new/NewPatientForm.test.tsx",
"diff": "@@ -223,8 +223,8 @@ describe('New Patient Form', () => {\nconst dateOfBirthTextInput = wrapper.findWhere((w) => w.prop('name') === 'dateOfBirth')\n- expect(dateOfBirthTextInput.prop('value')).toEqual(\n- DateTime.local()\n+ expect(DateTime.fromJSDate(dateOfBirthTextInput.prop('value')).toISODate()).toEqual(\n+ DateTime.fromJSDate(new Date())\n.minus({ year: 5 })\n.toISODate(),\n)\n@@ -279,7 +279,6 @@ describe('New Patient Form', () => {\nconst expectedFamilyName = 'family name'\nconst expectedSuffix = 'suffix'\nconst expectedSex = 'male'\n- const expectedDateOfBirth = '2019-12-15'\nconst expectedType = 'charity'\nconst expectedOccupation = 'occupation'\nconst expectedPreferredLanguage = 'preferred language'\n@@ -308,12 +307,6 @@ describe('New Patient Form', () => {\n}\n})\n- act(() => {\n- if (dateOfBirthInput) {\n- fireEvent.change(dateOfBirthInput, { target: { value: expectedDateOfBirth } })\n- }\n- })\n-\nact(() => {\nif (patientTypeDropdown) {\nfireEvent.change(patientTypeDropdown, { target: { value: expectedType } })\n@@ -349,8 +342,8 @@ describe('New Patient Form', () => {\nconst expectedPatient = {\nname: new Name(expectedPrefix, expectedGivenName, expectedFamilyName, expectedSuffix),\nsex: expectedSex,\n- dateOfBirth: expectedDateOfBirth,\ntype: expectedType,\n+ dateOfBirth: '',\noccupation: expectedOccupation,\npreferredLanguage: expectedPreferredLanguage,\nphoneNumber: expectedPhoneNumber,\n"
},
{
"change_type": "MODIFY",
"old_path": "src/components/input/DatePickerWithLabelFormGroup.tsx",
"new_path": "src/components/input/DatePickerWithLabelFormGroup.tsx",
"diff": "import React from 'react'\n-import { Label } from '@hospitalrun/components'\n+import { Label, DateTimePicker } from '@hospitalrun/components'\ninterface Props {\nname: string\nlabel: string\n- value: string\n+ value: Date | undefined\nisEditable: boolean\n- onChange: (event: React.ChangeEvent<HTMLInputElement>) => void\n+ onChange: (date: Date) => void\n}\nconst DatePickerWithLabelFormGroup = (props: Props) => {\n- const { onChange, label, name, value, isEditable } = props\n+ const { onChange, label, name, isEditable, value } = props\nconst id = `${name}DatePicker`\nreturn (\n<div className=\"form-group\">\n<Label text={label} htmlFor={id} />\n- <input\n+ <DateTimePicker\n+ dateFormat=\"MM/dd/yyyy\"\n+ dateFormatCalendar=\"LLLL yyyy\"\n+ dropdownMode=\"scroll\"\n+ selected={value}\n+ timeIntervals={30}\n+ withPortal={false}\ndisabled={!isEditable}\n- className=\"form-control\"\n- type=\"date\"\n- value={value}\n- id={id}\n- onChange={onChange}\n+ onChange={(inputDate) => {\n+ onChange(inputDate)\n+ }}\n/>\n</div>\n)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/patients/new/NewPatientForm.tsx",
"new_path": "src/patients/new/NewPatientForm.tsx",
"diff": "@@ -62,6 +62,10 @@ const NewPatientForm = (props: Props) => {\nonFieldChange(fieldName, event.target.value)\n}\n+ const onDateOfBirthChange = (date: string) => {\n+ onFieldChange('dateOfBirth', date)\n+ }\n+\nconst onInputElementChange = (event: React.ChangeEvent<HTMLInputElement>, fieldName: string) => {\nonFieldChange(fieldName, event.target.value)\n}\n@@ -75,10 +79,10 @@ const NewPatientForm = (props: Props) => {\n}\nsetApproximateAge(approximateAgeNumber)\n- const approximateDateOfBirth = DateTime.local().minus({\n+ const approximateDateOfBirth = DateTime.fromJSDate(new Date()).minus({\nyears: approximateAgeNumber,\n})\n- setPatient({ ...patient, dateOfBirth: approximateDateOfBirth.toISODate() })\n+ setPatient({ ...patient, dateOfBirth: approximateDateOfBirth.toISO() })\n}\nreturn (\n@@ -172,9 +176,12 @@ const NewPatientForm = (props: Props) => {\nname=\"dateOfBirth\"\nlabel={t('patient.dateOfBirth')}\nisEditable={isEditable && !patient.isApproximateDateOfBirth}\n- value={patient.dateOfBirth}\n- onChange={(event: React.ChangeEvent<HTMLInputElement>) => {\n- onInputElementChange(event, 'dateOfBirth')\n+ value={patient.dateOfBirth.length > 0 ? new Date(patient.dateOfBirth) : undefined}\n+ onChange={(date: Date) => {\n+ const dateString = DateTime.fromJSDate(date).toISODate()\n+ console.log(date.toISOString())\n+ console.log(dateString)\n+ onDateOfBirthChange(date.toISOString())\n}}\n/>\n</div>\n@@ -190,7 +197,7 @@ const NewPatientForm = (props: Props) => {\n</div>\n</div>\n{patient.isApproximateDateOfBirth && (\n- <div className=\"col-md-3\">\n+ <div className=\"col-md-6\">\n<TextInputWithLabelFormGroup\nlabel={t('patient.approximateAge')}\nname=\"approximateAge\"\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | feat(patients): use hospital run date picker |
288,323 | 20.12.2019 21:49:39 | 21,600 | 9bc43653ac1526ff7e432bd3d5a99fd1a16107a6 | feat(patients): flatten name object | [
{
"change_type": "MODIFY",
"old_path": "src/__tests__/patients/new/NewPatient.test.tsx",
"new_path": "src/__tests__/patients/new/NewPatient.test.tsx",
"diff": "@@ -7,7 +7,6 @@ import NewPatient from '../../../patients/new/NewPatient'\nimport NewPatientForm from '../../../patients/new/NewPatientForm'\nimport store from '../../../store'\nimport Patient from '../../../model/Patient'\n-import Name from '../../../model/Name'\nimport * as patientSlice from '../../../patients/patients-slice'\nimport * as titleUtil from '../../../util/useTitle'\n@@ -39,9 +38,10 @@ describe('New Patient', () => {\nit('should call create patient when save button is clicked', async () => {\njest.spyOn(patientSlice, 'createPatient')\n- const expectedName = new Name('prefix', 'given', 'family', 'suffix')\nconst expectedPatient = {\n- name: expectedName,\n+ sex: 'male',\n+ givenName: 'givenName',\n+ familyName: 'familyName',\n} as Patient\nconst wrapper = mount(\n"
},
{
"change_type": "MODIFY",
"old_path": "src/__tests__/patients/new/NewPatientForm.test.tsx",
"new_path": "src/__tests__/patients/new/NewPatientForm.test.tsx",
"diff": "@@ -10,7 +10,6 @@ import SelectWithLabelFormGroup from '../../../components/input/SelectWithLableF\nimport DatePickerWithLabelFormGroup from '../../../components/input/DatePickerWithLabelFormGroup'\nimport TextFieldWithLabelFormGroup from '../../../components/input/TextFieldWithLabelFormGroup'\nimport Patient from '../../../model/Patient'\n-import Name from '../../../model/Name'\nconst onSave = jest.fn()\nconst onCancel = jest.fn()\n@@ -264,7 +263,6 @@ describe('New Patient Form', () => {\nconst familyNameInput = wrapper.getByPlaceholderText('patient.familyName')\nconst suffixInput = wrapper.getByPlaceholderText('patient.suffix')\nconst sexDropdown = wrapper.getByText('patient.sex').nextElementSibling\n- const dateOfBirthInput = wrapper.getByText('patient.dateOfBirth').nextElementSibling\nconst patientTypeDropdown = wrapper.getByText('patient.type').nextElementSibling\nconst occupationInput = wrapper.getByPlaceholderText('patient.occupation')\nconst preferredLanguageInput = wrapper.getByPlaceholderText('patient.preferredLanguage')\n@@ -340,7 +338,10 @@ describe('New Patient Form', () => {\n})\nconst expectedPatient = {\n- name: new Name(expectedPrefix, expectedGivenName, expectedFamilyName, expectedSuffix),\n+ prefix: expectedPrefix,\n+ givenName: expectedGivenName,\n+ familyName: expectedFamilyName,\n+ suffix: expectedSuffix,\nsex: expectedSex,\ntype: expectedType,\ndateOfBirth: '',\n"
},
{
"change_type": "MODIFY",
"old_path": "src/config/pouchdb.ts",
"new_path": "src/config/pouchdb.ts",
"diff": "@@ -11,15 +11,15 @@ function createDb(name: string) {\n}\nconst db = new PouchDB(name)\n- db.sync(\n- `https://a27fa3db-db4d-4456-8465-da953aee0f5b-bluemix:cd6f332d39f24d2b7cfc89d82f6836d46012ef3188698319b0d5fff177cb2ddc@a27fa3db-db4d-4456-8465-da953aee0f5b-bluemix.cloudantnosqldb.appdomain.cloud/${name}`,\n- {\n- live: true,\n- retry: true,\n- },\n- ).on('change', (info) => {\n- console.log(info)\n- })\n+ // db.sync(\n+ // `https://a27fa3db-db4d-4456-8465-da953aee0f5b-bluemix:cd6f332d39f24d2b7cfc89d82f6836d46012ef3188698319b0d5fff177cb2ddc@a27fa3db-db4d-4456-8465-da953aee0f5b-bluemix.cloudantnosqldb.appdomain.cloud/${name}`,\n+ // {\n+ // live: true,\n+ // retry: true,\n+ // },\n+ // ).on('change', (info) => {\n+ // console.log(info)\n+ // })\nreturn db\n}\n"
},
{
"change_type": "DELETE",
"old_path": "src/model/Name.ts",
"new_path": null,
"diff": "-export default class Name {\n- prefix?: string\n-\n- given?: string\n-\n- family?: string\n-\n- suffix?: string\n-\n- constructor(prefix?: string, given?: string, family?: string, suffix?: string) {\n- this.prefix = prefix\n- this.given = given\n- this.family = family\n- this.suffix = suffix\n- }\n-}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/model/Patient.ts",
"new_path": "src/model/Patient.ts",
"diff": "import AbstractDBModel from './AbstractDBModel'\n-import Name from './Name'\nexport default class Patient extends AbstractDBModel {\n- name: Name\n+ prefix?: string\n+\n+ givenName?: string\n+\n+ familyName?: string\n+\n+ suffix?: string\nsex: string\n@@ -25,8 +30,11 @@ export default class Patient extends AbstractDBModel {\nconstructor(\nid: string,\nrev: string,\n- name: Name,\nsex: string,\n+ prefix?: string,\n+ givenName?: string,\n+ familyName?: string,\n+ suffix?: string,\ndateOfBirth?: string,\nisApproximateDateOfBirth?: boolean,\nphoneNumber?: string,\n@@ -37,7 +45,10 @@ export default class Patient extends AbstractDBModel {\ntype?: string,\n) {\nsuper(id, rev)\n- this.name = name\n+ this.prefix = prefix\n+ this.givenName = givenName\n+ this.familyName = familyName\n+ this.suffix = suffix\nthis.sex = sex\nthis.dateOfBirth = dateOfBirth\nthis.isApproximateDateOfBirth = isApproximateDateOfBirth\n"
},
{
"change_type": "MODIFY",
"old_path": "src/patients/list/Patients.tsx",
"new_path": "src/patients/list/Patients.tsx",
"diff": "@@ -26,7 +26,7 @@ const Patients = () => {\n{patients.map((p) => (\n<Link to={`/patients/${p.id}`} key={p.id}>\n<li key={p.id}>\n- {p.name.given} {p.name.family}\n+ {p.givenName} {p.familyName}\n</li>\n</Link>\n))}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/patients/new/NewPatientForm.tsx",
"new_path": "src/patients/new/NewPatientForm.tsx",
"diff": "@@ -7,7 +7,6 @@ import TextFieldWithLabelFormGroup from '../../components/input/TextFieldWithLab\nimport TextInputWithLabelFormGroup from '../../components/input/TextInputWithLabelFormGroup'\nimport DatePickerWithLabelFormGroup from '../../components/input/DatePickerWithLabelFormGroup'\nimport Patient from '../../model/Patient'\n-import Name from '../../model/Name'\ninterface Props {\nonCancel: () => void\n@@ -37,7 +36,10 @@ const NewPatientForm = (props: Props) => {\nconst onSaveButtonClick = async () => {\nconst newPatient = {\n- name: new Name(patient.prefix, patient.givenName, patient.familyName, patient.suffix),\n+ prefix: patient.prefix,\n+ familyName: patient.familyName,\n+ givenName: patient.givenName,\n+ suffix: patient.suffix,\nsex: patient.sex,\ndateOfBirth: patient.dateOfBirth,\ntype: patient.type,\n"
},
{
"change_type": "MODIFY",
"old_path": "src/patients/patient-slice.ts",
"new_path": "src/patients/patient-slice.ts",
"diff": "import { createSlice, PayloadAction } from '@reduxjs/toolkit'\nimport Patient from '../model/Patient'\n-import Name from '../model/Name'\nimport PatientRepository from '../clients/db/PatientRepository'\nimport { AppThunk } from '../store'\n@@ -13,7 +12,7 @@ interface PatientState {\nconst initialState: PatientState = {\nisLoading: false,\nisUpdatedSuccessfully: false,\n- patient: new Patient('', '', new Name('', '', '', ''), ''),\n+ patient: new Patient('', '', ''),\n}\nfunction startLoading(state: PatientState) {\n"
},
{
"change_type": "MODIFY",
"old_path": "src/patients/view/ViewPatient.tsx",
"new_path": "src/patients/view/ViewPatient.tsx",
"diff": "@@ -26,7 +26,7 @@ const ViewPatient = () => {\nreturn (\n<div className=\"container\">\n- <h1>{`${patient.name.given} ${patient.name.family}`}</h1>\n+ <h1>{`${patient.givenName} ${patient.familyName}`}</h1>\n</div>\n)\n}\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | feat(patients): flatten name object |
288,323 | 20.12.2019 21:53:44 | 21,600 | 9072ac910538c9d7425b4f1a96db8bfd6f17e740 | feat(patients): change the new patients route | [
{
"change_type": "MODIFY",
"old_path": "src/__tests__/containers/HospitalRun.test.tsx",
"new_path": "src/__tests__/containers/HospitalRun.test.tsx",
"diff": "@@ -12,7 +12,7 @@ describe('HospitalRun', () => {\nit('should render the new patient screen when /patients/new is accessed', () => {\nconst wrapper = mount(\n<Provider store={store}>\n- <MemoryRouter initialEntries={['/new/patients']}>\n+ <MemoryRouter initialEntries={['/patients/new']}>\n<HospitalRun />\n</MemoryRouter>\n</Provider>,\n"
},
{
"change_type": "MODIFY",
"old_path": "src/components/Navbar.tsx",
"new_path": "src/components/Navbar.tsx",
"diff": "@@ -31,7 +31,7 @@ const Navbar = () => {\n{\nlabel: t('actions.new'),\nonClick: () => {\n- history.push('/new/patients')\n+ history.push('/patients/new')\n},\n},\n],\n"
},
{
"change_type": "MODIFY",
"old_path": "src/containers/HospitalRun.tsx",
"new_path": "src/containers/HospitalRun.tsx",
"diff": "@@ -36,7 +36,7 @@ const HospitalRun = () => {\n<PrivateRoute\nisAuthenticated={permissions.includes(Permissions.WritePatients)}\nexact\n- path=\"/new/patients\"\n+ path=\"/patients/new\"\ncomponent={NewPatient}\n/>\n<PrivateRoute\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | feat(patients): change the new patients route |
288,323 | 20.12.2019 22:45:14 | 21,600 | 97cf2636e987bf219f7a8836aaf04e63c98b59be | feat(patients): use date-fns in favor of luxon | [
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"@semantic-release/changelog\": \"~3.0.4\",\n\"@semantic-release/git\": \"~7.0.16\",\n\"@semantic-release/release-notes-generator\": \"~7.3.0\",\n- \"@types/luxon\": \"^1.21.0\",\n\"bootstrap\": \"~4.4.1\",\n+ \"date-fns\": \"~2.8.1\",\n\"i18next\": \"^19.0.1\",\n\"i18next-browser-languagedetector\": \"^4.0.1\",\n\"i18next-xhr-backend\": \"^3.2.2\",\n- \"luxon\": \"^1.21.3\",\n\"pouchdb\": \"~7.1.1\",\n\"pouchdb-adapter-memory\": \"^7.1.1\",\n\"react\": \"~16.12.0\",\n"
},
{
"change_type": "MODIFY",
"old_path": "src/__tests__/patients/new/NewPatientForm.test.tsx",
"new_path": "src/__tests__/patients/new/NewPatientForm.test.tsx",
"diff": "@@ -3,7 +3,7 @@ import React, { ChangeEvent } from 'react'\nimport { shallow, mount } from 'enzyme'\nimport { Button, Checkbox } from '@hospitalrun/components'\nimport { render, act, fireEvent } from '@testing-library/react'\n-import { DateTime } from 'luxon'\n+import { isEqual, startOfDay, subYears } from 'date-fns'\nimport NewPatientForm from '../../../patients/new/NewPatientForm'\nimport TextInputWithLabelFormGroup from '../../../components/input/TextInputWithLabelFormGroup'\nimport SelectWithLabelFormGroup from '../../../components/input/SelectWithLableFormGroup'\n@@ -222,12 +222,9 @@ describe('New Patient Form', () => {\nconst dateOfBirthTextInput = wrapper.findWhere((w) => w.prop('name') === 'dateOfBirth')\n- expect(DateTime.fromJSDate(dateOfBirthTextInput.prop('value')).toISODate()).toEqual(\n- DateTime.fromJSDate(new Date())\n- .minus({ year: 5 })\n- .toISODate(),\n- )\n- })\n+ expect(\n+ isEqual(dateOfBirthTextInput.prop('value'), startOfDay(subYears(new Date(), 5))),\n+ ).toBeTruthy()\n})\ndescribe('on unknown checkbox click', () => {\n@@ -370,3 +367,4 @@ describe('New Patient Form', () => {\n})\n})\n})\n+})\n"
},
{
"change_type": "MODIFY",
"old_path": "src/patients/new/NewPatientForm.tsx",
"new_path": "src/patients/new/NewPatientForm.tsx",
"diff": "import React, { useState } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { Button, Checkbox } from '@hospitalrun/components'\n-import { DateTime } from 'luxon'\n+import { startOfDay, subYears } from 'date-fns'\nimport SelectWithLabelFormGroup from '../../components/input/SelectWithLableFormGroup'\nimport TextFieldWithLabelFormGroup from '../../components/input/TextFieldWithLabelFormGroup'\nimport TextInputWithLabelFormGroup from '../../components/input/TextInputWithLabelFormGroup'\n@@ -64,8 +64,8 @@ const NewPatientForm = (props: Props) => {\nonFieldChange(fieldName, event.target.value)\n}\n- const onDateOfBirthChange = (date: string) => {\n- onFieldChange('dateOfBirth', date)\n+ const onDateOfBirthChange = (date: Date) => {\n+ onFieldChange('dateOfBirth', date.toISOString())\n}\nconst onInputElementChange = (event: React.ChangeEvent<HTMLInputElement>, fieldName: string) => {\n@@ -81,10 +81,8 @@ const NewPatientForm = (props: Props) => {\n}\nsetApproximateAge(approximateAgeNumber)\n- const approximateDateOfBirth = DateTime.fromJSDate(new Date()).minus({\n- years: approximateAgeNumber,\n- })\n- setPatient({ ...patient, dateOfBirth: approximateDateOfBirth.toISO() })\n+ const approximateDateOfBirth = subYears(new Date(), approximateAgeNumber)\n+ setPatient({ ...patient, dateOfBirth: startOfDay(approximateDateOfBirth).toISOString() })\n}\nreturn (\n@@ -180,10 +178,7 @@ const NewPatientForm = (props: Props) => {\nisEditable={isEditable && !patient.isApproximateDateOfBirth}\nvalue={patient.dateOfBirth.length > 0 ? new Date(patient.dateOfBirth) : undefined}\nonChange={(date: Date) => {\n- const dateString = DateTime.fromJSDate(date).toISODate()\n- console.log(date.toISOString())\n- console.log(dateString)\n- onDateOfBirthChange(date.toISOString())\n+ onDateOfBirthChange(date)\n}}\n/>\n</div>\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | feat(patients): use date-fns in favor of luxon |
288,323 | 20.12.2019 22:59:19 | 21,600 | 281674cbb3d9caff84ce17f8992101b7d351ff46 | feat(patients): pass is approximate date of birth flag | [
{
"change_type": "MODIFY",
"old_path": "src/__tests__/patients/new/NewPatientForm.test.tsx",
"new_path": "src/__tests__/patients/new/NewPatientForm.test.tsx",
"diff": "@@ -341,6 +341,7 @@ describe('New Patient Form', () => {\nsuffix: expectedSuffix,\nsex: expectedSex,\ntype: expectedType,\n+ isApproximateDateOfBirth: false,\ndateOfBirth: '',\noccupation: expectedOccupation,\npreferredLanguage: expectedPreferredLanguage,\n"
},
{
"change_type": "MODIFY",
"old_path": "src/patients/new/NewPatientForm.tsx",
"new_path": "src/patients/new/NewPatientForm.tsx",
"diff": "@@ -42,6 +42,7 @@ const NewPatientForm = (props: Props) => {\nsuffix: patient.suffix,\nsex: patient.sex,\ndateOfBirth: patient.dateOfBirth,\n+ isApproximateDateOfBirth: patient.isApproximateDateOfBirth,\ntype: patient.type,\noccupation: patient.occupation,\npreferredLanguage: patient.preferredLanguage,\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | feat(patients): pass is approximate date of birth flag |
288,323 | 30.12.2019 18:55:11 | 21,600 | d2e65d7397466c6e14edda0b3b74818b9bfd78e2 | chore(deps): bump from 0.22.2 to 0.24.0 | [
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"private\": false,\n\"license\": \"MIT\",\n\"dependencies\": {\n- \"@hospitalrun/components\": \"^0.22.0\",\n+ \"@hospitalrun/components\": \"^0.24.0\",\n\"@reduxjs/toolkit\": \"~1.2.1\",\n\"@semantic-release/changelog\": \"~3.0.4\",\n\"@semantic-release/git\": \"~7.0.16\",\n"
},
{
"change_type": "MODIFY",
"old_path": "public/locales/en/translation.json",
"new_path": "public/locales/en/translation.json",
"diff": "\"save\": \"Save\",\n\"cancel\": \"Cancel\",\n\"new\": \"New\",\n- \"list\": \"List\"\n+ \"list\": \"List\",\n+ \"search\": \"Search\"\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/components/Navbar.tsx",
"new_path": "src/components/Navbar.tsx",
"diff": "@@ -15,8 +15,16 @@ const Navbar = () => {\nhistory.push('/')\n},\n}}\n- onSearchButtonClick={() => console.log('hello')}\n- onSearchTextBoxChange={() => console.log('hello')}\n+ search={{\n+ onClickButton: () => {\n+ console.log('search')\n+ },\n+ onChangeInput: () => {\n+ console.log('change')\n+ },\n+ placeholderText: t('actions.search'),\n+ buttonText: t('actions.search'),\n+ }}\nnavLinks={[\n{\nlabel: t('patients.label'),\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | chore(deps): bump @hospitalrun/components from 0.22.2 to 0.24.0 |
288,323 | 01.01.2020 17:40:23 | 21,600 | d23f860ce7e71cf892e7584e2eef6de0d4c79a70 | feat(patients): fix routing after successfully creating new patient | [
{
"change_type": "MODIFY",
"old_path": "src/patients/patients-slice.ts",
"new_path": "src/patients/patients-slice.ts",
"diff": "@@ -44,7 +44,7 @@ export const createPatient = (patient: Patient, history: any): AppThunk => async\ndispatch(createPatientStart())\nconst newPatient = await PatientRepository.save(patient)\ndispatch(createPatientSuccess())\n- history.push(`patients/${newPatient.id}`)\n+ history.push(`/patients/${newPatient.id}`)\n} catch (error) {\nconsole.log(error)\n}\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | feat(patients): fix routing after successfully creating new patient |
Subsets and Splits