Skip to content

Commit

Permalink
Show Annif version in WebUI (#745)
Browse files Browse the repository at this point in the history
* Show Annif version in WebUI below text box

* Make clear version number is for Annif
  • Loading branch information
juhoinkinen authored Nov 21, 2023
1 parent 86ce3e7 commit a501e53
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions annif/static/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ h1 { font-size: 2rem; }
border-radius: 0px;
padding: 2px 7px;
}
#annif-version {
float: right;
margin-top: 0.5rem;
font-size: 1rem;
}
label, #suggestions {
border-top: 1px solid #343260;
margin-bottom: 0.5rem;
Expand Down
10 changes: 10 additions & 0 deletions annif/templates/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ <h2 v-if="problem.hasTitle()"><% problem.title %></h2>
<div class="row mb-5">
<div class="col-md-8">
<annif-textarea @text-changed="onTextChanged" @text-cleared="onTextCleared"></annif-textarea>
<span id="annif-version">Annif v<% annif_version %></span>
</div>
<div class="col-md-4">
<div id="project-selection-wrapper">
Expand Down Expand Up @@ -233,6 +234,7 @@ <h2 class="mt-4" id="suggestions">Suggested subjects</h2>\
el: '#app',
data: {
text: '',
annif_version: '',
project: '',
limit: 10,
projects: [],
Expand All @@ -243,6 +245,7 @@ <h2 class="mt-4" id="suggestions">Suggested subjects</h2>\
mounted: function() {
// TBD: we can add a button to reload the list of projects later
this.loadProjects();
this.loadVersion();
},
methods: {
clearResults: function() {
Expand Down Expand Up @@ -282,6 +285,13 @@ <h2 class="mt-4" id="suggestions">Suggested subjects</h2>\
}
});
},
loadVersion: function() {
var this_ = this;
axios.get('/v1')
.then(res => {
this_.annif_version = res.data.version;
})
},
suggest: function(event) {
this.problems = [];
if (this.text.trim() === '') {
Expand Down

0 comments on commit a501e53

Please sign in to comment.