UrlLinks.js 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. define([ "require", "utils/Enums", "utils/Utils", "underscore" ], function(require, Enums, Utils) {
  2. "use strict";
  3. var UrlLinks = {
  4. apiBaseUrl: Utils.getBaseUrl(window.location.pathname)
  5. };
  6. return _.extend(UrlLinks, {
  7. baseUrl: UrlLinks.apiBaseUrl + "/api/atlas",
  8. baseUrlV2: UrlLinks.apiBaseUrl + "/api/atlas/v2",
  9. typedefsUrl: function() {
  10. return {
  11. defs: this.baseUrlV2 + "/types/typedefs",
  12. def: this.baseUrlV2 + "/types/typedef"
  13. };
  14. },
  15. entitiesDefApiUrl: function(name) {
  16. return this.getDefApiUrl("entity", name);
  17. },
  18. classificationDefApiUrl: function(name) {
  19. return this.getDefApiUrl("classification", name);
  20. },
  21. businessMetadataDefApiUrl: function(name) {
  22. return this.getDefApiUrl("business_metadata", name);
  23. },
  24. enumDefApiUrl: function(name) {
  25. return this.getDefApiUrl("enum", name);
  26. },
  27. metricsApiUrl: function() {
  28. return this.baseUrl + "/admin/metrics";
  29. },
  30. pendingTaskApiUrl: function() {
  31. return this.baseUrl + "/admin/tasks";
  32. },
  33. debugMetricsApiUrl: function() {
  34. return this.baseUrl + "/admin/debug/metrics";
  35. },
  36. migrationStatusApiUrl: function() {
  37. return this.baseUrl + "/admin/status";
  38. },
  39. rootEntityDefUrl: function(name) {
  40. return this.baseUrlV2 + "/types/entitydef/name/" + name;
  41. },
  42. rootClassificationDefUrl: function(name) {
  43. return this.baseUrlV2 + "/types/classificationdef/name/" + name;
  44. },
  45. getDefApiUrl: function(type, name) {
  46. var defUrl, defApiUrl = this.typedefsUrl();
  47. return defUrl = name ? defApiUrl.def + "/name/" + name : defApiUrl.defs, type ? defUrl += "?type=" + type : defUrl;
  48. },
  49. entitiesApiUrl: function(options) {
  50. var entitiesUrl = this.baseUrlV2 + "/entity";
  51. if (options) {
  52. var guid = options.guid, associatedGuid = options.associatedGuid, name = options.name, minExtInfo = options.minExtInfo;
  53. if (guid && name && associatedGuid) return entitiesUrl + "/guid/" + guid + "/classification/" + name + "?associatedEntityGuid=" + associatedGuid;
  54. guid && name ? entitiesUrl += "/guid/" + guid + "/classification/" + name : guid && !name && (entitiesUrl += "/guid/" + guid);
  55. }
  56. return minExtInfo ? entitiesUrl += "?minExtInfo=" + minExtInfo : entitiesUrl;
  57. },
  58. entityLabelsAPIUrl: function(guid) {
  59. return this.entitiesApiUrl({
  60. guid: guid
  61. }) + "/labels";
  62. },
  63. entityHeaderApiUrl: function(guid) {
  64. return this.entitiesApiUrl({
  65. guid: guid
  66. }) + "/header";
  67. },
  68. entitiesTraitsApiUrl: function(token) {
  69. return token ? this.baseUrlV2 + "/entity/guid/" + token + "/classifications" : this.baseUrlV2 + "/entity/bulk/classification";
  70. },
  71. entitiesBusinessMetadataApiUrl: function(guid) {
  72. if (guid) return this.baseUrlV2 + "/entity/guid/" + guid + "/businessmetadata?isOverwrite=true";
  73. },
  74. entityCollectionaudit: function(guid) {
  75. return this.baseUrlV2 + "/entity/" + guid + "/audit";
  76. },
  77. expimpAudit: function(options) {
  78. var url = this.baseUrl + "/admin/expimp/audit", queryParam = [];
  79. if (options) var serverName = options.serverName, limit = options.limit, offset = options.offset;
  80. return serverName && queryParam.push("serverName=" + serverName), limit && queryParam.push("limit=" + limit),
  81. offset && queryParam.push("offset=" + offset), queryParam.length > 0 && (url = url + "?" + queryParam.join("&")),
  82. url;
  83. },
  84. classicationApiUrl: function(name, guid) {
  85. var typeUrl = this.typedefsUrl();
  86. return name ? typeUrl.def + "/name/" + name + "?type=classification" : guid ? typeUrl.def + "/guid/" + guid + "?type=classification" : void 0;
  87. },
  88. typesApiUrl: function() {
  89. return this.typedefsUrl().defs + "/headers?excludeInternalTypesAndReferences=true";
  90. },
  91. lineageApiUrl: function(guid) {
  92. var lineageUrl = this.baseUrlV2 + "/lineage";
  93. return guid ? lineageUrl + "/" + guid : lineageUrl;
  94. },
  95. relationshipApiUrl: function(guid) {
  96. var relationshipUrl = this.baseUrlV2 + "/relationship";
  97. return guid ? relationshipUrl + "/guid/" + guid + "?extendedInfo=true" : relationshipUrl;
  98. },
  99. schemaApiUrl: function(guid) {
  100. var lineageUrl = this.baseUrl + "/lineage";
  101. return guid ? lineageUrl + "/" + guid + "/schema" : lineageUrl;
  102. },
  103. searchApiUrl: function(searchtype) {
  104. var searchUrl = this.baseUrlV2 + "/search";
  105. return searchtype ? searchUrl + "/" + searchtype : searchUrl;
  106. },
  107. saveSearchApiUrl: function(saveSearchType) {
  108. var saveSearchUrl = this.searchApiUrl() + "/saved";
  109. return saveSearchType ? saveSearchUrl + "/" + saveSearchType : saveSearchUrl;
  110. },
  111. glossaryApiUrl: function(options) {
  112. var guid = options && options.guid, glossaryUrl = this.baseUrlV2 + "/glossary";
  113. return guid ? glossaryUrl + "/" + guid : glossaryUrl;
  114. },
  115. glossaryImportTempUrl: function() {
  116. return this.glossaryApiUrl() + "/import/template";
  117. },
  118. glossaryImportUrl: function() {
  119. return this.glossaryApiUrl() + "/import";
  120. },
  121. businessMetadataImportTempUrl: function() {
  122. return this.entitiesApiUrl() + "/businessmetadata/import/template";
  123. },
  124. businessMetadataImportUrl: function() {
  125. return this.entitiesApiUrl() + "/businessmetadata/import";
  126. },
  127. apiDocUrl: function() {
  128. return this.apiBaseUrl + "/apidocs/index.html";
  129. },
  130. categoryApiUrl: function(options) {
  131. var guid = options && options.guid, list = options && options.list, related = options && options.related, categoryUrl = this.glossaryApiUrl() + "/" + (list ? "categories" : "category");
  132. return guid ? related ? categoryUrl + "/" + guid + "/related" : categoryUrl + "/" + guid : categoryUrl;
  133. },
  134. termApiUrl: function(options) {
  135. var guid = options && options.guid, list = options && options.list, related = options && options.related, termUrl = this.glossaryApiUrl() + "/" + (list ? "terms" : "term");
  136. return guid ? related ? termUrl + "/" + guid + "/related" : termUrl + "/" + guid : termUrl;
  137. },
  138. termToEntityApiUrl: function(guid) {
  139. var termUrl = this.termApiUrl({
  140. list: !0
  141. });
  142. if (guid) return termUrl + "/" + guid + "/assignedEntities";
  143. },
  144. versionApiUrl: function() {
  145. return this.baseUrl + "/admin/version";
  146. },
  147. sessionApiUrl: function() {
  148. return this.baseUrl + "/admin/session";
  149. },
  150. adminApiUrl: function() {
  151. return this.baseUrl + "/admin/audits";
  152. }
  153. }), UrlLinks;
  154. });