From 365f17cc1704daf18e941bebf917c568d9a45d5b Mon Sep 17 00:00:00 2001
From: Martin Weise <martin.weise@tuwien.ac.at>
Date: Thu, 7 Mar 2024 07:42:48 +0000
Subject: [PATCH] Updated the docs and switcher

---
 .docs/.swagger/api-analyse.yaml    |  2 +-
 .docs/.swagger/api-data.yaml       |  6 +--
 .docs/.swagger/api-metadata.yaml   |  6 +--
 .docs/.swagger/api-search.yaml     |  2 +-
 .docs/.swagger/api-sidecar.yaml    |  2 +-
 .docs/.swagger/api-upload.yaml     |  2 +-
 .docs/overrides/main.html          | 19 +--------
 .docs/scripts/extra.js             | 13 ++++++
 .docs/stylesheets/extra.css        |  8 ++--
 .gitignore                         |  1 +
 dbrepo-search-service/coverage.txt | 66 ------------------------------
 mkdocs.yml                         |  2 +
 12 files changed, 32 insertions(+), 97 deletions(-)
 create mode 100644 .docs/scripts/extra.js
 delete mode 100644 dbrepo-search-service/coverage.txt

diff --git a/.docs/.swagger/api-analyse.yaml b/.docs/.swagger/api-analyse.yaml
index d40208256c..b59837ca7e 100644
--- a/.docs/.swagger/api-analyse.yaml
+++ b/.docs/.swagger/api-analyse.yaml
@@ -12,7 +12,7 @@ info:
     name: Apache 2.0
     url: https://www.apache.org/licenses/LICENSE-2.0
   title: Database Repository Analyse Service API
-  version: $TAG
+  version: __APPVERSION__
 openapi: 3.0.0
 paths:
   /api/analyse/determinedt:
diff --git a/.docs/.swagger/api-data.yaml b/.docs/.swagger/api-data.yaml
index 2dd3a10e30..3c8bc05392 100644
--- a/.docs/.swagger/api-data.yaml
+++ b/.docs/.swagger/api-data.yaml
@@ -8,15 +8,15 @@ info:
   license:
     name: Apache 2.0
     url: https://www.apache.org/licenses/LICENSE-2.0
-  version: $TAG
+  version: __APPVERSION__
 externalDocs:
   description: Sourcecode Documentation
   url: https://gitlab.phaidra.org/fair-data-austria-db-repository/fda-services
 servers:
 - url: http://localhost:9093
-  description: Generated server url
+  description: Development instance
 - url: https://test.dbrepo.tuwien.ac.at
-  description: Sandbox
+  description: Staging instance
 paths: {}
 components:
   securitySchemes:
diff --git a/.docs/.swagger/api-metadata.yaml b/.docs/.swagger/api-metadata.yaml
index ee2919a16e..fc826f5487 100644
--- a/.docs/.swagger/api-metadata.yaml
+++ b/.docs/.swagger/api-metadata.yaml
@@ -8,15 +8,15 @@ info:
   license:
     name: Apache 2.0
     url: https://www.apache.org/licenses/LICENSE-2.0
-  version: $TAG
+  version: __APPVERSION__
 externalDocs:
   description: Sourcecode Documentation
   url: https://gitlab.phaidra.org/fair-data-austria-db-repository/fda-services
 servers:
 - url: http://localhost:9099
-  description: Generated server url
+  description: Development instance
 - url: https://test.dbrepo.tuwien.ac.at
-  description: Sandbox
+  description: Staging instance
 paths:
   /api/database/{databaseId}/table/{tableId}/history:
     get:
diff --git a/.docs/.swagger/api-search.yaml b/.docs/.swagger/api-search.yaml
index 6c6822d5fd..0da98c6f1d 100644
--- a/.docs/.swagger/api-search.yaml
+++ b/.docs/.swagger/api-search.yaml
@@ -12,7 +12,7 @@ info:
     name: Apache 2.0
     url: https://www.apache.org/licenses/LICENSE-2.0
   title: Database Repository Search Service API
