VSchemaList.js 1.4 KB

123456789101112131415161718192021222324252627282930313233
  1. define([ "require", "utils/Globals", "collection/BaseCollection", "models/VSchema", "utils/UrlLinks" ], function(require, Globals, BaseCollection, VSchema, UrlLinks) {
  2. "use strict";
  3. var VSchemaList = BaseCollection.extend({
  4. url: UrlLinks.baseURL,
  5. model: VSchema,
  6. initialize: function() {
  7. this.modelName = "VSchema", this.modelAttrName = "results";
  8. },
  9. parseRecords: function(resp, options) {
  10. try {
  11. if (!this.modelAttrName) throw new Error("this.modelAttrName not defined for " + this);
  12. this.keyList = resp[this.modelAttrName].dataType.attributeDefinitions, resp[this.modelAttrName].dataType.superTypes && resp[this.modelAttrName].dataType.superTypes.indexOf("Asset") != -1 && this.keyList.push({
  13. name: "name",
  14. dataTypeName: "string",
  15. isComposite: !1,
  16. isIndexable: !0,
  17. isUnique: !1,
  18. multiplicity: {},
  19. reverseAttributeName: null
  20. });
  21. var arr = [];
  22. return resp[this.modelAttrName].rows.forEach(function(d) {
  23. arr.push(d);
  24. }), arr;
  25. } catch (e) {
  26. console.log(e);
  27. }
  28. }
  29. }, {
  30. tableCols: {}
  31. });
  32. return VSchemaList;
  33. });