Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import Backbone from "backbone";
import APIToken from "models/APIToken";
import globals from "globals";
export default Backbone.Collection.extend({
model: APIToken,
url: globals.API_V2_ROOT + "/access_tokens",
parse: function(data) {
return data.results;
}
});
import Backbone from "backbone";
import Size from "models/Size";
import globals from "globals";
export default Backbone.Collection.extend({
model: Size,
url: globals.API_V2_ROOT + "/sizes",
parse: function(response) {
this.meta = {
count: response.count,
next: response.next,
previous: response.previous
};
return response.results;
},
comparator: function(lhs, rhs) {
var lhsCPU = parseInt(lhs.get("cpu"));
var rhsCPU = parseInt(rhs.get("cpu"));
if (lhsCPU === rhsCPU) {
report: function(params) {
if (!params.instance) throw new Error("Missing instance");
if (!params.reportInfo) throw new Error("Missing reportInfo");
let instance = params.instance,
reportInfo = params.reportInfo;
let reportData = {
message: reportInfo.details,
instance: instance.id,
problems: reportInfo.problems ? reportInfo.problems : [],
...Utils.browserContext()
};
$.ajax({
url: globals.API_V2_ROOT + "/email_instance_report",
type: "POST",
data: JSON.stringify(reportData),
dataType: "json",
contentType: "application/json",
success: function() {
Utils.displayInfo({
message:
"We're sorry to hear you're having trouble with your instance. Your report has " +
"been sent to support and someone will contact you through email to help resolve your issue."
});
},
error: function(response, status, error) {
Utils.displayError({
title: "Your instance report could not be sent",
response: response
});
url: function() {
return `${globals.API_V2_ROOT}/instances/${this.alias}/actions`;
}
});
import Backbone from "backbone";
import Tag from "models/Tag";
import globals from "globals";
export default Backbone.Collection.extend({
model: Tag,
url: globals.API_V2_ROOT + "/tags",
comparator: function(model) {
let name = model.get("name");
if (!name) {
return name;
}
return name.toLowerCase();
},
parse: function(response) {
this.meta = {
count: response.count,
next: response.next,
previous: response.previous
};
import Backbone from "backbone";
import globals from "globals";
export default Backbone.Model.extend({
urlRoot: globals.API_V2_ROOT + "/status_types"
});
import Backbone from "backbone";
import globals from "globals";
export default Backbone.Model.extend({
url: globals.API_V2_ROOT + "/accounts"
});
define(function (require) {
"use strict";
var Backbone = require('backbone'),
Quota = require('models/Quota'),
globals = require('globals');
return Backbone.Collection.extend({
model: Quota,
url: globals.API_V2_ROOT + "/quotas",
parse: function (response) {
this.meta = {
count: response.count,
next: response.next,
previous: response.previous
};
return response.results;
}
});
});
import Backbone from "backbone";
import globals from "globals";
export default Backbone.Model.extend({
urlRoot: globals.API_V2_ROOT + "/help_links",
idAttribute: "link_key",
parse: function(attributes) {
return attributes;
}
});
define(function(require){
"use strict";
var Backbone = require('backbone'),
globals = require('globals');
return Backbone.Model.extend({
urlRoot: globals.API_V2_ROOT + "/project_volumes"
});
});