Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
malclocke committed Jul 18, 2024
1 parent f437383 commit e21a553
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
27 changes: 27 additions & 0 deletions app/views/pg_hero/home/_pev2.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<script src="https://unpkg.com/[email protected]/dist/vue.global.prod.js"></script>
<script src="https://unpkg.com/pev2/dist/pev2.umd.js"></script>
<link
href="https://unpkg.com/[email protected]/dist/css/bootstrap.min.css"
rel="stylesheet"
/>
<link rel="stylesheet" href="https://unpkg.com/pev2/dist/style.css" />

<div id="pev2">
<pev2 :plan-source="plan" plan-query="" />
</div>

<script>
const { createApp } = Vue;

const plan = "<%= escape_javascript(plan.html_safe) %>";

const app = createApp({
data() {
return {
plan: plan,
}
},
});
app.component("pev2", pev2.Plan);
app.mount("#pev2");
</script>
5 changes: 3 additions & 2 deletions app/views/pg_hero/home/explain.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
<% if @explanation %>
<% if @visualize %>
<p>Paste the output below into the <%= link_to "explain visualizer", PgHero.visualize_url, target: "_blank" %></p>
<%= render partial: "pev2", locals: { plan: @explanation } %>
<% else %>
<pre><code><%= @explanation %></code></pre>
<% end %>
<pre><code><%= @explanation %></code></pre>
<% unless @visualize %>
<p><%= link_to "See how to interpret this", "https://www.postgresql.org/docs/current/static/using-explain.html", target: "_blank" %></p>
<% end %>
Expand Down

0 comments on commit e21a553

Please sign in to comment.