Skip to content

Commit

Permalink
Merge pull request #959 from jasonvarga/dump-js
Browse files Browse the repository at this point in the history
[4.x] Dump visibility toggling, search, etc.
  • Loading branch information
taylorotwell authored Oct 6, 2020
2 parents 4bd0a8b + e9da5cf commit cd6b43c
Show file tree
Hide file tree
Showing 2 changed files with 530 additions and 2 deletions.
38 changes: 36 additions & 2 deletions resources/js/screens/dumps/index.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script type="text/ecmascript-6">
import axios from 'axios';
import sfdump from './sfdump';
export default {
/**
Expand All @@ -12,7 +13,9 @@
ready: false,
newEntriesTimeout: null,
newEntriesTimer: 2000,
recordingStatus: 'enabled'
recordingStatus: 'enabled',
sfDump: null,
triggered: [],
};
},
Expand All @@ -23,6 +26,8 @@
mounted() {
document.title = "Dumps - Telescope";
this.initDumperJs();
this.loadEntries();
},
Expand All @@ -44,6 +49,8 @@
this.entries = response.data.entries;
this.recordingStatus = response.data.status;
this.$nextTick(() => this.triggerDumps());
this.checkForNewEntries();
});
},
Expand All @@ -67,6 +74,33 @@
})
}, this.newEntriesTimer);
},
/**
* Initialize the VarDumper JS functions.
*/
initDumperJs() {
this.sfDump = sfdump(document);
},
/**
* Trigger the Sfdump() for every newly dumped <pre> tag.
*/
triggerDumps() {
const divs = this.$refs.dumps;
if (! divs) return;
divs.forEach(el => {
const id = el.children[0].id;
if (this.triggered.includes(id)) return;
this.sfDump(id);
this.triggered.push(id);
});
}
}
}
</script>
Expand Down Expand Up @@ -126,7 +160,7 @@
<span class="text-white text-monospace" style="font-size: 12px;">{{timeAgo(entry.created_at)}}</span>
</div>

<div v-html="entry.content.dump"></div>
<div v-html="entry.content.dump" ref="dumps"></div>
</div>
</transition-group>
</div>
Expand Down
Loading

0 comments on commit cd6b43c

Please sign in to comment.