Commit 426e4ac6 authored by dindigala's avatar dindigala
Browse files

chore: merge branch 'develop' into issue/projectheader

parents b84e7dec 1d5efe2b
Pipeline #209285 passed with stages
in 6 minutes and 15 seconds
......@@ -30,7 +30,7 @@ done
rm "${FILES[@]}"
# print the result
ls $DIST_DIR
ls -l $DIST_DIR
# replace the included js files from the former build by the single one concatenated above
sed -ri 's:<script\s+src.*</script>:<script src="'${PROD_NAME}'.js"></script>:' ${DIST_DIR}/index.html
......
#!/bin/bash
# This script is resposible for determining which artifacts are too old to be
# kept any longer. The artifacts are needed and preserved for having the
# environments at hand any time.
#
# Some lines have been commented since they don't work properly at the moment.
# Currently artifacts are kept for two weeks since this is our average sprint
# duration.
#
# Some lines have been commented out since they don't work properly at the moment.
# We left them in there as a basis in case we want to improve the performance
# of the build process at a later stage.
#
......
#!/bin/bash
# This script remove any entry point given at src/index.template.html.
# If an entry point is removed, src/index.template.html is committed again
# to the repository which triggers a new pipeline. Here there variable
# $CONTINUE_BUILD comes into play.
# In order to avoid having to build the complete application although the
# current pipeline will trigger a new one, $CONTINUE_BUILD is set to "false"
# and prevents a complete build and deployment.
FILE="src/index.template.html"
if grep -q '"entrypoint": ""' "$FILE"; then
......@@ -8,9 +16,9 @@ if grep -q '"entrypoint": ""' "$FILE"; then
else
echo "Entry point has to be removed."
mkdir -p /tmp/this && cd /tmp/this || exit
git clone git@gitlab.gwdg.de:subugoe/emo/QViewer.git
cd QViewer || exit
git clone git@gitlab.gwdg.de:subugoe/emo/tido.git
cd tido || exit
sed -i 's/"entrypoint": ".*"/"entrypoint": ""/' src/index.template.html
git add src/index.template.html && git commit -m "ci: remove entry point" && git push
echo "CONTINUE_BUILD=false" >> build.env
fi
\ No newline at end of file
fi
#!/bin/bash
# This script creates a basic 404 page for GitLab pages.
# It comes into play when a build isn't continued due to the entry point being removed.
# Since the removal of an entry point triggers a new pipeline, the respective GitLab page
# will be created accordingly. The page created by this script serves as a placeholder until
# the correct page has been created.
echo "Create 404 page"
mkdir public
echo "<!DOCTYPE html><html><head><title>TIDO 404</title><meta charset='utf-8'></head><body>404: no build contents have been provided</body>" > public/404.html
#!/bin/bash
# this script sets the entrypoint for TIDO
# This script sets the entry point for TIDO's GitLab pages. They are not part of version
# controlling.
#
# reason: if an entrypoint is provided, it will be compiled and integrated into the build
# the build takes precedence and prevents the according config option to take effect
# on the the other hand, the entrypoint is needed for the demo page to show data
# https://subugoe.pages.gwdg.de/emo/Qviewer/develop/#/
# Reason: If an entrypoint is provided, it will be compiled and integrated into the build.
# Since we still want to have data at our hands when developing and for the official TIDO
# link, the entry point has to be set without being present in the repository.
echo CI_COMMIT_REF_NAME=${CI_COMMIT_REF_NAME}
......@@ -23,7 +23,7 @@ case $CI_COMMIT_REF_NAME in
echo "set entrypoint for testing"
# TIDO is developed in the context of the Ahiqar project, therefore we use the Ahiqar data for
# development purposes.
ENTRY_POINT=https://ahikar-test.sub.uni-goettingen.de/api/textapi/ahikar/arabic-karshuni/collection.json
ENTRY_POINT=https://ahikar-dev.sub.uni-goettingen.de/api/textapi/ahikar/arabic-karshuni/collection.json
sed -ri 's|.*("entrypoint"\s*:).*$|\t\t\t\1 "'${ENTRY_POINT}'",|' src/index.template.html
;;
esac
......
#!/bin/bash
# This script takes the old artifacts containing the data needed for the environments and
# adds the current branch's data to them.
dist_dir=$(grep distDir quasar.conf.js | cut -d "'" -f2)
project_id=10921
# get the latest 'deploy' artifact which contains the former states/environments
# get and extract the latest 'deploy' artifact which contains the former states/environments
jobs=$(curl --header "PRIVATE-TOKEN: $API_TOKEN" "https://gitlab.gwdg.de/api/v4/projects/${project_id}/jobs?scope=success" | jq 'sort_by(.finished_at) | reverse')
latest_deploy_job_id=$(echo $jobs | jq '.[] | select(.stage == "deploy").id' | sed -n 1p)
curl --output old-artifact.zip --header "PRIVATE-TOKEN: $API_TOKEN" "https://gitlab.gwdg.de/api/v4/projects/10921/jobs/${latest_deploy_job_id}/artifacts"
# add current data to artifact
unzip -u old-artifact.zip
# add current data to artifact. this only takes place if $CONTINUE_BUILD is set to 'true' or we are on a feature/bugfix/… branch.
# the differentiation between the branches is necessary because $CONTINUE_BUILD is only set on 'main' and 'develop'.
if [[ $CONTINUE_BUILD == "true" || ($CI_COMMIT_BRANCH != "main" && $CI_COMMIT_BRANCH != "develop") ]]; then
mkdir -p public/{${CI_COMMIT_SHORT_SHA},${CI_COMMIT_REF_SLUG}}
echo public/${CI_COMMIT_SHORT_SHA} public/${CI_COMMIT_REF_SLUG} | xargs -n 1 cp --remove-destination --recursive ${dist_dir}/*
......
# this file defines the CI/CD stages for the TIDO viewer.
# in some cases they invoke scripts provided at .ci-scripts/ in order to
# keep this file slim and clear. please have a look at these scripts for
# information that goes beyond the documentation of the single stages.
cache:
paths:
- node_modules/
......@@ -18,6 +23,13 @@ stages:
- git config --global user.email "tido@gitlab.gwdg.de"
- git config --global user.name "Gitlab CI"
# this stage checks if an entry point is set in src/index.template.html and removes it.
# the reasoning behind this is that the entry point should be empty on `develop` and `main`
# so that releases don't accidentally ship an entry point.
# during this stage, the variable $CONTINUE_BUILD is set and exported which determines if
# the following pipeline stages are fully executed. if an entry point has to be removed, it is
# set to 'false' since src/index.template.html is modified and recomitted which triggers a new
# pipeline.
clean_up:
image: docker.gitlab.gwdg.de/mrodzis/docker-images/debian
stage: clean
......@@ -31,8 +43,9 @@ clean_up:
reports:
dotenv: build.env
# builds TIDO on feature and bugfix branches.
build_test:
image: docker.gitlab.gwdg.de/subugoe/emo/qviewer/node:latest
image: docker.gitlab.gwdg.de/subugoe/emo/tido/node:latest
except:
- main
- develop
......@@ -43,8 +56,11 @@ build_test:
paths:
- dist/
# builds TIDO on `main` and `develop`.
# the software is only built if no entry point has been removed during
# the 'clean' stage.
build_main_and_develop:
image: docker.gitlab.gwdg.de/subugoe/emo/qviewer/node:latest
image: docker.gitlab.gwdg.de/subugoe/emo/tido/node:latest
only:
- main
- develop
......@@ -56,6 +72,11 @@ build_main_and_develop:
- dist/
expire_in: 1 mos
# this job triggers a new build of the Ahiqar specific TIDO viewer after a
# merge to `main` (which is only done during a release).
# this way the Ahiqar specific TIDO gets updated automatically if a new
# version of the generic TIDO is available.
# this connection will be removed at some point of the TIDO development.
update-ahikar:
stage: deploy
only:
......@@ -65,6 +86,10 @@ update-ahikar:
UPSTREAM_COMMIT_SHA: "${CI_COMMIT_SHA}"
trigger: "subugoe/ahiqar/ahiqar-tido"
# creates the GitLab pages for the environments.
# if an entry point has been removed during the 'clean' stage, we temporarily set a custom
# 404 page on `main` and `develop` which will replaced during the next pipeline. since
# removing the entry point triggers a new pipeline, the 404 state will only last for a few minutes.
pages:
image: docker.gitlab.gwdg.de/mrodzis/docker-images/debian
# at the very early stage lets deploy for every branch
......@@ -83,12 +108,14 @@ pages:
- bash .ci-scripts/gitlab-remove-old-artifacts.sh
environment:
name: ${CI_COMMIT_REF_SLUG}
url: https://subugoe.pages.gwdg.de/emo/Qviewer/${CI_COMMIT_REF_SLUG}/
url: https://subugoe.pages.gwdg.de/emo/tido/${CI_COMMIT_REF_SLUG}/
artifacts:
name: "$CI_COMMIT_SHORT_SHA"
paths:
- public
# this stage serves for preserving the pages that have been created in the last two weeks.
# without this job the pages would get lost or be overwritten by the 'pages' job.
pushback:
before_script:
- dnf install -y zip
......
{
"commitUrlFormat": "https://gitlab.gwdg.de/subugoe/emo/Qviewer/-/commit/{{hash}}",
"compareUrlFormat": "https://gitlab.gwdg.de/subugoe/emo/Qviewer/compare/{{previousTag}}...{{currentTag}}",
"issueUrlFormat": "https://gitlab.gwdg.de/subugoe/emo/Qviewer/-/issues/{{id}}",
"commitUrlFormat": "https://gitlab.gwdg.de/subugoe/emo/tido/-/commit/{{hash}}",
"compareUrlFormat": "https://gitlab.gwdg.de/subugoe/emo/tido/compare/{{previousTag}}...{{currentTag}}",
"issueUrlFormat": "https://gitlab.gwdg.de/subugoe/emo/tido/-/issues/{{id}}",
"types": [
{"type": "chore", "section":"Chore", "hidden": false},
{"type": "revert", "section":"Reverts", "hidden": false},
......@@ -16,4 +16,4 @@
{"type": "build", "section":"Build System", "hidden": false},
{"type": "ci", "section":"Continuos Integration", "hidden":false}
]
}
\ No newline at end of file
}
This diff is collapsed.
......@@ -5,9 +5,9 @@ Feel free to propose changes whenever the workflow could be improved!
## Issue Tracker
Issues are created and assigned by the project's Product Owner during a sprint planning in the [issue tracker](https://gitlab.gwdg.de/subugoe/emo/QViewer/-/issues).
Issues are created and assigned by the project's Product Owner during a sprint planning in the [issue tracker](https://gitlab.gwdg.de/subugoe/emo/tido/-/issues).
As soon as you start working on a assigned issue, switch its label to `Doing`.
This will cause the issue to be moved into the right list of the repository's [board](https://gitlab.gwdg.de/subugoe/emo/QViewer/-/boards).
This will cause the issue to be moved into the right list of the repository's [board](https://gitlab.gwdg.de/subugoe/emo/tido/-/boards).
## Internal Workflow
......@@ -15,7 +15,7 @@ This will cause the issue to be moved into the right list of the repository's [b
Bugs and change requests are managed by the project's Product Owner.
Please report any problems that aren't related to the bugfix/feature you're working on right now to her/him.
Bug reports can also be handed it via [mail](mailto:gitlab+subugoe-emo-qviewer-10921-issue-@gwdg.de).
Bug reports can also be handed it via [mail](mailto:gitlab+subugoe-emo-tido-10921-issue-@gwdg.de).
She/he will create an issue in the correct repository and ask for assignees in the course of the next sprint planning.
### Git Flow
......
FROM node:latest
FROM node:12-slim
RUN npm install --global @quasar/cli
\ No newline at end of file
......@@ -7,7 +7,7 @@ Although TIDO is designed as a generic viewer for digital editions, it is curren
This is the reason for "Ahiqar" being mentioned several times in the docs of this repo.
Demo: <https://subugoe.pages.gwdg.de/emo/Qviewer/develop>
Demo: <https://subugoe.pages.gwdg.de/emo/tido/develop>
(For newer branches the demo is deployed in a directory named with branch name lowercased, shortened to 63 bytes, and with everything except `0-9` and `a-z` replaced with `-` (CI_COMMIT_REF_SLUG).
Also the commit short hash can be used to see a demo.
......@@ -125,7 +125,7 @@ npm install -g @vue/cli @vue/cli-service-global @quasar/cli
#### Clone the repository
```bash
git clone git@gitlab.gwdg.de:subugoe/emo/Qviewer.git
git clone git@gitlab.gwdg.de:subugoe/emo/tido.git
```
#### Get the dependencies
......@@ -187,7 +187,7 @@ You can fully customize the Viewer's behaviour:
There are options to
- change the color scheme
- show or hide individual bars (info, navigation, toggles)
- show or hide individual bars (titles, navigation, toggles)
- group multiple components inside a single panel
- set the order of the panels
- rename labels and / or panel headings
......@@ -203,32 +203,41 @@ As a rule of thumb, each key with a boolean value (e.g. *true* or *false*) defau
"annotations": {
"types": [
{
"content-type": "Person",
"contenttype": "Person",
"icon": "fasUser",
"label": "Names"
},
{
"content-type": "Place",
"contenttype": "Place",
"icon": "fasMapMarkerAlt",
"label": "Places"
},
{
"content-type": "Editorial Comment",
"contenttype": "Editorial Comment",
"icon": "fasComment",
"label": "Comments"
},
{
"contenttype": "Motif",
"icon": "fasHighlighter",
"label": "Motifs"
}
]
],
"tabs": {
"Editorial": ["Person", "Place", "Editorial Comment"],
"Motif": ["Motif"]
}
},
"colors": {
"primary": "",
"secondary": "",
"accent": ""
},
"headers": {
"all": true,
"info": true,
"header_section": {
"show": true,
"navigation": true,
"panelheadings": true,
"titles": true,
"toggle": true
},
"labels": {
......@@ -316,6 +325,23 @@ As a rule of thumb, each key with a boolean value (e.g. *true* or *false*) defau
The label of the annotation type respectively
- **tabs**
the tabs-object represents different types of annotations to be displayed in tabs accordingly.
it consists of further extensible sub keys called group labels, either of it representing a single group of annotations, e.g. *editorial*, *motifs*.
these labels act as your tab heading and it's naming is up to your liking.
e.g.
```JSON
"tabs": {
"First group": ["Person", "Place", "Editorial Comment"],
"Second one": ["Motif"]
}
```
**Note**: The strings contained within the group label keys (e.g. *Person*, *Place*, ...) have to match it's API-counterpart explicitely. Please refer to the note above (content-type).
- **colors**
set the colors used in the frontend.
......@@ -326,7 +352,7 @@ As a rule of thumb, each key with a boolean value (e.g. *true* or *false*) defau
If any value is left blank (e.g. `"primary": "",`), a default color scheme will be used.
- **headers**
- **header_section**
- **show**
......@@ -336,10 +362,6 @@ As a rule of thumb, each key with a boolean value (e.g. *true* or *false*) defau
*(A use case might be to embed the Viewer into an existing website and you simply need more screen space)*
- **info**
set this value to `false` if you want to switch off the Infobar (a.k.a. breadcrumbs)
- **navigation**
set this value to `false` if you want to switch off the NavBar
......@@ -348,6 +370,10 @@ As a rule of thumb, each key with a boolean value (e.g. *true* or *false*) defau
set this value to `false` if you want to switch off the panels' headings respectively
- **titles**
set this value to `false` if you want to switch off the Titlebar (a.k.a. breadcrumbs)
- **toggle**
set this value to `false` if you want to switch off the ToggleBar.
......@@ -505,8 +531,8 @@ The dockerfile is used for GitLab CI.
It needs to be updated when either `node` or `quasar-cli` should be updated.
```bash
docker build --pull -t docker.gitlab.gwdg.de/subugoe/emo/qviewer/node .
docker push docker.gitlab.gwdg.de/subugoe/emo/qviewer/node
docker build --pull -t docker.gitlab.gwdg.de/subugoe/emo/tido/node .
docker push docker.gitlab.gwdg.de/subugoe/emo/tido/node
```
## Connecting the Viewer to a Backend
......@@ -530,8 +556,8 @@ Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduc
## Versioning
We use [SemVer](https://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://gitlab.gwdg.de/subugoe/emo/Qviewer/-/tags).
We use [SemVer](https://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://gitlab.gwdg.de/subugoe/emo/tido/-/tags).
## Authors
See the list of [contributors](https://gitlab.gwdg.de/subugoe/emo/Qviewer/-/graphs/develop) who participated in this project.
See the list of [contributors](https://gitlab.gwdg.de/subugoe/emo/tido/-/graphs/develop) who participated in this project.
This diff is collapsed.
{
"name": "@subugoe/tido",
"version": "1.11.0",
"version": "1.13.0",
"description": "Text vIever for Digital Objects",
"productName": "TIDO",
"keywords": [
......@@ -14,7 +14,7 @@
"cordovaId": "de.uni-goettingen.sub.emo",
"capacitorId": "",
"bugs": {
"email": "gitlab+subugoe-emo-qviewer-10921-issue-@gwdg.de"
"email": "gitlab+subugoe-emo-tido-10921-issue-@gwdg.de"
},
"license": "AGPL-3.0-or-later",
"author": "Göttingen State and University Library - SUB",
......@@ -27,7 +27,7 @@
],
"repository": {
"type": "git",
"url": "https://gitlab.gwdg.de/subugoe/emo/Qviewer.git"
"url": "https://gitlab.gwdg.de/subugoe/emo/tido.git"
},
"private": false,
"dependencies": {
......@@ -98,7 +98,7 @@
"release": "npm run build && npm run tweak:build && npm publish",
"test": "npm run test:unit",
"test:unit": "jest --updateSnapshot",
"tweak:build": "./tweak_build.sh",
"tweak:build": "bash .build-scripts/tweak_build.sh",
"write-changelog": "HUSKY_SKIP_HOOKS=1 standard-version"
},
"files": [
......
......@@ -5,9 +5,10 @@
view="hHh Lpr fFf"
>
<Header
v-if="config.headers.all"
v-if="config['header_section'].show"
:collectiontitle="collectiontitle"
:config="config"
:default-view="defaultView"
:imageurl="imageurl"
:item="item"
:itemurls="itemurls"
......@@ -41,6 +42,7 @@
<script>
import { colors } from 'quasar';
import treestore from '@/stores/treestore.js';
import Header from '@/components/header.vue';
import Panels from '@/mixins/panels';
......@@ -59,16 +61,27 @@ export default {
config: {},
contentTypes: [],
contentUrls: [],
fontsize: 14,
fontsize: 16,
imageurl: '',
isCollection: false,
item: {},
itemurl: '',
itemurls: [],
loaded: false,
manifests: [],
tree: [],
};
},
watch: {
'$route.query': {
handler: 'onItemUrlChange',
immediate: true,
},
manifests: {
handler: 'onItemUrlChange',
immediate: false,
},
},
created() {
this.getConfig();
this.init();
......@@ -102,16 +115,11 @@ export default {
*
* @param string url
*/
this.$root.$on('update-item', (url) => {
this.itemurl = url;
this.$router.push({ query: { itemurl: url } });
// NOTE: Set imageurl to an empty string. Otherwise, if there is no corresponding image,
// the "preceding" image according to the "preceding" item will be shown.
this.imageurl = '';
this.getItemData(url);
});
},
methods: {
defaultView() {
this.loaded = false;
},
/**
* get resources using JavaScript's native fetch api
* caller: *getCollection()*, *getItemData()*, *getManifest()*
......@@ -155,7 +163,6 @@ export default {
}
} catch (err) {
this.annotations = [];
this.$q.notify({ message: 'No annotations available' });
} finally {
this.annotationLoading = true;
}
......@@ -168,30 +175,36 @@ export default {
*
* @param string url
*/
getCollection(url) {
async getCollection(url) {
this.isCollection = true;
this.request(url)
.then((data) => {
this.collection = data;
this.collectiontitle = this.getLabel(data);
this.tree.push(
{
children: [],
handler: (node) => {
this.$root.$emit('update-tree-knots', node.label);
},
label: this.collectiontitle,
'label-key': this.collectiontitle,
selectable: false,
},
);
const data = await this.request(url);
if (Array.isArray(data.sequence)) {
data.sequence.forEach((seq) => this.getManifest(seq.id));
}
});
this.collection = data;
this.collectiontitle = this.getLabel(data);
this.tree.push(
{
children: [],
handler: (node) => {
this.$root.$emit('update-tree-knots', node.label);
},
label: this.collectiontitle,
'label-key': this.collectiontitle,
selectable: false,
},
);
if (Array.isArray(data.sequence)) {
const promises = [];
data.sequence.forEach((seq) => promises.push(this.getManifest(seq.id)));
await Promise.all(promises);
}
if (this.manifests?.[0]?.sequence?.[0]?.id && !this.$route.query.itemurl) {
this.loaded = false;
this.$router.push({ query: { itemurl: this.manifests?.[0]?.sequence?.[0]?.id } });
}
},
/**
* get config object (JSON) from index.html
......@@ -279,7 +292,7 @@ export default {
*
* @return array urls
*/
getItemUrls(sequence, label) {
getItemUrls(sequence) {
const urls = [];
sequence.forEach((item) => {
......@@ -294,11 +307,8 @@ export default {
if (this.itemurl === node.label) {
return;
}
// node.label === itemurl
// @param label === manifest label; passed by getManifest()
this.$root.$emit('update-item', node.label, this.getSequenceIndex(label));
this.$root.$emit('update-item-index', this.getItemIndex(node.label));
this.$root.$emit('update-sequence-index', this.getSequenceIndex(label));
this.loaded = false;
this.$router.push({ query: { itemurl: node.label } });
},
},
);
......@@ -325,40 +335,34 @@ export default {
*
* @param string url
*/
getManifest(url) {
this.request(url)
.then((data) => {
// if the entrypoint points to a single manifest, initialize the tree
if (this.isCollection === false) {
this.tree.push({ label: '', 'label-key': this.config.labels.manifest, children: [] });
}
async getManifest(url) {
const data = await this.request(url);
if (!Array.isArray(data.sequence)) {
data.sequence = [data.sequence];
}
// if the entrypoint points to a single manifest, initialize the tree
if (this.isCollection === false) {
this.tree.push({ label: '', 'label-key': this.config.labels.manifest, children: [] });
}
if (data.sequence[0] !== 'undefined') {
data.sequence.map((seq) => this.itemurls.push(seq.id));
}
this.manifests.push(data);
this.tree[0].children.push(
{
children: this.getItemUrls(data.sequence, data.label),
label: data.label,
'label-key': data.label,
handler: (node) => {
this.$root.$emit('update-tree-knots', node.label);
},
selectable: false,
},
);
// make sure that urls are set just once on init
if (!this.itemurl && data.sequence[0]) {
this.itemurl = data.sequence[0].id;
this.getItemData(data.sequence[0].id);
}
});
if (!Array.isArray(data.sequence)) {
data.sequence = [data.sequence];
}