From fa849d011d8c1f58153af0e332004a6b26c5917b Mon Sep 17 00:00:00 2001 From: chriscauley Date: Fri, 20 Aug 2021 18:36:01 +0000 Subject: [PATCH 1/6] adding some notes to quick start guide --- docs/development/quick-start.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/development/quick-start.md b/docs/development/quick-start.md index 00c614e..c39f879 100644 --- a/docs/development/quick-start.md +++ b/docs/development/quick-start.md @@ -25,6 +25,9 @@ The password is available in BitWarden under the entry `read_only @ postgresql` + !!! note + Your WORKSTATION_LAN_IP should start with `192.` or `10.` and can be found with `hostname -I` on Linux and `ifconfig` on mac. + !!! note The above configuration points `DB_PORT` at **5433** because we'll be opening a tunnel from there to the online/remote database with the `kubectl port-forward` command in step 4. @@ -40,7 +43,7 @@ docker run -ti --rm -v $(pwd):/app -w /app composer:2.0 composer install ``` -4. Open a tunnel from the online PostgreSQL database to local port `5433`: +4. Open a tunnel from the online PostgreSQL database to local port `5433` (if you modified the DB_PORT in step 2 you should change `5433` below): ```bash export KUBECONFIG=~/.kube/letsplan-deployer.yaml @@ -73,3 +76,5 @@ ```bash ./vendor/bin/sail yarn watch ``` + +9. The server will now be running on http://localhost:7780 \ No newline at end of file From 35005d75061c6142d664c1e3f80b4377cd7685bb Mon Sep 17 00:00:00 2001 From: chriscauley Date: Fri, 20 Aug 2021 18:40:40 +0000 Subject: [PATCH 2/6] Planning Overlays > Development Index working --- resources/js/Shared/Layouts/MapSheetLayout.vue | 2 +- resources/js/Shared/MapboxMap.vue | 16 +++++++++++++++- resources/js/Shared/ParcelInfo.vue | 15 +++++++-------- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/resources/js/Shared/Layouts/MapSheetLayout.vue b/resources/js/Shared/Layouts/MapSheetLayout.vue index 7440870..6385eb8 100644 --- a/resources/js/Shared/Layouts/MapSheetLayout.vue +++ b/resources/js/Shared/Layouts/MapSheetLayout.vue @@ -300,7 +300,7 @@ export default { this.isPopupVisible = true; this.$refs.parcelpopup.setMapboxMap(this.$refs.mapboxmap.map); this.$refs.parcelpopup.setCoords(event.coords); - this.$refs.parcelinfo.fetchParcel(event.properties.parcel_id); + this.$refs.parcelinfo.fetchParcel(event.properties); this.$refs.mapboxmap.highlightSource(event.feature); } }, diff --git a/resources/js/Shared/MapboxMap.vue b/resources/js/Shared/MapboxMap.vue index d642c61..a4b19f8 100644 --- a/resources/js/Shared/MapboxMap.vue +++ b/resources/js/Shared/MapboxMap.vue @@ -21,7 +21,7 @@ export default { colorNone: '#c0c0c0', colorRankSteps: [ 'step', - ['feature-state', 'rank'], + ['feature-state', 'dev_index'], '#c0c0c0', 0, '#28caf4', 150000, '#377bf4', 500000, @@ -29,6 +29,16 @@ export default { '#8104f4', 5000000, '#c804f4', ], + colorLayersSteps: [ + 'step', + ['get', 'dev_index'], + '#c0c0c0', 0, + '#28caf4', 20, + '#377bf4', 40, + '#311df4', 60, + '#8104f4', 80, + '#c804f4', + ], colorZoningCategories: [ 'match', ['get', 'zoning'], @@ -106,6 +116,10 @@ export default { this.map.setPaintProperty('urban-areas-fill', 'fill-color', this.colorPermitsConstSteps); return; } + if (tiles === 'layers') { + this.map.setPaintProperty('urban-areas-fill', 'fill-color', this.colorLayersSteps); + return; + } this.map.setPaintProperty('urban-areas-fill', 'fill-color', this.colorNone); }, diff --git a/resources/js/Shared/ParcelInfo.vue b/resources/js/Shared/ParcelInfo.vue index bb19664..268f0b5 100644 --- a/resources/js/Shared/ParcelInfo.vue +++ b/resources/js/Shared/ParcelInfo.vue @@ -45,7 +45,6 @@
@@ -140,19 +139,19 @@ export default { }, methods: { - fetchParcel(parcelId) { + fetchParcel({ id, dev_index }) { // avoid having to load the same parcel data twice in a session - if (this.cache[parcelId]) { - this.parcel = this.cache[parcelId]; + if (this.cache[id]) { + this.parcel = this.cache[id]; return; } this.loading = true; - window.axios.get(`/parcel/${parcelId}`) + window.axios.get(`/parcel/${id}`) .then((response) => response.data.data).then((data) => { - const parcel = { id: data.id, ...data.attributes }; + const parcel = { id: data.id, ...data.attributes, dev_index }; this.parcel = parcel; - this.cache[parcelId] = parcel; + this.cache[id] = parcel; }).catch(() => { this.parcel = {}; }) From 21ce537552b87894fa172ede7f2df103f8ce63cf Mon Sep 17 00:00:00 2001 From: chriscauley Date: Fri, 20 Aug 2021 21:30:13 +0000 Subject: [PATCH 3/6] preservation and dev_index toggles now working --- resources/js/Pages/Explore/Layers.vue | 36 +++++++++++++- .../js/Shared/Layouts/MapSheetLayout.vue | 15 +++--- resources/js/Shared/MapboxMap.vue | 48 ++++++++++++++----- resources/js/Shared/ParcelInfo.vue | 15 +++--- resources/js/store/index.js | 4 ++ 5 files changed, 93 insertions(+), 25 deletions(-) diff --git a/resources/js/Pages/Explore/Layers.vue b/resources/js/Pages/Explore/Layers.vue index a45e13b..eae4ea6 100644 --- a/resources/js/Pages/Explore/Layers.vue +++ b/resources/js/Pages/Explore/Layers.vue @@ -1,5 +1,10 @@ diff --git a/resources/js/Shared/Layouts/MapSheetLayout.vue b/resources/js/Shared/Layouts/MapSheetLayout.vue index 6385eb8..281634c 100644 --- a/resources/js/Shared/Layouts/MapSheetLayout.vue +++ b/resources/js/Shared/Layouts/MapSheetLayout.vue @@ -277,12 +277,15 @@ export default { /* eslint-disable prefer-spread */ // const featMin = Math.min.apply(Math, features.map((f) => f.properties[propertyName] || 0)); features.forEach((feat) => { - const fstate = { rank: 0 }; - // no scaling or ranking since using hard coded sales price breaks - fstate.rank = feat.properties.sale_price_adj; - // for non-numeric and 0 assign negative number to color appropriately - if (!fstate.rank) { - fstate.rank = -1; + const { dev_index } = feat.properties + // TODO uncomment this line to see preservation on map + // const preservation = (dev_index * 4357) % 100 + const preservation = undefined + const fstate = { + rank: feat.properties.sale_price_adj || -1, + combined_layers: (dev_index || 0) + (preservation || 0), + preservation: preservation || -1, + dev_index: dev_index || -1, } this.$refs.mapboxmap.map.setFeatureState({ source: 'urban-areas', diff --git a/resources/js/Shared/MapboxMap.vue b/resources/js/Shared/MapboxMap.vue index a4b19f8..699a4cd 100644 --- a/resources/js/Shared/MapboxMap.vue +++ b/resources/js/Shared/MapboxMap.vue @@ -21,7 +21,7 @@ export default { colorNone: '#c0c0c0', colorRankSteps: [ 'step', - ['feature-state', 'dev_index'], + ['feature-state', 'rank'], '#c0c0c0', 0, '#28caf4', 150000, '#377bf4', 500000, @@ -29,16 +29,6 @@ export default { '#8104f4', 5000000, '#c804f4', ], - colorLayersSteps: [ - 'step', - ['get', 'dev_index'], - '#c0c0c0', 0, - '#28caf4', 20, - '#377bf4', 40, - '#311df4', 60, - '#8104f4', 80, - '#c804f4', - ], colorZoningCategories: [ 'match', ['get', 'zoning'], @@ -82,6 +72,34 @@ export default { }, methods: { + getLayerSteps() { + const { dev_index, preservation } = this.$store.getters.getField('layers') + + let max = 100 + let attribute + + if (preservation && dev_index) { // both + max = 200 + attribute = 'combined_layers' + } else if (preservation) { + attribute = 'preservation' + } else if (dev_index) { + attribute = 'dev_index' + } else { // neither + return this.colorNone + } + + return [ + 'step', + ['feature-state', attribute], + '#c0c0c0', 0, + '#28caf4', 0.2 * max, + '#377bf4', 0.4 * max, + '#311df4', 0.6 * max, + '#8104f4', 0.8 * max, + '#c804f4', + ]; + }, highlightSource(feature) { const clickHighlightSource = this.map.getSource('click-highlight'); clickHighlightSource.setData(feature); @@ -117,7 +135,8 @@ export default { return; } if (tiles === 'layers') { - this.map.setPaintProperty('urban-areas-fill', 'fill-color', this.colorLayersSteps); + this.getLayerSteps() + this.map.setPaintProperty('urban-areas-fill', 'fill-color', this.getLayerSteps()); return; } this.map.setPaintProperty('urban-areas-fill', 'fill-color', this.colorNone); @@ -234,6 +253,11 @@ export default { }); this.showTiles(this.tiles); + this.$store.subscribe((mutation, state) => { + if (mutation.type === 'updateLayers') { + this.showTiles(this.tiles) + } + }) }); }, }, diff --git a/resources/js/Shared/ParcelInfo.vue b/resources/js/Shared/ParcelInfo.vue index 268f0b5..7687adc 100644 --- a/resources/js/Shared/ParcelInfo.vue +++ b/resources/js/Shared/ParcelInfo.vue @@ -45,6 +45,7 @@
@@ -140,21 +140,23 @@ export default { }, methods: { - fetchParcel({ parcel_id, dev_index, preservation }) { + fetchParcel({ parcel_id: parcelId, dev_index: devIndex, preservation }) { // avoid having to load the same parcel data twice in a session - if (this.cache[parcel_id]) { - this.parcel = this.cache[parcel_id]; + if (this.cache[parcelId]) { + this.parcel = this.cache[parcelId]; return; } this.loading = true; - window.axios.get(`/parcel/${parcel_id}`) + window.axios.get(`/parcel/${parcelId}`) .then((response) => response.data.data).then((data) => { - const parcel = { id: parcel_id, ...data.attributes, dev_index, preservation }; + const parcel = { + id: parcelId, ...data.attributes, devIndex, preservation, + }; // TODO uncomment next line to use dummy value for preservation - // parcel.preservation = (parcel.dev_index * 4357) % 100 + // parcel.preservation = (parcel.devIndex * 4357) % 100 this.parcel = parcel; - this.cache[parcel_id] = parcel; + this.cache[parcelId] = parcel; }).catch(() => { this.parcel = {}; }) diff --git a/resources/js/store/index.js b/resources/js/store/index.js index 0651ad7..46cb780 100644 --- a/resources/js/store/index.js +++ b/resources/js/store/index.js @@ -23,7 +23,7 @@ export default new Vuex.Store({ }, survey_results: null, submitted: false, - layers: { dev_index: true, preservation: true }, + layers: { devIndex: true, preservation: true }, // from letsplanorg exploreIsExpanded: false, @@ -38,8 +38,9 @@ export default new Vuex.Store({ }, updateField, updateLayers(state, layers) { - state.layers = layers - } + // eslint-disable-next-line no-param-reassign + state.layers = layers; + }, }, getters: { getField, From 832c502d53d38c806434aba123206f4df3d8d982 Mon Sep 17 00:00:00 2001 From: Chris Alfano Date: Fri, 20 Aug 2021 18:59:21 -0400 Subject: [PATCH 5/6] style(docs): make url a link --- docs/development/quick-start.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/development/quick-start.md b/docs/development/quick-start.md index c39f879..d9c2868 100644 --- a/docs/development/quick-start.md +++ b/docs/development/quick-start.md @@ -77,4 +77,4 @@ ./vendor/bin/sail yarn watch ``` -9. The server will now be running on http://localhost:7780 \ No newline at end of file +9. The server will now be running on \ No newline at end of file From 367e1018e0cc6d548d75b76b576fac52adf47bab Mon Sep 17 00:00:00 2001 From: chriscauley Date: Mon, 23 Aug 2021 15:58:10 +0000 Subject: [PATCH 6/6] disabling preservation for now --- resources/js/Pages/Explore/Layers.vue | 4 +++- resources/js/store/index.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/resources/js/Pages/Explore/Layers.vue b/resources/js/Pages/Explore/Layers.vue index 931b37f..52bc96e 100644 --- a/resources/js/Pages/Explore/Layers.vue +++ b/resources/js/Pages/Explore/Layers.vue @@ -16,6 +16,7 @@ class="flex-grow-1" :label="item.label" :color="item.color" + :disabled="item.disabled" @change="onChange" /> @@ -67,7 +68,8 @@ export default { attribute: 'preservation', color: 'teal', isDialogVisible: false, - value: true, + value: false, + disabled: true, tooltip: `The Preservation Index is built from our community survey here. Go to the OurPlan Methodology to learn more about how the index is created. diff --git a/resources/js/store/index.js b/resources/js/store/index.js index 46cb780..88958d2 100644 --- a/resources/js/store/index.js +++ b/resources/js/store/index.js @@ -23,7 +23,7 @@ export default new Vuex.Store({ }, survey_results: null, submitted: false, - layers: { devIndex: true, preservation: true }, + layers: { devIndex: true, preservation: false }, // from letsplanorg exploreIsExpanded: false,