diff --git a/deploy/app.js b/deploy/app.js index a879b9243f53a78385fbc76b4a81f5f23364195c..bb74e13f8eb48c713560e8eaeb6876ffbe87936c 100644 --- a/deploy/app.js +++ b/deploy/app.js @@ -71,6 +71,12 @@ const PUBLIC_PATH = process.env.NODE_ENV === 'production' */ app.use('/.well-known', express.static(path.join(__dirname, 'well-known'))) +/** + * show dev banner + * n.b., must be before express.static() call + */ +app.use(require('./devBanner')) + /** * only use compression for production * this allows locally built aot to be served without errors diff --git a/deploy/devBanner/index.js b/deploy/devBanner/index.js new file mode 100644 index 0000000000000000000000000000000000000000..8f9ee7fef018b40c90d917e687dc65ca0145497b --- /dev/null +++ b/deploy/devBanner/index.js @@ -0,0 +1,26 @@ +const express = require('express') +const router = express.Router() + +/** + * build flag + */ +const BUILD_TEXT = process.env.BUILD_TEXT || '' +const versionCss = ` /* overwritten */ +body::after +{ + content: '${BUILD_TEXT}'; +} +` +const buildTextIsDefined = typeof process.env.BUILD_TEXT !== 'undefined' + +/** + * bypass if env var not defined + * i.e. in order to show nothing, must EXPLICITLY set envvar BUILD_TEXT as empty string + */ +router.get('/version.css', (req, res, next) => { + if (!buildTextIsDefined) return next() + res.setHeader('Content-Type', 'text/css; charset=UTF-8') + res.status(200).send(versionCss) +}) + +module.exports = router \ No newline at end of file diff --git a/package.json b/package.json index da8ebe32fc5e0d9561b8cc35aec82e6e60920224..9d13f653c2e66d9d14b16a8855e815dbad992277 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "build-export": "webpack --config webpack.export.js", "build-export-min": "webpack --config webpack.export.min.js", "build-export-aot": "webpack --config webpack.export.aot.js", - "build-aot": "PRODUCTION=true GIT_HASH=`git log --pretty=format:'%h' --invert-grep --grep=^.ignore -1` webpack --config webpack.aot.js", + "build-aot": "PRODUCTION=true GIT_HASH=`git rev-parse --short HEAD` webpack --config webpack.aot.js", "build-min": "webpack --config webpack.prod.js", "build": "webpack --config webpack.dev.js", "plugin-server": "node ./src/plugin_examples/server.js", diff --git a/src/atlasViewer/atlasViewer.constantService.service.ts b/src/atlasViewer/atlasViewer.constantService.service.ts index 6a6fe0615d2fb1e03441bb69c8428e68d3ffb1d3..e0c159f0447124ea82493ceb81b058acff3e096d 100644 --- a/src/atlasViewer/atlasViewer.constantService.service.ts +++ b/src/atlasViewer/atlasViewer.constantService.service.ts @@ -194,11 +194,15 @@ Interactive atlas viewer requires **webgl2.0**, and the \`EXT_color_buffer_float ] public showHelpPerspectiveViewMap = this.showHelpPerspectiveDesktop - get showHelpSupportText() { - return `Did you encounter an issue? - Send us an email: <a target = "_blank" href = "mailto:${this.supportEmailAddress}">${this.supportEmailAddress}</a>, - raise/track issues at github repo: <a target = "_blank" href = "${this.repoUrl}">${this.repoUrl}</a>` - } + /** + * raise/track issues at github repo: <a target = "_blank" href = "${this.repoUrl}">${this.repoUrl}</a> + */ + + private supportEmailAddress = `inm1-bda@fz-juelich.de` + + public showHelpSupportText:string = `Did you encounter an issue? +Send us an email: <a target = "_blank" href = "mailto:${this.supportEmailAddress}">${this.supportEmailAddress}</a>` + incorrectParcellationNameSearchParam(title) { return `The selected parcellation - ${title} - is not available. The the first parcellation of the template is selected instead.` @@ -208,7 +212,6 @@ Interactive atlas viewer requires **webgl2.0**, and the \`EXT_color_buffer_float return `The selected template - ${title} - is not available.` } - private supportEmailAddress = `x.gui@fz-juelich.de` private repoUrl = `https://github.com/HumanBrainProject/interactive-viewer` constructor( diff --git a/src/components/pagination/pagination.component.ts b/src/components/pagination/pagination.component.ts index 0e5ff89eefc188bd56b05c768ababcdd89310bb8..1723d4540cef7683c09f8ca7f5e81986c6003f80 100644 --- a/src/components/pagination/pagination.component.ts +++ b/src/components/pagination/pagination.component.ts @@ -4,8 +4,7 @@ import { Component, Input, Output, EventEmitter } from '@angular/core' selector : 'pagination-component', templateUrl : './pagination.template.html', styleUrls : [ - './pagination.style.css', - '../../css/darkBtns.css' + './pagination.style.css' ] }) diff --git a/src/css/darkBtns.css b/src/css/darkBtns.css deleted file mode 100644 index 35e4e24ea3ba616e1b5227c7a874758d6d957f21..0000000000000000000000000000000000000000 --- a/src/css/darkBtns.css +++ /dev/null @@ -1,12 +0,0 @@ - -:host-context([darktheme="true"]) .btn.btn-default -{ - background-color:rgba(128,128,128,0.5); - color:rgba(240,240,240,0.9); - border: none; -} - -:host-context([darktheme="true"]) .btn.btn-default > * -{ - font-size: 100%; -} \ No newline at end of file diff --git a/src/index.html b/src/index.html index c0c9c594f700b0fe55a83c70d2834370852d40cf..f805b632d4972715268dace025282d807365fffe 100644 --- a/src/index.html +++ b/src/index.html @@ -9,6 +9,7 @@ <link rel="stylesheet" href="extra_styles.css"> <link rel="stylesheet" href="plugin_styles.css"> <link rel="stylesheet" href="theme.css"> + <link rel="stylesheet" href="version.css"> <title>Interactive Atlas Viewer</title> </head> diff --git a/src/main-aot.ts b/src/main-aot.ts index d08b57c5c399ec7276603381e62b8d87034762ff..10bfb6cac304ba1bece7e906b4645d09bf093505 100644 --- a/src/main-aot.ts +++ b/src/main-aot.ts @@ -6,9 +6,6 @@ import { platformBrowserDynamic } from '@angular/platform-browser-dynamic' import { MainModule } from './main.module'; import { enableProdMode } from '@angular/core'; -import './theme.scss' -import './res/css/extra_styles.css' - const requireAll = (r:any) => {r.keys().forEach(r)} requireAll(require.context('./res/ext', false, /\.json$/)) requireAll(require.context('./res/images', true, /\.jpg|\.png/)) @@ -17,7 +14,6 @@ requireAll(require.context(`./plugin_examples`, true)) /* aot === production mode */ enableProdMode() -if(PRODUCTION) - console.log(`Interactive Atlas Viewer: ${VERSION}`) +if(PRODUCTION) console.log(`Interactive Atlas Viewer: ${VERSION}`) platformBrowserDynamic().bootstrapModule(MainModule) \ No newline at end of file diff --git a/src/main.module.ts b/src/main.module.ts index b4ffa246b99054600f4814e50b572fd03d2fca47..50ba1a22d5d3c4f5fbe8af4980272da10827aad3 100644 --- a/src/main.module.ts +++ b/src/main.module.ts @@ -50,6 +50,10 @@ import { DatabrowserModule } from "./ui/databrowserModule/databrowser.module"; import 'hammerjs' import { UIService } from "./services/uiService.service"; +import 'src/res/css/version.css' +import 'src/theme.scss' +import 'src/res/css/extra_styles.css' + @NgModule({ imports : [ FormsModule, diff --git a/src/main.ts b/src/main.ts index 039f4efc7e3c2cac31b7a009744fda7acdc7a660..479dbb34491927cd7ed00952948534c70cdc698f 100644 --- a/src/main.ts +++ b/src/main.ts @@ -6,9 +6,6 @@ import 'third_party/testSafari.js' import { platformBrowserDynamic } from '@angular/platform-browser-dynamic' import { MainModule } from './main.module'; -import './theme.scss' -import './res/css/extra_styles.css' - const requireAll = (r:any) => {r.keys().forEach(r)} requireAll(require.context('./res/ext',false, /\.json$/)) requireAll(require.context('./res/images',true,/\.jpg|\.png/)) diff --git a/src/res/css/extra_styles.css b/src/res/css/extra_styles.css index cb86ba171285962fa0cc59b0f14bb51d9b4e6a37..c9c1ac7c1e2a3617ebe776786d75ff6ff8351421 100644 --- a/src/res/css/extra_styles.css +++ b/src/res/css/extra_styles.css @@ -635,3 +635,15 @@ mat-icon[fontset="far"] { outline: none!important; } + +body::after +{ + content: ''; + position: fixed; + bottom: 1rem; + right: 2rem; + font-size: 200%; + color: rgba(128, 128, 128, 0.5); + pointer-events: none; + z-index: 99999; +} diff --git a/src/res/css/version.css b/src/res/css/version.css new file mode 100644 index 0000000000000000000000000000000000000000..8c34cd43715e530a36a9b163615d09d0350eee35 --- /dev/null +++ b/src/res/css/version.css @@ -0,0 +1,5 @@ +/* fall back */ +body::after +{ + content: 'dev build'; +} \ No newline at end of file diff --git a/src/ui/pluginBanner/pluginBanner.component.ts b/src/ui/pluginBanner/pluginBanner.component.ts index 02d92bce45410ea55a3ccbfa9b81ad6c5058e7b5..299f345f00f196f170ad8b1bf985be20ee5da206 100644 --- a/src/ui/pluginBanner/pluginBanner.component.ts +++ b/src/ui/pluginBanner/pluginBanner.component.ts @@ -6,8 +6,7 @@ import { PluginServices, PluginManifest } from "src/atlasViewer/atlasViewer.plug selector : 'plugin-banner', templateUrl : './pluginBanner.template.html', styleUrls : [ - `./pluginBanner.style.css`, - '../../css/darkBtns.css' + `./pluginBanner.style.css` ] })