Skip to content

Commit 15723ea

Browse files
authored
Merge pull request #70 from HSG-Library/develop
Open URL Module and Docker setup
2 parents 5e1775f + 2ed1177 commit 15723ea

File tree

11 files changed

+254
-1
lines changed

11 files changed

+254
-1
lines changed

.dockerignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
node_modules
2+
npm-debug.log
3+
.git
4+
.gitignore
5+
.DS_Store
6+
*.md
7+
.vscode

DOCKER.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Running Primo Explore with Docker (Node 10)
2+
3+
Since this project requires Node 10 which is not compatible with modern macOS, use Docker to run the development environment.
4+
5+
## Prerequisites
6+
- Docker installed and running
7+
8+
## Quick Start
9+
10+
### Run Development Server
11+
```bash
12+
docker-compose up
13+
```
14+
15+
The dev server will be available at `http://localhost:8003`
16+
17+
### Run in Detached Mode
18+
```bash
19+
docker-compose up -d
20+
```
21+
22+
### Stop the Server
23+
```bash
24+
docker-compose down
25+
```
26+
27+
## Running Other Commands
28+
29+
### Access Container Shell
30+
```bash
31+
docker-compose run --rm primo-dev bash
32+
```
33+
34+
Once inside, you can run any command:
35+
```bash
36+
gulp run --ve --browserify --view 41SLSP_HSG-sandbox_jfu
37+
npm install
38+
# etc.
39+
```
40+
41+
## Troubleshooting
42+
43+
### Port Already in Use
44+
If port 8003 is already in use, edit the `docker-compose.yml` and change:
45+
```yaml
46+
ports:
47+
- "8004:8003" # Use 8004 on host, 8003 in container
48+
```
49+
50+
### Clean Start
51+
To completely reset the environment:
52+
```bash
53+
docker-compose down -v
54+
docker-compose up
55+
```

Dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
FROM node:10
2+
3+
# Debian Stretch is EOL - update sources to use archive repositories
4+
RUN sed -i 's/deb.debian.org/archive.debian.org/g' /etc/apt/sources.list && \
5+
sed -i 's|security.debian.org|archive.debian.org|g' /etc/apt/sources.list && \
6+
sed -i '/stretch-updates/d' /etc/apt/sources.list
7+
8+
# Install system dependencies required for canvas and other native modules
9+
RUN apt-get update && apt-get install -y \
10+
build-essential \
11+
pkg-config \
12+
libcairo2-dev \
13+
libpango1.0-dev \
14+
libjpeg-dev \
15+
libgif-dev \
16+
librsvg2-dev \
17+
python \
18+
&& rm -rf /var/lib/apt/lists/*
19+
20+
# Install gulp globally
21+
RUN npm install -g gulp-cli
22+
23+
# Set working directory
24+
WORKDIR /primo-explore-devenv
25+
26+
# Expose the development server port
27+
EXPOSE 8003

css/hsg-openurl-interlibrary.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.hsg-openurl-container{
2+
justify-content: center;
3+
margin: 1em 0;
4+
padding: 1em;
5+
background-color: #f7eda3;
6+
border-color: #ede49e;
7+
box-shadow: 0 1px 0 0 rgb(0 0 0 / 3%), 0 5px 5px -3px rgb(0 0 0 / 7%);
8+
}
9+
.hsg-openurl{
10+
display:block;
11+
}

docker-compose.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
services:
2+
primo-dev:
3+
build:
4+
context: ../../..
5+
dockerfile: primo-explore/custom/41SLSP_HSG-sandbox_jfu/Dockerfile
6+
container_name: primo-explore-dev
7+
working_dir: /primo-explore-devenv
8+
volumes:
9+
# Mount the entire primo-explore-devenv directory
10+
- ../../../:/primo-explore-devenv
11+
# Persist node_modules to avoid reinstalling
12+
- node_modules:/primo-explore-devenv/node_modules
13+
ports:
14+
- "8003:8003"
15+
environment:
16+
# Enable polling for file watchers (required for Docker on macOS)
17+
- CHOKIDAR_USEPOLLING=true
18+
- CHOKIDAR_INTERVAL=1000
19+
# Disable browser-sync ghost mode for better reliability
20+
- BROWSERSYNC_DISABLE_HOST_CHECK=true
21+
command: bash -c "npm install && gulp run --ve --browserify --view 41SLSP_HSG-sandbox_jfu"
22+
stdin_open: true
23+
tty: true
24+
25+
volumes:
26+
node_modules:
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
import { slspArchivesHtgiModule } from './slsp-archives-htgi/slsp-archives-htgi.module'
2+
import { hsgOpenurlInterlibraryModule } from './hsg-openurl-interlibrary/hsg-openurl-interlibrary.module'
23

34
export const hsgHtgiSvcAfterModule = angular
45
.module('hsgHtgiSvcAfterModule', [])
56
.component('almaHtgiSvcAfter', {
67
bindings: { parentCtrl: '<' },
78
template: `
89
<slsp-archives-htgi-component after-ctrl="$ctrl"></slsp-archives-htgi-component>
10+
<hsg-openurl-interlibrary-component after-ctrl="$ctrl"></hsg-openurl-interlibrary-component>
911
`
1012
})
1113

1214
hsgHtgiSvcAfterModule.requires.push(slspArchivesHtgiModule.name)
15+
hsgHtgiSvcAfterModule.requires.push(hsgOpenurlInterlibraryModule.name)
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
export const hsgOpenurlInterlibraryConfig = function(){
2+
return {
3+
labels: {
4+
text:{
5+
de: 'Leider wurde die gewünschte Ressource in unserem Bestand nicht gefunden. Folgende Möglichkeiten stehen Ihnen ergänzend zur Verfügung:',
6+
en: 'Unfortunately, the requested resource was not found in our inventory. The following options are available to you:'
7+
},
8+
linktext_interlib:{
9+
de: 'Fernleihe in Auftrag geben',
10+
en: 'Interlibrary loan'
11+
},
12+
link_interlib: {
13+
de: 'https://www.unisg.ch/de/universitaet/bibliothek/suchen-und-nutzen/medienbeschaffung/fernleihe/',
14+
en: 'https://www.unisg.ch/en/university/library/search-and-use/document-retrieval/interlibrary-loan/'
15+
},
16+
linktext_article: {
17+
de: 'Zeitschriftenartikel bestellen',
18+
en: 'Order Journal Article'
19+
},
20+
link_article: {
21+
de: 'https://www.unisg.ch/de/universitaet/bibliothek/suchen-und-nutzen/medienbeschaffung/zeitschriftenartikel/',
22+
en: 'https://www.unisg.ch/en/university/library/search-and-use/document-retrieval/order-form-journal-articles/'
23+
}
24+
}
25+
}
26+
}
27+
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
export class hsgOpenurlInterlibraryController {
2+
3+
constructor($location, hsgTranslatorService, hsgOpenurlInterlibraryConfig) {
4+
this.$location = $location;
5+
this.translator = hsgTranslatorService;
6+
this.config = hsgOpenurlInterlibraryConfig;
7+
}
8+
9+
$onInit() {
10+
11+
this.openurl = false;
12+
13+
if (!this.$location.$$path) {
14+
console.error("***HSG*** hsgOpenurlInterlibraryController.$onInit: $$path not available");
15+
return;
16+
}
17+
18+
if (this.$location.$$path.indexOf('openurl') > -1) {
19+
let search = this.$location.$$search;
20+
console.log('search: ', search);
21+
this.openurl = true;
22+
23+
if (search['issn']) {
24+
this.issn = search['issn'];
25+
console.log('issn: ', this.issn);
26+
}
27+
else if (search['rft.issn']) {
28+
this.issn = search['rft.issn'];
29+
console.log('issn: ', this.issn);
30+
}
31+
if (search['isbn']) {
32+
this.isbn = search['isbn'];
33+
console.log('isbn: ', this.isbn);
34+
}
35+
else if (search['rft.isbn']) {
36+
this.isbn = search['rft.isbn'];
37+
console.log('isbn: ', this.isbn);
38+
}
39+
}
40+
}
41+
42+
isBookorUnknown() {
43+
return this.isbn || (!this.issn && !this.isbn);
44+
}
45+
46+
isArticleorUnkown() {
47+
return this.issn || (!this.issn && !this.isbn);
48+
}
49+
50+
translate(key) {
51+
if (!this.config) {
52+
console.log("config missing")
53+
return
54+
}
55+
return this.translator.getLabel(key, this.config)
56+
}
57+
58+
}
59+
60+
hsgOpenurlInterlibraryController.$inject = ['$location', 'hsgTranslatorService', 'hsgOpenurlInterlibraryConfig'];
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<div ng-if="$ctrl.openurl" class="layout-row hsg-openurl-container">
2+
<div class="hsg-openurl">
3+
<span>{{::$ctrl.translate('text')}}</span>
4+
<br>
5+
<a ng-if="$ctrl.isBookorUnknown()" href={{::$ctrl.translate('link_interlib')}} target="_blank" rel="noopener">
6+
<span>{{::$ctrl.translate('linktext_interlib')}}</span>
7+
<prm-icon external-link icon-type="svg" svg-icon-set="primo-ui" icon-definition="open-in-new"></prm-icon>
8+
<br>
9+
</a>
10+
11+
<a ng-if="$ctrl.isArticleorUnkown()" href={{::$ctrl.translate('link_article')}} target="_blank" rel="noopener">
12+
<span>{{::$ctrl.translate('linktext_article')}}</span>
13+
<prm-icon external-link icon-type="svg" svg-icon-set="primo-ui" icon-definition="open-in-new"></prm-icon>
14+
<br>
15+
</a>
16+
17+
</div>
18+
</div>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Wurde von der ETH übernommen und basiert auf dem Modul eth-openurl-interlibrary
2+
3+
import {hsgTranslatorService} from '../../../services/hsg-translator.service';
4+
import {hsgOpenurlInterlibraryConfig} from './hsg-openurl-interlibrary.config';
5+
import {hsgOpenurlInterlibraryController} from './hsg-openurl-interlibrary.controller';
6+
import {hsgOpenurlInterlibraryHtml} from './hsg-openurl-interlibrary.html';
7+
8+
export const hsgOpenurlInterlibraryModule = angular
9+
.module('hsgOpenurlInterlibraryModule', [])
10+
.factory('hsgTranslatorService', hsgTranslatorService)
11+
.factory('hsgOpenurlInterlibraryConfig', hsgOpenurlInterlibraryConfig)
12+
.controller('hsgOpenurlInterlibraryController', hsgOpenurlInterlibraryController)
13+
.component('hsgOpenurlInterlibraryComponent', {
14+
bindings: {afterCtrl: '<'},
15+
controller: 'hsgOpenurlInterlibraryController',
16+
template: hsgOpenurlInterlibraryHtml
17+
})

0 commit comments

Comments
 (0)