diff --git a/app/app.js b/app/app.js index 831ad6106dd44d9b0c1314be3c0c11bb0085b56d..78395642373a95242e61982fd099c7eaa35e2169 100644 --- a/app/app.js +++ b/app/app.js @@ -7,6 +7,11 @@ let App; Ember.MODEL_FACTORY_INJECTIONS = true; + +avoidEnumerableNativeExtensions(Array.prototype); +avoidEnumerableNativeExtensions(Function.prototype); +avoidEnumerableNativeExtensions(String.prototype); + App = Ember.Application.extend({ modulePrefix: config.modulePrefix, podModulePrefix: config.podModulePrefix, @@ -16,3 +21,16 @@ App = Ember.Application.extend({ loadInitializers(App, config.modulePrefix); export default App; + +// ember (via ember-runtime) sets native prototype enhancements like .property/.observer, but as enumerable +// we need to fix enumerability since it breaks cose-bilkent and sometimes cytoscape +function avoidEnumerableNativeExtensions(proto) { + Object.keys(proto) // already gets all enumerables, no need to filter + .map(key => { + return { key, descriptor: Object.getOwnPropertyDescriptor(proto, key) }; + }) + .forEach(obj => { + obj.descriptor.enumerable = false; + Object.defineProperty(proto, obj.key, obj.descriptor); + }); +} \ No newline at end of file diff --git a/app/components/architecture-viewer.js b/app/components/architecture-viewer.js index 060be555e146119134109cc03e5897abd3450d61..d84afde70f5a1d0601c17c2eb08a0f30313703f3 100644 --- a/app/components/architecture-viewer.js +++ b/app/components/architecture-viewer.js @@ -4,12 +4,12 @@ import Themes from './architecture-visualisation-cytoscape/themes'; export default Ember.Component.extend({ graph: null, entityDetails: null, - layoutAlgorithm: 'cose', + layoutAlgorithm: 'cose-bilkent', theme: Themes[Object.keys(Themes)[0]], // first theme themes: Object.keys(Themes), layoutAlgorithms: [ 'cose', - //'cose-bilkent', // broken - see https://github.com/cytoscape/cytoscape.js-cose-bilkent/issues/18 + 'cose-bilkent', 'cola', 'grid', 'concentric', diff --git a/config/environment.js b/config/environment.js index 688e1c0c7eedbe17ff7b2681f0e6bdd58f33fc13..c40c6dd03390384110f166bc2e389cc96d4906eb 100644 --- a/config/environment.js +++ b/config/environment.js @@ -11,6 +11,7 @@ module.exports = function(environment) { // Here you can enable experimental features on an ember canary build // e.g. 'with-controller': true } + //EXTEND_PROTOTYPES: true // (true is default) See avoidEnumerableNativeExtensions in app.js }, APP: { @@ -19,6 +20,7 @@ module.exports = function(environment) { } }; + if (environment === 'development') { // ENV.APP.LOG_RESOLVER = true; // ENV.APP.LOG_ACTIVE_GENERATION = true; @@ -44,4 +46,4 @@ module.exports = function(environment) { } return ENV; -}; +}; \ No newline at end of file