diff --git a/js/app/map/map.js b/js/app/map/map.js
index 5ec0f55e..8fa47343 100644
--- a/js/app/map/map.js
+++ b/js/app/map/map.js
@@ -2809,7 +2809,7 @@ define([
let interval = mapElement.getMapOverlayInterval();
if(
- ! interval ||
+ !interval ||
options.forceData === true
){
diff --git a/js/app/map/system.js b/js/app/map/system.js
index 4acf9b93..ce5b39cf 100644
--- a/js/app/map/system.js
+++ b/js/app/map/system.js
@@ -109,6 +109,83 @@ define([
let mapContainer = $(map.getContainer());
let mapId = mapContainer.data('id');
+ /**
+ * update new system dialog with some "additional" data
+ * -> if system was mapped before
+ * @param dialogElement
+ * @param systemData
+ */
+ let updateDialog = (dialogElement, systemData = null) => {
+ let labelEmpty = 'empty';
+ let labelUnknown = 'unknown';
+ let labelExist = 'loaded';
+
+ let showInfoHeadline = 'fadeOut';
+ let showInfoSection = 'hide';
+ let info = labelEmpty;
+
+ let statusId = false; // -> no value change
+ let alias = labelEmpty;
+ let description = labelEmpty;
+ let createdTime = labelUnknown;
+ let updatedTime = labelUnknown;
+
+ if(systemData){
+ // system data found for selected system
+ showInfoHeadline = 'fadeIn';
+ showInfoSection = 'show';
+ info = labelExist;
+ statusId = parseInt(Util.getObjVal(systemData, 'status.id')) || statusId;
+ alias = systemData.alias.length ? Util.htmlEncode(systemData.alias) : alias;
+ description = systemData.description.length ? systemData.description : description;
+
+ let dateCreated = new Date(systemData.created.created * 1000);
+ let dateUpdated = new Date(systemData.updated.updated * 1000);
+ let dateCreatedUTC = Util.convertDateToUTC(dateCreated);
+ let dateUpdatedUTC = Util.convertDateToUTC(dateUpdated);
+
+ createdTime = Util.convertDateToString(dateCreatedUTC);
+ updatedTime = Util.convertDateToString(dateUpdatedUTC);
+
+ }else if(systemData === null){
+ // no system found for selected system
+ showInfoHeadline = 'fadeIn';
+ }
+
+ // update new system dialog with new default data
+ dialogElement.find('#' + config.dialogSystemSectionInfoStatusId).html(info);
+ if(statusId !== false){
+ dialogElement.find('#' + config.dialogSystemStatusSelectId).val(statusId).trigger('change');
+ }
+ dialogElement.find('#' + config.dialogSystemAliasId).html(alias);
+ dialogElement.find('#' + config.dialogSystemDescriptionId).html(description);
+ dialogElement.find('#' + config.dialogSystemCreatedId).html(' ' + createdTime);
+ dialogElement.find('#' + config.dialogSystemUpdatedId).html(' ' + updatedTime);
+ dialogElement.find('[data-target="#' + config.dialogSystemSectionInfoId + '"]').velocity('stop').velocity(showInfoHeadline, {duration: 120});
+ dialogElement.find('[data-type="spinner"]').removeClass('in');
+ dialogElement.find('#' + config.dialogSystemSectionInfoId).collapse(showInfoSection);
+ };
+
+ /**
+ * request system data from server for persistent data -> update dialog
+ * @param dialogElement
+ * @param mapId
+ * @param systemId
+ */
+ let requestSystemData = (dialogElement, mapId, systemId) => {
+ // show loading animation
+ dialogElement.find('[data-type="spinner"]').addClass('in');
+
+ MapUtil.requestSystemData({
+ mapId: mapId,
+ systemId: systemId,
+ isCcpId: 1
+ }, {
+ dialogElement: dialogElement
+ }).then(payload => updateDialog(payload.context.dialogElement, payload.data))
+ .catch(payload => updateDialog(payload.context.dialogElement));
+ };
+
// format system status for form select -----------------------------------------------------------------------
// "default" selection (id = 0) prevents status from being overwritten
// -> e.g. keep status information if system was just inactive (active = 0)
@@ -242,7 +319,7 @@ define([
systemDialog.on('show.bs.modal', function(e){
let dialogElement = $(this);
- // init "status" select2
+ // init "status" select2 ------------------------------------------------------------------------------
for(let [statusName, data] of Object.entries(Init.systemStatus)){
statusData.push({id: data.id, text: data.label, class: data.class});
}
@@ -251,6 +328,13 @@ define([
data: statusData,
iconClass: 'fa-tag'
});
+
+ // initial dialog update with persistent system data --------------------------------------------------
+ // -> only if system is preselected (e.g. current active system)
+ let systemId = parseInt(dialogElement.find('.' + config.dialogSystemSelectClass).val()) || 0;
+ if(systemId){
+ requestSystemData(dialogElement, mapId, systemId);
+ }
});
systemDialog.on('shown.bs.modal', function(e){
@@ -266,20 +350,10 @@ define([
selectElement.delay(240).initSystemSelect({
key: 'id',
disabledOptions: mapSystemIds,
- onChange: (systemId) => {
+ onChange: systemId => {
// on system select -> update dialog with persistent system data
if(systemId){
- // show loading animation
- dialogElement.find('[data-type="spinner"]').addClass('in');
-
- MapUtil.requestSystemData({
- mapId: mapId,
- systemId: systemId,
- isCcpId: 1
- }, {
- dialogElement: dialogElement
- }).then(payload => updateDialog(payload.context.dialogElement, payload.data))
- .catch(payload => updateDialog(payload.context.dialogElement));
+ requestSystemData(dialogElement, mapId, systemId);
}else{
// no system selected
updateDialog(dialogElement, false);
@@ -290,64 +364,6 @@ define([
// show dialog
systemDialog.modal('show');
-
- /**
- * update new system dialog with some "additional" data
- * -> if system was mapped before
- * @param dialogElement
- * @param systemData
- */
- let updateDialog = (dialogElement, systemData = null) => {
- let labelEmpty = 'empty';
- let labelUnknown = 'unknown';
- let labelExist = 'loaded';
-
- let showInfoHeadline = 'fadeOut';
- let showInfoSection = 'hide';
- let info = labelEmpty;
-
- let statusId = false; // -> no value change
- let alias = labelEmpty;
- let description = labelEmpty;
- let createdTime = labelUnknown;
- let updatedTime = labelUnknown;
-
- if(systemData){
- // system data found for selected system
- showInfoHeadline = 'fadeIn';
- showInfoSection = 'show';
- info = labelExist;
- statusId = parseInt(Util.getObjVal(systemData, 'status.id')) || statusId;
- alias = systemData.alias.length ? Util.htmlEncode(systemData.alias) : alias;
- description = systemData.description.length ? systemData.description : description;
-
- let dateCreated = new Date(systemData.created.created * 1000);
- let dateUpdated = new Date(systemData.updated.updated * 1000);
- let dateCreatedUTC = Util.convertDateToUTC(dateCreated);
- let dateUpdatedUTC = Util.convertDateToUTC(dateUpdated);
-
- createdTime = Util.convertDateToString(dateCreatedUTC);
- updatedTime = Util.convertDateToString(dateUpdatedUTC);
-
- }else if(systemData === null){
- // no system found for selected system
- showInfoHeadline = 'fadeIn';
- }
-
- // update new system dialog with new default data
- dialogElement.find('#' + config.dialogSystemSectionInfoStatusId).html(info);
- if(statusId !== false){
- dialogElement.find('#' + config.dialogSystemStatusSelectId).val(statusId).trigger('change');
- }
- dialogElement.find('#' + config.dialogSystemAliasId).html(alias);
- dialogElement.find('#' + config.dialogSystemDescriptionId).html(description);
- dialogElement.find('#' + config.dialogSystemCreatedId).html(' ' + createdTime);
- dialogElement.find('#' + config.dialogSystemUpdatedId).html(' ' + updatedTime);
- dialogElement.find('#' + config.dialogSystemSectionInfoId).collapse(showInfoSection);
- dialogElement.find('[data-target="#' + config.dialogSystemSectionInfoId + '"]').velocity(showInfoHeadline);
- dialogElement.find('[data-type="spinner"]').removeClass('in');
- };
-
});
};
diff --git a/js/app/ui/dialog/map_info.js b/js/app/ui/dialog/map_info.js
index 8d9c90cb..2a5b07eb 100644
--- a/js/app/ui/dialog/map_info.js
+++ b/js/app/ui/dialog/map_info.js
@@ -1254,7 +1254,7 @@ define([
*/
$.fn.showMapInfoDialog = function(options){
let activeMap = Util.getMapModule().getActiveMap();
- let mapData = activeMap.getMapDataFromClient({forceData: true});
+ let mapData = activeMap ? activeMap.getMapDataFromClient({forceData: true}) : false;
if(mapData !== false){
// "log" tab -> get "Origin", not all config options are set in mapData
@@ -1351,6 +1351,13 @@ define([
});
});
+ }else{
+ // no active map found (e.g. not loaded yet, or no map exists)
+ Util.showNotify({
+ title: 'Map data not found',
+ text: 'No map initialized at this point',
+ type: 'warning'}
+ );
}
};
diff --git a/public/js/v1.4.2/app/map/system.js b/public/js/v1.4.2/app/map/system.js
index 4acf9b93..ce5b39cf 100644
--- a/public/js/v1.4.2/app/map/system.js
+++ b/public/js/v1.4.2/app/map/system.js
@@ -109,6 +109,83 @@ define([
let mapContainer = $(map.getContainer());
let mapId = mapContainer.data('id');
+ /**
+ * update new system dialog with some "additional" data
+ * -> if system was mapped before
+ * @param dialogElement
+ * @param systemData
+ */
+ let updateDialog = (dialogElement, systemData = null) => {
+ let labelEmpty = 'empty';
+ let labelUnknown = 'unknown';
+ let labelExist = 'loaded';
+
+ let showInfoHeadline = 'fadeOut';
+ let showInfoSection = 'hide';
+ let info = labelEmpty;
+
+ let statusId = false; // -> no value change
+ let alias = labelEmpty;
+ let description = labelEmpty;
+ let createdTime = labelUnknown;
+ let updatedTime = labelUnknown;
+
+ if(systemData){
+ // system data found for selected system
+ showInfoHeadline = 'fadeIn';
+ showInfoSection = 'show';
+ info = labelExist;
+ statusId = parseInt(Util.getObjVal(systemData, 'status.id')) || statusId;
+ alias = systemData.alias.length ? Util.htmlEncode(systemData.alias) : alias;
+ description = systemData.description.length ? systemData.description : description;
+
+ let dateCreated = new Date(systemData.created.created * 1000);
+ let dateUpdated = new Date(systemData.updated.updated * 1000);
+ let dateCreatedUTC = Util.convertDateToUTC(dateCreated);
+ let dateUpdatedUTC = Util.convertDateToUTC(dateUpdated);
+
+ createdTime = Util.convertDateToString(dateCreatedUTC);
+ updatedTime = Util.convertDateToString(dateUpdatedUTC);
+
+ }else if(systemData === null){
+ // no system found for selected system
+ showInfoHeadline = 'fadeIn';
+ }
+
+ // update new system dialog with new default data
+ dialogElement.find('#' + config.dialogSystemSectionInfoStatusId).html(info);
+ if(statusId !== false){
+ dialogElement.find('#' + config.dialogSystemStatusSelectId).val(statusId).trigger('change');
+ }
+ dialogElement.find('#' + config.dialogSystemAliasId).html(alias);
+ dialogElement.find('#' + config.dialogSystemDescriptionId).html(description);
+ dialogElement.find('#' + config.dialogSystemCreatedId).html(' ' + createdTime);
+ dialogElement.find('#' + config.dialogSystemUpdatedId).html(' ' + updatedTime);
+ dialogElement.find('[data-target="#' + config.dialogSystemSectionInfoId + '"]').velocity('stop').velocity(showInfoHeadline, {duration: 120});
+ dialogElement.find('[data-type="spinner"]').removeClass('in');
+ dialogElement.find('#' + config.dialogSystemSectionInfoId).collapse(showInfoSection);
+ };
+
+ /**
+ * request system data from server for persistent data -> update dialog
+ * @param dialogElement
+ * @param mapId
+ * @param systemId
+ */
+ let requestSystemData = (dialogElement, mapId, systemId) => {
+ // show loading animation
+ dialogElement.find('[data-type="spinner"]').addClass('in');
+
+ MapUtil.requestSystemData({
+ mapId: mapId,
+ systemId: systemId,
+ isCcpId: 1
+ }, {
+ dialogElement: dialogElement
+ }).then(payload => updateDialog(payload.context.dialogElement, payload.data))
+ .catch(payload => updateDialog(payload.context.dialogElement));
+ };
+
// format system status for form select -----------------------------------------------------------------------
// "default" selection (id = 0) prevents status from being overwritten
// -> e.g. keep status information if system was just inactive (active = 0)
@@ -242,7 +319,7 @@ define([
systemDialog.on('show.bs.modal', function(e){
let dialogElement = $(this);
- // init "status" select2
+ // init "status" select2 ------------------------------------------------------------------------------
for(let [statusName, data] of Object.entries(Init.systemStatus)){
statusData.push({id: data.id, text: data.label, class: data.class});
}
@@ -251,6 +328,13 @@ define([
data: statusData,
iconClass: 'fa-tag'
});
+
+ // initial dialog update with persistent system data --------------------------------------------------
+ // -> only if system is preselected (e.g. current active system)
+ let systemId = parseInt(dialogElement.find('.' + config.dialogSystemSelectClass).val()) || 0;
+ if(systemId){
+ requestSystemData(dialogElement, mapId, systemId);
+ }
});
systemDialog.on('shown.bs.modal', function(e){
@@ -266,20 +350,10 @@ define([
selectElement.delay(240).initSystemSelect({
key: 'id',
disabledOptions: mapSystemIds,
- onChange: (systemId) => {
+ onChange: systemId => {
// on system select -> update dialog with persistent system data
if(systemId){
- // show loading animation
- dialogElement.find('[data-type="spinner"]').addClass('in');
-
- MapUtil.requestSystemData({
- mapId: mapId,
- systemId: systemId,
- isCcpId: 1
- }, {
- dialogElement: dialogElement
- }).then(payload => updateDialog(payload.context.dialogElement, payload.data))
- .catch(payload => updateDialog(payload.context.dialogElement));
+ requestSystemData(dialogElement, mapId, systemId);
}else{
// no system selected
updateDialog(dialogElement, false);
@@ -290,64 +364,6 @@ define([
// show dialog
systemDialog.modal('show');
-
- /**
- * update new system dialog with some "additional" data
- * -> if system was mapped before
- * @param dialogElement
- * @param systemData
- */
- let updateDialog = (dialogElement, systemData = null) => {
- let labelEmpty = 'empty';
- let labelUnknown = 'unknown';
- let labelExist = 'loaded';
-
- let showInfoHeadline = 'fadeOut';
- let showInfoSection = 'hide';
- let info = labelEmpty;
-
- let statusId = false; // -> no value change
- let alias = labelEmpty;
- let description = labelEmpty;
- let createdTime = labelUnknown;
- let updatedTime = labelUnknown;
-
- if(systemData){
- // system data found for selected system
- showInfoHeadline = 'fadeIn';
- showInfoSection = 'show';
- info = labelExist;
- statusId = parseInt(Util.getObjVal(systemData, 'status.id')) || statusId;
- alias = systemData.alias.length ? Util.htmlEncode(systemData.alias) : alias;
- description = systemData.description.length ? systemData.description : description;
-
- let dateCreated = new Date(systemData.created.created * 1000);
- let dateUpdated = new Date(systemData.updated.updated * 1000);
- let dateCreatedUTC = Util.convertDateToUTC(dateCreated);
- let dateUpdatedUTC = Util.convertDateToUTC(dateUpdated);
-
- createdTime = Util.convertDateToString(dateCreatedUTC);
- updatedTime = Util.convertDateToString(dateUpdatedUTC);
-
- }else if(systemData === null){
- // no system found for selected system
- showInfoHeadline = 'fadeIn';
- }
-
- // update new system dialog with new default data
- dialogElement.find('#' + config.dialogSystemSectionInfoStatusId).html(info);
- if(statusId !== false){
- dialogElement.find('#' + config.dialogSystemStatusSelectId).val(statusId).trigger('change');
- }
- dialogElement.find('#' + config.dialogSystemAliasId).html(alias);
- dialogElement.find('#' + config.dialogSystemDescriptionId).html(description);
- dialogElement.find('#' + config.dialogSystemCreatedId).html(' ' + createdTime);
- dialogElement.find('#' + config.dialogSystemUpdatedId).html(' ' + updatedTime);
- dialogElement.find('#' + config.dialogSystemSectionInfoId).collapse(showInfoSection);
- dialogElement.find('[data-target="#' + config.dialogSystemSectionInfoId + '"]').velocity(showInfoHeadline);
- dialogElement.find('[data-type="spinner"]').removeClass('in');
- };
-
});
};
diff --git a/public/js/v1.4.2/app/ui/dialog/map_info.js b/public/js/v1.4.2/app/ui/dialog/map_info.js
index 8d9c90cb..2a5b07eb 100644
--- a/public/js/v1.4.2/app/ui/dialog/map_info.js
+++ b/public/js/v1.4.2/app/ui/dialog/map_info.js
@@ -1254,7 +1254,7 @@ define([
*/
$.fn.showMapInfoDialog = function(options){
let activeMap = Util.getMapModule().getActiveMap();
- let mapData = activeMap.getMapDataFromClient({forceData: true});
+ let mapData = activeMap ? activeMap.getMapDataFromClient({forceData: true}) : false;
if(mapData !== false){
// "log" tab -> get "Origin", not all config options are set in mapData
@@ -1351,6 +1351,13 @@ define([
});
});
+ }else{
+ // no active map found (e.g. not loaded yet, or no map exists)
+ Util.showNotify({
+ title: 'Map data not found',
+ text: 'No map initialized at this point',
+ type: 'warning'}
+ );
}
};