Skip to content

Commit

Permalink
advertise build version within frontend (closes #486)
Browse files Browse the repository at this point in the history
  • Loading branch information
boogheta committed Sep 8, 2023
1 parent 300fa6e commit 70c410f
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ bin/hyphe-phantomjs*
config/apache2.conf
config/config.json*
config/salt
VERSION
.env
.python-version
config-backend.env
Expand Down
7 changes: 6 additions & 1 deletion hyphe_frontend/app/views/help.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ <h2>
<div class="pusher"></div>
</div>
<md-list class="credits-list-footer">
<md-list-item ng-if="version" ng-href="https://github.com/medialab/hyphe/tree/{{version}}" target="_blank" aria-label="médialab website">
<span layout-padding >
Hyphe {{version}}
</span>
</md-list-item>
<md-list-item ng-href="https://medialab.sciencespo.fr/en" target="_blank" aria-label="médialab website">
<span layout-padding >
médialab
Expand All @@ -82,7 +87,7 @@ <h2>
DIME-SHS
</span>
</md-list-item>
<md-list-item ng-href="http://tools.medialab.sciences-po.fr/" target="_blank" aria-label="medialab Tools">
<md-list-item ng-href="https://medialab.sciencespo.fr/tools/" target="_blank" aria-label="medialab Tools">
<span layout-padding >
médialab Tools
</span>
Expand Down
9 changes: 8 additions & 1 deletion hyphe_frontend/app/views/help.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ angular.module('hyphe.helpController', ['ngSanitize'])
$anchorScroll,
$routeParams,
$timeout,
config
config,
$http
) {
$scope.currentPage = 'help'

$scope.version = null
$scope.corpusName = corpus.getName(config.get('extraTitle') || '')
$scope.corpusId = corpus.getId()
$scope.headerCustomColor = config.get('headerCustomColor') || '#328dc7';
Expand All @@ -38,6 +41,10 @@ angular.module('hyphe.helpController', ['ngSanitize'])
})
$scope.highlightedEntry = $routeParams.entry

$http({url: "conf/VERSION"}).then(function(res){
$scope.version = res.data.replace(/[\n\r]/, '').replace(/^(\d)/, 'v$1')
}, function() {})

$scope.$watchGroup(['highlightedEntry', 'definitions'], function (newValues, oldValues) {
$timeout(function () {
if ($routeParams.entry) {
Expand Down
14 changes: 7 additions & 7 deletions hyphe_frontend/app/views/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -191,24 +191,24 @@ <h3>Login to {{ corpus.name }}</h3>

<div layout="row" class="credits-list" layout-align="center" md-colors="{background: 'default-background-100'}">

<md-list-item ng-href="https://medialab.sciencespo.fr/en" target="_blank" aria-label="médialab website">
<md-list-item ng-if="version" ng-href="https://github.com/medialab/hyphe/tree/{{version}}" target="_blank" aria-label="Hyphe version">
<span layout-padding >
médialab
Hyphe {{version}}
</span>
</md-list-item>
<md-list-item ng-href="https://dime-shs.sciencespo.fr/en/" target="_blank" aria-label="DIME SHS">
<md-list-item ng-href="https://medialab.sciencespo.fr/en" target="_blank" aria-label="médialab website">
<span layout-padding >
DIME SHS
médialab
</span>
</md-list-item>
<md-list-item ng-href="http://tools.medialab.sciences-po.fr/" target="_blank" aria-label="médialab Tools">
<md-list-item ng-href="https://medialab.sciencespo.fr/tools/" target="_blank" aria-label="médialab Tools">
<span layout-padding >
Tools
Tools
</span>
</md-list-item>
<md-list-item ng-href="https://github.com/medialab/hyphe" target="_blank" aria-label="Hyphe's source code on GitHub">
<span layout-padding >
Source Code
Source Code
</span>
</md-list-item>
</div>
Expand Down
9 changes: 7 additions & 2 deletions hyphe_frontend/app/views/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

angular.module('hyphe.loginController', [])

.controller('Login', ['$scope', 'api', 'utils', '$location', 'corpus', 'config'
,function($scope, api, utils, $location, corpus, config) {
.controller('Login', ['$scope', 'api', 'utils', '$location', 'corpus', 'config', '$http'
,function($scope, api, utils, $location, corpus, config, $http) {
$scope.currentPage = 'login'

$scope.version = null

$scope.corpusList
$scope.corpusList_byId = {}
$scope.corpusNameList = []
Expand Down Expand Up @@ -89,6 +91,9 @@ angular.module('hyphe.loginController', [])
refresh()
$scope.loop = setInterval(refresh, 2500)
$scope.$on('$destroy', function(){ clearInterval($scope.loop) })
$http({url: "conf/VERSION"}).then(function(res){
$scope.version = res.data.replace(/[\n\r]/, '').replace(/^(\d)/, 'v$1')
}, function() {})

function refresh(){
getStatus()
Expand Down

0 comments on commit 70c410f

Please sign in to comment.