aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/metrics/metric.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/sonar-web/src/main/js/apps/metrics/metric.js')
-rw-r--r--server/sonar-web/src/main/js/apps/metrics/metric.js65
1 files changed, 33 insertions, 32 deletions
diff --git a/server/sonar-web/src/main/js/apps/metrics/metric.js b/server/sonar-web/src/main/js/apps/metrics/metric.js
index cb160c882d0..82bb67c20fe 100644
--- a/server/sonar-web/src/main/js/apps/metrics/metric.js
+++ b/server/sonar-web/src/main/js/apps/metrics/metric.js
@@ -1,37 +1,38 @@
-define(function () {
+import _ from 'underscore';
+import Backbone from 'backbone';
- return Backbone.Model.extend({
- idAttribute: 'id',
+export default Backbone.Model.extend({
+ idAttribute: 'id',
- urlRoot: function () {
- return baseUrl + '/api/metrics';
- },
+ urlRoot: function () {
+ return baseUrl + '/api/metrics';
+ },
- sync: function (method, model, options) {
- var opts = options || {};
- if (method === 'create') {
- _.defaults(opts, {
- url: this.urlRoot() + '/create',
- type: 'POST',
- data: _.pick(model.toJSON(), 'key', 'name', 'description', 'domain', 'type')
- });
- }
- if (method === 'update') {
- _.defaults(opts, {
- url: this.urlRoot() + '/update',
- type: 'POST',
- data: _.pick(model.toJSON(), 'id', 'key', 'name', 'description', 'domain', 'type')
- });
- }
- if (method === 'delete') {
- _.defaults(opts, {
- url: this.urlRoot() + '/delete',
- type: 'POST',
- data: { ids: this.id }
- });
- }
- return Backbone.ajax(opts);
+ sync: function (method, model, options) {
+ var opts = options || {};
+ if (method === 'create') {
+ _.defaults(opts, {
+ url: this.urlRoot() + '/create',
+ type: 'POST',
+ data: _.pick(model.toJSON(), 'key', 'name', 'description', 'domain', 'type')
+ });
}
- });
-
+ if (method === 'update') {
+ _.defaults(opts, {
+ url: this.urlRoot() + '/update',
+ type: 'POST',
+ data: _.pick(model.toJSON(), 'id', 'key', 'name', 'description', 'domain', 'type')
+ });
+ }
+ if (method === 'delete') {
+ _.defaults(opts, {
+ url: this.urlRoot() + '/delete',
+ type: 'POST',
+ data: { ids: this.id }
+ });
+ }
+ return Backbone.ajax(opts);
+ }
});
+
+