DumpEvent.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <template>
  2. <div>
  3. <DefinitionList title="Dump">
  4. <DefinitionListRow label="Content"
  5. ><code class="code-block mb-3" v-html="event.label"></code>
  6. </DefinitionListRow>
  7. <DefinitionListRow label="Location"
  8. ><FilePath
  9. v-if="event.file"
  10. :file="event.file"
  11. :lineNumber="event.line_number"
  12. :editable="true"
  13. ></FilePath>
  14. </DefinitionListRow>
  15. </DefinitionList>
  16. </div>
  17. </template>
  18. <script>
  19. import FilePath from '../../Shared/FilePath';
  20. import DefinitionList from '../../Shared/DefinitionList';
  21. import DefinitionListRow from '../../Shared/DefinitionListRow.js';
  22. export default {
  23. components: { DefinitionListRow, DefinitionList, FilePath },
  24. inject: ['setTab'],
  25. props: ['event'],
  26. mounted() {
  27. let dumpId = this.detectDumpId(this.event.label);
  28. if (dumpId) {
  29. window.Sfdump(dumpId);
  30. }
  31. },
  32. methods: {
  33. detectDumpId(dumpHtml) {
  34. const pattern = /sf-dump-([0-9]+)/gm;
  35. const matches = pattern.exec(dumpHtml);
  36. return matches[0] || null;
  37. },
  38. openInStackTab() {
  39. this.setTab('StackTab', {
  40. file: this.event.file,
  41. lineNumber: this.event.line_number,
  42. });
  43. },
  44. },
  45. };
  46. </script>