-  version: $TAG
+  version: __APPVERSION__
 openapi: 3.0.0
 paths:
   /api/search:
diff --git a/.docs/.swagger/api-sidecar.yaml b/.docs/.swagger/api-sidecar.yaml
index 16840f5350..d0b972b18d 100644
--- a/.docs/.swagger/api-sidecar.yaml
+++ b/.docs/.swagger/api-sidecar.yaml
@@ -21,7 +21,7 @@ info:
     name: Apache 2.0
     url: https://www.apache.org/licenses/LICENSE-2.0
   title: Database Repository Data Database sidecar API
-  version: $TAG
+  version: __APPVERSION__
 openapi: 3.0.0
 paths:
   /health:
diff --git a/.docs/.swagger/api-upload.yaml b/.docs/.swagger/api-upload.yaml
index 138a9bb51e..b08342a543 100644
--- a/.docs/.swagger/api-upload.yaml
+++ b/.docs/.swagger/api-upload.yaml
@@ -8,7 +8,7 @@ info:
   license:
     name: Apache 2.0
     url: https://www.apache.org/licenses/LICENSE-2.0
-  version: $TAG
+  version: __APPVERSION__
 externalDocs:
   description: Sourcecode Documentation
   url: https://gitlab.phaidra.org/fair-data-austria-db-repository/fda-services
diff --git a/.docs/overrides/main.html b/.docs/overrides/main.html
index 5da83ed925..9f9a6daf6f 100644
--- a/.docs/overrides/main.html
+++ b/.docs/overrides/main.html
@@ -3,24 +3,9 @@
 {% block announce %}
 <label for="version">Version</label>
 <select style="margin-left:8px;" id="version" name="version" onchange="switchVersion(this.options[this.selectedIndex].value)">
+    <option value="latest">latest</option>
+    <option value="1.4.1">1.4.1</option>
     <option value="1.4.0">1.4.0</option>
     <option value="1.3.0">1.3.0</option>
-    <option value="latest">latest</option>
 </select>
-<script>
-    function getVersion() {
-        const segments = location.pathname.split('/')
-        console.debug('segments', segments)
-        if (segments.length >= 4) {
-            return segments[3]
-        } else {
-            return '$VERSION'
-        }
-    }
-    function switchVersion(value) {
-        if (!value) { return }
-        this.location.href = location.protocol + '//' + location.host + '/infrastructures/dbrepo/' + value + '/'
-    }
-    document.getElementById("version").value = getVersion()
-</script>
 {% endblock %}
diff --git a/.docs/scripts/extra.js b/.docs/scripts/extra.js
new file mode 100644
index 0000000000..4768615e22
--- /dev/null
+++ b/.docs/scripts/extra.js
@@ -0,0 +1,13 @@
+function getVersion() {
+    const segments = location.pathname.split('/');
+    if (segments.length >= 4) {
+        return segments[3];
+    } else {
+        return '__APPVERSION__';
+    }
+}
+function switchVersion(value) {
+    if (!value) { return }
+    this.location.href = location.protocol + '//' + location.host + '/infrastructures/dbrepo/' + value + '/';
+}
+document.getElementById("version").value = getVersion();
\ No newline at end of file
diff --git a/.docs/stylesheets/extra.css b/.docs/stylesheets/extra.css
index 3275909e35..6d045c82da 100644
--- a/.docs/stylesheets/extra.css
+++ b/.docs/stylesheets/extra.css
@@ -9,14 +9,14 @@ figure img.img-border {
     border: 1px solid #b3b3b3;
 }
 
