From 84832eee5b17c480770d65b3bcfd547fc320b506 Mon Sep 17 00:00:00 2001 From: dleadbetter <> Date: Tue, 30 Jan 2024 12:06:23 -0500 Subject: [PATCH 1/4] CDC #113 - Adding place layers embedded list and modal; Updating PlaceForm component to use new map controls --- Gemfile | 3 +- Gemfile.lock | 38 ++-- client/package.json | 8 +- client/src/components/PlaceForm.js | 118 ++++++++++-- client/src/components/PlaceForm.module.css | 3 +- client/src/components/PlaceLayerModal.js | 179 ++++++++++++++++++ .../src/components/PlaceLayerModal.module.css | 3 + client/src/i18n/en.json | 36 ++++ client/src/transforms/Place.js | 4 +- client/src/transforms/PlaceLayers.js | 40 ++++ client/src/types/Place.js | 13 +- client/src/utils/PlaceLayers.js | 72 +++++++ client/yarn.lock | 85 +++++---- ...nector_place_layers.core_data_connector.rb | 13 ++ db/schema.rb | 17 +- 15 files changed, 551 insertions(+), 81 deletions(-) create mode 100644 client/src/components/PlaceLayerModal.js create mode 100644 client/src/components/PlaceLayerModal.module.css create mode 100644 client/src/transforms/PlaceLayers.js create mode 100644 client/src/utils/PlaceLayers.js create mode 100644 db/migrate/20240130122627_create_core_data_connector_place_layers.core_data_connector.rb diff --git a/Gemfile b/Gemfile index aa7b945..67592fd 100644 --- a/Gemfile +++ b/Gemfile @@ -37,7 +37,8 @@ gem 'resource_api', git: 'https://github.com/performant-software/resource-api.gi gem 'jwt_auth', git: 'https://github.com/performant-software/jwt-auth.git', tag: 'v0.1.2' # Core data -gem 'core_data_connector', git: 'https://github.com/performant-software/core-data-connector.git', tag: 'v0.1.26' +#gem 'core_data_connector', git: 'https://github.com/performant-software/core-data-connector.git', tag: 'v0.1.26' +gem 'core_data_connector', path: '../core-data-connector' # IIIF gem 'triple_eye_effable', git: 'https://github.com/performant-software/triple-eye-effable.git', tag: 'v0.1.10' diff --git a/Gemfile.lock b/Gemfile.lock index db86d90..932a1a5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,23 +1,3 @@ -GIT - remote: https://github.com/performant-software/core-data-connector.git - revision: 0691112b658c2c7980a76e560f1435c682b62b63 - tag: v0.1.26 - specs: - core_data_connector (0.1.0) - activerecord-postgis-adapter (~> 8.0) - faker - jwt (~> 2.7.1) - jwt_auth - rack-cors (~> 2.0.1) - rails (>= 6.0.3.2, < 8) - resource_api - rgeo-geojson (~> 2.1) - rubyzip (~> 2.3.2) - triple_eye_effable - typesense (~> 0.14) - typhoeus (~> 1.4) - user_defined_fields - GIT remote: https://github.com/performant-software/jwt-auth.git revision: fa54af0cdcad6122fad10d9ad745b814c2918853 @@ -55,6 +35,24 @@ GIT rails (>= 6.0.3.2, < 8) resource_api +PATH + remote: ../core-data-connector + specs: + core_data_connector (0.1.0) + activerecord-postgis-adapter (~> 8.0) + faker + jwt (~> 2.7.1) + jwt_auth + rack-cors (~> 2.0.1) + rails (>= 6.0.3.2, < 8) + resource_api + rgeo-geojson (~> 2.1) + rubyzip (~> 2.3.2) + triple_eye_effable + typesense (~> 0.14) + typhoeus (~> 1.4) + user_defined_fields + GEM remote: https://rubygems.org/ specs: diff --git a/client/package.json b/client/package.json index 64a6a56..123f618 100644 --- a/client/package.json +++ b/client/package.json @@ -11,10 +11,10 @@ "flow": "flow" }, "dependencies": { - "@performant-software/geospatial": "^1.1.2", - "@performant-software/semantic-components": "^1.1.2", - "@performant-software/shared-components": "^1.1.2", - "@performant-software/user-defined-fields": "^1.1.2", + "@performant-software/geospatial": "^1.1.3-beta.8", + "@performant-software/semantic-components": "^1.1.3-beta.8", + "@performant-software/shared-components": "^1.1.3-beta.8", + "@performant-software/user-defined-fields": "^1.1.3-beta.8", "boring-avatars": "^1.10.1", "classnames": "^2.3.1", "i18next": "^21.9.1", diff --git a/client/src/components/PlaceForm.js b/client/src/components/PlaceForm.js index 0c2a01e..0cfb9db 100644 --- a/client/src/components/PlaceForm.js +++ b/client/src/components/PlaceForm.js @@ -1,14 +1,23 @@ // @flow -import { MapDraw } from '@performant-software/geospatial'; +import { + GeoJsonLayer, + LayerMenu, + MapControl, + MapDraw, + RasterLayer +} from '@performant-software/geospatial'; import { BooleanIcon, EmbeddedList, FileInputButton } from '@performant-software/semantic-components'; import type { EditContainerProps } from '@performant-software/shared-components/types'; import { UserDefinedFieldsForm } from '@performant-software/user-defined-fields'; import cx from 'classnames'; -import React, { useCallback } from 'react'; +import React, { useCallback, useMemo } from 'react'; import { useTranslation } from 'react-i18next'; -import { Form, Header } from 'semantic-ui-react'; +import { Form, Header, Icon } from 'semantic-ui-react'; +import _ from 'underscore'; import type { Place as PlaceType } from '../types/Place'; +import PlaceLayerModal from './PlaceLayerModal'; +import PlaceLayerUtils from '../utils/PlaceLayers'; import PlaceNameModal from './PlaceNameModal'; import styles from './PlaceForm.module.css'; @@ -16,9 +25,46 @@ type Props = EditContainerProps & { item: PlaceType }; +const { LayerTypes } = PlaceLayerUtils; + const PlaceForm = (props: Props) => { const { t } = useTranslation(); + /** + * Memo-izes the names of the passed place layers. + */ + const layerNames = useMemo(() => _.pluck(props.item.place_layers, 'name'), [props.item.place_layers]); + + /** + * Parses the geometry for the passed layers. + */ + const layers = useMemo(() => _.map(props.item.place_layers, (layer) => ({ + ...layer, + geometry: layer.geometry ? JSON.parse(layer.geometry) : undefined + })), [props.item.place_layers]); + + /** + * Renders the passed layer. + * + * @type {(function(*): *)|*} + */ + const renderLayer = useCallback((layer) => { + if (layer.layer_type === LayerTypes.geojson) { + return ( + + ); + } + + return ( + + ); + }, []); + /** * Sets the uploaded file as the GeoJSON object. * @@ -71,16 +117,64 @@ const PlaceForm = (props: Props) => { data={props.item.place_geometry?.geometry_json} mapStyle={`https://api.maptiler.com/maps/basic-v2/style.json?key=${process.env.REACT_APP_MAP_TILER_KEY}`} onChange={(data) => props.onSetState({ place_geometry: { geometry_json: data } })} - style={{ - marginBottom: '4em' - }} + > + + + )} + onSelection={onUpload} + /> + + + { _.map(layers, renderLayer) } + + +
- { props.item.project_model_id && ( = (props: Props) => { + const [loading, setLoading] = useState(false); + const [tab, setTab] = useState(props.item.geometry ? Tabs.file : Tabs.url); + + const { t } = useTranslation(); + + /** + * Sets a memo-ized version of the parsed and formatted GeoJSON. + * + * @type {string} + */ + const geometry = useMemo(() => ( + JSON.stringify(JSON.parse(props.item.geometry || '{}'), null, 2) + ), [props.item.geometry]); + + /** + * Sets the uploaded file as the GeoJSON object. + * + * @type {(function([*]): void)|*} + */ + const onUpload = useCallback(([file]) => { + setLoading(true); + + file.text() + .then((value) => props.onSetState({ geometry: value, url: null })) + .finally(() => setLoading(false)); + }, []); + + /** + * Sets the geometry to the passed value and clears the URL. + * + * @type {(function(*, {value: *}): void)|*} + */ + const onGeometryChange = useCallback((e, { value }) => { + props.onSetState({ url: null, geometry: value }); + }, []); + + /** + * Sets the URL to the passed value and clears the geometry. + * + * @type {(function(*, {value: *}): void)|*} + */ + const onUrlChange = useCallback((e, { value }) => { + props.onSetState({ url: value, geometry: null }); + }, []); + + /** + * Set the default layer type on the state for a new record. + */ + useEffect(() => { + if (!props.item.layer_type) { + props.onSetState({ layer_type: LayerTypes.geojson }); + } + }, []); + + return ( + + + + + + { props.item.layer_type === LayerTypes.geojson && ( + <> + + setTab(Tabs.url)} + /> + setTab(Tabs.file)} + /> + + { tab === Tabs.url && ( + + )} + { tab === Tabs.file && ( + <> + + + + )} + + )} + { props.item.layer_type === LayerTypes.raster && ( + + )} + + { props.children } + + ); +}; + +export default PlaceLayerModal; diff --git a/client/src/components/PlaceLayerModal.module.css b/client/src/components/PlaceLayerModal.module.css new file mode 100644 index 0000000..0c812e4 --- /dev/null +++ b/client/src/components/PlaceLayerModal.module.css @@ -0,0 +1,3 @@ +.placeLayerModal > .content .ui.button.uploadButton { + margin-bottom: 1em; +} \ No newline at end of file diff --git a/client/src/i18n/en.json b/client/src/i18n/en.json index a7aead0..2224aa1 100644 --- a/client/src/i18n/en.json +++ b/client/src/i18n/en.json @@ -234,8 +234,14 @@ }, "PlaceForm": { "labels": { + "layers": "Layers", "names": "Names" }, + "placeLayers": { + "columns": { + "name": "Name" + } + }, "placeNames": { "columns": { "name": "Name", @@ -243,6 +249,36 @@ } } }, + "PlaceLayerModal": { + "labels": { + "geometry": "GeoJSON", + "name": "Name", + "type": "Type", + "url": "URL" + }, + "layerTypes": { + "geometry": "GeoJSON", + "url": "URL" + }, + "tabs": { + "file": "File", + "url": "URL" + }, + "title": { + "add": "Add Layer", + "edit": "Edit Layer" + } + }, + "PlaceLayers": { + "errors": { + "geojson": "Either a URL or a GeoJSON file is required", + "raster": "A URL is required for Raster layers" + }, + "labels": { + "geojson": "GeoJSON", + "raster": "Raster" + } + }, "PlaceModal": { "title": "Add Place" }, diff --git a/client/src/transforms/Place.js b/client/src/transforms/Place.js index acdcea9..797a038 100644 --- a/client/src/transforms/Place.js +++ b/client/src/transforms/Place.js @@ -3,6 +3,7 @@ import { BaseTransform } from '@performant-software/shared-components'; import type { Place as PlaceType } from '../types/Place'; import PlaceGeometry from './PlaceGeometry'; +import PlaceLayers from './PlaceLayers'; import PlaceNames from './PlaceNames'; /** @@ -55,7 +56,8 @@ class Place extends BaseTransform { toPayload(place: PlaceType): any { return super.toPayload(place, { ...PlaceNames.toPayload(place), - ...PlaceGeometry.toPayload(place) + ...PlaceGeometry.toPayload(place), + ...PlaceLayers.toPayload(place) }); } } diff --git a/client/src/transforms/PlaceLayers.js b/client/src/transforms/PlaceLayers.js new file mode 100644 index 0000000..5ac28f4 --- /dev/null +++ b/client/src/transforms/PlaceLayers.js @@ -0,0 +1,40 @@ +// @flow + +import { NestedAttributesTransform } from '@performant-software/shared-components'; +import type { Place as PlaceType } from '../types/Place'; + +/** + * Class responsible for transforming place layer objects. + */ +class PlaceLayers extends NestedAttributesTransform { + /** + * Returns the place names payload keys. + * + * @returns {string[]} + */ + getPayloadKeys(): Array { + return [ + 'id', + 'name', + 'layer_type', + 'geometry', + 'url', + '_destroy' + ]; + } + + /** + * Returns the place layers for the passed place to be sent on POST/PUT requests. + * + * @param place + * @param collection + * + * @returns {*} + */ + toPayload(place: PlaceType, collection: string = 'place_layers'): any { + return super.toPayload(place, collection); + } +} + +const PlaceLayersTransform: PlaceLayers = new PlaceLayers(); +export default PlaceLayersTransform; diff --git a/client/src/types/Place.js b/client/src/types/Place.js index eca53a7..af1655b 100644 --- a/client/src/types/Place.js +++ b/client/src/types/Place.js @@ -1,5 +1,13 @@ // @flow +export type PlaceLayer = { + id: number, + name: string, + layer_type: string, + geometry: { [key: string]: any }, + url: string +}; + export type PlaceName = { id: number, name: string, @@ -15,7 +23,8 @@ export type Place = { id: number, project_model_id: number, name: string, - uuid: string + uuid: string, place_names: Array, - place_geometry: PlaceGeometry + place_geometry: PlaceGeometry, + place_layers: Array }; diff --git a/client/src/utils/PlaceLayers.js b/client/src/utils/PlaceLayers.js new file mode 100644 index 0000000..32e1e03 --- /dev/null +++ b/client/src/utils/PlaceLayers.js @@ -0,0 +1,72 @@ +// @flow + +import _ from 'underscore'; +import i18n from '../i18n/i18n'; +import type { PlaceLayer as PlaceLayerType } from '../types/Place'; + +const EMPTY_JSON = '{}'; + +const LayerTypes = { + geojson: 'geojson', + raster: 'raster' +}; + +const LayerTypeLabels = { + [LayerTypes.geojson]: i18n.t('PlaceLayers.labels.geojson'), + [LayerTypes.raster]: i18n.t('PlaceLayers.labels.raster') +}; + +/** + * Returns the label for the passed place layer type. + * + * @param placeLayer + * + * @returns {*} + */ +const getLayerTypeView = (placeLayer: PlaceLayerType) => LayerTypeLabels[placeLayer?.layer_type]; + +/** + * Returns the dropdown options for the place layer type. + * + * @returns {*} + */ +const getLayerTypeOptions = () => _.map(_.keys(LayerTypeLabels), (key) => ({ + key, + value: key, + text: LayerTypeLabels[key] +})); + +/** + * Validates the passed place layer. + * + * @param layer + * + * @returns {{}} + */ +const validate = (layer: PlaceLayerType) => { + const errors = {}; + + if (layer.layer_type === LayerTypes.raster && _.isEmpty(layer.url)) { + _.extend(errors, { url: i18n.t('PlaceLayers.errors.raster') }); + } + + if (layer.layer_type === LayerTypes.geojson) { + if (_.isEmpty(layer.url) && (_.isEmpty(layer.geometry) || layer.geometry === EMPTY_JSON)) { + _.extend(errors, { geojson: i18n.t('PlaceLayers.errors.geojson') }); + } + + if (!_.isEmpty(layer.url) && !_.isEmpty(layer.geometry) && layer.geometry !== EMPTY_JSON) { + _.extend(errors, { geojson: i18n.t('PlaceLayers.errors.geojson') }); + } + } + + return errors; +}; + +export default { + getLayerTypeOptions, + getLayerTypeView, + LayerTypeLabels, + LayerTypes, + validate +}; diff --git a/client/yarn.lock b/client/yarn.lock index d1f5f3d..b480402 100644 --- a/client/yarn.lock +++ b/client/yarn.lock @@ -2048,24 +2048,25 @@ "@stitches/react" "^1.2.7" react "^18.2.0" -"@performant-software/geospatial@^1.1.2": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@performant-software/geospatial/-/geospatial-1.1.2.tgz#82ed5d3079a9091ba2d205eb8bd324fa9e91e703" - integrity sha512-rAlcQ1jz0snB3FxGRvKbmnZIHQge5AG562FS9nZavyWvoMjH2eUz/WRG57xGUI49oYtK9XNITkgOCodeq+i/Rw== +"@performant-software/geospatial@^1.1.3-beta.8": + version "1.1.3-beta.8" + resolved "https://registry.yarnpkg.com/@performant-software/geospatial/-/geospatial-1.1.3-beta.8.tgz#56555d18425acee1e4b29d24a92bb09dcbc4ac94" + integrity sha512-W/B0iCg+kmCwVOnXr3nwNpwyhGf9s5HxQfC4SMsUo18+NM6BDx75Ym45TUEIApO2aihCckQivLE1EK7/ZUqouQ== dependencies: "@mapbox/mapbox-gl-draw" "^1.4.3" "@turf/turf" "^6.5.0" mapbox-gl "npm:empty-npm-package@1.0.0" - maplibre-gl "^3.5.2" + maplibre-gl "^3.6.2" + react-icons "^5.0.1" react-map-gl "^7.1.6" underscore "^1.13.6" -"@performant-software/semantic-components@^1.1.2": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@performant-software/semantic-components/-/semantic-components-1.1.2.tgz#9b05ecd8bb6e58d789766d793daee3cca07ae01a" - integrity sha512-0y9czJrpU2RdCO8rq57G0s/v2Wzek3vYAJev03DvjaIlc3XAobqNmS3wDK2u0q9g8iLkiXtK8+IdqqLUIqE5Mw== +"@performant-software/semantic-components@^1.1.3-beta.8": + version "1.1.3-beta.8" + resolved "https://registry.yarnpkg.com/@performant-software/semantic-components/-/semantic-components-1.1.3-beta.8.tgz#909609b9914807be207e0c78aa7c8314e840a814" + integrity sha512-3EkBPJv2TXhegDQfPHS+8IPOlWiMFZyDSsMRnBQKnIG8Z7wSVso98xCSA7aCEZF17XCkwmgti9DaYbJ3sR5DQg== dependencies: - "@performant-software/shared-components" "^1.1.2" + "@performant-software/shared-components" "^1.1.3-beta.8" "@react-google-maps/api" "^2.8.1" axios "^0.26.1" i18next "^19.4.4" @@ -2084,10 +2085,10 @@ zotero-api-client "^0.40.0" zotero-translation-client "^5.0.1" -"@performant-software/shared-components@^1.1.2": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@performant-software/shared-components/-/shared-components-1.1.2.tgz#c9e4a4da02d2b84112ace27b9c930f2a96805697" - integrity sha512-Uqv6yKvDIqkjtjAhyfs15/24znzcTeLReaMp06+I6OrFUswk+EkXjOCpEn/kzDgelUrFFJHIPZ7GJ5XyawS76Q== +"@performant-software/shared-components@^1.1.3-beta.8": + version "1.1.3-beta.8" + resolved "https://registry.yarnpkg.com/@performant-software/shared-components/-/shared-components-1.1.3-beta.8.tgz#d77a0e6ebffa1e11c1faa48a211414d54a0588ac" + integrity sha512-Xhpc4IjPTl6NWMvrZLiZtpLOAw5TZl316PQoIn1Sx6ZWClyi4b03kXim195LbmW/RdNTIGd3O5WXechNx4AaGg== dependencies: "@react-google-maps/api" "^2.8.1" "@samvera/clover-iiif" "^1.10.3" @@ -2107,13 +2108,13 @@ underscore "^1.13.2" zotero-translation-client "^5.0.1" -"@performant-software/user-defined-fields@^1.1.2": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@performant-software/user-defined-fields/-/user-defined-fields-1.1.2.tgz#c74a519c41194d8d0e0268ecd853ab45a706c3a2" - integrity sha512-Z3/AB/qVGEmbT8xGChroBTaHzgZLg9yinw4n6ZJrdmY+RtF9PqQBC7x+cMmxYqXquLVh21JpiOsi2hfHp+iAXA== +"@performant-software/user-defined-fields@^1.1.3-beta.8": + version "1.1.3-beta.8" + resolved "https://registry.yarnpkg.com/@performant-software/user-defined-fields/-/user-defined-fields-1.1.3-beta.8.tgz#41819050cf0aa2bca02af73fcdfa8199e6c11551" + integrity sha512-LQOBoCURkRkdr2+LF+DYBLIe3c4sphRCQ8b+4rGhFQj2f56L+7MGyXvRlT5Vna6uKqlBsgCGg5aha0uYmhU1eg== dependencies: - "@performant-software/semantic-components" "^1.1.2" - "@performant-software/shared-components" "^1.1.2" + "@performant-software/semantic-components" "^1.1.3-beta.8" + "@performant-software/shared-components" "^1.1.3-beta.8" i18next "^21.9.1" semantic-ui-react "^2.1.2" underscore "^1.13.2" @@ -4035,7 +4036,7 @@ "@types/qs" "*" "@types/serve-static" "*" -"@types/geojson@*", "@types/geojson@^7946.0.12": +"@types/geojson@*", "@types/geojson@^7946.0.13": version "7946.0.13" resolved "https://registry.yarnpkg.com/@types/geojson/-/geojson-7946.0.13.tgz#e6e77ea9ecf36564980a861e24e62a095988775e" integrity sha512-bmrNrgKMOhM3WsafmbGmC+6dsF2Z308vLFsQ3a/bT8X8Sv5clVYpPars/UPq+sAaJP+5OoLAYgwbkS5QEJdLUQ== @@ -4125,12 +4126,12 @@ dependencies: "@types/geojson" "*" -"@types/mapbox__point-geometry@*", "@types/mapbox__point-geometry@^0.1.3": +"@types/mapbox__point-geometry@*", "@types/mapbox__point-geometry@^0.1.4": version "0.1.4" resolved "https://registry.yarnpkg.com/@types/mapbox__point-geometry/-/mapbox__point-geometry-0.1.4.tgz#0ef017b75eedce02ff6243b4189210e2e6d5e56d" integrity sha512-mUWlSxAmYLfwnRBmgYV86tgYmMIICX4kza8YnE/eIlywGe2XoOxlpVnXWwir92xRLjwyarqwpu2EJKD2pk0IUA== -"@types/mapbox__vector-tile@^1.3.3": +"@types/mapbox__vector-tile@^1.3.4": version "1.3.4" resolved "https://registry.yarnpkg.com/@types/mapbox__vector-tile/-/mapbox__vector-tile-1.3.4.tgz#ad757441ef1d34628d9e098afd9c91423c1f8734" integrity sha512-bpd8dRn9pr6xKvuEBQup8pwQfD4VUyqO/2deGjfpe6AwC8YRlyEipvefyRJUSiCJTZuCb8Pl1ciVV5ekqJ96Bg== @@ -4154,11 +4155,16 @@ resolved "https://registry.yarnpkg.com/@types/parse-json/-/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0" integrity sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA== -"@types/pbf@*", "@types/pbf@^3.0.4": +"@types/pbf@*": version "3.0.4" resolved "https://registry.yarnpkg.com/@types/pbf/-/pbf-3.0.4.tgz#32f8cd8bb2fb53e5870a5d751210d1dcdce23f85" integrity sha512-SOFlLGZkLbEXJRwcWCqeP/Koyaf/uAqLXHUsdo/nMfjLsNd8kqauwHe9GBOljSmpcHp/LC6kOjo3SidGjNirVA== +"@types/pbf@^3.0.5": + version "3.0.5" + resolved "https://registry.yarnpkg.com/@types/pbf/-/pbf-3.0.5.tgz#a9495a58d8c75be4ffe9a0bd749a307715c07404" + integrity sha512-j3pOPiEcWZ34R6a6mN07mUkM4o4Lwf6hPNt8eilOeZhTFbxFXmKhvXl9Y28jotFPaI1bpPDJsbCprUoNke6OrA== + "@types/prettier@^2.1.5": version "2.6.1" resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.6.1.tgz#76e72d8a775eef7ce649c63c8acae1a0824bbaed" @@ -4244,10 +4250,10 @@ resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.1.tgz#20f18294f797f2209b5f65c8e3b5c8e8261d127c" integrity sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw== -"@types/supercluster@^7.1.2": - version "7.1.2" - resolved "https://registry.yarnpkg.com/@types/supercluster/-/supercluster-7.1.2.tgz#2391a1b22ef108e37d51d4c8bdea7dc04ebf4bcf" - integrity sha512-qMhofL945Z4njQUuntadexAgPtpiBC014WvVqU70Prj42LC77Xgmz04us7hSMmwjs7KbgAwGBmje+FSOvDbP0Q== +"@types/supercluster@^7.1.3": + version "7.1.3" + resolved "https://registry.yarnpkg.com/@types/supercluster/-/supercluster-7.1.3.tgz#1a1bc2401b09174d9c9e44124931ec7874a72b27" + integrity sha512-Z0pOY34GDFl3Q6hUFYf3HkTwKEE02e7QgtJppBt+beEAxnyOpJua+voGFvxINBHa06GwLFFym7gRPY2SiKIfIA== dependencies: "@types/geojson" "*" @@ -8729,10 +8735,10 @@ makeerror@1.0.12: resolved "https://registry.yarnpkg.com/empty-npm-package/-/empty-npm-package-1.0.0.tgz#fda29eb6de5efa391f73d578697853af55f6793a" integrity sha512-q4Mq/+XO7UNDdMiPpR/LIBIW1Zl4V0Z6UT9aKGqIAnBCtCb3lvZJM1KbDbdzdC8fKflwflModfjR29Nt0EpcwA== -maplibre-gl@^3.5.2: - version "3.5.2" - resolved "https://registry.yarnpkg.com/maplibre-gl/-/maplibre-gl-3.5.2.tgz#84a352f1845c6ccf6fe5d86aaa0d0e8b0f18923c" - integrity sha512-deqYA/RiEyXMGroZMDbOWNQTLnFsxREC+mDkQnuyCUNdBWm1KHafsXJYZP7rlLa5RLQNq05IAUAizY9aHTpIUw== +maplibre-gl@^3.6.2: + version "3.6.2" + resolved "https://registry.yarnpkg.com/maplibre-gl/-/maplibre-gl-3.6.2.tgz#abc2f34bddecabef8c20028eff06d62e36d75ccc" + integrity sha512-krg2KFIdOpLPngONDhP6ixCoWl5kbdMINP0moMSJFVX7wX1Clm2M9hlNKXS8vBGlVWwR5R3ZfI6IPrYz7c+aCQ== dependencies: "@mapbox/geojson-rewind" "^0.5.2" "@mapbox/jsonlint-lines-primitives" "^2.0.2" @@ -8742,11 +8748,11 @@ maplibre-gl@^3.5.2: "@mapbox/vector-tile" "^1.3.1" "@mapbox/whoots-js" "^3.1.0" "@maplibre/maplibre-gl-style-spec" "^19.3.3" - "@types/geojson" "^7946.0.12" - "@types/mapbox__point-geometry" "^0.1.3" - "@types/mapbox__vector-tile" "^1.3.3" - "@types/pbf" "^3.0.4" - "@types/supercluster" "^7.1.2" + "@types/geojson" "^7946.0.13" + "@types/mapbox__point-geometry" "^0.1.4" + "@types/mapbox__vector-tile" "^1.3.4" + "@types/pbf" "^3.0.5" + "@types/supercluster" "^7.1.3" earcut "^2.2.4" geojson-vt "^3.2.1" gl-matrix "^3.4.3" @@ -10403,6 +10409,11 @@ react-icons@^4.10.1: resolved "https://registry.yarnpkg.com/react-icons/-/react-icons-4.10.1.tgz#3f3b5eec1f63c1796f6a26174a1091ca6437a500" integrity sha512-/ngzDP/77tlCfqthiiGNZeYFACw85fUjZtLbedmJ5DTlNDIwETxhwBzdOJ21zj4iJdvc0J3y7yOsX3PpxAJzrw== +react-icons@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/react-icons/-/react-icons-5.0.1.tgz#1694e11bfa2a2888cab47dcc30154ce90485feee" + integrity sha512-WqLZJ4bLzlhmsvme6iFdgO8gfZP17rfjYEJ2m9RsZjZ+cc4k1hTzknEz63YS1MeT50kVzoa1Nz36f4BEx+Wigw== + react-is@^16.12.0, react-is@^16.13.1, react-is@^16.6.3, react-is@^16.7.0: version "16.13.1" resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" diff --git a/db/migrate/20240130122627_create_core_data_connector_place_layers.core_data_connector.rb b/db/migrate/20240130122627_create_core_data_connector_place_layers.core_data_connector.rb new file mode 100644 index 0000000..8e55e96 --- /dev/null +++ b/db/migrate/20240130122627_create_core_data_connector_place_layers.core_data_connector.rb @@ -0,0 +1,13 @@ +# This migration comes from core_data_connector (originally 20240122175227) +class CreateCoreDataConnectorPlaceLayers < ActiveRecord::Migration[7.0] + def change + create_table :core_data_connector_place_layers do |t| + t.references :place + t.string :name + t.string :layer_type + t.string :url + t.string :geometry + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 2b68905..8291445 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2024_01_18_173700) do +ActiveRecord::Schema[7.0].define(version: 2024_01_30_122627) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" enable_extension "plpgsql" @@ -109,6 +109,17 @@ t.index ["place_id"], name: "index_core_data_connector_place_geometries_on_place_id" end + create_table "core_data_connector_place_layers", force: :cascade do |t| + t.bigint "place_id" + t.string "name" + t.string "layer_type" + t.string "url" + t.string "geometry" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["place_id"], name: "index_core_data_connector_place_layers_on_place_id" + end + create_table "core_data_connector_place_names", force: :cascade do |t| t.bigint "place_id", null: false t.string "name" @@ -141,11 +152,11 @@ create_table "core_data_connector_project_model_relationships", force: :cascade do |t| t.bigint "primary_model_id", null: false t.bigint "related_model_id", null: false - t.string "name" - t.boolean "multiple" t.datetime "created_at", null: false t.datetime "updated_at", null: false t.string "slug" + t.boolean "multiple" + t.string "name" t.boolean "allow_inverse", default: false, null: false t.string "inverse_name" t.boolean "inverse_multiple", default: false From 707c5400eeefb08b580bf416d3d957bf9f17aea0 Mon Sep 17 00:00:00 2001 From: dleadbetter <> Date: Thu, 1 Feb 2024 08:17:25 -0500 Subject: [PATCH 2/4] CDC #113 - Re-generating Gemfile.lock --- Gemfile.lock | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Gemfile.lock b/Gemfile.lock index 932a1a5..8a1577f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -46,6 +46,7 @@ PATH rack-cors (~> 2.0.1) rails (>= 6.0.3.2, < 8) resource_api + rexml (~> 3.2) rgeo-geojson (~> 2.1) rubyzip (~> 2.3.2) triple_eye_effable @@ -235,6 +236,7 @@ GEM rake (13.0.6) reline (0.3.8) io-console (~> 0.5) + rexml (3.2.6) rgeo (3.0.1) rgeo-activerecord (7.0.1) activerecord (>= 5.0) From 7fdf99b887179f221d67327d58ac9d58e47be1a9 Mon Sep 17 00:00:00 2001 From: dleadbetter <> Date: Thu, 1 Feb 2024 08:20:23 -0500 Subject: [PATCH 3/4] CDC #113 - Updating "core_data_connector" gem to latest version; Installing migrations --- Gemfile | 3 +- Gemfile.lock | 40 ++++++++++--------- ..._to_web_identifiers.core_data_connector.rb | 6 +++ db/schema.rb | 3 +- 4 files changed, 30 insertions(+), 22 deletions(-) create mode 100644 db/migrate/20240201131946_add_web_identifier_z_id_to_web_identifiers.core_data_connector.rb diff --git a/Gemfile b/Gemfile index 67592fd..646dd14 100644 --- a/Gemfile +++ b/Gemfile @@ -37,8 +37,7 @@ gem 'resource_api', git: 'https://github.com/performant-software/resource-api.gi gem 'jwt_auth', git: 'https://github.com/performant-software/jwt-auth.git', tag: 'v0.1.2' # Core data -#gem 'core_data_connector', git: 'https://github.com/performant-software/core-data-connector.git', tag: 'v0.1.26' -gem 'core_data_connector', path: '../core-data-connector' +gem 'core_data_connector', git: 'https://github.com/performant-software/core-data-connector.git', tag: 'v0.1.29' # IIIF gem 'triple_eye_effable', git: 'https://github.com/performant-software/triple-eye-effable.git', tag: 'v0.1.10' diff --git a/Gemfile.lock b/Gemfile.lock index 8a1577f..c562cd0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,3 +1,24 @@ +GIT + remote: https://github.com/performant-software/core-data-connector.git + revision: a2dcd60f4da587a410cbdf9440427f3a3927bd7e + tag: v0.1.29 + specs: + core_data_connector (0.1.0) + activerecord-postgis-adapter (~> 8.0) + faker + jwt (~> 2.7.1) + jwt_auth + rack-cors (~> 2.0.1) + rails (>= 6.0.3.2, < 8) + resource_api + rexml (~> 3.2) + rgeo-geojson (~> 2.1) + rubyzip (~> 2.3.2) + triple_eye_effable + typesense (~> 0.14) + typhoeus (~> 1.4) + user_defined_fields + GIT remote: https://github.com/performant-software/jwt-auth.git revision: fa54af0cdcad6122fad10d9ad745b814c2918853 @@ -35,25 +56,6 @@ GIT rails (>= 6.0.3.2, < 8) resource_api -PATH - remote: ../core-data-connector - specs: - core_data_connector (0.1.0) - activerecord-postgis-adapter (~> 8.0) - faker - jwt (~> 2.7.1) - jwt_auth - rack-cors (~> 2.0.1) - rails (>= 6.0.3.2, < 8) - resource_api - rexml (~> 3.2) - rgeo-geojson (~> 2.1) - rubyzip (~> 2.3.2) - triple_eye_effable - typesense (~> 0.14) - typhoeus (~> 1.4) - user_defined_fields - GEM remote: https://rubygems.org/ specs: diff --git a/db/migrate/20240201131946_add_web_identifier_z_id_to_web_identifiers.core_data_connector.rb b/db/migrate/20240201131946_add_web_identifier_z_id_to_web_identifiers.core_data_connector.rb new file mode 100644 index 0000000..797352e --- /dev/null +++ b/db/migrate/20240201131946_add_web_identifier_z_id_to_web_identifiers.core_data_connector.rb @@ -0,0 +1,6 @@ +# This migration comes from core_data_connector (originally 20240122201553) +class AddWebIdentifierZIdToWebIdentifiers < ActiveRecord::Migration[7.0] + def change + add_column :core_data_connector_web_identifiers, :z_web_identifier_id, :integer + end +end \ No newline at end of file diff --git a/db/schema.rb b/db/schema.rb index 8291445..3807b74 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2024_01_30_122627) do +ActiveRecord::Schema[7.0].define(version: 2024_02_01_131946) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" enable_extension "plpgsql" @@ -265,6 +265,7 @@ t.datetime "created_at", null: false t.datetime "updated_at", null: false t.jsonb "extra" + t.integer "z_web_identifier_id" t.index ["identifiable_type", "identifiable_id"], name: "index_core_data_connector_web_identifiers_on_identifiable" t.index ["web_authority_id"], name: "index_core_data_connector_web_identifiers_on_web_authority_id" end From 27f875c8f59ca4083b031e729017abc9bdff90f4 Mon Sep 17 00:00:00 2001 From: dleadbetter <> Date: Thu, 1 Feb 2024 08:21:45 -0500 Subject: [PATCH 4/4] CDC #113 - Updating react-components packages to the latest version --- client/package.json | 8 ++++---- client/yarn.lock | 38 +++++++++++++++++++------------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/client/package.json b/client/package.json index 123f618..197fd34 100644 --- a/client/package.json +++ b/client/package.json @@ -11,10 +11,10 @@ "flow": "flow" }, "dependencies": { - "@performant-software/geospatial": "^1.1.3-beta.8", - "@performant-software/semantic-components": "^1.1.3-beta.8", - "@performant-software/shared-components": "^1.1.3-beta.8", - "@performant-software/user-defined-fields": "^1.1.3-beta.8", + "@performant-software/geospatial": "^1.1.3", + "@performant-software/semantic-components": "^1.1.3", + "@performant-software/shared-components": "^1.1.3", + "@performant-software/user-defined-fields": "^1.1.3", "boring-avatars": "^1.10.1", "classnames": "^2.3.1", "i18next": "^21.9.1", diff --git a/client/yarn.lock b/client/yarn.lock index b480402..ad0815d 100644 --- a/client/yarn.lock +++ b/client/yarn.lock @@ -2048,10 +2048,10 @@ "@stitches/react" "^1.2.7" react "^18.2.0" -"@performant-software/geospatial@^1.1.3-beta.8": - version "1.1.3-beta.8" - resolved "https://registry.yarnpkg.com/@performant-software/geospatial/-/geospatial-1.1.3-beta.8.tgz#56555d18425acee1e4b29d24a92bb09dcbc4ac94" - integrity sha512-W/B0iCg+kmCwVOnXr3nwNpwyhGf9s5HxQfC4SMsUo18+NM6BDx75Ym45TUEIApO2aihCckQivLE1EK7/ZUqouQ== +"@performant-software/geospatial@^1.1.3": + version "1.1.3" + resolved "https://registry.yarnpkg.com/@performant-software/geospatial/-/geospatial-1.1.3.tgz#d09781e3b6fc504aaf600c5caaddce2c3579754d" + integrity sha512-C3JTi2Kdcrz4agzd6lNS3V3D4elu7aYUhmaFXNgcoIsqiuoyyQYYh0Q2drUbeJHIubF6biMynOtFpXOawEVTCQ== dependencies: "@mapbox/mapbox-gl-draw" "^1.4.3" "@turf/turf" "^6.5.0" @@ -2061,12 +2061,12 @@ react-map-gl "^7.1.6" underscore "^1.13.6" -"@performant-software/semantic-components@^1.1.3-beta.8": - version "1.1.3-beta.8" - resolved "https://registry.yarnpkg.com/@performant-software/semantic-components/-/semantic-components-1.1.3-beta.8.tgz#909609b9914807be207e0c78aa7c8314e840a814" - integrity sha512-3EkBPJv2TXhegDQfPHS+8IPOlWiMFZyDSsMRnBQKnIG8Z7wSVso98xCSA7aCEZF17XCkwmgti9DaYbJ3sR5DQg== +"@performant-software/semantic-components@^1.1.3": + version "1.1.3" + resolved "https://registry.yarnpkg.com/@performant-software/semantic-components/-/semantic-components-1.1.3.tgz#99bfc7a958245d9d68793d419983952323ea4f4e" + integrity sha512-00UM3o8C2tX5B1nY9BWYDkJ64Byj9d1pLJdpM5R87MbSXp5h0hfVko5tEMrU+apxnUubbZvDIRRZFJJF4PFH+Q== dependencies: - "@performant-software/shared-components" "^1.1.3-beta.8" + "@performant-software/shared-components" "^1.1.3" "@react-google-maps/api" "^2.8.1" axios "^0.26.1" i18next "^19.4.4" @@ -2085,10 +2085,10 @@ zotero-api-client "^0.40.0" zotero-translation-client "^5.0.1" -"@performant-software/shared-components@^1.1.3-beta.8": - version "1.1.3-beta.8" - resolved "https://registry.yarnpkg.com/@performant-software/shared-components/-/shared-components-1.1.3-beta.8.tgz#d77a0e6ebffa1e11c1faa48a211414d54a0588ac" - integrity sha512-Xhpc4IjPTl6NWMvrZLiZtpLOAw5TZl316PQoIn1Sx6ZWClyi4b03kXim195LbmW/RdNTIGd3O5WXechNx4AaGg== +"@performant-software/shared-components@^1.1.3": + version "1.1.3" + resolved "https://registry.yarnpkg.com/@performant-software/shared-components/-/shared-components-1.1.3.tgz#d93fe467b8f36ce31882bfa171d279e78a9347c2" + integrity sha512-/HSOUZVrZDL2hTfMjPxIgBkiBKvIu1RQvOQQyqdcG+mFjKhejs8j5TsxuJAhGZ1j2rZyWN9zOOazdZ+6Yfct2w== dependencies: "@react-google-maps/api" "^2.8.1" "@samvera/clover-iiif" "^1.10.3" @@ -2108,13 +2108,13 @@ underscore "^1.13.2" zotero-translation-client "^5.0.1" -"@performant-software/user-defined-fields@^1.1.3-beta.8": - version "1.1.3-beta.8" - resolved "https://registry.yarnpkg.com/@performant-software/user-defined-fields/-/user-defined-fields-1.1.3-beta.8.tgz#41819050cf0aa2bca02af73fcdfa8199e6c11551" - integrity sha512-LQOBoCURkRkdr2+LF+DYBLIe3c4sphRCQ8b+4rGhFQj2f56L+7MGyXvRlT5Vna6uKqlBsgCGg5aha0uYmhU1eg== +"@performant-software/user-defined-fields@^1.1.3": + version "1.1.3" + resolved "https://registry.yarnpkg.com/@performant-software/user-defined-fields/-/user-defined-fields-1.1.3.tgz#0dccbf1e47b820f76eb268c334b04060578d3d83" + integrity sha512-jPpqsfkMHhTpx3xM6qM99tuOeu9ns7iMLBL+mUiECfJNCPFwbPU1KfuQYkI7DOGRYiP2DKmHX7GQ40TkRO4dcw== dependencies: - "@performant-software/semantic-components" "^1.1.3-beta.8" - "@performant-software/shared-components" "^1.1.3-beta.8" + "@performant-software/semantic-components" "^1.1.3" + "@performant-software/shared-components" "^1.1.3" i18next "^21.9.1" semantic-ui-react "^2.1.2" underscore "^1.13.2"