- code cleanup

This commit is contained in:
Mark Friedrich
2019-04-27 23:55:24 +02:00
parent b5a3012ffd
commit a04256d0ea
5 changed files with 23 additions and 31 deletions

View File

@@ -522,7 +522,6 @@ define([
case 'add_system':
// add a new system
System.showNewSystemDialog(map, {sourceSystem: system}, saveSystemCallback);
break;
case 'lock_system':
// lock system
@@ -670,7 +669,6 @@ define([
// open map info dialog tab
$(document).triggerMenuEvent('ShowMapInfo', {tab: 'information'});
break;
}
};
@@ -745,19 +743,12 @@ define([
switch(action){
case 'bubble':
console.log(endpoint.getType())
//console.log(endpoint.getParameters() )
mapElement.getMapOverlay('timer').startMapUpdateCounter();
endpoint.toggleType(action);
//endpoint.setParameter('test', 123);
for(let connection of endpoint.connections){
$(connection).markAsChanged();
}
//$(connection).markAsChanged();
console.log(endpoint.getType())
//console.log(endpoint.getParameters() )
break;
}
};
@@ -899,8 +890,6 @@ define([
label && connectionData.endpoints[label] &&
Array.isArray(connectionData.endpoints[label].types)
){
console.log('draw con add Type: ', connectionData.endpoints[label].types)
for(let type of connectionData.endpoints[label].types){
endpoint.addType(type);
}
@@ -993,10 +982,6 @@ define([
connection.setParameter('eolUpdated', newConnectionData.eolUpdated);
connection.setParameter('changed', false);
console.log('update con -------------', connectionData.id)
console.log(connectionData)
console.log(newConnectionData)
return connection;
};

View File

@@ -283,6 +283,12 @@ define([
return mapElement.find('.' + config.systemSelectedClass);
};
/**
* filter jsPlumb connection or endpoint types
* -> remove default type(s)
* @param types
* @returns {*}
*/
let filterDefaultTypes = types => {
return types.filter(type => type.length > 0 && type !== 'default' && type !== 'active');
};
@@ -296,6 +302,11 @@ define([
return endpoint.isSource ? 'source' : endpoint.isTarget ? 'target' : false;
};
/**
* get data from endpoint
* @param endpoint
* @returns {{types: *, label: string}}
*/
let getDataByEndpoint = endpoint => {
return {
label: getLabelByEndpoint(endpoint),

View File

@@ -13,7 +13,7 @@ define(['jquery', 'mustache'], ($, Mustache) => {
* @returns {Promise<any>}
*/
let render = (path, data) => {
let renderExecutor = (resolve) => {
let renderExecutor = resolve => {
requirejs(['text!templates/' + path + '.html'], template => {
resolve(Mustache.render(template, data));
});

View File

@@ -522,7 +522,6 @@ define([
case 'add_system':
// add a new system
System.showNewSystemDialog(map, {sourceSystem: system}, saveSystemCallback);
break;
case 'lock_system':
// lock system
@@ -670,7 +669,6 @@ define([
// open map info dialog tab
$(document).triggerMenuEvent('ShowMapInfo', {tab: 'information'});
break;
}
};
@@ -745,19 +743,12 @@ define([
switch(action){
case 'bubble':
console.log(endpoint.getType())
//console.log(endpoint.getParameters() )
mapElement.getMapOverlay('timer').startMapUpdateCounter();
endpoint.toggleType(action);
//endpoint.setParameter('test', 123);
for(let connection of endpoint.connections){
$(connection).markAsChanged();
}
//$(connection).markAsChanged();
console.log(endpoint.getType())
//console.log(endpoint.getParameters() )
break;
}
};
@@ -899,8 +890,6 @@ define([
label && connectionData.endpoints[label] &&
Array.isArray(connectionData.endpoints[label].types)
){
console.log('draw con add Type: ', connectionData.endpoints[label].types)
for(let type of connectionData.endpoints[label].types){
endpoint.addType(type);
}
@@ -993,10 +982,6 @@ define([
connection.setParameter('eolUpdated', newConnectionData.eolUpdated);
connection.setParameter('changed', false);
console.log('update con -------------', connectionData.id)
console.log(connectionData)
console.log(newConnectionData)
return connection;
};

View File

@@ -283,6 +283,12 @@ define([
return mapElement.find('.' + config.systemSelectedClass);
};
/**
* filter jsPlumb connection or endpoint types
* -> remove default type(s)
* @param types
* @returns {*}
*/
let filterDefaultTypes = types => {
return types.filter(type => type.length > 0 && type !== 'default' && type !== 'active');
};
@@ -296,6 +302,11 @@ define([
return endpoint.isSource ? 'source' : endpoint.isTarget ? 'target' : false;
};
/**
* get data from endpoint
* @param endpoint
* @returns {{types: *, label: string}}
*/
let getDataByEndpoint = endpoint => {
return {
label: getLabelByEndpoint(endpoint),