Skip to content

Commit

Permalink
Merge branch 'main' into localization-update
Browse files Browse the repository at this point in the history
  • Loading branch information
mrinnetmaki authored Jul 23, 2023
2 parents 6d82003 + 68aec8f commit 132f544
Show file tree
Hide file tree
Showing 136 changed files with 3,712 additions and 3,789 deletions.
39 changes: 37 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: 2
jobs:
build:
build-macos:
working_directory: ~/tidepool-org/chrome-uploader
parallelism: 1
# CircleCI 2.0 does not support environment variables that refer to each other the same way as 1.0 did.
Expand All @@ -11,6 +11,8 @@ jobs:
xcode: '12.5.1'
steps:
- checkout
- run: git submodule sync
- run: git submodule update --init
- run: echo 'export PATH=${PATH}:${HOME}/${CIRCLE_PROJECT_REPONAME}/node_modules/.bin' >> $BASH_ENV
- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
Expand All @@ -36,13 +38,46 @@ jobs:
- run: yarn test
# Package
- run: if [ -z "$CIRCLE_PR_NUMBER" ]; then yarn package; else echo "Forked repo; no package built."; fi
build-windows:
machine:
# see https://circleci.com/developer/machine/image/windows-server-2019 for details
image: windows-server-2019-vs2019:stable
resource_class: windows.medium
shell: bash.exe
steps:
- checkout
- run: git submodule sync
- run: git submodule update --init
- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
- run: nvm install v12.13.0
- run: nvm use v12.13.0
- run: node -v
- run: npm install --global yarn
- run: yarn config set cache-folder ~/.cache/yarn
- run: yarn --frozen-lockfile
- save_cache:
key: dependency-cache-{{ checksum "package.json" }}
paths:
- ~/.cache/yarn
- ./node_modules
# Test
- run: yarn lint
- run: yarn test
# Package
- run: if [ -z "$CIRCLE_PR_NUMBER" ]; then yarn package; else echo "Forked repo; no package built."; fi
- run: if [ -n "$CIRCLE_TAG" ]; then yarn av-whitelist; else echo "Not a tagged release."; fi

