Skip to content

Commit

Permalink
chore: merge branch 'next' into fix/prioritize-organisation-name
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik committed May 4, 2020
2 parents ddfe97d + ac61c2e commit 2208b83
Show file tree
Hide file tree
Showing 19 changed files with 306 additions and 77 deletions.
59 changes: 59 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,62 @@
# [2.4.0](https://github.com/dhis2/app-hub/compare/v2.3.5...v2.4.0) (2020-05-04)


### Bug Fixes

* add owner to clone script to keep user access ([78eb336](https://github.com/dhis2/app-hub/commit/78eb336ac6f790d5ad28b4c6543ea450ffc08158))
* add support for owner when creating app ([4c88334](https://github.com/dhis2/app-hub/commit/4c88334323b2467eaa64d4902ef86c64c0fa9710))
* add user to org if not in org ([106161b](https://github.com/dhis2/app-hub/commit/106161be24872e42f288e38cc3871bdf8c145d1d))
* avoid creating dupes when cloning ([c4ce579](https://github.com/dhis2/app-hub/commit/c4ce57975f274ede6f40f08739c494be0be3db5b))
* check against correct app_id ([ebd9dd9](https://github.com/dhis2/app-hub/commit/ebd9dd9a8e2dff41976c84896c2415c62309c515))
* only add to org if manager or same as currUser ([ea6ce0c](https://github.com/dhis2/app-hub/commit/ea6ce0c78e7b03bb337190e8db751287708e21ad))
* remove < 2.28 versions and add 2.33, 2.34 ([16ffcf8](https://github.com/dhis2/app-hub/commit/16ffcf81aa352a53f9e858b6a1be2d5856483de0))
* return 400 if trying to upload to other org ([db084e6](https://github.com/dhis2/app-hub/commit/db084e61e98ea6f6b90373db26a62945bafbcc24))
* show errormessage from unauthorized response ([d768285](https://github.com/dhis2/app-hub/commit/d768285e71f15cc9c272faadb03a4ebe54e89d65))
* update test to work with new versions ([ab8e141](https://github.com/dhis2/app-hub/commit/ab8e1417197c227aa53266c05f0e13d9e69ce66d))
* use email from jsonpayload ([944f6c4](https://github.com/dhis2/app-hub/commit/944f6c441b6484d2bdd743badb03e1ffe040e613))
* use transaction when getting user ([1536a44](https://github.com/dhis2/app-hub/commit/1536a446af73a8d04adbe787febe139a218f06bc))


### Features

* **organisationService:** add hasUser-function ([9b7a0eb](https://github.com/dhis2/app-hub/commit/9b7a0eb103bd2855043b4bf6b9d52edb0b853d5f))

## [2.3.5](https://github.com/dhis2/app-hub/compare/v2.3.4...v2.3.5) (2020-04-27)


### Bug Fixes

* avoid creating dupes when cloning ([2cd8fc0](https://github.com/dhis2/app-hub/commit/2cd8fc0729a91a8251597b9956104f5887e8c392))
* correct mkdirSync params ([74aaa04](https://github.com/dhis2/app-hub/commit/74aaa04d67dbdc9632f7a409e7ed0d6025d2b50d))

## [2.3.4](https://github.com/dhis2/app-hub/compare/v2.3.3...v2.3.4) (2020-04-24)


### Bug Fixes

* appcard height ([caf7a2f](https://github.com/dhis2/app-hub/commit/caf7a2f15b0864886c2aed06a4cb86a23da97c49))

## [2.3.3](https://github.com/dhis2/app-hub/compare/v2.3.2...v2.3.3) (2020-04-23)


### Bug Fixes

* move users-with-organisations view to correct folder ([22d31d4](https://github.com/dhis2/app-hub/commit/22d31d479fb712675c5039704433d699036d6be2))

## [2.3.2](https://github.com/dhis2/app-hub/compare/v2.3.1...v2.3.2) (2020-04-22)


### Bug Fixes

* **createapp:** add user to organisation if org does note xist ([ffb0733](https://github.com/dhis2/app-hub/commit/ffb07331ed68384924142d2d8cb062afe0811290))

## [2.3.1](https://github.com/dhis2/app-hub/compare/v2.3.0...v2.3.1) (2020-04-22)


### Bug Fixes

* handle downloads without auth ([b58d8bb](https://github.com/dhis2/app-hub/commit/b58d8bb2a772cb0642c42180d030836c90cd4652))

# [2.3.0](https://github.com/dhis2/app-hub/compare/v2.2.0...v2.3.0) (2020-04-21)


Expand Down
15 changes: 1 addition & 14 deletions client/default.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,7 @@ module.exports = {
baseAppName: '/',
},
ui: {
dhisVersions: [
'2.32',
'2.31',
'2.30',
'2.29',
'2.28',
'2.27',
'2.26',
'2.25',
'2.24',
'2.23',
'2.22',
'2.21',
],
dhisVersions: ['2.34', '2.33', '2.32', '2.31', '2.30', '2.29', '2.28'],
appStatusToDisplayName: {
NOT_APPROVED: 'Rejected',
PENDING: 'Pending',
Expand Down
15 changes: 1 addition & 14 deletions client/development.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,7 @@ module.exports = {
baseAppName: '/',
},
ui: {
dhisVersions: [
'2.32',
'2.31',
'2.30',
'2.29',
'2.28',
'2.27',
'2.26',
'2.25',
'2.24',
'2.23',
'2.22',
'2.21',
],
dhisVersions: ['2.34', '2.33', '2.32', '2.31', '2.30', '2.29', '2.28'],
appStatusToDisplayName: {
NOT_APPROVED: 'Rejected',
PENDING: 'Pending',
Expand Down
2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "client",
"version": "2.3.0",
"version": "2.4.0",
"description": "The App Hub Client",
"main": "src/index.js",
"repository": "https://github.com/dhis2/app-hub",
Expand Down
50 changes: 31 additions & 19 deletions client/src/actions/epics.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { concatMap, mergeAll } from 'rxjs/operators'
const loadAppsAll = action$ =>
action$.pipe(
ofType(actions.APPS_ALL_LOAD),
concatMap(action => {
concatMap(() => {
return api
.getAllApps()
.then(apps => actionCreators.appsAllLoaded(apps))
Expand All @@ -25,7 +25,7 @@ const loadAppsAll = action$ =>
const loadAppsApproved = action$ =>
action$.pipe(
ofType(actions.APPS_APPROVED_LOAD),
concatMap(action => {
concatMap(() => {
return api
.getApprovedApps()
.then(apps => actionCreators.loadedApprovedApps(apps))
Expand Down Expand Up @@ -68,7 +68,7 @@ const setAppApproval = action$ =>
const { id: transactionID } = action.meta.optimistic
return api
.setAppApproval(id, status)
.then(resp =>
.then(() =>
actionCreators.commitOrRevertOptimisticAction(
actionCreators.setAppApprovalSuccess(action.payload),
transactionID
Expand All @@ -93,7 +93,7 @@ const deleteApp = action$ =>
const { id } = action.meta.optimistic
return api
.deleteApp(action.payload.app.id)
.then(resp =>
.then(() =>
actionCreators.commitOrRevertOptimisticAction(
actionCreators.deleteAppSuccess(action.payload.app),
id
Expand All @@ -114,7 +114,7 @@ const deleteApp = action$ =>
const user = action$ =>
action$.pipe(
ofType(actions.USER_LOAD),
concatMap(action => {
concatMap(() => {
const auth = getAuth()
return new Promise((resolve, reject) => {
auth.lock.getProfile(auth.getToken(), (error, profile) => {
Expand All @@ -132,7 +132,7 @@ const user = action$ =>
const userApps = action$ =>
action$.pipe(
ofType(actions.USER_APPS_LOAD),
concatMap(action => {
concatMap(() => {
return api
.getUserApps()
.then(apps => actionCreators.userAppsLoaded(apps))
Expand Down Expand Up @@ -168,14 +168,26 @@ const newApp = action$ =>
concatMap(action => {
return api
.createApp(action.payload)
.then(app => {
history.push('/user')
return actionCreators.addAppSuccess(app)
.catch(response => {
if (response.status === 400) {
return response.json()
}
return {
type: actions.APP_ADD_ERROR,
payload: response,
}
})
.then(json => {
if (json.statusCode && json.statusCode === 400) {
return {
type: actions.APP_ADD_ERROR,
payload: { message: json.message },
}
} else {
history.push('/user')
return actionCreators.addAppSuccess(json)
}
})
.catch(error => ({
type: actions.APP_ADD_ERROR,
payload: error,
}))
})
)

Expand All @@ -192,7 +204,7 @@ const editApp = action$ =>
const { id } = action.meta.optimistic
return api
.updateApp(app.id, data)
.then(resp =>
.then(() =>
actionCreators.commitOrRevertOptimisticAction(
actionCreators.editAppSuccess(app, data),
id
Expand Down Expand Up @@ -222,7 +234,7 @@ const deleteVersion = action$ =>
const { id } = action.meta.optimistic
return api
.deleteVersion(appId, version.id)
.then(response =>
.then(() =>
actionCreators.commitOrRevertOptimisticAction(
actionCreators.deleteAppVersionSuccess(
version,
Expand Down Expand Up @@ -316,7 +328,7 @@ const deleteImage = action$ =>
const { id } = action.meta.optimistic
return api
.deleteImage(appId, imageId)
.then(response =>
.then(() =>
actionCreators.commitOrRevertOptimisticAction(
actionCreators.deleteImageFromAppSuccess(
appId,
Expand Down Expand Up @@ -349,7 +361,7 @@ const editImage = action$ =>
const { id } = action.meta.optimistic
return api
.updateImage(appId, imageId, data)
.then(response =>
.then(() =>
actionCreators.commitOrRevertOptimisticAction(
actionCreators.editImageSuccess(appId, imageId, data),
id
Expand Down Expand Up @@ -387,7 +399,7 @@ const editVersion = action$ =>
const { id } = action.meta.optimistic
return api
.updateVersion(appId, version.id, versionObj)
.then(response =>
.then(() =>
actionCreators.commitOrRevertOptimisticAction(
actionCreators.editAppVersionSuccess(appId, versionObj),
id
Expand All @@ -409,7 +421,7 @@ const editVersion = action$ =>
const loadChannels = action$ =>
action$.pipe(
ofType(actions.CHANNELS_LOAD_BEGIN),
concatMap(action => {
concatMap(() => {
return api
.getAllChannels()
.then(channels => actionCreators.loadChannelsSuccess(channels))
Expand Down
7 changes: 4 additions & 3 deletions client/src/components/appCards/AppCardItem.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// eslint-disable-next-line react/no-deprecated
import React, { PropTypes } from 'react'

import { Link } from 'react-router-dom'
import config from '../../../config'
import { Card, CardMedia, CardTitle } from 'material-ui/Card'
Expand Down Expand Up @@ -33,7 +32,7 @@ const AppItem = props => {
}

return (
<div data-test="app-card">
<div data-test="app-card" style={{ height: '100%' }}>
<Card style={{ height: '100%' }}>
<Link to={`/app/${id}`}>
<CardMedia style={mediaStyle} />
Expand All @@ -55,14 +54,16 @@ const AppItem = props => {

AppItem.propTypes = {
app: PropTypes.shape({
appType: PropTypes.number,
appType: PropTypes.string,
description: PropTypes.string,
developer: PropTypes.shape({
name: PropTypes.string,
organisation: PropTypes.string,
}),
id: PropTypes.string,
images: PropTypes.array,
name: PropTypes.string,
requiredDhisVersion: PropTypes.string,
}),
}

Expand Down
4 changes: 2 additions & 2 deletions client/test/config/configResolver.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-undef */
import ConfigImport, { getConfig } from '../../config/configResolver'
import DirectDefaultConfig from '../../default.config.js'
import fs from 'fs'
import merge from 'lodash/merge'
const defaultConfigPath = '../../config/'
const Config = ConfigImport.default
Expand All @@ -27,7 +27,7 @@ describe('ConfigResolver', () => {
describe('getConfig()', () => {
const override = {
routes: { baseAppName: 'baseAppName' },
ui: { dhisVersions: ['2.32'] },
ui: { dhisVersions: ['2.34'] },
}
const addition = {
another: 'setting',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@
"cypress-cucumber-preprocessor": {
"nonGlobalStepDefinitions": true
},
"version": "2.3.0"
"version": "2.4.0"
}
2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "server",
"version": "2.3.0",
"version": "2.4.0",
"description": "The App Hub Server",
"main": "src/main.js",
"repository": "https://github.com/dhis2/app-hub",
Expand Down
3 changes: 3 additions & 0 deletions server/src/data/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,7 @@ module.exports = {
deleteAppVersion: require('./deleteAppVersion'),
deleteChannel: require('./deleteChannel'),
getOrganisationAppsByUserId: require('./getOrganisationAppsByUserId'),
createAppStatus: require('./createAppStatus'),
createAppVersion: require('./createAppVersion'),
createLocalizedAppVersion: require('./createLocalizedAppVersion'),
}
6 changes: 6 additions & 0 deletions server/src/models/v1/in/CreateAppModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ const CreateModelAppData = Joi.object().keys({
description: Joi.string().allow('', null),
})
),
owner: Joi.object({
email: Joi.string()
.email()
.required(),
name: Joi.string().required(),
}),
})

const payloadSchema = Joi.object({
Expand Down
Loading

0 comments on commit 2208b83

Please sign in to comment.