Skip to content

Commit

Permalink
feat: Add latest release version tag to Navbar component
Browse files Browse the repository at this point in the history
Signed-off-by: Vanessa Fotso <vfotso@mitre.org>
  • Loading branch information
vanessuniq committed Apr 26, 2023
1 parent f8e0b5c commit 507f036
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion app/javascript/components/navbar/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<b-navbar toggleable="lg" type="dark" variant="dark">
<b-navbar-brand id="heading" href="/">
<i class="mdi mdi-radar" aria-hidden="true" />
VULCAN
VULCAN <span class="latest-release">{{ latestRelease }}</span>
</b-navbar-brand>

<b-navbar-toggle target="nav-collapse" />
Expand Down Expand Up @@ -66,6 +66,31 @@ export default {
required: false,
},
},
data() {
return {
latestRelease: "",
};
},
mounted() {
this.fetchLatestRelease();
},
methods: {
fetchLatestRelease() {
const owner = "mitre";
const repo = "vulcan";
// Make the API request to fetch the latest release
fetch(`https://api.github.com/repos/${owner}/${repo}/releases/latest`)
.then((response) => response.json())
.then((data) => {
this.latestRelease = data.tag_name;
})
.catch((error) => {
// console.error("Error fetching latest release:", error);
this.latestRelease = "";
});
},
},
};
</script>

Expand All @@ -75,6 +100,10 @@ export default {
font-weight: 700;
letter-spacing: 1px;
}
.latest-release {
font-size: 0.6em;
}
.right-container {
gap: 32px;
}
Expand Down

0 comments on commit 507f036

Please sign in to comment.