Skip to content

Commit bd4ef99

Browse files
committed
allow to hardforce color of the main menu for specific usecases such as two parallel instances needed like at BNF (closes #430)
1 parent a3c242e commit bd4ef99

25 files changed

+67
-29
lines changed

config-frontend.env.example

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
HYPHE_BROWSER_URL=https://github.com/medialab/hyphe-browser/releases
22
HYPHE_GOOGLE_ANALYTICS_ID=
33
HYPHE_DISCLAIMER=
4+
HYPHE_CUSTOM_COLOR=
45

56
# Setup USER & PASS to restrict Hyphe's access to informed users
67
# PASS should be encrypted, generate it using the following command and paste the result here: openssl passwd -apr1

doc/config.md

+6
Original file line numberDiff line numberDiff line change
@@ -157,3 +157,9 @@ A few adjustments can be set to the frontend by editing the file `hyphe_frontend
157157
- `hyBroURL` (in Docker: `HYPHE_BROWSER_URL`):
158158

159159
A direct link URL to a web directory hosting build installs of Hyphe Browser
160+
161+
- `headerCustomColor` (in Docker: `HYPHE_CUSTOM_COLOR`):
162+
163+
An hexadecimal color code (i.e. #328dc7) that will be used as the background of the login menu as well as of the top left corpus title zone in the web interface.
164+
165+

hyphe_frontend/app/app.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,4 +157,4 @@ angular.module('hyphe.analytics', [])
157157
ga('create', googleAnalyticsId, 'auto');
158158
}
159159

160-
}])
160+
}])

hyphe_frontend/app/conf/conf_default.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ angular.module('hyphe.conf', [])
1010
.constant('googleAnalyticsId', '')
1111
.constant('disclaimer', '')
1212
.constant('hyBroURL', 'https://github.com/medialab/hyphe-browser/releases/')
13-
13+
.constant('headerCustomColor', '')
1414

1515

1616
;

hyphe_frontend/app/partials/topbar.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div layout="row" layout-fill>
2-
<div layout="row" class="sidebar-width topbar-project" md-colors="{background: 'default-primary-500'}">
2+
<div layout="row" class="sidebar-width topbar-project" md-colors="{background: 'default-primary-500'}" ng-style="{'background-color': headerCustomColor}">
33
<div flex>
44
<div layout-fill layout="row" layout-padding layout-align="start center">
55
{{corpusName}}

hyphe_frontend/app/views/definewebentities.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22

33
angular.module('hyphe.definewebentitiesController', [])
44

5-
.controller('DefineWebEntities', ['$scope', 'store', 'utils', 'api', 'QueriesBatcher', '$location', 'PrefixConflictsIndex', 'corpus'
6-
,function($scope, store, utils, api, QueriesBatcher, $location, PrefixConflictsIndex, corpus) {
5+
.controller('DefineWebEntities', ['$scope', 'store', 'utils', 'api', 'QueriesBatcher', '$location', 'PrefixConflictsIndex', 'corpus', 'config'
6+
,function($scope, store, utils, api, QueriesBatcher, $location, PrefixConflictsIndex, corpus, config) {
77
$scope.currentPage = 'definewebentities'
88
$scope.corpusName = corpus.getName()
99
$scope.corpusId = corpus.getId()
10+
$scope.headerCustomColor = config.get('headerCustomColor') || '#328dc7';
1011

1112
$scope.list = []
1213
$scope.list_byId = {}

hyphe_frontend/app/views/export.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22

33
angular.module('hyphe.exportController', [])
44

5-
.controller('export', ['$scope', 'api', 'utils', 'corpus'
6-
,function($scope, api, utils, corpus) {
5+
.controller('export', ['$scope', 'api', 'utils', 'corpus', 'config'
6+
,function($scope, api, utils, corpus, config) {
77
$scope.currentPage = 'export'
88
$scope.corpusName = corpus.getName()
99
$scope.corpusId = corpus.getId()
10+
$scope.headerCustomColor = config.get('headerCustomColor') || '#328dc7';
1011

1112
$scope.dataVolume = 'compact'
1213
$scope.compactFields = ['id', 'name', 'prefixes', 'indegree', 'pages_total', 'pages_crawled', 'status', 'last_modification_date', 'user_tags']

hyphe_frontend/app/views/help.js

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ angular.module('hyphe.helpController', ['ngSanitize'])
1717
$scope.currentPage = 'help'
1818
$scope.corpusName = corpus.getName()
1919
$scope.corpusId = corpus.getId()
20+
$scope.headerCustomColor = config.get('headerCustomColor') || '#328dc7';
2021
$scope.hyBro = config.get('hyBroURL')
2122

2223
// Build index

hyphe_frontend/app/views/importurls.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22

33
angular.module('hyphe.importurlsController', [])
44

5-
.controller('ImportUrls', ['$scope', 'FileLoader', 'Parser', 'extractURLs', 'droppableTextArea', 'store', 'corpus', '$timeout', 'api'
6-
,function($scope, FileLoader, Parser, extractURLs, droppableTextArea, store, corpus, $timeout, api) {
5+
.controller('ImportUrls', ['$scope', 'FileLoader', 'Parser', 'extractURLs', 'droppableTextArea', 'store', 'corpus', '$timeout', 'api', 'config'
6+
,function($scope, FileLoader, Parser, extractURLs, droppableTextArea, store, corpus, $timeout, api, config) {
77
$scope.currentPage = 'importurls'
88
$scope.corpusName = corpus.getName()
99
$scope.corpusId = corpus.getId()
10+
$scope.headerCustomColor = config.get('headerCustomColor') || '#328dc7';
1011

1112
var parser = new Parser()
1213

hyphe_frontend/app/views/listWebentities.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ angular.module('hyphe.listwebentitiesController', [])
1212
$timeout,
1313
$route,
1414
$window,
15-
corpus
15+
corpus,
16+
config
1617
) {
1718
$scope.currentPage = 'listWebentities'
1819
$scope.corpusName = corpus.getName()
1920
$scope.corpusId = corpus.getId()
21+
$scope.headerCustomColor = config.get('headerCustomColor') || '#328dc7';
2022

2123
$scope.dynamicWebentities
2224

hyphe_frontend/app/views/login.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ <h1 style="font-weight: 100; font-family: Roboto;font-size: 3.5em;">hyphe</h1>
3838
<div
3939
ng-if="!disconnected && !loading"
4040
>
41-
<md-button class="md-raised md-primary" ng-show="uiMode == 'default' && corpusList.length > 0" ng-click="switchToNew()" layout-fill>
41+
<md-button class="md-raised md-primary" ng-show="uiMode == 'default' && corpusList.length > 0" ng-click="switchToNew()" layout-fill ng-style="{'background-color': headerCustomColor}">
4242
<md-icon>add</md-icon> New Corpus
4343
</md-button>
4444
</div>

hyphe_frontend/app/views/login.js

+7-5
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

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

5-
.controller('Login', ['$scope', 'api', 'utils', '$location', 'corpus'
6-
,function($scope, api, utils, $location, corpus) {
5+
.controller('Login', ['$scope', 'api', 'utils', '$location', 'corpus', 'config'
6+
,function($scope, api, utils, $location, corpus, config) {
77
$scope.currentPage = 'login'
88

99
$scope.corpusList
@@ -29,6 +29,8 @@ angular.module('hyphe.loginController', [])
2929
$scope.starting = false
3030
$scope.search_query = ''
3131

32+
$scope.headerCustomColor = config.get('headerCustomColor') || '#328dc7';
33+
3234
$scope.createCorpus = function(){
3335
var isValid = true
3436

@@ -113,7 +115,7 @@ angular.module('hyphe.loginController', [])
113115

114116
openCorpus($scope.corpus.corpus_id, $scope.corpus.name)
115117

116-
},function(data, status, headers, config){
118+
},function(data, status, headers, conf){
117119

118120
$scope.starting = false
119121
if(data && data[0] && data[0].message.match(/^Wrong auth.*/)){
@@ -133,7 +135,7 @@ angular.module('hyphe.loginController', [])
133135

134136
openCorpus(data.corpus_id, $scope.new_project_name)
135137

136-
},function(data, status, headers, config){
138+
},function(data, status, headers, conf){
137139
$scope.starting = false
138140

139141
$scope.new_project_message = 'Error creating corpus'
@@ -165,7 +167,7 @@ angular.module('hyphe.loginController', [])
165167
return 0;
166168
})
167169

168-
},function(data, status, headers, config){
170+
},function(data, status, headers, conf){
169171
$scope.loadingList = false
170172
$scope.corpusList = ''
171173
$scope.disconnected = true

hyphe_frontend/app/views/manageTags.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@ angular.module('hyphe.manageTagsController', [])
1111
$location,
1212
$timeout,
1313
$filter,
14-
$mdColors
14+
$mdColors,
15+
config
1516
) {
1617
var pageSize = 1000
1718

1819
$scope.currentPage = 'manageTags'
1920
$scope.corpusName = corpus.getName()
2021
$scope.corpusId = corpus.getId()
22+
$scope.headerCustomColor = config.get('headerCustomColor') || '#328dc7';
2123

2224
$scope.data = {
2325
in: {

hyphe_frontend/app/views/monitorCrawls.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ angular.module('hyphe.monitorcrawlsController', [])
1212
$location,
1313
refreshScheduler,
1414
corpus,
15-
$timeout
15+
$timeout,
16+
config
1617
){
1718
$scope.currentPage = 'monitorCrawls'
1819
$scope.corpusName = corpus.getName()
1920
$scope.corpusId = corpus.getId()
21+
$scope.headerCustomColor = config.get('headerCustomColor') || '#328dc7';
2022

2123
$scope.selectedTab = 0
2224
$scope.focusedJobId

hyphe_frontend/app/views/network.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ angular.module('hyphe.networkController', ['angular-md5'])
99
utils,
1010
md5,
1111
corpus,
12-
$window
12+
config,
13+
$window,
1314
) {
1415
$scope.currentPage = 'network'
1516
$scope.corpusName = corpus.getName()
1617
$scope.corpusId = corpus.getId()
18+
$scope.headerCustomColor = config.get('headerCustomColor') || '#328dc7';
1719
})

hyphe_frontend/app/views/overview.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22

33
angular.module('hyphe.overviewController', [])
44

5-
.controller('Overview', ['$scope', 'api', 'utils', 'corpus'
6-
,function($scope, api, utils, corpus) {
5+
.controller('Overview', ['$scope', 'api', 'utils', 'corpus', 'config'
6+
,function($scope, api, utils, corpus, config) {
77
$scope.currentPage = 'overview'
88
$scope.corpusName = corpus.getName()
99
$scope.corpusId = corpus.getId()
10+
$scope.headerCustomColor = config.get('headerCustomColor') || '#328dc7';
1011

1112
$scope.corpusStatus
1213
$scope.corpusStatistics

hyphe_frontend/app/views/prepareCrawls.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22

33
angular.module('hyphe.preparecrawlsController', [])
44

5-
.controller('PrepareCrawls', ['$scope', 'api', 'store', 'utils', '$location', 'QueriesBatcher', 'corpus', '$timeout', '$interval', '$mdDialog'
6-
,function($scope, api, store, utils, $location, QueriesBatcher, corpus, $timeout, $interval, $mdDialog) {
5+
.controller('PrepareCrawls', ['$scope', 'api', 'store', 'utils', '$location', 'QueriesBatcher', 'corpus', '$timeout', '$interval', '$mdDialog', 'config'
6+
,function($scope, api, store, utils, $location, QueriesBatcher, corpus, $timeout, $interval, $mdDialog, config) {
77

88
$scope.currentPage = 'prepareCrawls'
99
$scope.corpusName = corpus.getName()
1010
$scope.corpusId = corpus.getId()
11+
$scope.headerCustomColor = config.get('headerCustomColor') || '#328dc7';
1112

1213
$scope.crawlDepth = 1
1314
$scope.cautious = false

hyphe_frontend/app/views/prospect.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ angular.module('hyphe.prospectController', [])
1010
corpus,
1111
store,
1212
$location,
13-
$window
13+
$window,
14+
config
1415
) {
1516
$scope.currentPage = 'prospect'
1617
$scope.corpusName = corpus.getName()
1718
$scope.corpusId = corpus.getId()
19+
$scope.headerCustomColor = config.get('headerCustomColor') || '#328dc7';
1820

1921
$scope.loading = false // This flag prevents multiple simultaneous queries
2022

hyphe_frontend/app/views/settings.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22

33
angular.module('hyphe.settingsController', [])
44

5-
.controller('settings', ['$scope', 'api', 'utils', '$location', 'corpus'
6-
,function($scope, api, utils, $location, corpus) {
5+
.controller('settings', ['$scope', 'api', 'utils', '$location', 'corpus', 'config'
6+
,function($scope, api, utils, $location, corpus, config) {
77
$scope.MAXPAGES = 50
88
$scope.currentPage = 'settings'
99
$scope.corpusName = corpus.getName()
1010
$scope.corpusId = corpus.getId()
11+
$scope.headerCustomColor = config.get('headerCustomColor') || '#328dc7';
1112
$scope.corpusNotEmpty
1213
$scope.corpusSettingsEditMode = false
1314
$scope.options = {}

hyphe_frontend/app/views/tool_networkTagStats.js

+2
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ angular.module('hyphe.toolNetworkTagStatsController', [])
99
utils,
1010
md5,
1111
corpus,
12+
config,
1213
$window
1314
) {
1415
$scope.currentPage = 'toolNetworkTagStats'
1516
$scope.corpusName = corpus.getName()
1617
$scope.corpusId = corpus.getId()
18+
$scope.headerCustomColor = config.get('headerCustomColor') || '#328dc7';
1719

1820
var pageSize = 5000
1921
$scope.checkLoadAndUpdateCurrentToken = 0

hyphe_frontend/app/views/tools.js

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ angular.module('hyphe.toolsController', ['ngSanitize'])
1212
$scope.currentPage = 'tools'
1313
$scope.corpusName = corpus.getName()
1414
$scope.corpusId = corpus.getId()
15+
$scope.headerCustomColor = config.get('headerCustomColor') || '#328dc7';
1516

1617
$scope.goTo = function(url){
1718
$location.path(url)

hyphe_frontend/app/views/webentity.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@ angular.module('hyphe.webentityController', [])
1313
$window,
1414
$timeout,
1515
$mdColors,
16-
autocompletion
16+
autocompletion,
17+
config
1718
){
1819
$scope.currentPage = 'webentity'
1920
$scope.corpusName = corpus.getName()
2021
$scope.corpusId = corpus.getId()
22+
$scope.headerCustomColor = config.get('headerCustomColor') || '#328dc7';
2123

2224
$scope.webentity = {id:utils.readWebentityIdFromRoute(), loading:true}
2325

hyphe_frontend/app/views/webentity_explorer.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ angular.module('hyphe.webentityExplorerController', [])
1010
corpus,
1111
$location,
1212
$timeout,
13-
$rootScope
13+
$rootScope,
14+
config
1415
) {
1516
$scope.corpusName = corpus.getName()
1617
$scope.corpusId = corpus.getId()
18+
$scope.headerCustomColor = config.get('headerCustomColor') || '#328dc7';
1719

1820
$scope.explorerActive = false
1921

hyphe_frontend/app/views/webentity_pagesNetwork.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ angular.module('hyphe.webentityPagesNetworkController', [])
99
corpus,
1010
$timeout,
1111
$window,
12-
$mdSidenav
12+
$mdSidenav,
13+
config
1314
) {
1415
$scope.corpusName = corpus.getName()
1516
$scope.corpusId = corpus.getId()
17+
$scope.headerCustomColor = config.get('headerCustomColor') || '#328dc7';
1618

1719
$scope.webentity = {id:utils.readWebentityIdFromRoute(), loading:true}
1820
$scope.pages = []

hyphe_frontend/docker-entrypoint.sh

+3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ sed --in-place "s|'serverURL'\s*,.*|'serverURL', window.location.pathname === '/
1818
[[ ! -z "${HYPHE_BROWSER_URL}" ]] &&
1919
sed --in-place "s|'hyBroURL'\s*,.*|'hyBroURL', '${HYPHE_BROWSER_URL}')|" $CONFIGFILE
2020

21+
[[ ! -z "${HYPHE_CUSTOM_COLOR}" ]] &&
22+
sed --in-place "s|'headerCustomColor'\s*,.*|'headerCustomColor', '${HYPHE_CUSTOM_COLOR}')|" $CONFIGFILE
23+
2124
chmod -R 550 /frontend/app && chown -R nginx:nginx /frontend/app
2225

2326
envsubst '\$NS \$BACKEND_HOST \$BACKEND_PORT' < /etc/nginx/conf.d/docker-nginx-vhost.template > /etc/nginx/conf.d/default.conf

0 commit comments

Comments
 (0)