# runs build for all branches and all tags starting with v.
workflows:
version: 2
build-release:
jobs:
- build:
- build-macos:
filters:
tags:
only: /^v.*/
- build-windows:
filters:
tags:
only: /^v.*/
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"no-use-before-define": 0,
"max-len": ["warn", { "code": 100 }],
"prefer-destructuring": "warn",
"linebreak-style": 0,
"no-buffer-constructor": "warn"
},
"plugins": [
Expand Down
7 changes: 4 additions & 3 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ When creating a request, please fill in parts 1 and 2 with as much information a
### 2. Requirements
**Known requirements for**
- **customer:**
- **functionality:**
- **usability:**
- **regulation:**
- **functionality (incl. [62304, ch. 5.2.2 sublauses a,b,d](https://drive.google.com/file/d/19vfHS2bDeDMbb1QquLW44N_cBbctIE00/view?usp=sharing)):**
- **usability (incl. [62304, ch. 5.2.2 sublause f](https://drive.google.com/file/d/19vfHS2bDeDMbb1QquLW44N_cBbctIE00/view?usp=sharing)):**
- **regulation (incl. [62304, ch. 5.2.2 sublause l](https://drive.google.com/file/d/19vfHS2bDeDMbb1QquLW44N_cBbctIE00/view?usp=sharing)):**
- **any other mentioned in [62304, ch. 5.2.2](https://drive.google.com/file/d/19vfHS2bDeDMbb1QquLW44N_cBbctIE00/view?usp=sharing):**

- [ ] Design and development inputs have approved by [name, date].

Expand Down
20 changes: 10 additions & 10 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ _Instruction: Remove bullet, which is not the analysis result._
_Instruction: Check that the OWASP top 10 have been taken into account._

[https://github.com/OWASP/www-project-top-ten/blob/master/index.md](https://github.com/OWASP/www-project-top-ten/blob/master/index.md)
- [ ] **1 Injection** - [comments]
- [ ] **2 Broken Authentication** - [comments]
- [ ] **3 Sensitive Data Exposure** - [comments]
- [ ] **4 XML External Entities (XXE)** - [comments]
- [ ] **5 Broken Access Control** - [comments]
- [ ] **6 Security Misconfiguration** - [comments]
- [ ] **7 Cross-Site Scripting XSS** - [comments]
- [ ] **8 Insecure Deserialization** - [comments]
- [ ] **9 Using Components with Known Vulnerabilities** - [comments]
- [ ] **10 Insufficient Logging & Monitoring** - [comments]
- [ ] **A01:2021-Broken Access Control** - [comments]
- [ ] **A02:2021-Cryptographic Failures** - [comments]
- [ ] **A03:2021-Injection** - [comments]
- [ ] **A04:2021-Insecure Design** - [comments]
- [ ] **A05:2021-Security Misconfiguration** - [comments]
- [ ] **A06:2021-Vulnerable and Outdated Components** - [comments]
- [ ] **A07:2021-Identification and Authentication Failures** - [comments]
- [ ] **A08:2021-Software and Data Integrity Failures** - [comments]
- [ ] **A09:2021-Security Logging and Monitoring Failures** - [comments]
- [ ] **A10:2021-Server-Side Request Forgery** - [comments]

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ app/style.css.map
main.js
main.js.map


lib/drivers/medtronic/cli/*.json
lib/drivers/insulet/cli/*.ibf
resources/win/disk1
resources/win/setup.*

tmp
npm-debug.log
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "lib/drivers/tandem"]
path = lib/drivers/tandem
url = [email protected]:tidepool-org/tandem-driver.git
25 changes: 13 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ Installable uploader software, based on Tidepool's open source implementation


[![CircleCI](https://circleci.com/gh/tidepool-org/uploader/tree/master.svg?style=shield)](https://circleci.com/gh/tidepool-org/uploader/tree/master)
[![Build status](https://ci.appveyor.com/api/projects/status/jj71uykxm27s3mla/branch/master?svg=true)](https://ci.appveyor.com/project/krystophv/uploader/branch/master)


This is an [Electron App](https://electron.atom.io/) that acts as an uploader client for Tidepool. It is intended to allow you to plug diabetes devices into your computer's USB port, read the data stored on them, and upload a standardized version of the data to the Tidepool cloud.
Expand Down Expand Up @@ -90,7 +89,7 @@ All debug options are turned *off* by default in `config/local.sh`.

## Tests

To run the tests in this repository as they are run on CircleCI and Appveyor use:
To run the tests in this repository as they are run on CircleCI use:

```bash
$ yarn test
Expand All @@ -100,7 +99,7 @@ $ yarn test

We use [ESLint](http://eslint.org/) to lint our JavaScript code. We try to use the same linting options across all our client apps, but there are a few exceptions in this application, noted with comments in the `.eslintrc` configuration file.

To run the linter (which also runs on CircleCI and Appveyor with every push, along with `npm test`), use:
To run the linter (which also runs on CircleCI with every push, along with `npm test`), use:

```
$ npm run lint
Expand All @@ -121,7 +120,7 @@ See [this guidance on our use of GitBook at Tidepool](http://developer.tidepool.
This section is Tidepool-specific. Release management and application updates are handled via the Github provider in the `electron-builder` project. The recommended workflow for a new production release is as follows:

1. When you're working on what might become a new release, increment the version number in `package.json` and `app/package.json` and commit/push (on the branch)
1. The CI server(s) will create a draft release in Github with the title of the version from the `package.json` file and will automatically attach the distribution artifacts to that draft (drafts are not publicly visible)
1. The CI server will create a draft release in Github with the title of the version from the `package.json` file and will automatically attach the distribution artifacts to that draft (drafts are not publicly visible)
1. When your pull request is approved and merged to `master`, go to the draft release and type in the version for the tag name, ensure that you're targeting the `master` branch, fill out the release notes and publish the release. This will create the tag for you.

For a non-production release (alpha, dev, etc.)
Expand All @@ -134,22 +133,24 @@ The Uploader has a self-update mechanism that will look at the latest release an

### CI server environment variables

We use the following environment variables on the CI servers:
We use the following environment variables on the CI server:

| Variable | CI Server | Use |
| Variable | OS Image | Use |
|----------|-----------|-------|
| APPLEID | CircleCI | Notarization |
| APPLEIDPASS | CircleCI | Notarization |
| APPLEID | MacOS | Notarization |
| APPLEIDPASS | MacOS | Notarization |
| AWS_ACCESS_KEY_ID | Both | S3 builds and AV e-mails |
| AWS_SECRET_ACESS_KEY | Both | S3 builds and AV e-mails |
| CSC_FOR_PULL_REQUEST | Both | `true`, code signing for PR |
| CSC_KEY_PASSWORD | Both | Certificate password |
| CSC_LINK | Both | Code signing certificate |
| DEBUG | CircleCI | Set to `electron-builder` |
| CSC_KEY_PASSWORD | MacOS | Certificate password |
| CSC_LINK | MacOS | Code signing certificate |
| WIN_CSC_KEY_PASSWORD | Windows | Certificate password |
| WIN_CSC_LINK | Windows | Code signing certificate |
| DEBUG | MacOS | Set to `electron-builder` |
| GH_TOKEN | Both | For GitHub builds |
| PUBLISH_FOR_PULL_REQUEST | Both | `true`, build artefact for PR |
| ROLLBAR_POST_TOKEN | Both | Rollbar logging |
| FTP_AV_PASSWORD_TIDEPOOL | Appveyor | AV submission |
| FTP_AV_PASSWORD_TIDEPOOL | Windows | AV submission |

## Editor Configuration
**Atom**
Expand Down
46 changes: 38 additions & 8 deletions app/actions/async.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,51 @@ export function doAppInit(opts, servicesToInit) {
}

api.user.initializationInfo((err, results) => {
const [ user, profile, memberships, associatedAccounts, clinics ] = results;
if (err) {
return dispatch(sync.initializeAppFailure(err));
}
dispatch(sync.initializeAppSuccess());
dispatch(doVersionCheck());
dispatch(sync.setUserInfoFromToken({
user: results[0],
profile: results[1],
memberships: results[2]
user: user,
profile: profile,
memberships: memberships
}));
dispatch(sync.getClinicsForClinicianSuccess(clinics, user.userid));
const isClinic = personUtils.isClinic(user);
if(!_.isEmpty(clinics)){
if (clinics.length == 1) { // select clinic and go to clinic user select page
let clinicId = _.get(clinics,'0.clinic.id',null);
dispatch(fetchPatientsForClinic(clinicId));
dispatch(sync.selectClinic(clinicId));
return dispatch(
setPage(pages.CLINIC_USER_SELECT, actionSources.USER, {
metric: { eventName: metrics.CLINIC_SEARCH_DISPLAYED },
})
);
}
if (clinics.length > 1) { // more than one clinic - go to workspace switch
return dispatch(
setPage(pages.WORKSPACE_SWITCH, actionSources.USER, {
metric: { eventName: metrics.WORKSPACE_SWITCH_DISPLAYED}
})
);
}
}
if(isClinic){ // "old" style clinic account without new clinic
return dispatch(
setPage(pages.CLINIC_USER_SELECT, actionSources.USER, {
metric: { eventName: metrics.CLINIC_SEARCH_DISPLAYED },
})
);
}
// detect if a DSA here and redirect to data storage screen
const { targetUsersForUpload } = getState();
if (_.isEmpty(targetUsersForUpload)) {
return dispatch(setPage(pages.NO_UPLOAD_TARGETS));
}

const { uploadTargetUser } = getState();
if (uploadTargetUser !== null) {
dispatch(sync.setBlipViewDataUrl(
Expand Down Expand Up @@ -275,11 +310,6 @@ export function doDeviceUpload(driverId, opts = {}, utc) {
displayErr.linkText = 'Please see this support article.';
}

if (err.message === 'E_MULTIPLE_DEVICES') {
displayErr = new Error(ErrorMessages.E_MULTIPLE_DEVICES);
deviceDetectErrProps.code = 'E_MULTIPLE_DEVICES';
}

displayErr.originalError = err;
return dispatch(sync.uploadFailure(displayErr, deviceDetectErrProps, targetDevice));
}
Expand Down
13 changes: 12 additions & 1 deletion app/actions/sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,15 @@ export function setAllUsers(user, profile, memberships){
};
}

export function acknowledgeNotification(acknowledgedNotification) {
return {
type: ActionTypes.ACKNOWLEDGE_NOTIFICATION,
payload: {
acknowledgedNotification: acknowledgedNotification,
},
};
}

/*
* relating to async action creator doAppInit
*/
Expand Down Expand Up @@ -862,7 +871,9 @@ export function createClinicCustodialAccountSuccess(clinicId, patient, patientId
};
}

export function createClinicCustodialAccountFailure(error, apiError) {
export function createClinicCustodialAccountFailure(err, apiError) {
const error = new Error(getCreateCustodialAccountErrorMessage(err.status || null));
error.originalError = err;
return {
type: ActionTypes.CREATE_CLINIC_CUSTODIAL_ACCOUNT_FAILURE,
error: error,
Expand Down
28 changes: 28 additions & 0 deletions app/components/ClinicUserEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,15 @@ class ClinicUserEdit extends React.Component {
onSubmitFail: PropTypes.func.isRequired,
createClinicUser: PropTypes.func.isRequired,
updateClinicPatient: PropTypes.func.isRequired,
acknowledgeNotification: PropTypes.func.isRequired,
working: PropTypes.object.isRequired,
clinics: PropTypes.object.isRequired,
};

handleCancel = () => {
if(this.props.working.creatingClinicCustodialAccount.notification) {
this.props.acknowledgeNotification();
}
this.props.cancelEdit();
};

Expand Down Expand Up @@ -200,6 +206,27 @@ class ClinicUserEdit extends React.Component {
);
};

renderNotification = () => {
var {creatingClinicCustodialAccount} = this.props.working;
if (_.isNull(creatingClinicCustodialAccount.notification)) {
return null;
}

return (
<div className={styles.error}>
<span>
{i18n.t(creatingClinicCustodialAccount.notification.message)}
<i
className={styles.iconClose}
onClick={
() => { this.props.acknowledgeNotification('creatingClinicCustodialAccount'); }
}
></i>
</span>
</div>
);
};

renderDateInputs = (fields) => (
<div>
<div className={styles.bdayWrap}>
Expand Down Expand Up @@ -335,6 +362,7 @@ class ClinicUserEdit extends React.Component {
</div>
{this.renderCreateError()}
{this.renderUpdateError()}
{this.renderNotification()}
</div>
</form>
</div>
Expand Down
1 change: 1 addition & 0 deletions app/constants/actionTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export const DISMISS_CREATE_CUSTODIAL_ACCOUNT_ERROR = 'DISMISS_CREATE_CUSTODIAL_
export const SET_ALL_USERS = 'SET_ALL_USERS';
export const TIMEZONE_BLUR = 'TIMEZONE_BLUR';
export const SELECT_CLINIC = 'SELECT_CLINIC';
export const ACKNOWLEDGE_NOTIFICATION = 'ACKNOWLEDGE_NOTIFICATION';

/*
* Asyncronous action types
Expand Down
1 change: 0 additions & 1 deletion app/constants/errorMessages.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,4 @@ module.exports = {
ERR_FETCHING_PATIENT: 'Something went wrong while fetching patient.',
ERR_YOUR_ACCOUNT_NOT_CONFIGURED: 'Sorry! It appears that your account hasn\'t been fully set up.',
ERR_FETCHING_PATIENTS_FOR_CLINIC: 'Something went wrong while fetching patients for clinic.',
E_MULTIPLE_DEVICES: 'We found more than one device plugged in. Only plug in the device you intend to upload.',
};
5 changes: 4 additions & 1 deletion app/containers/ClinicUserEditPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ export class ClinicUserEditPage extends Component {
dismissUpdateProfileError={this.props.sync.dismissUpdateProfileError}
onSubmitFail={this.props.sync.clinicInvalidDate}
selectedClinicId={this.props.selectedClinicId}
clinics={this.props.clinics} />
clinics={this.props.clinics}
working={this.props.working}
acknowledgeNotification={this.props.sync.acknowledgeNotification} />
</div>
);
}
Expand All @@ -77,6 +79,7 @@ export default connect(
memberships: state.memberships,
selectedClinicId: state.selectedClinicId,
clinics: state.clinics,
working: state.working,
};
},
(dispatch) => {
Expand Down
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "sensotrend-uploader",
"productName": "sensotrend-uploader",
"version": "2.44.1",
"version": "2.46.0",
"description": "Sensotrend Uploader",
"main": "./main.prod.js",
"author": {
Expand Down
Loading

0 comments on commit 132f544

Please sign in to comment.