How to use the globals.API_V2_ROOT function in globals

To help you get started, we’ve selected a few globals examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cyverse / troposphere / troposphere / static / js / collections / APITokenCollection.js View on Github external
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;
    }
});
github cyverse / troposphere / troposphere / static / js / collections / SizeCollection.js View on Github external
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) {
github cyverse / troposphere / troposphere / static / js / actions / instance / report.js View on Github external
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
                });
github cyverse / troposphere / troposphere / static / js / collections / InstanceActionCollection.js View on Github external
url: function() {
        return `${globals.API_V2_ROOT}/instances/${this.alias}/actions`;
    }
});
github cyverse / troposphere / troposphere / static / js / collections / TagCollection.js View on Github external
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
        };
github cyverse / troposphere / troposphere / static / js / models / Status.js View on Github external
import Backbone from "backbone";
import globals from "globals";

export default Backbone.Model.extend({
    urlRoot: globals.API_V2_ROOT + "/status_types"
});
github cyverse / troposphere / troposphere / static / js / models / Account.js View on Github external
import Backbone from "backbone";
import globals from "globals";

export default Backbone.Model.extend({
    url: globals.API_V2_ROOT + "/accounts"
});
github cyverse / troposphere / troposphere / static / js / collections / QuotaCollection.js View on Github external
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;
    }
  });

});
github cyverse / troposphere / troposphere / static / js / models / HelpLink.js View on Github external
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;
    }
});
github cyverse / troposphere / troposphere / static / js / models / ProjectVolume.js View on Github external
define(function(require){
  "use strict";

  var Backbone = require('backbone'),
      globals = require('globals');

  return Backbone.Model.extend({
    urlRoot: globals.API_V2_ROOT + "/project_volumes"
  });

});