-.md-main .md-content a:not(.action-button),
-.md-main .md-content a:not(.action-button) {
+.md-main .md-content a:not(.action-button):not([tabindex]),
+.md-main .md-content a:not(.action-button):not([tabindex]) {
     color: var(--md-typeset-color);
     border-bottom: 2px solid var(--md-primary-fg-color);
 }
 
-.md-main .md-content a:not(.action-button):focus,
-.md-main .md-content a:not(.action-button):hover {
+.md-main .md-content a:not(.action-button):not([tabindex]):focus,
+.md-main .md-content a:not(.action-button):not([tabindex]):hover {
     color: var(--md-typeset-color);
     border-bottom: 2px solid var(--md-primary-fg-color--dark);
 }
diff --git a/.gitignore b/.gitignore
index 4785a0ee84..0f101110ab 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,6 +7,7 @@ target/
 # generated
 ready
 schema.xsd
+swagger/
 
 # docs
 .docs/.swagger/dist/
diff --git a/dbrepo-search-service/coverage.txt b/dbrepo-search-service/coverage.txt
deleted file mode 100644
index 9cb4528d61..0000000000
--- a/dbrepo-search-service/coverage.txt
+++ /dev/null
@@ -1,66 +0,0 @@
-Name                                                                     Stmts   Miss  Cover
---------------------------------------------------------------------------------------------
-/usr/lib/python3/dist-packages/six.py                                      504    247    51%
-/usr/local/lib/python3.9/dist-packages/anyio/__init__.py                    67      0   100%
-/usr/local/lib/python3.9/dist-packages/anyio/_core/__init__.py               0      0   100%
-/usr/local/lib/python3.9/dist-packages/anyio/_core/_eventloop.py            62     38    39%
-/usr/local/lib/python3.9/dist-packages/anyio/_core/_exceptions.py           16      3    81%
-/usr/local/lib/python3.9/dist-packages/anyio/_core/_fileio.py              306    161    47%
-/usr/local/lib/python3.9/dist-packages/anyio/_core/_resources.py             7      3    57%
-/usr/local/lib/python3.9/dist-packages/anyio/_core/_signals.py               7      1    86%
-/usr/local/lib/python3.9/dist-packages/anyio/_core/_sockets.py             207    160    23%
-/usr/local/lib/python3.9/dist-packages/anyio/_core/_streams.py              16      8    50%
-/usr/local/lib/python3.9/dist-packages/anyio/_core/_subprocesses.py         38     27    29%
-/usr/local/lib/python3.9/dist-packages/anyio/_core/_synchronization.py     241    145    40%
-/usr/local/lib/python3.9/dist-packages/anyio/_core/_tasks.py                53     21    60%
-/usr/local/lib/python3.9/dist-packages/anyio/_core/_testing.py              29     15    48%
-/usr/local/lib/python3.9/dist-packages/anyio/_core/_typedattr.py            34     10    71%
-/usr/local/lib/python3.9/dist-packages/anyio/abc/__init__.py                44      0   100%
-/usr/local/lib/python3.9/dist-packages/anyio/abc/_eventloop.py             169     43    75%
-/usr/local/lib/python3.9/dist-packages/anyio/abc/_resources.py              12      2    83%
-/usr/local/lib/python3.9/dist-packages/anyio/abc/_sockets.py                76     25    67%
-/usr/local/lib/python3.9/dist-packages/anyio/abc/_streams.py                55     10    82%
-/usr/local/lib/python3.9/dist-packages/anyio/abc/_subprocesses.py           29      0   100%
-/usr/local/lib/python3.9/dist-packages/anyio/abc/_tasks.py                  27      3    89%
-/usr/local/lib/python3.9/dist-packages/anyio/abc/_testing.py                18      2    89%
-/usr/local/lib/python3.9/dist-packages/anyio/from_thread.py                180    127    29%
-/usr/local/lib/python3.9/dist-packages/anyio/lowlevel.py                    79     41    48%
-/usr/local/lib/python3.9/dist-packages/anyio/pytest_plugin.py               95     65    32%
-/usr/local/lib/python3.9/dist-packages/anyio/streams/__init__.py             0      0   100%
-/usr/local/lib/python3.9/dist-packages/anyio/streams/memory.py             133     80    40%
-/usr/local/lib/python3.9/dist-packages/anyio/streams/stapled.py             64     29    55%
-/usr/local/lib/python3.9/dist-packages/anyio/streams/tls.py                139     85    39%
-/usr/local/lib/python3.9/dist-packages/anyio/to_thread.py                   10      2    80%
-/usr/local/lib/python3.9/dist-packages/gunicorn/__init__.py                  4      0   100%
-/usr/local/lib/python3.9/dist-packages/gunicorn/config.py                 1094    275    75%
-/usr/local/lib/python3.9/dist-packages/gunicorn/errors.py                    8      3    62%
-/usr/local/lib/python3.9/dist-packages/gunicorn/http/__init__.py             3      0   100%
-/usr/local/lib/python3.9/dist-packages/gunicorn/http/body.py               209    184    12%
-/usr/local/lib/python3.9/dist-packages/gunicorn/http/errors.py              70     30    57%
-/usr/local/lib/python3.9/dist-packages/gunicorn/http/message.py            239    209    13%
-/usr/local/lib/python3.9/dist-packages/gunicorn/http/parser.py              29     19    34%
-/usr/local/lib/python3.9/dist-packages/gunicorn/http/unreader.py            56     43    23%
-/usr/local/lib/python3.9/dist-packages/gunicorn/http/wsgi.py               247    211    15%
-/usr/local/lib/python3.9/dist-packages/gunicorn/reloader.py                 78     55    29%
-/usr/local/lib/python3.9/dist-packages/gunicorn/util.py                    367    294    20%
-/usr/local/lib/python3.9/dist-packages/gunicorn/workers/__init__.py          1      0   100%
-/usr/local/lib/python3.9/dist-packages/gunicorn/workers/base.py            170    140    18%
-/usr/local/lib/python3.9/dist-packages/gunicorn/workers/workertmp.py        33     21    36%
-/usr/local/lib/python3.9/dist-packages/simplejson/__init__.py               80     57    29%
-/usr/local/lib/python3.9/dist-packages/simplejson/compat.py                 29     16    45%
-/usr/local/lib/python3.9/dist-packages/simplejson/decoder.py               227    180    21%
-/usr/local/lib/python3.9/dist-packages/simplejson/encoder.py               412    358    13%
-/usr/local/lib/python3.9/dist-packages/simplejson/errors.py                 29     23    21%
-/usr/local/lib/python3.9/dist-packages/simplejson/raw_json.py                3      1    67%
-/usr/local/lib/python3.9/dist-packages/simplejson/scanner.py                64     53    17%
-/usr/local/lib/python3.9/dist-packages/sniffio/__init__.py                   3      0   100%
-/usr/local/lib/python3.9/dist-packages/sniffio/_impl.py                     33     22    33%
-/usr/local/lib/python3.9/dist-packages/sniffio/_version.py                   1      0   100%
-/usr/local/lib/python3.9/dist-packages/socks.py                            445    355    20%
-/usr/local/lib/python3.9/dist-packages/wrapt/__init__.py                     7      0   100%
-/usr/local/lib/python3.9/dist-packages/wrapt/arguments.py                   16     13    19%
-/usr/local/lib/python3.9/dist-packages/wrapt/decorators.py                 192    105    45%
-/usr/local/lib/python3.9/dist-packages/wrapt/importer.py                   126     99    21%
-/usr/local/lib/python3.9/dist-packages/wrapt/wrappers.py                   508    341    33%
---------------------------------------------------------------------------------------------
-TOTAL                                                                     7500   4460    41%
diff --git a/mkdocs.yml b/mkdocs.yml
index 3eef0cf8c1..d6f8249501 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -41,6 +41,8 @@ nav:
   - contact.md
 extra_css:
   - stylesheets/extra.css
+extra_javascript:
+  - scripts/extra.js
 theme:
   favicon: images/signet_white.png
   custom_dir: .docs/overrides
-- 
GitLab