@phila/layerboard 2.0.4 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@phila/layerboard",
3
3
  "description": "A Vue.js component for creating an app from an ESRI web map",
4
- "version": "2.0.4",
4
+ "version": "2.2.0",
5
5
  "author": "City of Philadelphia <maps@phila.gov>",
6
6
  "repository": "https://github.com/cityofphiladelphia/layerboard",
7
7
  "license": "MIT",
@@ -57,7 +57,7 @@
57
57
  <popover
58
58
  v-if="popoverOpen"
59
59
  :options="popoverOptions"
60
- :slots="{'text': popoverText}"
60
+ :slots="{ 'text': popoverText }"
61
61
  />
62
62
  </div>
63
63
  </template>
@@ -66,22 +66,18 @@
66
66
  import axios from 'axios';
67
67
  import TopicPanel from './TopicPanel.vue';
68
68
  import MapPanel from './MapPanel.vue';
69
- // import FooterTest from './FooterTest.vue';
70
- // console.log('FooterTest:', FooterTest)
71
69
 
72
70
  export default {
73
71
  name: 'Layerboard',
74
72
  components: {
75
73
  TopicPanel,
76
74
  MapPanel,
77
- // FooterTest,
78
75
  CyclomediaWidget: () => import(/* webpackChunkName: "mbmb_pvm_CyclomediaWidget" */'@phila/vue-mapping/src/cyclomedia/Widget.vue'),
79
76
  PictometryWidget: () => import(/* webpackChunkName: "mbmb_pvm_PictometryWidget" */'@phila/vue-mapping/src/pictometry/Widget.vue'),
80
77
  PictometryLayer: () => import(/* webpackChunkName: "mbmb_pvm_PictometryLayer" */'@phila/vue-mapping/src/pictometry/Layer.vue'),
81
78
  PictometryPngMarker: () => import(/* webpackChunkName: "mbmb_pvm_PictometryPngMarker" */'@phila/vue-mapping/src/pictometry/PngMarker.vue'),
82
79
  PictometryViewCone: () => import(/* webpackChunkName: "mbmb_pvm_PictometryViewCone" */'@phila/vue-mapping/src/pictometry/ViewCone.vue'),
83
80
  Popover: () => import(/* webpackChunkName: "mbmb_pvc_Popover" */'@phila/vue-comps/src/components/Popover.vue'),
84
- // Footer: () => import(/* webpackChunkName: "Footer" */'./Footer.vue'),
85
81
  },
86
82
  computed: {
87
83
  popoverOpen() {
@@ -115,10 +111,9 @@ export default {
115
111
  }
116
112
  const center = this.$config.map.center;
117
113
  return center;
118
-
119
114
  },
120
115
  cycloRotationAngle() {
121
- return this.$store.state.cyclomedia.orientation.yaw * (180/3.14159265359);
116
+ return this.$store.state.cyclomedia.orientation.yaw * (180 / 3.14159265359);
122
117
  },
123
118
  cycloHFov() {
124
119
  return this.$store.state.cyclomedia.orientation.hFov;
@@ -136,7 +131,6 @@ export default {
136
131
  return false;
137
132
  }
138
133
  return true;
139
-
140
134
  },
141
135
  geocodeData() {
142
136
  return this.$store.state.geocode.data;
@@ -155,7 +149,6 @@ export default {
155
149
  return 'See Map';
156
150
  }
157
151
  return 'See Datasets';
158
-
159
152
  },
160
153
  shouldShowTopics() {
161
154
  return this.$store.state.shouldShowTopics;
@@ -166,16 +159,11 @@ export default {
166
159
  },
167
160
  watch: {
168
161
  pictometryShowAddressMarker(nextValue) {
169
- // console.log('watch pictometryShowAddressMarker', nextValue);
170
162
  },
171
163
  windowDim(nextDim) {
172
164
  this.calculateShouldShowTopics();
173
165
  this.calculateShouldShowMap();
174
166
  },
175
- // windowWidth(nextWidth) {
176
- // this.calculateShouldShowTopics();
177
- // this.calculateShouldShowMap();
178
- // },
179
167
  fullScreenMapEnabled(nextValue) {
180
168
  this.calculateShouldShowTopics();
181
169
  this.calculateShouldShowMap();
@@ -192,7 +180,6 @@ export default {
192
180
  },
193
181
  },
194
182
  mounted() {
195
- // console.log('cyclo', this.$config.cyclomedia.enabled, CyclomediaWidget);
196
183
  let defaultLayers = [];
197
184
 
198
185
  if (this.$config.initialPopover && window.location.hash == '') {
@@ -213,8 +200,6 @@ export default {
213
200
  }
214
201
  }
215
202
 
216
- // console.log('Layerboard.vue mounted, this.$config.topics:', this.$config.topics, 'defaultLayers:', defaultLayers, 'this.$store.state.map.webMapLayersAndRest:', this.$store.state.map.webMapLayersAndRest);
217
-
218
203
  this.$store.commit('setDefaultLayers', defaultLayers);
219
204
  this.$store.commit('setWebMapActiveLayers', defaultLayers);
220
205
 
@@ -232,37 +217,21 @@ export default {
232
217
  this.handleWindowResize();
233
218
 
234
219
  const store = this.$store;
235
- const knackUrl = "https://api.knackhq.com/v1/objects/object_4/records/export?type=json";
236
- const params = {
237
- // dataType: 'json'
238
- };
239
- const headers = {
240
- 'X-Knack-Application-Id': '550c60d00711ffe12e9efc64',
241
- 'X-Knack-REST-API-Key': '7bce4520-28dc-11e5-9f0a-4d758115b820',
242
- };
243
- axios.get(knackUrl, { params, headers }).then(response => {
244
- const dataOut = response.data;
245
- const records = dataOut.records;
246
- const recordsFiltered = records.filter(record => record.field_12 === "API" || record.field_12 === "GeoService");
220
+ const cartoUrlQuery = `https://phl.carto.com:443/api/v2/sql?q= \
221
+ select url_text, COALESCE(representation, '') as representation \
222
+ from phl.knack_metadata_reps_endpoints_join \
223
+ WHERE ( format = 'API' OR format = 'GeoService' ) \
224
+ AND url_text IS NOT null`;
247
225
 
226
+ axios.get(cartoUrlQuery).then(response => {
227
+ const data = response.data.rows;
248
228
  let bennyEndpoints = {};
249
-
250
- for (let record of recordsFiltered) {
251
- const url = record.field_25.split('"')[1];
252
- let url2;
253
- if (url) {
254
- url2 = url.split('query')[0].replace('https://', '').replace('http://', '').replace(/\/$/, "").toLowerCase();
255
- } else {
256
- url2 = null;
257
- }
258
- if (record.field_13_raw.length > 0) {
259
- bennyEndpoints[url2] = record.field_13_raw[0].id;
260
- } else {
261
- bennyEndpoints[url2] = '';
262
- }
263
- }
229
+ data.map((datum) => {
230
+ const shortUrl = datum.url_text.split('query')[0].replace('https://', '').replace('http://', '').replace(/\/$/, "").toLowerCase();
231
+ bennyEndpoints[shortUrl] = datum.representation;
232
+ });
264
233
  store.commit('setBennyEndpoints', bennyEndpoints);
265
- }, response => {
234
+ }, () => {
266
235
  console.log('AXIOS ERROR Layerboard.vue');
267
236
  });
268
237
  },
@@ -273,17 +242,14 @@ export default {
273
242
  this.$store.commit('setDidToggleTopicsOn', !prevVal);
274
243
  },
275
244
  calculateShouldShowTopics() {
276
- // const windowWidth = this.windowWidth;
277
245
  const windowWidth = this.windowDim.width;
278
246
  const smallScreen = windowWidth < 750;
279
247
  const didToggleTopicsOn = this.$store.state.didToggleTopicsOn;
280
248
  const fullScreenMapEnabled = this.$store.state.fullScreenMapEnabled;
281
- // console.log('calculateShouldShowTopics, smallScreen:', smallScreen, 'didToggleTopicsOn', didToggleTopicsOn, 'fullScreenMapEnabled', fullScreenMapEnabled);
282
249
  const shouldShowTopics = !smallScreen && !fullScreenMapEnabled || smallScreen && didToggleTopicsOn;
283
250
  this.$store.commit('setShouldShowTopics', shouldShowTopics);
284
251
  },
285
252
  calculateShouldShowMap() {
286
- // const windowWidth = this.windowWidth;
287
253
  const windowWidth = this.windowDim.width;
288
254
  const notMobile = windowWidth > 750;
289
255
  const didToggleTopicsOn = this.$store.state.didToggleTopicsOn;
@@ -294,21 +260,14 @@ export default {
294
260
  const windowHeight = window.innerHeight;
295
261
  const rootElement = document.getElementById('mb-root');
296
262
  const rootStyle = window.getComputedStyle(rootElement);
297
- // const rootHeight = rootStyle.getPropertyValue('height');
298
- // const rootHeightNum = parseInt(rootHeight.replace('px', ''));
299
- // const rootHeightNum = 100;
300
263
  const rootWidth = rootStyle.getPropertyValue('width');
301
264
  const rootHeight = rootStyle.getPropertyValue('height');
302
265
  const rootWidthNum = parseInt(rootWidth.replace('px', ''));
303
266
  const rootHeightNum = parseInt(rootHeight.replace('px', ''));
304
-
305
267
  const dim = {
306
268
  width: rootWidthNum,
307
269
  height: rootHeightNum,
308
270
  };
309
-
310
- // console.log('Layerboard handleWindowResize is running, dim:', dim);
311
- // this.$store.commit('setWindowWidth', rootWidthNum);
312
271
  this.$store.commit('setWindowDimensions', dim);
313
272
  },
314
273
  },
@@ -316,46 +275,41 @@ export default {
316
275
  </script>
317
276
 
318
277
  <style>
319
- /*don't highlight any form elements*/
320
- input:focus,
321
- select:focus,
322
- textarea:focus,
323
- button:focus {
324
- outline: none;
325
- }
278
+ /*don't highlight any form elements*/
279
+ input:focus,
280
+ select:focus,
281
+ textarea:focus,
282
+ button:focus {
283
+ outline: none;
284
+ }
326
285
 
327
- /* standards applies padding to buttons, which causes some weirdness with
286
+ /* standards applies padding to buttons, which causes some weirdness with
328
287
  buttons on the map panel. override here. */
329
- button {
330
- padding: inherit;
331
- }
288
+ button {
289
+ padding: inherit;
290
+ }
332
291
 
333
- .mb-root {
334
- position: absolute;
335
- bottom: 0;
336
- top: 78px;
337
- left: 0;
338
- right: 0;
339
- overflow: auto;
340
- }
292
+ .mb-root {
293
+ position: absolute;
294
+ bottom: 0;
295
+ top: 78px;
296
+ left: 0;
297
+ right: 0;
298
+ overflow: auto;
299
+ }
341
300
 
301
+ .datasets-button {
302
+ display: none;
303
+ height: 36px;
304
+ margin: 0;
305
+ }
306
+
307
+ /*small devices only*/
308
+ /* @media screen and (max-width: 39.9375em) { */
309
+ @media screen and (max-width: 750px) {
342
310
  .datasets-button {
343
- display: none;
311
+ display: block;
344
312
  height: 36px;
345
- margin: 0;
346
- }
347
-
348
- .mb-panel {
349
- /* height: 100%; */
350
313
  }
351
-
352
- /*small devices only*/
353
- /* @media screen and (max-width: 39.9375em) { */
354
- @media screen and (max-width: 750px) {
355
- .datasets-button {
356
- display: block;
357
- height: 36px;
358
- }
359
- }
360
-
314
+ }
361
315
  </style>