From f724b60f2809ea1b33e5060c714b9ce8c80fa226 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Wed, 6 Apr 2016 14:02:06 +0200 Subject: [PATCH] fix rule workspace --- .../src/main/js/components/workspace/main.js | 5 ++--- .../src/main/js/components/workspace/models/item.js | 11 +++++------ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/server/sonar-web/src/main/js/components/workspace/main.js b/server/sonar-web/src/main/js/components/workspace/main.js index 79735999c64..28381164816 100644 --- a/server/sonar-web/src/main/js/components/workspace/main.js +++ b/server/sonar-web/src/main/js/components/workspace/main.js @@ -75,11 +75,11 @@ Workspace.prototype = { }, openComponent (options) { - return this.open(_.extend(options, { type: 'component' })); + return this.open(_.extend(options, { '__type__': 'component' })); }, openRule (options) { - return this.open(_.extend(options, { type: 'rule' })); + return this.open(_.extend(options, { '__type__': 'rule' })); }, showViewer (Viewer, model) { @@ -142,4 +142,3 @@ Workspace.getInstance = function () { }; export default Workspace.getInstance(); - diff --git a/server/sonar-web/src/main/js/components/workspace/models/item.js b/server/sonar-web/src/main/js/components/workspace/models/item.js index 69f855577a9..c896c940244 100644 --- a/server/sonar-web/src/main/js/components/workspace/models/item.js +++ b/server/sonar-web/src/main/js/components/workspace/models/item.js @@ -22,23 +22,23 @@ import Backbone from 'backbone'; export default Backbone.Model.extend({ validate () { - if (!this.has('type')) { + if (!this.has('__type__')) { return 'type is missing'; } - if (this.get('type') === 'component' && !this.has('uuid')) { + if (this.get('__type__') === 'component' && !this.has('uuid')) { return 'uuid is missing'; } - if (this.get('type') === 'rule' && !this.has('key')) { + if (this.get('__type__') === 'rule' && !this.has('key')) { return 'key is missing'; } }, isComponent () { - return this.get('type') === 'component'; + return this.get('__type__') === 'component'; }, isRule () { - return this.get('type') === 'rule'; + return this.get('__type__') === 'rule'; }, destroy (options) { @@ -46,4 +46,3 @@ export default Backbone.Model.extend({ this.trigger('destroy', this, this.collection, options); } }); - -- 2.39.5