index.ejs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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 sibiling in static/app/utils/extractSlug.tsx
  19. // The two regexps are not meant to be exactly the same
  20. var knownDomains = /\.(?:localhost|dev\.getsentry\.net|sentry\.dev)(?:\:\d*)?$/;
  21. if (window.location.host.match(knownDomains)) {
  22. var domainParts = window.location.host.split('.');
  23. var slug = domainParts.shift();
  24. return slug;
  25. }
  26. var pathReg = /\/organizations\/(.+?(?=(\/|$)))(\/|$)/i;
  27. var matches = pathReg.exec(window.location.pathname);
  28. if (matches) {
  29. return matches[1];
  30. }
  31. console.error(`Could not extract an organization slug from ${window.location}. Assuming 'sentry'`);
  32. return 'sentry';
  33. }
  34. var slug = extractSlug();
  35. var preloadPromises = { orgSlug: slug };
  36. function promiseRequest(url) {
  37. return new Promise(function (resolve, reject) {
  38. var xhr = new XMLHttpRequest();
  39. xhr.open('GET', url);
  40. xhr.onload = function () {
  41. try {
  42. this.status >= 200 && this.status < 300
  43. ? resolve([JSON.parse(xhr.response), this.statusText, xhr])
  44. : reject([this.status, this.statusText]);
  45. } catch(e) {
  46. reject();
  47. }
  48. };
  49. xhr.onerror = function () {
  50. reject([this.status, this.statusText]);
  51. };
  52. xhr.send();
  53. });
  54. }
  55. function makeUrl(suffix) {
  56. return '/api/0/organizations/' + slug + suffix;
  57. }
  58. window.__sentry_preload = preloadPromises;
  59. if (slug !== 'new') {
  60. preloadPromises.organization = promiseRequest(makeUrl('/?detailed=0'));
  61. preloadPromises.projects = promiseRequest(makeUrl('/projects/?all_projects=1&collapse=latestDeploys'));
  62. preloadPromises.teams = promiseRequest(makeUrl('/teams/'));
  63. }
  64. } catch(err) {
  65. console.error(err)
  66. }
  67. </script>
  68. </head>
  69. <body>
  70. <% if (htmlWebpackPlugin.options.unsupportedBrowser) { %>
  71. <style>.unsupported-browser { display: none; }</style>
  72. <div class="unsupported-browser">
  73. Sorry, your browser is not supported. Please upgrade to
  74. the latest version or switch your browser to use this site.
  75. See <a href="http://outdatedbrowser.com/">outdatedbrowser.com</a>
  76. for options.
  77. </div>
  78. <% } %>
  79. <div id="blk_router">
  80. <div class="loading triangle">
  81. <div class="loading-mask"></div>
  82. <div class="loading-indicator" data-test-id="loading-indicator">
  83. <img src="<%=require('sentry-images/sentry-loader.svg')%>" />
  84. </div>
  85. <div class="loading-message">
  86. <p>Please wait while we load an obnoxious amount of JavaScript.</p>
  87. <p>
  88. <small>You may need to disable adblocking extensions to load Sentry.</small>
  89. </p>
  90. </div>
  91. </div>
  92. </div>
  93. <% if (htmlWebpackPlugin.options.window) { %>
  94. <script>
  95. <% for (var varName in htmlWebpackPlugin.options.window) { %>
  96. window['<%=varName%>'] = <%= JSON.stringify(htmlWebpackPlugin.options.window[varName]) %>;
  97. <% } %>
  98. </script>
  99. <% } %>
  100. </body>
  101. </html>