-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4267 from beyondessential/release-2022-47
Release 2022-47
- Loading branch information
Showing
29 changed files
with
472 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
packages/admin-panel/src/pages/resources/EntityTypesPage.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* Tupaia MediTrak | ||
* Copyright (c) 2017 Beyond Essential Systems Pty Ltd | ||
*/ | ||
|
||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { ResourcePage } from './ResourcePage'; | ||
|
||
const ENTITY_TYPES_ENDPOINT = 'entityTypes'; | ||
|
||
export const ENTITY_TYPES_COLUMNS = [ | ||
{ source: 'id', show: false }, | ||
{ | ||
Header: 'Type', | ||
source: 'type', | ||
filterable: false, | ||
sortable: false, | ||
}, | ||
]; | ||
|
||
export const EntityTypesPage = ({ getHeaderEl }) => ( | ||
<ResourcePage | ||
title="Entity Types" | ||
endpoint={ENTITY_TYPES_ENDPOINT} | ||
columns={ENTITY_TYPES_COLUMNS} | ||
getHeaderEl={getHeaderEl} | ||
/> | ||
); | ||
|
||
EntityTypesPage.propTypes = { | ||
getHeaderEl: PropTypes.func.isRequired, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
55 changes: 55 additions & 0 deletions
55
packages/central-server/src/apiV2/entityTypes/GetEntityTypes.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/** | ||
* Tupaia | ||
* Copyright (c) 2017 - 2022 Beyond Essential Systems Pty Ltd | ||
*/ | ||
|
||
import { allowNoPermissions } from '../../permissions'; | ||
import { GETHandler } from '../GETHandler'; | ||
|
||
/** | ||
* Custom implementation required for this route as there is no corresponding DatabaseModel for EntityType | ||
* (it's an enum not a table) | ||
*/ | ||
export class GetEntityTypes extends GETHandler { | ||
async assertUserHasAccess() { | ||
await this.assertPermissions(allowNoPermissions); | ||
} | ||
|
||
async getEntityTypes() { | ||
return this.models.entity.getEntityTypes(); | ||
} | ||
|
||
async getDbQueryOptions() { | ||
const { limit, page } = this.getPaginationParameters(); | ||
const offset = limit * page; | ||
|
||
return { limit, offset }; | ||
} | ||
|
||
async findSingleRecord(recordId) { | ||
const entityTypes = await this.getEntityTypes(); | ||
const entityType = entityTypes.find(type => type === recordId); | ||
if (!entityType) { | ||
return undefined; | ||
} | ||
|
||
return { id: entityType, type: entityType }; | ||
} | ||
|
||
async findRecords(criteria, options) { | ||
const { limit, offset } = options; | ||
const entityTypes = await this.getEntityTypes(); | ||
if (offset) { | ||
entityTypes.splice(0, offset); | ||
} | ||
if (limit) { | ||
entityTypes.splice(limit); | ||
} | ||
return entityTypes.map(type => ({ id: type, type })); | ||
} | ||
|
||
async countRecords() { | ||
const entityTypes = await this.getEntityTypes(); | ||
return entityTypes.length; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/** | ||
* Tupaia | ||
* Copyright (c) 2017 - 2022 Beyond Essential Systems Pty Ltd | ||
*/ | ||
|
||
export { GetEntityTypes } from './GetEntityTypes'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
packages/database/src/migrations/20221104002716-UnfpaPopulationTileSet-modifies-data.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
'use strict'; | ||
|
||
import { updateValues } from '../utilities'; | ||
|
||
var dbm; | ||
var type; | ||
var seed; | ||
|
||
/** | ||
* We receive the dbmigrate dependency from dbmigrate initially. | ||
* This enables us to not have to rely on NODE_PATH. | ||
*/ | ||
exports.setup = function (options, seedLink) { | ||
dbm = options.dbmigrate; | ||
type = dbm.dataType; | ||
seed = seedLink; | ||
}; | ||
|
||
const projectCode = 'unfpa'; | ||
const previousConfig = { | ||
permanentRegionLabels: true, | ||
projectDashboardHeader: 'Regional', | ||
}; | ||
const newConfig = { | ||
tileSets: 'unfpaPopulation', | ||
includeDefaultTileSets: true, | ||
permanentRegionLabels: true, | ||
projectDashboardHeader: 'Regional', | ||
}; | ||
|
||
exports.up = async function (db) { | ||
await updateValues(db, 'project', { config: newConfig }, { code: projectCode }); | ||
}; | ||
|
||
exports.down = async function (db) { | ||
await updateValues(db, 'project', { config: previousConfig }, { code: projectCode }); | ||
}; | ||
|
||
exports._meta = { | ||
version: 1, | ||
}; |
Oops, something went wrong.