Skip to content
Snippets Groups Projects
Commit 6a3849bf authored by Mathis Neumann's avatar Mathis Neumann
Browse files

fix cose-bilkent by making embers native prototype enhancements not enumerable

parent 159b031d
No related branches found
No related tags found
No related merge requests found
......@@ -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
......@@ -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',
......
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment