Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: elekto version in UI #102

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions elekto/assets/scss/components/_sidebar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,17 @@
&__footer {
position: absolute;
bottom: 0;
width: $sidebar-width;
text-align: center;
color: #a8a8a8;
font-weight: 300;
font-size: 10px;
padding-bottom: 10px;
&_version {
position: absolute;
bottom: 0;
right: 0;
padding-bottom: 10px;
font-weight: bold;
}
}

&-active {
Expand Down
2 changes: 1 addition & 1 deletion elekto/static/css/main.css

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions elekto/templates/components/sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,7 @@
<div class="sidebar-item sidebar__footer">
copyright 2020 © elekto
</div>
<div class="sidebar-item sidebar__footer_version">
version: x.x.x
</div>
</div>
15 changes: 15 additions & 0 deletions elekto/templates/layouts/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,21 @@
document.getElementById('message').hidden = true
}, 10000);
}
document.addEventListener('DOMContentLoaded', function () {
// Fetch the version from the Flask API
fetch('https://api.github.com/repos/elekto-io/elekto/releases/latest')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Am I reading this right? It seems to be pulling the latest version number from GitHub, rather than the version the user is actually running. Or did I miss something?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my bad , i haven't thought through this

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should i run the bash script ' git describe --tags from the flask ' to get the current version?

.then(response => response.json())
.then(data => {
// Update the version in the sidebar
const versionElement = document.querySelector('.sidebar__footer_version');
versionElement.textContent = `version: ${data.tag_name}`;
})
.catch(error => {
console.error('Error fetching version:', error);
const versionElement = document.getElementById('version');
versionElement.textContent = 'Version: Unavailable';
});
});
</script>
{% block script %}{% endblock %}
</body>
Expand Down