UrlLinks.js 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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. regitrydataDefApiUrl: function(name) {
  37. return this.baseUrlV2 + "/entity/getRegistryData";
  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. typesApiUrl: function() {
  85. return this.typedefsUrl().defs + "/headers?excludeInternalTypesAndReferences=true";
  86. },
  87. lineageApiUrl: function(guid) {
  88. var lineageUrl = this.baseUrlV2 + "/lineage";
  89. return guid ? lineageUrl + "/" + guid : lineageUrl;
  90. },
  91. relationshipApiUrl: function(guid) {
  92. var relationshipUrl = this.baseUrlV2 + "/relationship";
  93. return guid ? relationshipUrl + "/guid/" + guid + "?extendedInfo=true" : relationshipUrl;
  94. },
  95. schemaApiUrl: function(guid) {
  96. var lineageUrl = this.baseUrl + "/lineage";
  97. return guid ? lineageUrl + "/" + guid + "/schema" : lineageUrl;
  98. },
  99. searchApiUrl: function(searchtype) {
  100. var searchUrl = this.baseUrlV2 + "/search";
  101. return searchtype ? searchUrl + "/" + searchtype : searchUrl;
  102. },
  103. saveSearchApiUrl: function(saveSearchType) {
  104. var saveSearchUrl = this.searchApiUrl() + "/saved";
  105. return saveSearchType ? saveSearchUrl + "/" + saveSearchType : saveSearchUrl;
  106. },
  107. glossaryApiUrl: function(options) {
  108. var guid = options && options.guid, glossaryUrl = this.baseUrlV2 + "/glossary";
  109. return guid ? glossaryUrl + "/" + guid : glossaryUrl;
  110. },
  111. glossaryImportTempUrl: function() {
  112. return this.glossaryApiUrl() + "/import/template";
  113. },
  114. glossaryImportUrl: function() {
  115. return this.glossaryApiUrl() + "/import";
  116. },
  117. businessMetadataImportTempUrl: function() {
  118. return this.entitiesApiUrl() + "/businessmetadata/import/template";
  119. },
  120. businessMetadataImportUrl: function() {
  121. return this.entitiesApiUrl() + "/businessmetadata/import";
  122. },
  123. apiDocUrl: function() {
  124. return this.apiBaseUrl + "/apidocs/index.html";
  125. },
  126. categoryApiUrl: function(options) {
  127. var guid = options && options.guid, list = options && options.list, related = options && options.related, categoryUrl = this.glossaryApiUrl() + "/" + (list ? "categories" : "category");
  128. return guid ? related ? categoryUrl + "/" + guid + "/related" : categoryUrl + "/" + guid : categoryUrl;
  129. },
  130. termApiUrl: function(options) {
  131. var guid = options && options.guid, list = options && options.list, related = options && options.related, termUrl = this.glossaryApiUrl() + "/" + (list ? "terms" : "term");
  132. return guid ? related ? termUrl + "/" + guid + "/related" : termUrl + "/" + guid : termUrl;
  133. },
  134. termToEntityApiUrl: function(guid) {
  135. var termUrl = this.termApiUrl({
  136. list: !0
  137. });
  138. if (guid) return termUrl + "/" + guid + "/assignedEntities";
  139. },
  140. versionApiUrl: function() {
  141. return this.baseUrl + "/admin/version";
  142. },
  143. sessionApiUrl: function() {
  144. return this.baseUrl + "/admin/session";
  145. },
  146. adminApiUrl: function() {
  147. return this.baseUrl + "/admin/audits";
  148. }
  149. }), UrlLinks;
  150. });