Skip to content

Commit

Permalink
Merge pull request #320 from dhis2/fix/prioritize-organisation-name
Browse files Browse the repository at this point in the history
fix: show org name instead of individual dev
  • Loading branch information
Erik A authored May 4, 2020
2 parents ac61c2e + 2208b83 commit 699a3df
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 28 deletions.
11 changes: 9 additions & 2 deletions client/src/components/appCards/AppCardItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ const AppItem = props => {
height: '190px',
}

let developerNameToShow = developer.organisation
if (!developerNameToShow) {
developerNameToShow = developer.name ? developer.name : 'Unspecified'
}

return (
<div data-test="app-card" style={{ height: '100%' }}>
<Card style={{ height: '100%' }}>
Expand All @@ -36,8 +41,9 @@ const AppItem = props => {
title={<Link to={`/app/${id}`}>{name}</Link>}
subtitle={
<span>
{developer.name ? developer.name : 'Unspecified'}{' '}
<br /> {config.ui.appTypeToDisplayName[appType]}{' '}
{developerNameToShow}
<br />
{config.ui.appTypeToDisplayName[appType]}{' '}
</span>
}
/>
Expand All @@ -52,6 +58,7 @@ AppItem.propTypes = {
description: PropTypes.string,
developer: PropTypes.shape({
name: PropTypes.string,
organisation: PropTypes.string,
}),
id: PropTypes.string,
images: PropTypes.array,
Expand Down
30 changes: 6 additions & 24 deletions client/src/components/appView/AppView.jsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
// eslint-disable-next-line react/no-deprecated
import React, { Component, PropTypes } from 'react'
import { connect } from 'react-redux'
import {
Card,
CardText,
CardTitle,
CardHeader,
CardMedia,
} from 'material-ui/Card'
import { Card, CardText, CardTitle, CardHeader } from 'material-ui/Card'
import ImageViewer from './ImageViewer'
import Subheader from '../header/SubHeader'
import Grid from '../../material/Grid/Grid'
import Col from '../../material/Grid/Col'
import { Link } from 'react-router-dom'
import { Redirect, Route } from 'react-router-dom'
import VersionList from '../appVersion/VersionList'
import { loadApp } from '../../actions/actionCreators'
import config from '../../../config'
import AppLogo from './AppLogo'
import Theme from '../../styles/theme'
import { FadeAnimation } from '../utils/Animate'

const styles = {
appDescription: {
Expand All @@ -42,23 +34,11 @@ class AppView extends Component {
return null
}

const {
id,
appName,
developer,
description,
images,
appType,
requiredDhisVersion,
lastUpdated,
} = app
const versions = app.versions.sort(
(a, b) => a.lastUpdated - b.lastUpdated
)
const { description, images } = app

const subtitle = (
<div>
Type: {config.ui.appTypeToDisplayName[app.appType]} <br />
Author: {app.developer.name} <br />
Organisation: {app.developer.organisation}{' '}
</div>
)
Expand Down Expand Up @@ -119,7 +99,9 @@ class AppView extends Component {
}

AppView.propTypes = {
loadApp: PropTypes.func.isRequired,
app: PropTypes.object,
match: PropTypes.object,
}

const mapStateToProps = (state, ownProps) => ({
Expand Down
4 changes: 3 additions & 1 deletion server/src/models/v1/in/CreateAppModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ const CreateModelAppData = Joi.object().keys({
name: Joi.string(),
description: Joi.string().allow(''),
appType: Joi.string().valid(...AppTypes),
sourceUrl: Joi.string().uri().allow(''),
sourceUrl: Joi.string()
.uri()
.allow(''),
developer: Joi.object().keys({
name: Joi.string(),
email: Joi.string().email(),
Expand Down
1 change: 0 additions & 1 deletion server/src/services/organisation.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const slugify = require('slugify')
const { NotFoundError } = require('../utils/errors')
const User = require('../models/v2/User')
const Organisation = require('../models/v2/Organisation')

const getOrganisationQuery = db =>
Expand Down

0 comments on commit 699a3df

Please sign in to comment.