-
Lene Wasskog authored
Ensure cancel button is available when new poi is selected Remove setting for "only my pois" from global state Display entire form also before pest is selected Add new css class for icons in form Enable removal of quantification data
Lene Wasskog authoredEnsure cancel button is available when new poi is selected Remove setting for "only my pois" from global state Display entire form also before pest is selected Add new css class for icons in form Enable removal of quantification data
CommonUtil.vue 4.30 KiB
<template></template>
<script>
import CommonUtilLocal from '@/components/CommonUtilLocal'
export default {
CONST_EVENT_LOGIN_USER_DETAIL: 'eventloginuserdetail',
CONST_STATUS_PENDING: 1,
CONST_STORAGE_UUID: 'store-user-uuid',
CONST_STORAGE_USER_DETAIL: 'store-user-detail',
CONST_STORE_TIMESTAMP: 'store-time-stamp',
CONST_STORAGE_CROP_CATEGORY: 'store-crop-category',
CONST_STORAGE_CROP_ID_LIST: 'store-crop-id-list',
CONST_STORAGE_CROP_LIST: 'store-crop-list',
CONST_STORAGE_PEST_LIST: 'store-pest-list',
CONST_STORAGE_CROP_PEST_LIST: 'store-crop-pest-list',
CONST_STORAGE_OBSERVATION_LIST: 'store-observation-list',
CONST_STORAGE_OBSERVATION_TIME_SERIES_LIST: 'store-observation-time-series-list',
CONST_STORAGE_IMAGE_LIST: 'store-image-list',
CONST_STORAGE_POI_LIST: 'store-poi-list',
CONST_STORAGE_VISIBILITY_POLYGON: 'store-polygon',
CONST_POI_TYPES: [
{"point_of_interest_type_id": 0, "default_name": "General", "is_user_selectable": true},
{"point_of_interest_type_id": 2, "default_name": "Farm", "is_user_selectable": true},
{"point_of_interest_type_id": 3, "default_name": "Field", "is_user_selectable": true},
{"point_of_interest_type_id": 5, "default_name": "Trap", "is_user_selectable": true},
{"point_of_interest_type_id": 1, "default_name": "Weather station", "is_user_selectable": false}
],
CONST_POI_TYPE_DEFAULT: 3,
CONST_IMAGE_WIDTH: 100,
CONST_IMAGE_HEIGHT: 100,
CONST_IMAGE_CANVAS_WIDTH: 100,
CONST_IMAGE_CANVAS_HEIGHT: 100,
CONST_CROP_CATEGORY_ID: 'cropCategoryId',
CONST_ORGANISM_ID: 'organismId',
CONST_OBSERVATION_TIME_SERIES_COUNT_START_ID: -1,
CONST_OBSERVATION_COUNT_START_ID: -1,
CONST_POI_COUNT_START_ID: -1,
CONST_URL_DOMAIN: CommonUtilLocal.CONST_URL_DOMAIN, // Moved to CommonUtilLocal.vue (not in Git repo)
CONST_URL_AUTH_UUID: '/rest/auth/uuid',
CONST_URL_AUTH_LOGIN: '/rest/auth/login',
CONST_URL_LAST_TIMESTAMP: '/rest/observation/organismsystemupdated',
CONST_URL_USER: '/user',
CONST_URL_CROP_CATEGORY: '/rest/organism/cropcategory/',
CONST_URL_CROP_LIST: '/rest/organism/crop/list',
CONST_URL_PEST_LIST: '/rest/organism/pest/list/',
CONST_URL_CROP_PEST_LIST: '/rest/organism/crop/pest/list',
CONST_URL_SYNC_UPDATE_OBSERVATIONS: '/rest/observation/syncobservationlistfromapp',
CONST_URL_SYNC_UPDATE_OBSERVATION: '/rest/observation/syncobservationfromapp',
CONST_URL_SYNC_UPDATE_OBSERVATION_TIME_SERIES: '/rest/observationtimeseries/syncfromapp',
CONST_URL_REGISTER_NEW_USER: '/rest/user/register',
CONST_URL_DELETE_USER: '/rest/user/deleteme',
CONST_URL_SYNC_UPDATE_POI: '/rest/poi/syncpoifromapp',
CONST_URL_USER_OBSERVATION_LIST: '/rest/observation/list/user',
CONST_URL_USER_OBSERVATION_TIME_SERIES_LIST: '/rest/observationtimeseries/list/user',
CONST_URL_USER_POI: '/rest/poi/user',
CONST_URL_POLYGON_SERVICES: '/rest/observation/polygonservices/',
CONST_URL_STATIC_IMAGE_PATH: '/static/images/observations/',
CONST_GPS_URL_NORWAY_MAP: 'https://opencache.statkart.no/gatekeeper/gk/gk.open_wmts?Version=1.0.0&service=wmts&request=getcapabilities',
CONST_GPS_DEFAULT_LATITUDE_NORWAY: 16,
CONST_GPS_DEFAULT_LONGITUDE_NORWAY: 63,
CONST_GPS_DEFAULT_LATITUDE_02_NORWAY: 63,
CONST_GPS_DEFAULT_LONGITUDE_02_NORWAY: 16,
CONST_GPS_DEFAULT_ZOOM: 4.2,
CONST_GPS_OBSERVATION_ZOOM: 10,
CONST_DB_NAME: 'db-index-observation',
CONST_DB_VERSION: 3,
CONST_DB_ENTITY_PHOTO: 'entityPhoto',
CONST_DB_INDEX_NAME_OBSERVATION_ID: 'observationId',
CONST_FIELD_MANDATORY: '<font color=red>*</font>',
logInfo: function(message) {
if(CommonUtilLocal.CONST_DEBUG){
console.info(message);
}
},
timeSeriesLabel(observationTimeSeries) {
if (observationTimeSeries && observationTimeSeries.name) {
let timeSeriesName = observationTimeSeries.name;
timeSeriesName = timeSeriesName.replace(/\s/g, '');
timeSeriesName = timeSeriesName.slice(0, 8);
return timeSeriesName.toUpperCase();
}
return "";
},
setHeaderTitle: function (headerTitle) {
document.getElementById("appHeader").innerHTML = headerTitle;
},
getSystemLocale: function() {
return "nb";
// TODO: Enable this when more languages are supported
/*
return typeof navigator.language != 'undefined' ?
navigator.language.trim().substring(0, 2)
: null;
*/
}
}
</script>