index.ejs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta http-equiv="content-type" content="text/html; charset=utf-8">
  5. <meta name="robots" content="NONE,NOARCHIVE" />
  6. <meta name="viewport" content="width=device-width, initial-scale=1">
  7. <title><%= htmlWebpackPlugin.options.title || 'Sentry Dev'%></title>
  8. <script>
  9. function __sentryMark(name) {
  10. if (!window.performance || typeof window.performance.mark !== 'function') { return; }
  11. window.performance.mark(name);
  12. }
  13. __sentryMark('head-start');
  14. </script>
  15. <script type="text/javascript">
  16. try {
  17. function extractSlug() {
  18. // XXX: If you change this also change its sibilings in:
  19. // - static/app/utils/extractSlug.tsx
  20. // - webpack.config.ts
  21. // NB: This RegExp is not exactly the same as the other two
  22. var knownDomains = /\.(?:localhost|dev\.getsentry\.net|sentry\.dev)(?:\:\d*)?$/;
  23. if (window.location.host.match(knownDomains)) {
  24. var domainParts = window.location.host.split('.');
  25. var slug = domainParts.shift();
  26. return slug;
  27. }
  28. var pathReg = /\/organizations\/(.+?(?=(\/|$)))(\/|$)/i;
  29. var matches = pathReg.exec(window.location.pathname);
  30. if (matches) {
  31. return matches[1];
  32. }
  33. console.error(`Could not extract an organization slug from ${window.location}. Assuming 'sentry'`);
  34. return 'sentry';
  35. }
  36. var slug = extractSlug();
  37. var preloadPromises = { orgSlug: slug };
  38. function promiseRequest(url) {
  39. return new Promise(function (resolve, reject) {
  40. var xhr = new XMLHttpRequest();
  41. xhr.open('GET', url);
  42. xhr.onload = function () {
  43. try {
  44. this.status >= 200 && this.status < 300
  45. ? resolve([JSON.parse(xhr.response), this.statusText, xhr])
  46. : reject([this.status, this.statusText]);
  47. } catch(e) {
  48. reject();
  49. }
  50. };
  51. xhr.onerror = function () {
  52. reject([this.status, this.statusText]);
  53. };
  54. xhr.send();
  55. });
  56. }
  57. function makeUrl(suffix) {
  58. return '/api/0/organizations/' + slug + suffix;
  59. }
  60. window.__sentry_preload = preloadPromises;
  61. if (slug !== 'new') {
  62. preloadPromises.organization = promiseRequest(makeUrl('/?detailed=0'));
  63. preloadPromises.projects = promiseRequest(makeUrl('/projects/?all_projects=1&collapse=latestDeploys'));
  64. preloadPromises.teams = promiseRequest(makeUrl('/teams/'));
  65. }
  66. } catch(err) {
  67. console.error(err)
  68. }
  69. </script>
  70. </head>
  71. <body>
  72. <% if (htmlWebpackPlugin.options.unsupportedBrowser) { %>
  73. <style>.unsupported-browser { display: none; }</style>
  74. <div class="unsupported-browser">
  75. Sorry, your browser is not supported. Please upgrade to
  76. the latest version or switch your browser to use this site.
  77. See <a href="http://outdatedbrowser.com/">outdatedbrowser.com</a>
  78. for options.
  79. </div>
  80. <% } %>
  81. <div id="blk_router">
  82. <div class="loading triangle">
  83. <div class="loading-mask"></div>
  84. <div class="loading-indicator" data-test-id="loading-indicator">
  85. <img src="<%=require('sentry-images/sentry-loader.svg')%>" />
  86. </div>
  87. <div class="loading-message">
  88. <p>Please wait while we load an obnoxious amount of JavaScript.</p>
  89. <p>
  90. <small>You may need to disable adblocking extensions to load Sentry.</small>
  91. </p>
  92. </div>
  93. </div>
  94. </div>
  95. <% if (htmlWebpackPlugin.options.window) { %>
  96. <script>
  97. <% for (var varName in htmlWebpackPlugin.options.window) { %>
  98. window['<%=varName%>'] = <%= JSON.stringify(htmlWebpackPlugin.options.window[varName]) %>;
  99. <% } %>
  100. </script>
  101. <% } %>
  102. </body>
  103. </html>