@abi-software/map-utilities 1.2.1-beta.1 → 1.2.1-beta.2

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/map-utilities",
3
- "version": "1.2.1-beta.1",
3
+ "version": "1.2.1-beta.2",
4
4
  "files": [
5
5
  "dist/*",
6
6
  "src/*",
@@ -106,9 +106,11 @@
106
106
  </div>
107
107
  </div>
108
108
 
109
- <div class="connectivity-graph-error" v-if="errorMessage || errorConnectivities">
110
- <strong v-if="errorConnectivities">{{ errorConnectivities }}</strong>
111
- {{ errorMessage }}
109
+ <div v-if="connectivityError" class="connectivity-graph-error">
110
+ <strong v-if="connectivityError.errorConnectivities">
111
+ {{ connectivityError.errorConnectivities }}
112
+ </strong>
113
+ {{ connectivityError.errorMessage }}
112
114
  </div>
113
115
 
114
116
  </div>
@@ -164,8 +166,7 @@ export default {
164
166
  zoomOutLabel: ZOOM_OUT_LABEL,
165
167
  iconColor: APP_PRIMARY_COLOR,
166
168
  zoomEnabled: false,
167
- errorMessage: '',
168
- errorConnectivities: '',
169
+ connectivityError: null,
169
170
  };
170
171
  },
171
172
  mounted() {
@@ -426,40 +427,12 @@ export default {
426
427
  this.zoomLockLabel = this.zoomEnabled ? ZOOM_UNLOCK_LABEL : ZOOM_LOCK_LABEL;
427
428
  this.connectivityGraph.enableZoom(!this.zoomEnabled);
428
429
  },
429
- getErrorConnectivities: function (errorData) {
430
- const errorDataToEmit = [...new Set(errorData)];
431
- let errorConnectivities = '';
432
-
433
- errorDataToEmit.forEach((connectivity, i) => {
434
- const { label } = connectivity;
435
- errorConnectivities += (i === 0) ? capitalise(label) : label;
436
-
437
- if (errorDataToEmit.length > 1) {
438
- if ((i + 2) === errorDataToEmit.length) {
439
- errorConnectivities += ' and ';
440
- } else if ((i + 1) < errorDataToEmit.length) {
441
- errorConnectivities += ', ';
442
- }
443
- }
444
- });
445
-
446
- return errorConnectivities;
447
- },
448
- /**
449
- * Function to show error message.
450
- * `errorInfo` includes `errorData` array (optional) for error connectivities
451
- * and `errorMessage` for error message.
452
- * @arg `errorInfo`
453
- */
454
- showErrorMessage: function (errorInfo) {
455
- const { errorData, errorMessage } = errorInfo;
456
- this.errorConnectivities = this.getErrorConnectivities(errorData);
457
- this.errorMessage = errorMessage;
430
+ showErrorMessage: function (connectivityError) {
431
+ this.connectivityError = {...connectivityError};
458
432
 
459
433
  // Show error for 3 seconds
460
434
  setTimeout(() => {
461
- this.errorConnectivities = '';
462
- this.errorMessage = '';
435
+ this.connectivityError = null;
463
436
  }, ERROR_TIMEOUT);
464
437
  },
465
438
  },