Ignition.js 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import Vue from 'vue';
  2. import App from './components/App';
  3. export default class Ignition {
  4. constructor(data) {
  5. this.data = data;
  6. this.tabCallbacks = [];
  7. }
  8. registerIcons() {
  9. Vue.component('Icon', require('./components/Icons/Icon').default);
  10. }
  11. registerBuiltinTabs() {
  12. Vue.component('AppTab', require('./components/Tabs/AppTab').default);
  13. Vue.component('ContextTab', require('./components/Tabs/ContextTab').default);
  14. Vue.component('LivewireTab', require('./components/Tabs/LivewireTab').default);
  15. Vue.component('DebugTab', require('./components/Tabs/DebugTab').default);
  16. Vue.component('RequestTab', require('./components/Tabs/RequestTab').default);
  17. Vue.component('StackTab', require('./components/Tabs/StackTab').default);
  18. Vue.component('UserTab', require('./components/Tabs/UserTab').default);
  19. }
  20. registerCustomTabs() {
  21. this.tabCallbacks.forEach(callback => callback(Vue, this.data));
  22. this.tabCallbacks = [];
  23. }
  24. registerTab(callback) {
  25. this.tabCallbacks.push(callback);
  26. }
  27. start() {
  28. this.registerIcons();
  29. this.registerBuiltinTabs();
  30. this.registerCustomTabs();
  31. window.app = new Vue({
  32. data: () => this.data,
  33. render(h) {
  34. return h(App, {
  35. props: {
  36. report: {
  37. ...this.report,
  38. stacktrace: this.report.stacktrace.map(frame => ({
  39. ...frame,
  40. relative_file: frame.file.replace(
  41. `${this.report.application_path}/`,
  42. '',
  43. ),
  44. })),
  45. },
  46. config: this.config,
  47. solutions: this.solutions,
  48. telescopeUrl: this.telescopeUrl,
  49. shareEndpoint: this.shareEndpoint,
  50. defaultTab: this.defaultTab,
  51. defaultTabProps: this.defaultTabProps,
  52. appEnv: this.appEnv,
  53. appDebug: this.appDebug,
  54. },
  55. });
  56. },
  57. }).$mount('#app');
  58. }
  59. }