Skip to content

Commit

Permalink
add hyperlinks for versions and address nits
Browse files Browse the repository at this point in the history
  • Loading branch information
pront committed Sep 7, 2023
1 parent 2e875b8 commit d3bc824
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 23 deletions.
4 changes: 2 additions & 2 deletions lib/vector-vrl/web-playground/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ fn get_vector_toml_path() -> PathBuf {

fn get_git_hash() -> String {
let output = Command::new("git")
.args(&["rev-parse", "HEAD"])
.args(["rev-parse", "HEAD"])
.output()
.unwrap();
.expect("Failed to get git HEAD sha");
let mut git_hash = String::from_utf8(output.stdout).unwrap();
git_hash.truncate(8);
git_hash
Expand Down
34 changes: 16 additions & 18 deletions lib/vector-vrl/web-playground/public/index.css
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
body {
margin-right: 2vw;
margin-left: 2vw;
margin-right: 2vw;
margin-left: 2vw;
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto,
Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji,
Segoe UI Symbol, Noto Color Emoji;
}

table {
width: 100%;
border-spacing: 10px;
}

td {
text-align: left;
font-weight: bold;
}


.headers-grid {
display: grid;
grid-template-columns: 3fr 2fr 7fr;
grid-template-rows: 90px;
gap: 10px;
font-family: "Helvetica Neue", serif;
width: 100%;
height: 100%;
margin: auto;
Expand Down Expand Up @@ -80,7 +93,6 @@ div#toolbar-section {
height: 100%;
grid-row: 1;
font-weight: bold;
font-family: "Helvetica Neue", serif;
}

#input-section #cell #container-program {
Expand Down Expand Up @@ -109,7 +121,6 @@ div#toolbar-section {
display: grid;
grid-row: 1;
font-weight: bold;
font-family: "Helvetica Neue", serif;
}

#output-section #event-cell #container-event {
Expand All @@ -130,7 +141,6 @@ div#toolbar-section {
display: grid;
grid-row: 1;
font-weight: bold;
font-family: "Helvetica Neue", serif;
height: 50px;
}

Expand All @@ -140,12 +150,6 @@ div#toolbar-section {
height: 100%;
}

body {
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto,
Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji,
Segoe UI Symbol, Noto Color Emoji;
}

/* BUTTONS */
.btn {
display: inline-block;
Expand Down Expand Up @@ -287,12 +291,6 @@ div#toolbar-section {
height: 100%;
}

body {
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto,
Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji,
Segoe UI Symbol, Noto Color Emoji;
}

.btn-primary {
display: inline-block;
outline: 0;
Expand Down
11 changes: 10 additions & 1 deletion lib/vector-vrl/web-playground/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,16 @@
<h2>VRL Playground</h2>
</div>
<div class="headers-grid-item">
<h4 id="versions-header"></h4>
<table>
<tr>
<td>Vector Version: </td>
<td><a id="vector-version-link"></a></td>
</tr>
<tr>
<td>VRL Version: </td>
<td><a id="vrl-version-link"></a></td>
</tr>
</table>
</div>
<div class="headers-grid-item" id="description-cell">
<p id="description-paragraph" >
Expand Down
16 changes: 14 additions & 2 deletions lib/vector-vrl/web-playground/public/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ String: {{str}}
You can try validating your JSON here: https://jsonlint.com/ \n`;

export class VrlWebPlayground {

constructor() {
let temp = init().then(() => {
this.run_vrl = run_vrl;
Expand Down Expand Up @@ -84,12 +85,23 @@ export class VrlWebPlayground {
}
}

document.getElementById('versions-header').innerText =
"Vector Version: " + vector_version() + "\nVRL Version: " + vrl_version();
this.addVersions();
});
});
}

addVersions() {
let vectorLinkElement = document.getElementById('vector-version-link');
let vectorVersion = vector_version();
vectorLinkElement.text = vectorVersion;
vectorLinkElement.href = `https://github.com/vectordotdev/vector/tree/${vectorVersion}`;

let vrlLinkElement = document.getElementById('vrl-version-link');
let vrlVersion = vrl_version();
vrlLinkElement.text = vrlVersion;
vrlLinkElement.href = `https://crates.io/crates/vrl/${vrlVersion}`;
}

createDefaultEditor(elementId, value, language, theme) {
return this.monaco.editor.create(document.getElementById(elementId), {
value: value,
Expand Down

0 comments on commit d3bc824

Please sign in to comment.