diff --git a/dbrepo-analyse-service/Pipfile.lock b/dbrepo-analyse-service/Pipfile.lock index a585c490977c27fbf12d31f6e8b663770523e50c..d600643542c4764ae750491e59e0fd8382a1ace7 100644 --- a/dbrepo-analyse-service/Pipfile.lock +++ b/dbrepo-analyse-service/Pipfile.lock @@ -180,20 +180,20 @@ }, "boto3": { "hashes": [ - "sha256:006800604c34382873521b20890b758eea7109d699696ece932131259d0a4658", - "sha256:d59642672b1f35f55f47b317693241ce53333816f47c9e72fcc8fd0e9adc6a87" + "sha256:777ec08a6fe0ad77fa0607b431542c51d2d2e4145fecd512bee9f383ee4184f2", + "sha256:c9055fe6a33f79c43053c06db432092cfcf88f4b4181950f5ca8f2f0cb6abb87" ], "index": "pypi", "markers": "python_version >= '3.8'", - "version": "==1.36.23" + "version": "==1.36.24" }, "botocore": { "hashes": [ - "sha256:886730e79495a2e153842725ebdf85185c8277cdf255b3b5879cd097ddc7fcc3", - "sha256:9feaa2d876f487e718a5fd80a35fa401042b518c0c75117d3e1ea39a567439e7" + "sha256:7d35ba92ccbed7aa7e1563b12bb339bde612d5f845c89bfdd79a6db8c26b9f2e", + "sha256:b8b2ad60e6545aaef3a40163793c39555fcfd67fb081a38695018026c4f4db25" ], "markers": "python_version >= '3.8'", - "version": "==1.36.23" + "version": "==1.36.24" }, "certifi": { "hashes": [ @@ -421,7 +421,7 @@ }, "dbrepo": { "hashes": [ - "sha256:b555d9cbbbc07f1bd8f449b7bb38b2f7221f86b897bff08dd7c34933befae865" + "sha256:779e7ee84ae91131e16100fee7143013b4c231dcd3990d418d024ff76af271e9" ], "path": "./lib/dbrepo-1.7.0.tar.gz" }, @@ -1621,7 +1621,7 @@ "sha256:1cee9ad369867bfdbbb48b7dd50374c0967a0bb7710050facf0dd6911440e3df", "sha256:f8c5449b3cf0861679ce7e0503c7b44b5ec981bec0d1d3795a07f1ba96f0204d" ], - "markers": "python_version >= '3.10'", + "markers": "python_version >= '3.9'", "version": "==2.3.0" }, "werkzeug": { @@ -2246,7 +2246,7 @@ "sha256:1cee9ad369867bfdbbb48b7dd50374c0967a0bb7710050facf0dd6911440e3df", "sha256:f8c5449b3cf0861679ce7e0503c7b44b5ec981bec0d1d3795a07f1ba96f0204d" ], - "markers": "python_version >= '3.10'", + "markers": "python_version >= '3.9'", "version": "==2.3.0" }, "wrapt": { diff --git a/dbrepo-analyse-service/lib/dbrepo-1.7.0-py3-none-any.whl b/dbrepo-analyse-service/lib/dbrepo-1.7.0-py3-none-any.whl index 42c0e32ce8e4f895afa9e105ecdcb3d508ba2257..f75ec9ba7a7a4ad6c2897e38abdae20c815f56c7 100644 Binary files a/dbrepo-analyse-service/lib/dbrepo-1.7.0-py3-none-any.whl and b/dbrepo-analyse-service/lib/dbrepo-1.7.0-py3-none-any.whl differ diff --git a/dbrepo-analyse-service/lib/dbrepo-1.7.0.tar.gz b/dbrepo-analyse-service/lib/dbrepo-1.7.0.tar.gz index 8ecf0661cfdd270b33d7fe4e8bdce444569e995c..be1dcfe68165001dbeacd670709955723a01e323 100644 Binary files a/dbrepo-analyse-service/lib/dbrepo-1.7.0.tar.gz and b/dbrepo-analyse-service/lib/dbrepo-1.7.0.tar.gz differ diff --git a/dbrepo-auth-service/listeners/target/create-event-listener.jar b/dbrepo-auth-service/listeners/target/create-event-listener.jar index a9437e2cc19fae55c40e5ab0ddf772e20f11ab81..3230bc2de1aa82754770364457fda657e7db3279 100644 Binary files a/dbrepo-auth-service/listeners/target/create-event-listener.jar and b/dbrepo-auth-service/listeners/target/create-event-listener.jar differ diff --git a/dbrepo-dashboard-service/.coverage b/dbrepo-dashboard-service/.coverage deleted file mode 100644 index 506ffe7fba86b0e70757d0f15ea4bb6516472b50..0000000000000000000000000000000000000000 Binary files a/dbrepo-dashboard-service/.coverage and /dev/null differ diff --git a/dbrepo-dashboard-service/Dockerfile b/dbrepo-dashboard-service/Dockerfile index 00fc60339b15b2e1ebeda9dbbf7849c96bd7a401..e4d9d8f5056d01714c0fc15c3840f8bf05cac921 100644 --- a/dbrepo-dashboard-service/Dockerfile +++ b/dbrepo-dashboard-service/Dockerfile @@ -1,9 +1,9 @@ -FROM docker.io/bitnami/grafana:10.4.9-debian-12-r0 AS runtime +FROM docker.io/bitnami/grafana:11.5.1 AS runtime LABEL org.opencontainers.image.authors="martin.weise@tuwien.ac.at" WORKDIR /app -COPY --chown=grafana:grafana ./dashboards /app/dashboards -COPY --chown=grafana:grafana ./provisioning /etc/grafana/provisioning -COPY --chown=grafana:grafana ./grafana.ini /etc/grafana/grafana.ini -COPY --chown=grafana:grafana ./ldap.toml /etc/grafana/ldap.toml +COPY --chown=grafana:grafana ./dashboards /app/dashboards +COPY --chown=grafana:grafana ./provisioning /etc/grafana/provisioning +COPY --chown=grafana:grafana ./grafana.ini /etc/grafana/grafana.ini +COPY --chown=grafana:grafana ./ldap.toml /etc/grafana/ldap.toml diff --git a/dbrepo-dashboard-service/access.py b/dbrepo-dashboard-service/access.py deleted file mode 100644 index 2f576db368e0f898c64b5a2cd3dd35f22f2384f2..0000000000000000000000000000000000000000 --- a/dbrepo-dashboard-service/access.py +++ /dev/null @@ -1,41 +0,0 @@ -import logging - -from grafana_client.client import GrafanaException -from werkzeug.exceptions import NotFound - -from api.dto import Permission -from clients import grafana_client - -statistics_row_title = '${table_id}' - - -def remove_anonymous_read_access(uid: str) -> None: - grafana = grafana_client.connect() - permissions = grafana.dashboard.get_permissions_by_uid(uid) - viewer_role = [permission for permission in permissions if - 'permissionName' in permission and permission['permissionName'] != 'View'] - if len(viewer_role) == 0: - logging.warning(f'Failed to find permissionName=View') - return None - try: - response = grafana_client.generic_post(f'/api/access-control/dashboards/{uid}/builtInRoles/Viewer', - Permission(permission='').model_dump()) - if response.status_code != 200: - raise OSError(f'Failed to remove anonymous read access: {response.content}') - except GrafanaException as e: - raise OSError(f'Failed to remove anonymous read access: {e.message}') - logging.info(f"Removed anonymous read access from dashboard with uid: {uid}") - - -def update_access(uid: str, username: str, permission: Permission) -> None: - try: - response = grafana_client.generic_get(f'/api/users/lookup?loginOrEmail={username}') - if response.status_code == 404: - raise NotFound(f"Failed to find user: {username}") - if response.status_code != 200: - raise OSError(f"Failed to add access to user: {username}") - grafana_client.generic_post(f"/api/access-control/dashboards/{uid}/users/{response.json()['id']}", - permission.model_dump()) - except GrafanaException as e: - logging.error(f'Failed to add access: {e.message}') - logging.info(f"Add access for dashboard with uid: {uid}") diff --git a/dbrepo-dashboard-service/api/dto.py b/dbrepo-dashboard-service/api/dto.py deleted file mode 100644 index e2dab237d52e9aa7a29b93081f20d76c97fabd19..0000000000000000000000000000000000000000 --- a/dbrepo-dashboard-service/api/dto.py +++ /dev/null @@ -1,50 +0,0 @@ -from __future__ import annotations - -from typing import Optional - -from pydantic import BaseModel - - -class Datasource(BaseModel): - uid: str - type: str - id: Optional[int] = None - orgId: Optional[int] = None - name: Optional[str] = None - typeLogoUrl: Optional[str] = None - access: Optional[str] = None - url: Optional[str] = None - user: Optional[str] = None - basicAuth: Optional[bool] = None - withCredentials: Optional[bool] = None - isDefault: Optional[bool] = None - version: Optional[int] = None - readOnly: Optional[bool] = None - jsonData: Optional[dict] = None - secureJsonFields: Optional[dict] = None - basicAuthUser: Optional[str] = None - basicAuthPassword: Optional[str] = None - password: Optional[str] = None - - -class CreateDatasource(BaseModel): - name: str - type: str - access: str - url: str - basicAuth: bool - version: int - readOnly: bool - jsonData: Optional[dict] = None - secureJsonData: Optional[dict] = None - basicAuthUser: Optional[str] = None - - -class Permission(BaseModel): - permission: str - - -class CreateDatasourceRequest(BaseModel): - database_internal_name: str - readonly: bool - type: str diff --git a/dbrepo-dashboard-service/clients/grafana_client.py b/dbrepo-dashboard-service/clients/grafana_client.py deleted file mode 100644 index 8f7d5aab0f3b28b702cf83cfd51e98bf1bc3c98e..0000000000000000000000000000000000000000 --- a/dbrepo-dashboard-service/clients/grafana_client.py +++ /dev/null @@ -1,27 +0,0 @@ -import logging -import os - -import requests -from requests import Response - -from grafana_client import GrafanaApi - -url = os.getenv('DASHBOARD_UI_ENDPOINT', 'http://localhost:3000') -username = os.getenv('SYSTEM_USERNAME', 'admin') -password = os.getenv('SYSTEM_PASSWORD', 'admin') - - -def connect() -> GrafanaApi: - return GrafanaApi.from_url(url=f'{url}', credential=(username, password)) - - -def generic_get(api_url: str) -> Response: - request_url = url + api_url - logging.debug(f'generic get url={request_url}, auth=({username}, <reacted>)') - return requests.get(request_url, auth=(username, password)) - - -def generic_post(api_url: str, payload: dict) -> Response: - request_url = url + api_url - logging.debug(f'generic post url={request_url}, payload={payload}, auth=({username}, <reacted>)') - return requests.post(request_url, json=payload, auth=(username, password)) diff --git a/dbrepo-dashboard-service/clients/keycloak_client.py b/dbrepo-dashboard-service/clients/keycloak_client.py deleted file mode 100644 index a04998e90986c7ede455454935e4b9c1cfe16b5a..0000000000000000000000000000000000000000 --- a/dbrepo-dashboard-service/clients/keycloak_client.py +++ /dev/null @@ -1,36 +0,0 @@ -import logging -import requests -from dataclasses import dataclass -from typing import List - -from flask import current_app -from jwt import jwk_from_pem, JWT - - -@dataclass(init=True, eq=True) -class User: - username: str - roles: List[str] - - -class KeycloakClient: - - def obtain_user_token(self, username: str, password: str) -> str: - response = requests.post( - f"{current_app.config['AUTH_SERVICE_ENDPOINT']}/realms/dbrepo/protocol/openid-connect/token", - data={ - "username": username, - "password": password, - "grant_type": "password", - "client_id": current_app.config["AUTH_SERVICE_CLIENT"], - "client_secret": current_app.config["AUTH_SERVICE_CLIENT_SECRET"] - }) - body = response.json() - if "access_token" not in body: - raise AssertionError(f"Failed to obtain user token(s): {response.status_code}") - return response.json()["access_token"] - - def verify_jwt(self, access_token: str) -> User: - public_key = jwk_from_pem(str(current_app.config["JWT_PUBKEY"]).encode('utf-8')) - payload = JWT().decode(message=access_token, key=public_key, do_time_check=True) - return User(username=payload.get('client_id'), roles=payload.get('realm_access')["roles"]) diff --git a/dbrepo-dashboard-service/coverage.txt b/dbrepo-dashboard-service/coverage.txt deleted file mode 100644 index 5436bf1f29acf58ee8eec467fbf34cc949d912d3..0000000000000000000000000000000000000000 --- a/dbrepo-dashboard-service/coverage.txt +++ /dev/null @@ -1,7 +0,0 @@ -Name Stmts Miss Cover --------------------------------------------------- -app.py 210 29 86% -clients/keycloak_client.py 36 9 75% -clients/opensearch_client.py 179 51 72% --------------------------------------------------- -TOTAL 425 89 79% diff --git a/dbrepo-dashboard-service/dashboard.py b/dbrepo-dashboard-service/dashboard.py deleted file mode 100644 index c77c1834ccf5a50340b09ff30ad82821dbad3c0a..0000000000000000000000000000000000000000 --- a/dbrepo-dashboard-service/dashboard.py +++ /dev/null @@ -1,273 +0,0 @@ -import logging -import os - -from dbrepo.api.dto import Database, Table -from grafana_client.client import GrafanaException - -from clients import grafana_client - -statistics_row_title = '${table_id}' - -base_url = os.getenv('BASE_URL', 'http://localhost') -datasource_uid = os.getenv('JSON_DATASOURCE_NAME', 'dbrepojson0') - - -def map_link(title: str, url: str) -> dict: - return dict(targetBlank=True, - asDropdown=False, - includeVars=False, - keepTime=False, - tags=[], - type='link', - icon='info', - title=title, - url=url) - - -def map_statistics_row(dashboard: dict) -> dict | None: - filtered_panels = [panel for panel in dashboard['panels'] if - panel['type'] == 'row' and panel['title'] == statistics_row_title and 'id' in panel] - if len(filtered_panels) > 0 and filtered_panels[0]['id'] is not None: - return filtered_panels[0] - logging.warning(f'Failed to find statistics row id') - return None - - -def map_links(database: Database) -> [dict]: - links = [] - if len(database.identifiers) > 0: - links.append(map_link('Database', f"{base_url}/pid/{database.identifiers[0].id}")) - else: - links.append(map_link('Database', f"{base_url}/database/{database.id}")) - return links - - -def map_templating(database: Database) -> dict: - options = [dict(selected=False, - text=table.name, - value=str(table.id)) for table in database.tables] - selected = dict(selected=True, - text=[table.name for table in database.tables], - value=[str(table.id) for table in database.tables]) - datasource = dict(uid=datasource_uid, - type='yesoreyeram-infinity-datasource') - return dict(list=[dict(description='', - name='table_id', - hide=0, - includeAll=True, - multi=True, - datasource=datasource, - refresh=1, - regex='', - sort=0, - definition='dbrepo-json- (infinity) json', - query=dict(queryType='infinity', - query='', - infinityQuery=dict(format='table', - filters=[], - parser='backend', - refId='variable', - root_selector='', - source='url', - type='json', - url=f"/api/database/{database.id}/table", - columns=[dict(selector='id', - text='value', - type='number'), - dict( - selector='internal_name', - text='name', - type='string')], - url_options=dict(data='', - method='GET'))), - label='Table ID', - skipUrlSync=False, - type='query', - current=selected, - options=options)]) - - -def map_timeseries_panel(database: Database, table: Table) -> dict: - datasource = dict(uid=datasource_uid, - type='yesoreyeram-infinity-datasource') - return dict( - title=table['name'], - type='timeseries', - datasource=datasource, - targets=[dict(datasource=datasource, - format='table', - global_query_id='', - hide=False, - refId='A', - root_selector='', - source='url', - type='json', - url=f"/api/database/{database['id']}/table/{table['id']}", - url_options=dict(data='', - method='GET'))], - gridPos=dict(h=8, - w=12, - x=0, - y=0), - options=dict(legend=dict(displayMode='list', - placement='bottom', - showLegend=True), - tooltip=dict(mode='single', - sort='none')), - fieldConfig=dict( - defaults=dict(color=dict(mode='palette-classic'), - custom=dict( - axisBorderShow=False, - axisCenteredZero=False, - axisColorMode='text', - axisLabel='', - axisPlacement='auto', - barAlignment=0, - drawStyle='line', - fillOpacity=0, - gradientMode='none', - hideFrom=dict(legend=False, - tooltip=False, - viz=False), - insertNulls=False, - lineInterpolation='linear', - lineWidth=1, - pointSize=5, - scaleDistribution=dict(type='linear'), - showPoints='auto', - spanNulls=False, - stacking=dict(group='A', - mode='none'), - thresholdsStyle=dict(mode='absolute'))))) - - -def map_panels(dashboard: dict, database_id: int | None = None) -> [dict]: - datasource = dict(uid=datasource_uid, - type='yesoreyeram-infinity-datasource') - if map_statistics_row(dashboard) is None: - dashboard['panels'].append(dict(collapsed=False, - repeat='table_id', - repeatDirection='h', - title=statistics_row_title, - type='row', - panels=[], - targets=[dict(refId='A', - datasource=datasource)], - gridPos=dict(h=1, - w=24, - x=0, - y=0))) - dashboard['panels'].append(dict(title='Sample', - type='table', - fieldConfig=dict( - defaults=dict( - color=dict(mode='palette-classic'), - custom=dict(axisBorderShow=False, - axisCenteredZero=False, - axisColorMode='text', - axisLabel='', - axisPlacement='auto', - barAlignment=0, - drawStyle='line', - fillOpacity=0, - gradientMode='none', - hideFrom=dict( - legend=False, - tooltip=False, - viz=False), - insertNulls=False, - lineInterpolation='linear', - lineWidth=1, - pointSize=5, - scaleDistribution=dict( - type='linear'), - showPoints='auto', - spanNulls=False, - stacking=dict(group='A', - mode='none'), - thresholdsStyle=dict( - mode='off'))), - overrides=[]), - options=dict(legend=dict(displayMode='list', - placement='bottom', - showLegend=True, - calcs=[]), - tooltip=dict(mode='single', - sort='none')), - targets=[dict(format='json', - columns=[], - datasource=datasource, - filters=[], - global_query_id='', - refId='A', - root_selector='', - source='url', - type='json', - url='/api/database/' + str( - database_id) + '/table/${table_id}/data', - url_options=dict(data='', - method='GET'))], - datasource=datasource, - gridPos=dict(h=4, - w=12, - x=0, - y=0))) - return dashboard['panels'] - - -def find(uid: str): - grafana = grafana_client.connect() - try: - return grafana.dashboard.get_dashboard(uid) - except GrafanaException: - return None - - -def create(database_name: str, uid: str = '') -> dict: - grafana = grafana_client.connect() - dashboard = dict(uid=uid, - title=f'{database_name} Overview', - tags=['generated', 'dbrepo'], - timezone='browser', - fiscalYearStartMonth=1, - panels=[]) - dashboard['panels'] = map_panels(dashboard) - payload = dict(folderUid='', - overwrite=False, - dashboard=dashboard) - dashboard = grafana.dashboard.update_dashboard(payload) - logging.info(f"Created dashboard with uid: {dashboard['uid']}") - return dashboard - - -def find(uid: str) -> dict | None: - grafana = grafana_client.connect() - try: - return grafana.dashboard.get_dashboard(uid)['dashboard'] - except GrafanaException: - return None - - -def delete(uid: str) -> None: - grafana = grafana_client.connect() - grafana.dashboard.delete_dashboard(uid) - - -def update(database: Database) -> dict: - grafana = grafana_client.connect() - dashboard = find(database.dashboard_uid) - # update metadata - if len(database.identifiers) > 0 and len(database.identifiers[0].titles) > 0: - dashboard['title'] = database.identifiers[0].titles[0].title - if len(database.identifiers) > 0 and len(database.identifiers[0].descriptions) > 0: - dashboard['description'] = database.identifiers[0].descriptions[0].description - dashboard['links'] = map_links(database) - dashboard['templating'] = map_templating(database) - # update panels - dashboard['panels'] = map_panels(dashboard, database.id) - payload = dict(folderUid='', - overwrite=True, - dashboard=dashboard) - dashboard = grafana.dashboard.update_dashboard(payload) - logging.info(f"Updated dashboard with uid: {dashboard['uid']}") - return dashboard diff --git a/dbrepo-dashboard-service/report.xml b/dbrepo-dashboard-service/report.xml deleted file mode 100644 index 202b3db684cda7c928023ebabbfa21b929ab63df..0000000000000000000000000000000000000000 --- a/dbrepo-dashboard-service/report.xml +++ /dev/null @@ -1 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><testsuites><testsuite name="pytest" errors="0" failures="0" skipped="0" tests="48" time="25.604" timestamp="2025-01-29T15:46:14.797988+01:00" hostname="medusa"><testcase classname="test.test_app.JwtTest" name="test_delete_database_no_auth_fails" time="11.131" /><testcase classname="test.test_app.JwtTest" name="test_delete_database_no_role_fails" time="0.317" /><testcase classname="test.test_app.JwtTest" name="test_delete_database_not_found_fails" time="0.370" /><testcase classname="test.test_app.JwtTest" name="test_delete_database_succeeds" time="0.524" /><testcase classname="test.test_app.JwtTest" name="test_get_fields_fails" time="0.154" /><testcase classname="test.test_app.JwtTest" name="test_get_fields_succeeds" time="0.218" /><testcase classname="test.test_app.JwtTest" name="test_get_fuzzy_search_no_query_fails" time="0.173" /><testcase classname="test.test_app.JwtTest" name="test_get_fuzzy_search_succeeds" time="0.283" /><testcase classname="test.test_app.JwtTest" name="test_get_index_fails" time="0.240" /><testcase classname="test.test_app.JwtTest" name="test_get_index_succeeds" time="0.190" /><testcase classname="test.test_app.JwtTest" name="test_health_succeeds" time="0.160" /><testcase classname="test.test_app.JwtTest" name="test_post_general_search_column_succeeds" time="0.386" /><testcase classname="test.test_app.JwtTest" name="test_post_general_search_concept_succeeds" time="0.341" /><testcase classname="test.test_app.JwtTest" name="test_post_general_search_identifier_succeeds" time="0.312" /><testcase classname="test.test_app.JwtTest" name="test_post_general_search_media_type_fails" time="0.140" /><testcase classname="test.test_app.JwtTest" name="test_post_general_search_no_body_fails" time="0.134" /><testcase classname="test.test_app.JwtTest" name="test_post_general_search_succeeds" time="0.284" /><testcase classname="test.test_app.JwtTest" name="test_post_general_search_table_succeeds" time="0.336" /><testcase classname="test.test_app.JwtTest" name="test_post_general_search_unit_succeeds" time="0.246" /><testcase classname="test.test_app.JwtTest" name="test_post_general_search_view_succeeds" time="0.281" /><testcase classname="test.test_app.JwtTest" name="test_update_database_empty_body_fails" time="0.177" /><testcase classname="test.test_app.JwtTest" name="test_update_database_malformed_body_fails" time="0.180" /><testcase classname="test.test_app.JwtTest" name="test_update_database_media_type_fails" time="0.231" /><testcase classname="test.test_app.JwtTest" name="test_update_database_no_auth_fails" time="0.119" /><testcase classname="test.test_app.JwtTest" name="test_update_database_no_body_fails" time="0.150" /><testcase classname="test.test_app.JwtTest" name="test_update_database_succeeds" time="0.243" /><testcase classname="test.test_jwt.JwtTest" name="test_get_user_roles_succeeds" time="0.146" /><testcase classname="test.test_jwt.JwtTest" name="test_verify_password_empty_password_fails" time="0.144" /><testcase classname="test.test_jwt.JwtTest" name="test_verify_password_empty_username_fails" time="0.127" /><testcase classname="test.test_jwt.JwtTest" name="test_verify_password_no_password_fails" time="0.142" /><testcase classname="test.test_jwt.JwtTest" name="test_verify_password_no_username_fails" time="0.146" /><testcase classname="test.test_jwt.JwtTest" name="test_verify_password_succeeds" time="0.152" /><testcase classname="test.test_jwt.JwtTest" name="test_verify_token_empty_token_fails" time="0.144" /><testcase classname="test.test_jwt.JwtTest" name="test_verify_token_malformed_token_fails" time="0.143" /><testcase classname="test.test_jwt.JwtTest" name="test_verify_token_no_token_fails" time="0.130" /><testcase classname="test.test_jwt.JwtTest" name="test_verify_token_succeeds" time="0.212" /><testcase classname="test.test_opensearch_client.OpenSearchClientTest" name="test_delete_database_fails" time="0.120" /><testcase classname="test.test_opensearch_client.OpenSearchClientTest" name="test_delete_database_succeeds" time="0.172" /><testcase classname="test.test_opensearch_client.OpenSearchClientTest" name="test_fuzzy_search_succeeds" time="0.190" /><testcase classname="test.test_opensearch_client.OpenSearchClientTest" name="test_get_fields_for_index_database_succeeds" time="0.201" /><testcase classname="test.test_opensearch_client.OpenSearchClientTest" name="test_get_fields_for_index_user_succeeds" time="0.202" /><testcase classname="test.test_opensearch_client.OpenSearchClientTest" name="test_unit_independent_search_fails" time="0.208" /><testcase classname="test.test_opensearch_client.OpenSearchClientTest" name="test_update_database_create_succeeds" time="0.205" /><testcase classname="test.test_opensearch_client.OpenSearchClientTest" name="test_update_database_malformed_fails" time="0.237" /><testcase classname="test.test_opensearch_client.OpenSearchClientTest" name="test_update_database_succeeds" time="0.214" /><testcase classname="test.test_keycloak_client.JwtTest" name="test_obtain_user_token_malformed_fails" time="0.112" /><testcase classname="test.test_keycloak_client.JwtTest" name="test_obtain_user_token_succeeds" time="0.149" /><testcase classname="test.test_keycloak_client.JwtTest" name="test_verify_jwt_succeeds" time="0.684" /></testsuite></testsuites> \ No newline at end of file diff --git a/dbrepo-data-service/services/src/main/java/at/tuwien/config/CacheConfig.java b/dbrepo-data-service/services/src/main/java/at/tuwien/config/CacheConfig.java index c798537b5b378822a82119b2ffcb7ec4c7bf1384..6fc7e7250cad33f8d2b9f81f3e2ec95f9fa934b9 100644 --- a/dbrepo-data-service/services/src/main/java/at/tuwien/config/CacheConfig.java +++ b/dbrepo-data-service/services/src/main/java/at/tuwien/config/CacheConfig.java @@ -19,7 +19,7 @@ import java.util.concurrent.TimeUnit; public class CacheConfig { @Value("${dbrepo.credentialCacheTimeout}") - private Long credentialCacheTimeout; + private Integer credentialCacheTimeout; @Bean public Cache<UUID, UserDto> userCache() { @@ -27,28 +27,28 @@ public class CacheConfig { } @Bean - public Cache<Long, ViewDto> viewCache() { - return new ExpiryCache<Long, ViewDto>().build(); + public Cache<UUID, ViewDto> viewCache() { + return new ExpiryCache<UUID, ViewDto>().build(); } @Bean - public Cache<Long, DatabaseAccessDto> accessCache() { - return new ExpiryCache<Long, DatabaseAccessDto>().build(); + public Cache<UUID, DatabaseAccessDto> accessCache() { + return new ExpiryCache<UUID, DatabaseAccessDto>().build(); } @Bean - public Cache<Long, TableDto> tableCache() { - return new ExpiryCache<Long, TableDto>().build(); + public Cache<UUID, TableDto> tableCache() { + return new ExpiryCache<UUID, TableDto>().build(); } @Bean - public Cache<Long, DatabaseDto> databaseCache() { - return new ExpiryCache<Long, DatabaseDto>().build(); + public Cache<UUID, DatabaseDto> databaseCache() { + return new ExpiryCache<UUID, DatabaseDto>().build(); } @Bean - public Cache<Long, ContainerDto> containerCache() { - return new ExpiryCache<Long, ContainerDto>().build(); + public Cache<UUID, ContainerDto> containerCache() { + return new ExpiryCache<UUID, ContainerDto>().build(); } class ExpiryCache<K, T> { diff --git a/dbrepo-data-service/services/src/main/java/at/tuwien/gateway/impl/MetadataServiceGatewayImpl.java b/dbrepo-data-service/services/src/main/java/at/tuwien/gateway/impl/MetadataServiceGatewayImpl.java index 832bf09061d5d5b82bf99f17acfd8e4a3e3e31a2..7d970cf3e881b426afaf1b75f871c49921bdaa00 100644 --- a/dbrepo-data-service/services/src/main/java/at/tuwien/gateway/impl/MetadataServiceGatewayImpl.java +++ b/dbrepo-data-service/services/src/main/java/at/tuwien/gateway/impl/MetadataServiceGatewayImpl.java @@ -63,7 +63,7 @@ public class MetadataServiceGatewayImpl implements MetadataServiceGateway { log.error("Failed to find container with id {}: service responded unsuccessful: {}", containerId, response.getStatusCode()); throw new MetadataServiceException("Failed to find container: service responded unsuccessful: " + response.getStatusCode()); } - final List<String> expectedHeaders = List.of("X-Username", "X-Password"); + final List<String> expectedHeaders = List.of("X-Username", "X-Password", "X-Jdbc-Method"); if (!response.getHeaders().keySet().containsAll(expectedHeaders)) { log.error("Failed to find all container headers"); log.debug("expected headers: {}", expectedHeaders); @@ -87,7 +87,7 @@ public class MetadataServiceGatewayImpl implements MetadataServiceGateway { MetadataServiceException { final ResponseEntity<DatabaseDto> response; final String url = "/api/database/" + id; - log.debug("get database info from metadata service: {}", url); + log.debug("get database info from metadata service: {}", url); try { response = internalRestTemplate.exchange(url, HttpMethod.GET, HttpEntity.EMPTY, DatabaseDto.class); } catch (ResourceAccessException | HttpServerErrorException e) { @@ -101,7 +101,7 @@ public class MetadataServiceGatewayImpl implements MetadataServiceGateway { log.error("Failed to find database with id {}: service responded unsuccessful: {}", id, response.getStatusCode()); throw new MetadataServiceException("Failed to find database: service responded unsuccessful: " + response.getStatusCode()); } - final List<String> expectedHeaders = List.of("X-Username", "X-Password"); + final List<String> expectedHeaders = List.of("X-Username", "X-Password", "X-Jdbc-Method"); if (!response.getHeaders().keySet().containsAll(expectedHeaders)) { log.error("Failed to find all database headers"); log.debug("expected headers: {}", expectedHeaders); @@ -115,6 +115,7 @@ public class MetadataServiceGatewayImpl implements MetadataServiceGateway { final DatabaseDto database = response.getBody(); database.getContainer().setUsername(response.getHeaders().get("X-Username").get(0)); database.getContainer().setPassword(response.getHeaders().get("X-Password").get(0)); + database.getContainer().getImage().setJdbcMethod(response.getHeaders().get("X-Jdbc-Method").get(0)); database.setLastRetrieved(Instant.now()); return database; } @@ -138,7 +139,7 @@ public class MetadataServiceGatewayImpl implements MetadataServiceGateway { log.error("Failed to find table with id {}: service responded unsuccessful: {}", id, response.getStatusCode()); throw new MetadataServiceException("Failed to find table: service responded unsuccessful: " + response.getStatusCode()); } - final List<String> expectedHeaders = List.of("X-Username", "X-Password"); + final List<String> expectedHeaders = List.of("X-Username", "X-Password", "X-Jdbc-Method"); if (!response.getHeaders().keySet().containsAll(expectedHeaders)) { log.error("Failed to find all table headers"); log.debug("expected headers: {}", expectedHeaders); @@ -152,6 +153,7 @@ public class MetadataServiceGatewayImpl implements MetadataServiceGateway { final TableDto table = metadataMapper.tableDtoToTableDto(response.getBody()); table.getDatabase().getContainer().setUsername(response.getHeaders().get("X-Username").get(0)); table.getDatabase().getContainer().setPassword(response.getHeaders().get("X-Password").get(0)); + table.getDatabase().getContainer().getImage().setJdbcMethod(response.getHeaders().get("X-Jdbc-Method").get(0)); table.setLastRetrieved(Instant.now()); return table; } @@ -175,7 +177,7 @@ public class MetadataServiceGatewayImpl implements MetadataServiceGateway { log.error("Failed to find view with id {}: service responded unsuccessful: {}", id, response.getStatusCode()); throw new MetadataServiceException("Failed to find view: service responded unsuccessful: " + response.getStatusCode()); } - final List<String> expectedHeaders = List.of("X-Username", "X-Password"); + final List<String> expectedHeaders = List.of("X-Username", "X-Password", "X-Jdbc-Method"); if (!response.getHeaders().keySet().containsAll(expectedHeaders)) { log.error("Failed to find all view headers"); log.debug("expected headers: {}", expectedHeaders); @@ -189,6 +191,7 @@ public class MetadataServiceGatewayImpl implements MetadataServiceGateway { final ViewDto view = metadataMapper.viewDtoToViewDto(response.getBody()); view.getDatabase().getContainer().setUsername(response.getHeaders().get("X-Username").get(0)); view.getDatabase().getContainer().setPassword(response.getHeaders().get("X-Password").get(0)); + view.getDatabase().getContainer().getImage().setJdbcMethod(response.getHeaders().get("X-Jdbc-Method").get(0)); view.setLastRetrieved(Instant.now()); return view; } diff --git a/dbrepo-data-service/services/src/main/java/at/tuwien/mapper/DataMapper.java b/dbrepo-data-service/services/src/main/java/at/tuwien/mapper/DataMapper.java index 5e2f8c88f7b8e4a2b2d6572d915ad1b6fc547890..65cf82bfcb10004cdb677577b09461f5b6e10923 100644 --- a/dbrepo-data-service/services/src/main/java/at/tuwien/mapper/DataMapper.java +++ b/dbrepo-data-service/services/src/main/java/at/tuwien/mapper/DataMapper.java @@ -17,7 +17,6 @@ import at.tuwien.api.database.table.constraints.foreign.ReferenceTypeDto; import at.tuwien.api.database.table.constraints.primary.PrimaryKeyDto; import at.tuwien.api.database.table.constraints.unique.UniqueDto; import at.tuwien.api.user.UserBriefDto; -import at.tuwien.config.QueryConfig; import at.tuwien.exception.TableNotFoundException; import org.apache.hadoop.shaded.com.google.common.hash.Hashing; import org.apache.hadoop.shaded.org.apache.commons.io.FileUtils; @@ -171,7 +170,7 @@ public interface DataMapper { return table; } - default ViewDto resultSetToTable(ResultSet resultSet, ViewDto view, QueryConfig queryConfig) throws SQLException { + default ViewDto resultSetToTable(ResultSet resultSet, ViewDto view) throws SQLException { final ViewColumnDto column = ViewColumnDto.builder() .ordinalPosition(resultSet.getInt(1) - 1) /* start at zero */ .isNullAllowed(resultSet.getString(3).equals("YES")) @@ -191,7 +190,6 @@ public interface DataMapper { } view.getColumns() .add(column); - log.trace("parsed view column: {}.{}", view.getInternalName(), column.getInternalName()); return view; } diff --git a/dbrepo-data-service/services/src/main/java/at/tuwien/mapper/MariaDbMapper.java b/dbrepo-data-service/services/src/main/java/at/tuwien/mapper/MariaDbMapper.java index 95427d384c3a06da7a8284cbb30a82d4c83cc6c4..4e48c02786ba60cfed541c80048e921fc39d6b61 100644 --- a/dbrepo-data-service/services/src/main/java/at/tuwien/mapper/MariaDbMapper.java +++ b/dbrepo-data-service/services/src/main/java/at/tuwien/mapper/MariaDbMapper.java @@ -113,7 +113,7 @@ public interface MariaDbMapper { } default String queryStoreCreateTableRawQuery() { - final String statement = "CREATE TABLE `qs_queries` ( `id` varchar(36) not null primary key, `created` datetime not null default now(), `executed` datetime not null default now(), `created_by` varchar(36), `query` text not null, `query_normalized` text not null, `is_persisted` boolean not null, `query_hash` varchar(255) not null, `result_hash` varchar(255), `result_number` bigint) WITH SYSTEM VERSIONING;"; + final String statement = "CREATE TABLE `qs_queries` ( `id` VARCHAR(36) NOT NULL PRIMARY KEY DEFAULT UUID(), `created` datetime NOT NULL DEFAULT NOW(), `executed` datetime NOT NULL default now(), `created_by` VARCHAR(36), `query` text NOT NULL, `query_normalized` text NOT NULL, `is_persisted` boolean NOT NULL, `query_hash` VARCHAR(255) NOT NULL, `result_hash` VARCHAR(255), `result_number` bigint) WITH SYSTEM VERSIONING;"; log.trace("mapped create query store table statement: {}", statement); return statement; } @@ -125,13 +125,13 @@ public interface MariaDbMapper { } default String queryStoreCreateStoreQueryProcedureRawQuery() { - final String statement = "CREATE PROCEDURE store_query(IN query TEXT, IN executed DATETIME, OUT queryId BIGINT) BEGIN DECLARE _queryhash varchar(255) DEFAULT SHA2(query, 256); DECLARE _username varchar(255) DEFAULT REGEXP_REPLACE(current_user(), '@.*', ''); DECLARE _query TEXT DEFAULT CONCAT('CREATE OR REPLACE TABLE _tmp AS (', query, ')'); PREPARE stmt FROM _query; EXECUTE stmt; DEALLOCATE PREPARE stmt; CALL hash_table('_tmp', @hash, @count); DROP TABLE IF EXISTS `_tmp`; IF @hash IS NULL THEN INSERT INTO `qs_queries` (`created_by`, `query`, `query_normalized`, `is_persisted`, `query_hash`, `result_hash`, `result_number`, `executed`) SELECT _username, query, query, false, _queryhash, @hash, @count, executed WHERE NOT EXISTS (SELECT `id` FROM `qs_queries` WHERE `query_hash` = _queryhash AND `result_hash` IS NULL); SET queryId = (SELECT `id` FROM `qs_queries` WHERE `query_hash` = _queryhash AND `result_hash` IS NULL); ELSE INSERT INTO `qs_queries` (`created_by`, `query`, `query_normalized`, `is_persisted`, `query_hash`, `result_hash`, `result_number`, `executed`) SELECT _username, query, query, false, _queryhash, @hash, @count, executed WHERE NOT EXISTS (SELECT `id` FROM `qs_queries` WHERE `query_hash` = _queryhash AND `result_hash` = @hash); SET queryId = (SELECT `id` FROM `qs_queries` WHERE `query_hash` = _queryhash AND `result_hash` = @hash); END IF; END;"; + final String statement = "CREATE PROCEDURE store_query(IN query TEXT, IN executed DATETIME, OUT queryId VARCHAR(36)) BEGIN DECLARE _queryhash VARCHAR(255) DEFAULT SHA2(query, 256); DECLARE _username VARCHAR(255) DEFAULT REGEXP_REPLACE(current_user(), '@.*', ''); DECLARE _query TEXT DEFAULT CONCAT('CREATE OR REPLACE TABLE _tmp AS (', query, ')'); PREPARE stmt FROM _query; EXECUTE stmt; DEALLOCATE PREPARE stmt; CALL hash_table('_tmp', @hash, @count); DROP TABLE IF EXISTS `_tmp`; IF @hash IS NULL THEN INSERT INTO `qs_queries` (`created_by`, `query`, `query_normalized`, `is_persisted`, `query_hash`, `result_hash`, `result_number`, `executed`) SELECT _username, query, query, false, _queryhash, @hash, @count, executed WHERE NOT EXISTS (SELECT `id` FROM `qs_queries` WHERE `query_hash` = _queryhash AND `result_hash` IS NULL); SET queryId = (SELECT `id` FROM `qs_queries` WHERE `query_hash` = _queryhash AND `result_hash` IS NULL); ELSE INSERT INTO `qs_queries` (`created_by`, `query`, `query_normalized`, `is_persisted`, `query_hash`, `result_hash`, `result_number`, `executed`) SELECT _username, query, query, false, _queryhash, @hash, @count, executed WHERE NOT EXISTS (SELECT `id` FROM `qs_queries` WHERE `query_hash` = _queryhash AND `result_hash` = @hash); SET queryId = (SELECT `id` FROM `qs_queries` WHERE `query_hash` = _queryhash AND `result_hash` = @hash); END IF; END;"; log.trace("mapped create query store store_query procedure statement: {}", statement); return statement; } default String queryStoreCreateInternalStoreQueryProcedureRawQuery() { - final String statement = "CREATE DEFINER = 'root' PROCEDURE _store_query(IN _username VARCHAR(255), IN query TEXT, IN executed DATETIME, OUT queryId BIGINT) BEGIN DECLARE _queryhash varchar(255) DEFAULT SHA2(query, 256); DECLARE _query TEXT DEFAULT CONCAT('CREATE OR REPLACE TABLE _tmp AS (', query, ')'); PREPARE stmt FROM _query; EXECUTE stmt; DEALLOCATE PREPARE stmt; CALL hash_table('_tmp', @hash, @count); DROP TABLE IF EXISTS `_tmp`; IF @hash IS NULL THEN INSERT INTO `qs_queries` (`created_by`, `query`, `query_normalized`, `is_persisted`, `query_hash`, `result_hash`, `result_number`, `executed`) SELECT _username, query, query, false, _queryhash, @hash, @count, executed WHERE NOT EXISTS (SELECT `id` FROM `qs_queries` WHERE `query_hash` = _queryhash AND `result_hash` IS NULL); SET queryId = (SELECT `id` FROM `qs_queries` WHERE `query_hash` = _queryhash AND `result_hash` IS NULL); ELSE INSERT INTO `qs_queries` (`created_by`, `query`, `query_normalized`, `is_persisted`, `query_hash`, `result_hash`, `result_number`, `executed`) SELECT _username, query, query, false, _queryhash, @hash, @count, executed WHERE NOT EXISTS (SELECT `id` FROM `qs_queries` WHERE `query_hash` = _queryhash AND `result_hash` = @hash); SET queryId = (SELECT `id` FROM `qs_queries` WHERE `query_hash` = _queryhash AND `result_hash` = @hash); END IF; END;"; + final String statement = "CREATE DEFINER = 'root' PROCEDURE _store_query(IN _username VARCHAR(255), IN query TEXT, IN executed DATETIME, OUT queryId VARCHAR(36)) BEGIN DECLARE _queryhash VARCHAR(255) DEFAULT SHA2(query, 256); DECLARE _query TEXT DEFAULT CONCAT('CREATE OR REPLACE TABLE _tmp AS (', query, ')'); PREPARE stmt FROM _query; EXECUTE stmt; DEALLOCATE PREPARE stmt; CALL hash_table('_tmp', @hash, @count); DROP TABLE IF EXISTS `_tmp`; IF @hash IS NULL THEN INSERT INTO `qs_queries` (`created_by`, `query`, `query_normalized`, `is_persisted`, `query_hash`, `result_hash`, `result_number`, `executed`) SELECT _username, query, query, false, _queryhash, @hash, @count, executed WHERE NOT EXISTS (SELECT `id` FROM `qs_queries` WHERE `query_hash` = _queryhash AND `result_hash` IS NULL); SET queryId = (SELECT `id` FROM `qs_queries` WHERE `query_hash` = _queryhash AND `result_hash` IS NULL); ELSE INSERT INTO `qs_queries` (`created_by`, `query`, `query_normalized`, `is_persisted`, `query_hash`, `result_hash`, `result_number`, `executed`) SELECT _username, query, query, false, _queryhash, @hash, @count, executed WHERE NOT EXISTS (SELECT `id` FROM `qs_queries` WHERE `query_hash` = _queryhash AND `result_hash` = @hash); SET queryId = (SELECT `id` FROM `qs_queries` WHERE `query_hash` = _queryhash AND `result_hash` = @hash); END IF; END;"; log.trace("mapped create query store _store_query procedure statement: {}", statement); return statement; } @@ -301,7 +301,7 @@ public interface MariaDbMapper { final StringBuilder stringBuilder = new StringBuilder("CREATE TABLE `") .append(nameToInternalName(data.getName())) .append("` ("); - log.trace("primary key column(s) exist: {}", data.getConstraints().getPrimaryKey()); + log.trace("PRIMARY KEY column(s) exist: {}", data.getConstraints().getPrimaryKey()); final int[] idx = {0}; for (CreateTableColumnDto column : data.getColumns()) { stringBuilder.append(idx[0]++ > 0 ? ", " : "") @@ -320,11 +320,11 @@ public interface MariaDbMapper { } } - /* create primary key index */ + /* create PRIMARY KEY index */ if (data.getConstraints() != null) { log.trace("constraints are {}", data.getConstraints()); if (data.getConstraints().getPrimaryKey() != null && !data.getConstraints().getPrimaryKey().isEmpty()) { - /* create primary key index */ + /* create PRIMARY KEY index */ stringBuilder.append(", PRIMARY KEY (") .append(String.join(",", data.getConstraints() .getPrimaryKey() diff --git a/dbrepo-data-service/services/src/main/java/at/tuwien/service/impl/CredentialServiceImpl.java b/dbrepo-data-service/services/src/main/java/at/tuwien/service/impl/CredentialServiceImpl.java index d5431e6ee61b65f20d76077d4b4af0c5bf5018ec..8f3553515f386afcc91627a0cecd11a05d263f27 100644 --- a/dbrepo-data-service/services/src/main/java/at/tuwien/service/impl/CredentialServiceImpl.java +++ b/dbrepo-data-service/services/src/main/java/at/tuwien/service/impl/CredentialServiceImpl.java @@ -23,22 +23,21 @@ public class CredentialServiceImpl implements CredentialService { private final MetadataServiceGateway gateway; private final Cache<UUID, UserDto> userCache; private final Cache<UUID, ViewDto> viewCache; - private final Cache<UUID, DatabaseAccessDto> accessCache; private final Cache<UUID, TableDto> tableCache; private final Cache<UUID, DatabaseDto> databaseCache; private final Cache<UUID, ContainerDto> containerCache; + private final Cache<UUID, DatabaseAccessDto> accessCache; @Autowired public CredentialServiceImpl(MetadataServiceGateway gateway, Cache<UUID, UserDto> userCache, - Cache<UUID, ViewDto> viewCache, Cache<UUID, DatabaseAccessDto> accessCache, - Cache<UUID, TableDto> tableCache, - Cache<UUID, DatabaseDto> databaseCache, + Cache<UUID, ViewDto> viewCache, Cache<UUID, TableDto> tableCache, + Cache<UUID, DatabaseAccessDto> accessCache, Cache<UUID, DatabaseDto> databaseCache, Cache<UUID, ContainerDto> containerCache) { this.gateway = gateway; this.userCache = userCache; this.viewCache = viewCache; - this.accessCache = accessCache; this.tableCache = tableCache; + this.accessCache = accessCache; this.databaseCache = databaseCache; this.containerCache = containerCache; } diff --git a/dbrepo-data-service/services/src/main/java/at/tuwien/service/impl/DatabaseServiceMariaDbImpl.java b/dbrepo-data-service/services/src/main/java/at/tuwien/service/impl/DatabaseServiceMariaDbImpl.java index 4d899c99782f99813c3618dd4c051a2a2a0f2da8..f7e12c69f6d2937850d0e2d9a2973b1e6e7dadf2 100644 --- a/dbrepo-data-service/services/src/main/java/at/tuwien/service/impl/DatabaseServiceMariaDbImpl.java +++ b/dbrepo-data-service/services/src/main/java/at/tuwien/service/impl/DatabaseServiceMariaDbImpl.java @@ -7,7 +7,6 @@ import at.tuwien.api.database.table.TableDto; import at.tuwien.api.database.table.constraints.unique.UniqueDto; import at.tuwien.api.database.table.internal.TableCreateDto; import at.tuwien.api.user.internal.UpdateUserPasswordDto; -import at.tuwien.config.QueryConfig; import at.tuwien.exception.*; import at.tuwien.mapper.DataMapper; import at.tuwien.mapper.MariaDbMapper; @@ -32,15 +31,13 @@ import java.util.List; public class DatabaseServiceMariaDbImpl extends DataConnector implements DatabaseService { private final DataMapper dataMapper; - private final QueryConfig queryConfig; private final MariaDbMapper mariaDbMapper; private final MetadataMapper metadataMapper; @Autowired - public DatabaseServiceMariaDbImpl(DataMapper dataMapper, QueryConfig queryConfig, MariaDbMapper mariaDbMapper, + public DatabaseServiceMariaDbImpl(DataMapper dataMapper, MariaDbMapper mariaDbMapper, MetadataMapper metadataMapper) { this.dataMapper = dataMapper; - this.queryConfig = queryConfig; this.mariaDbMapper = mariaDbMapper; this.metadataMapper = metadataMapper; } @@ -151,7 +148,7 @@ public class DatabaseServiceMariaDbImpl extends DataConnector implements Databas statement2.setString(2, view.getInternalName()); final ResultSet resultSet2 = statement2.executeQuery(); while (resultSet2.next()) { - view = dataMapper.resultSetToTable(resultSet2, view, queryConfig); + view = dataMapper.resultSetToTable(resultSet2, view); } connection.commit(); } catch (SQLException e) { diff --git a/dbrepo-data-service/services/src/main/java/at/tuwien/service/impl/SubsetServiceMariaDbImpl.java b/dbrepo-data-service/services/src/main/java/at/tuwien/service/impl/SubsetServiceMariaDbImpl.java index 3373f97b761f7e5e6a3a6a48da4c687a1a334ad4..8adaae9c6a065296fd42ea66e5cad8328cc6e06a 100644 --- a/dbrepo-data-service/services/src/main/java/at/tuwien/service/impl/SubsetServiceMariaDbImpl.java +++ b/dbrepo-data-service/services/src/main/java/at/tuwien/service/impl/SubsetServiceMariaDbImpl.java @@ -174,7 +174,7 @@ public class SubsetServiceMariaDbImpl extends DataConnector implements SubsetSer } callableStatement.setString(2, query); callableStatement.setTimestamp(3, Timestamp.from(timestamp)); - callableStatement.registerOutParameter(4, Types.BIGINT); + callableStatement.registerOutParameter(4, Types.VARCHAR); callableStatement.executeUpdate(); log.trace("executed statement in {} ms", System.currentTimeMillis() - start); queryId = UUID.fromString(callableStatement.getString(4)); diff --git a/dbrepo-gateway-service/dbrepo.conf b/dbrepo-gateway-service/dbrepo.conf index 60348a8197261ce82e73cdf8b81553ba6a4ffdac..94109cf9cc991f81643a6af439d5a177bda67c77 100644 --- a/dbrepo-gateway-service/dbrepo.conf +++ b/dbrepo-gateway-service/dbrepo.conf @@ -52,7 +52,7 @@ server { listen 8080 default_server; server_name _; - location /dashboard/ { + location /dashboard { rewrite ^/dashboard/(.*) /$1 break; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; @@ -63,7 +63,7 @@ server { } # Proxy Grafana Live WebSocket connections. - location /dashboard/api/live/ { + location /dashboard/api/live { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; @@ -129,7 +129,7 @@ server { proxy_read_timeout 90; } - location ~ /api/database/([0-9]+)/table/([0-9]+)/(data|history|export) { + location ~ "/api/database/([0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})/table/([0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})/(data|history|export)" { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; @@ -138,7 +138,7 @@ server { proxy_read_timeout 90; } - location ~ /api/database/([0-9]+)/view/([0-9]+)/(data|export) { + location ~ "/api/database/([0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})/view/([0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})/(data|export)" { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; @@ -147,7 +147,7 @@ server { proxy_read_timeout 90; } - location ~ /api/database/([0-9]+)/view { + location ~ "/api/database/([0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})/view" { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; @@ -156,7 +156,7 @@ server { proxy_read_timeout 90; } - location ~ /api/database/([0-9]+)/subset { + location ~ "/api/database/([0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})/subset" { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; @@ -165,7 +165,7 @@ server { proxy_read_timeout 600; } - location ~ /api/(database|concept|container|identifier|image|message|license|oai|ontology|unit|user) { + location ~ "/api/(database|concept|container|identifier|image|message|license|oai|ontology|unit|user)" { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; @@ -174,7 +174,7 @@ server { proxy_read_timeout 90; } - location ~ /pid/([0-9]+) { + location ~ "/pid/([0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})" { rewrite /pid/(.*) /api/identifier/$1 break; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; diff --git a/dbrepo-metadata-db/1_setup-schema.sql b/dbrepo-metadata-db/1_setup-schema.sql index 2ac584f1388394ca624bf3d7150391d443f601df..b9055cf884bdb3d310310c52a17471504cdc6fac 100644 --- a/dbrepo-metadata-db/1_setup-schema.sql +++ b/dbrepo-metadata-db/1_setup-schema.sql @@ -2,8 +2,8 @@ BEGIN; CREATE TABLE IF NOT EXISTS `mdb_users` ( - id UUID NOT NULL DEFAULT uuid(), - keycloak_id UUID NOT NULL DEFAULT UUID(), + id VARCHAR(36) NOT NULL DEFAULT UUID(), + keycloak_id VARCHAR(36) NOT NULL, username VARCHAR(255) NOT NULL, firstname VARCHAR(255), lastname VARCHAR(255), @@ -13,14 +13,14 @@ CREATE TABLE IF NOT EXISTS `mdb_users` mariadb_password VARCHAR(255) NOT NULL, theme VARCHAR(255) NOT NULL DEFAULT ('light'), language VARCHAR(3) NOT NULL DEFAULT ('en'), - PRIMARY KEY (id), - UNIQUE (keycloak_id), - UNIQUE (username) + PRIMARY KEY (`id`), + UNIQUE (`keycloak_id`), + UNIQUE (`username`) ) WITH SYSTEM VERSIONING; CREATE TABLE IF NOT EXISTS `mdb_images` ( - id UUID NOT NULL DEFAULT UUID(), + id VARCHAR(36) NOT NULL DEFAULT UUID(), registry VARCHAR(255) NOT NULL DEFAULT 'docker.io', name VARCHAR(255) NOT NULL, version VARCHAR(255) NOT NULL, @@ -31,14 +31,14 @@ CREATE TABLE IF NOT EXISTS `mdb_images` is_DEFAULT BOOLEAN NOT NULL DEFAULT FALSE, created TIMESTAMP NOT NULL DEFAULT NOW(), last_modified TIMESTAMP, - PRIMARY KEY (id), - UNIQUE (name, version), - UNIQUE (is_DEFAULT) + PRIMARY KEY (`id`), + UNIQUE (`name`, `version`), + UNIQUE (`is_DEFAULT`) ) WITH SYSTEM VERSIONING; CREATE TABLE IF NOT EXISTS `mdb_containers` ( - id UUID NOT NULL DEFAULT UUID(), + id VARCHAR(36) NOT NULL DEFAULT UUID(), internal_name VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, host VARCHAR(255) NOT NULL, @@ -46,16 +46,14 @@ CREATE TABLE IF NOT EXISTS `mdb_containers` ui_host VARCHAR(255) NOT NULL DEFAULT host, ui_port INT NOT NULL DEFAULT port, ui_additional_flags TEXT, - sidecar_host VARCHAR(255), - sidecar_port INT, - image_id UUID NOT NULL DEFAULT UUID(), + image_id VARCHAR(36) NOT NULL, created TIMESTAMP NOT NULL DEFAULT NOW(), last_modified TIMESTAMP, privileged_username VARCHAR(255) NOT NULL, privileged_password VARCHAR(255) NOT NULL, - quota INT NOT NULL DEFAULT 50, - PRIMARY KEY (id), - FOREIGN KEY (image_id) REFERENCES mdb_images (id) + quota INT, + PRIMARY KEY (`id`), + FOREIGN KEY (`image_id`) REFERENCES mdb_images (`id`) ) WITH SYSTEM VERSIONING; CREATE TABLE IF NOT EXISTS `mdb_licenses` @@ -63,14 +61,14 @@ CREATE TABLE IF NOT EXISTS `mdb_licenses` identifier VARCHAR(255) NOT NULL, uri TEXT NOT NULL, description TEXT NOT NULL, - PRIMARY KEY (identifier), + PRIMARY KEY (`identifier`), UNIQUE (uri(200)) ) WITH SYSTEM VERSIONING; CREATE TABLE IF NOT EXISTS `mdb_databases` ( - id UUID NOT NULL DEFAULT UUID(), - cid UUID NOT NULL DEFAULT UUID(), + id VARCHAR(36) NOT NULL DEFAULT UUID(), + cid VARCHAR(36) NOT NULL, name VARCHAR(255) NOT NULL, internal_name VARCHAR(255) NOT NULL, exchange_name VARCHAR(255) NOT NULL, @@ -79,20 +77,20 @@ CREATE TABLE IF NOT EXISTS `mdb_databases` is_public BOOLEAN NOT NULL DEFAULT TRUE, is_schema_public BOOLEAN NOT NULL DEFAULT TRUE, image LONGBLOB, - owned_by UUID, - contact_person UUID, + owned_by VARCHAR(36) NOT NULL, + contact_person VARCHAR(36) NOT NULL, created TIMESTAMP NOT NULL DEFAULT NOW(), last_modified TIMESTAMP, - PRIMARY KEY (id), - FOREIGN KEY (cid) REFERENCES mdb_containers (id), - FOREIGN KEY (owned_by) REFERENCES mdb_users (id), - FOREIGN KEY (contact_person) REFERENCES mdb_users (id) + PRIMARY KEY (`id`), + FOREIGN KEY (`cid`) REFERENCES mdb_containers (`id`), + FOREIGN KEY (`owned_by`) REFERENCES mdb_users (`id`), + FOREIGN KEY (`contact_person`) REFERENCES mdb_users (`id`) ) WITH SYSTEM VERSIONING; CREATE TABLE IF NOT EXISTS `mdb_tables` ( - id UUID NOT NULL DEFAULT UUID(), - tDBID UUID NOT NULL DEFAULT UUID(), + id VARCHAR(36) NOT NULL DEFAULT UUID(), + tDBID VARCHAR(36) NOT NULL, tName VARCHAR(64) NOT NULL, internal_name VARCHAR(64) NOT NULL, queue_name VARCHAR(255) NOT NULL, @@ -106,18 +104,18 @@ CREATE TABLE IF NOT EXISTS `mdb_tables` versioned BOOLEAN NOT NULL DEFAULT TRUE, is_public BOOLEAN NOT NULL DEFAULT TRUE, is_schema_public BOOLEAN NOT NULL DEFAULT TRUE, - owned_by UUID NOT NULL DEFAULT UUID(), + owned_by VARCHAR(36) NOT NULL DEFAULT UUID(), last_modified TIMESTAMP, - PRIMARY KEY (ID), - UNIQUE (tDBID, internal_name), - FOREIGN KEY (tDBID) REFERENCES mdb_databases (id), - FOREIGN KEY (owned_by) REFERENCES mdb_users (id) + PRIMARY KEY (`ID`), + UNIQUE (`tDBID`, `internal_name`), + FOREIGN KEY (`tDBID`) REFERENCES mdb_databases (`id`), + FOREIGN KEY (`owned_by`) REFERENCES mdb_users (`id`) ) WITH SYSTEM VERSIONING; CREATE TABLE IF NOT EXISTS `mdb_columns` ( - id UUID NOT NULL DEFAULT UUID(), - tID UUID NOT NULL DEFAULT UUID(), + id VARCHAR(36) NOT NULL DEFAULT UUID(), + tID VARCHAR(36) NOT NULL, cName VARCHAR(64), internal_name VARCHAR(64) NOT NULL, Datatype ENUM ('CHAR','VARCHAR','BINARY','VARBINARY','TINYBLOB','TINYTEXT','TEXT','BLOB','MEDIUMTEXT','MEDIUMBLOB','LONGTEXT','LONGBLOB','ENUM','SET','SERIAL','BIT','TINYINT','BOOL','SMALLINT','MEDIUMINT','INT','BIGINT','FLOAT','DOUBLE','DECIMAL','DATE','DATETIME','TIMESTAMP','TIME','YEAR'), @@ -135,140 +133,140 @@ CREATE TABLE IF NOT EXISTS `mdb_columns` std_dev Numeric NULL, created TIMESTAMP NOT NULL DEFAULT NOW(), last_modified TIMESTAMP, - FOREIGN KEY (tID) REFERENCES mdb_tables (ID) ON DELETE CASCADE, - PRIMARY KEY (ID), - UNIQUE (tID, internal_name) + FOREIGN KEY (`tID`) REFERENCES mdb_tables (`ID`) ON DELETE CASCADE, + PRIMARY KEY (`ID`), + UNIQUE (`tID`, `internal_name`) ) WITH SYSTEM VERSIONING; -CREATE TABLE IF NOT EXISTS `mdb_columns_ENUMs` +CREATE TABLE IF NOT EXISTS `mdb_columns_enums` ( - id UUID NOT NULL DEFAULT UUID(), - column_id UUID NOT NULL DEFAULT UUID(), + id VARCHAR(36) NOT NULL DEFAULT UUID(), + column_id VARCHAR(36) NOT NULL, value VARCHAR(255) NOT NULL, - FOREIGN KEY (column_id) REFERENCES mdb_columns (ID) ON DELETE CASCADE, - PRIMARY KEY (id) + FOREIGN KEY (`column_id`) REFERENCES mdb_columns (`ID`) ON DELETE CASCADE, + PRIMARY KEY (`id`) ) WITH SYSTEM VERSIONING; CREATE TABLE IF NOT EXISTS `mdb_columns_sets` ( - id UUID NOT NULL DEFAULT UUID(), - column_id UUID NOT NULL DEFAULT UUID(), + id VARCHAR(36) NOT NULL DEFAULT UUID(), + column_id VARCHAR(36) NOT NULL, value VARCHAR(255) NOT NULL, - FOREIGN KEY (column_id) REFERENCES mdb_columns (ID) ON DELETE CASCADE, - PRIMARY KEY (id) + FOREIGN KEY (`column_id`) REFERENCES mdb_columns (`ID`) ON DELETE CASCADE, + PRIMARY KEY (`id`) ) WITH SYSTEM VERSIONING; CREATE TABLE IF NOT EXISTS `mdb_constraints_foreign_key` ( - fkid UUID NOT NULL DEFAULT UUID(), - tid UUID NOT NULL DEFAULT UUID(), - rtid UUID NOT NULL DEFAULT UUID(), + fkid VARCHAR(36) NOT NULL DEFAULT UUID(), + tid VARCHAR(36) NOT NULL, + rtid VARCHAR(36) NOT NULL, name VARCHAR(255) NOT NULL, on_update VARCHAR(50) NULL, on_delete VARCHAR(50) NULL, position INT NULL, - PRIMARY KEY (fkid), - FOREIGN KEY (tid) REFERENCES mdb_tables (id) ON DELETE CASCADE, - FOREIGN KEY (rtid) REFERENCES mdb_tables (id) + PRIMARY KEY (`fkid`), + FOREIGN KEY (`tid`) REFERENCES mdb_tables (`id`) ON DELETE CASCADE, + FOREIGN KEY (`rtid`) REFERENCES mdb_tables (`id`) ) WITH SYSTEM VERSIONING; CREATE TABLE IF NOT EXISTS `mdb_constraints_primary_key` ( - pkid UUID NOT NULL DEFAULT UUID(), - tID UUID NOT NULL DEFAULT UUID(), - cid UUID NOT NULL DEFAULT UUID(), - PRIMARY KEY (pkid), - FOREIGN KEY (tID) REFERENCES mdb_tables (id) ON DELETE CASCADE, - FOREIGN KEY (cid) REFERENCES mdb_columns (id) ON DELETE CASCADE + pkid VARCHAR(36) NOT NULL DEFAULT UUID(), + tID VARCHAR(36) NOT NULL, + cid VARCHAR(36) NOT NULL, + PRIMARY KEY (`pkid`), + FOREIGN KEY (`tID`) REFERENCES mdb_tables (`id`) ON DELETE CASCADE, + FOREIGN KEY (`cid`) REFERENCES mdb_columns (`id`) ON DELETE CASCADE ) WITH SYSTEM VERSIONING; CREATE TABLE IF NOT EXISTS `mdb_constraints_foreign_key_reference` ( - id UUID NOT NULL DEFAULT UUID(), - fkid UUID NOT NULL DEFAULT UUID(), - cid UUID NOT NULL DEFAULT UUID(), - rcid UUID NOT NULL DEFAULT UUID(), - PRIMARY KEY (id), + id VARCHAR(36) NOT NULL DEFAULT UUID(), + fkid VARCHAR(36) NOT NULL, + cid VARCHAR(36) NOT NULL, + rcid VARCHAR(36) NOT NULL, + PRIMARY KEY (`id`), UNIQUE (fkid, cid, rcid), - FOREIGN KEY (fkid) REFERENCES mdb_constraints_foreign_key (fkid) ON UPDATE CASCADE, - FOREIGN KEY (cid) REFERENCES mdb_columns (id), - FOREIGN KEY (rcid) REFERENCES mdb_columns (id) + FOREIGN KEY (`fkid`) REFERENCES mdb_constraints_foreign_key (`fkid`) ON UPDATE CASCADE, + FOREIGN KEY (`cid`) REFERENCES mdb_columns (`id`), + FOREIGN KEY (`rcid`) REFERENCES mdb_columns (`id`) ) WITH SYSTEM VERSIONING; -CREATE TABLE IF NOT EXISTS `mdb_constraints_UNIQUE` +CREATE TABLE IF NOT EXISTS `mdb_constraints_unique` ( - uid UUID NOT NULL DEFAULT UUID(), + uid VARCHAR(36) NOT NULL DEFAULT UUID(), name VARCHAR(255) NOT NULL, - tid UUID NOT NULL DEFAULT UUID(), + tid VARCHAR(36) NOT NULL, position INT NULL, - PRIMARY KEY (uid), - FOREIGN KEY (tid) REFERENCES mdb_tables (id) ON DELETE CASCADE + PRIMARY KEY (`uid`), + FOREIGN KEY (`tid`) REFERENCES mdb_tables (`id`) ON DELETE CASCADE ); -CREATE TABLE IF NOT EXISTS `mdb_constraints_UNIQUE_columns` +CREATE TABLE IF NOT EXISTS `mdb_constraints_unique_columns` ( - id UUID NOT NULL DEFAULT UUID(), - uid UUID NOT NULL DEFAULT UUID(), - cid UUID NOT NULL DEFAULT UUID(), - PRIMARY KEY (id), - FOREIGN KEY (uid) REFERENCES mdb_constraints_UNIQUE (uid), - FOREIGN KEY (cid) REFERENCES mdb_columns (id) ON DELETE CASCADE + id VARCHAR(36) NOT NULL DEFAULT UUID(), + uid VARCHAR(36) NOT NULL, + cid VARCHAR(36) NOT NULL, + PRIMARY KEY (`id`), + FOREIGN KEY (`uid`) REFERENCES mdb_constraints_unique (`uid`), + FOREIGN KEY (`cid`) REFERENCES mdb_columns (`id`) ON DELETE CASCADE ) WITH SYSTEM VERSIONING; CREATE TABLE IF NOT EXISTS `mdb_constraints_checks` ( - id UUID NOT NULL DEFAULT UUID(), - tid UUID NOT NULL DEFAULT UUID(), + id VARCHAR(36) NOT NULL DEFAULT UUID(), + tid VARCHAR(36) NOT NULL, checks VARCHAR(255) NOT NULL, - PRIMARY KEY (id), - FOREIGN KEY (tid) REFERENCES mdb_tables (id) ON DELETE CASCADE + PRIMARY KEY (`id`), + FOREIGN KEY (`tid`) REFERENCES mdb_tables (`id`) ON DELETE CASCADE ) WITH SYSTEM VERSIONING; CREATE TABLE IF NOT EXISTS `mdb_concepts` ( - id UUID NOT NULL DEFAULT UUID(), + id VARCHAR(36) NOT NULL DEFAULT UUID(), uri TEXT NOT NULL, name VARCHAR(255) null, description TEXT null, created TIMESTAMP NOT NULL DEFAULT NOW(), - PRIMARY KEY (id), + PRIMARY KEY (`id`), UNIQUE (uri(200)) ) WITH SYSTEM VERSIONING; CREATE TABLE IF NOT EXISTS `mdb_units` ( - id UUID NOT NULL DEFAULT UUID(), + id VARCHAR(36) NOT NULL DEFAULT UUID(), uri TEXT NOT NULL, name VARCHAR(255) null, description TEXT null, created TIMESTAMP NOT NULL DEFAULT NOW(), - PRIMARY KEY (id), + PRIMARY KEY (`id`), UNIQUE (uri(200)) ) WITH SYSTEM VERSIONING; CREATE TABLE IF NOT EXISTS `mdb_columns_concepts` ( - id UUID NOT NULL DEFAULT UUID(), - cID UUID NOT NULL DEFAULT UUID(), - created TIMESTAMP NOT NULL DEFAULT NOW(), + id VARCHAR(36) NOT NULL DEFAULT UUID(), + cID VARCHAR(36) NOT NULL, + created TIMESTAMP NOT NULL DEFAULT NOW(), PRIMARY KEY (id, cid), - FOREIGN KEY (cID) REFERENCES mdb_columns (ID) + FOREIGN KEY (`cID`) REFERENCES mdb_columns (`ID`) ) WITH SYSTEM VERSIONING; CREATE TABLE IF NOT EXISTS `mdb_columns_units` ( - id UUID NOT NULL DEFAULT UUID(), - cID UUID NOT NULL DEFAULT UUID(), - created TIMESTAMP NOT NULL DEFAULT NOW(), + id VARCHAR(36) NOT NULL DEFAULT UUID(), + cID VARCHAR(36) NOT NULL, + created TIMESTAMP NOT NULL DEFAULT NOW(), PRIMARY KEY (id, cID), - FOREIGN KEY (cID) REFERENCES mdb_columns (ID) + FOREIGN KEY (`cID`) REFERENCES mdb_columns (`ID`) ) WITH SYSTEM VERSIONING; CREATE TABLE IF NOT EXISTS `mdb_view` ( - id UUID NOT NULL DEFAULT UUID(), - vdbid UUID NOT NULL DEFAULT UUID(), + id VARCHAR(36) NOT NULL DEFAULT UUID(), + vdbid VARCHAR(36) NOT NULL, vName VARCHAR(64) NOT NULL, internal_name VARCHAR(64) NOT NULL, Query TEXT NOT NULL, @@ -278,43 +276,43 @@ CREATE TABLE IF NOT EXISTS `mdb_view` InitialView BOOLEAN NOT NULL, created TIMESTAMP NOT NULL DEFAULT NOW(), last_modified TIMESTAMP, - owned_by UUID NOT NULL DEFAULT UUID(), - PRIMARY KEY (id), - FOREIGN KEY (vdbid) REFERENCES mdb_databases (id), - FOREIGN KEY (owned_by) REFERENCES mdb_users (id) + owned_by VARCHAR(36) NOT NULL, + PRIMARY KEY (`id`), + FOREIGN KEY (`vdbid`) REFERENCES mdb_databases (`id`), + FOREIGN KEY (`owned_by`) REFERENCES mdb_users (`id`) ) WITH SYSTEM VERSIONING; CREATE TABLE IF NOT EXISTS `mdb_messages` ( - id UUID NOT NULL DEFAULT UUID(), + id VARCHAR(36) NOT NULL DEFAULT UUID(), type ENUM ('ERROR', 'WARNING', 'INFO') NOT NULL DEFAULT 'INFO', message TEXT NOT NULL, link TEXT NULL, link_TEXT VARCHAR(255) NULL, display_start TIMESTAMP NULL, display_end TIMESTAMP NULL, - PRIMARY KEY (id) + PRIMARY KEY (`id`) ) WITH SYSTEM VERSIONING; CREATE TABLE IF NOT EXISTS `mdb_ontologies` ( - id UUID NOT NULL DEFAULT UUID(), - prefix VARCHAR(8) NOT NULL, - uri TEXT NOT NULL, + id VARCHAR(36) NOT NULL DEFAULT UUID(), + prefix VARCHAR(8) NOT NULL, + uri TEXT NOT NULL, uri_pattern TEXT, - sparql_endpoint TEXT NULL, - rdf_path TEXT NULL, + sparql_endpoint TEXT NULL, + rdf_path TEXT NULL, last_modified TIMESTAMP, - created TIMESTAMP NOT NULL DEFAULT NOW(), - UNIQUE (prefix), + created TIMESTAMP NOT NULL DEFAULT NOW(), + UNIQUE (`prefix`), UNIQUE (uri(200)), - PRIMARY KEY (id) + PRIMARY KEY (`id`) ) WITH SYSTEM VERSIONING; CREATE TABLE IF NOT EXISTS `mdb_view_columns` ( - id UUID NOT NULL DEFAULT UUID(), - view_id UUID NOT NULL DEFAULT UUID(), + id VARCHAR(36) NOT NULL DEFAULT UUID(), + view_id VARCHAR(36) NOT NULL, name VARCHAR(64), internal_name VARCHAR(64) NOT NULL, column_type ENUM ('CHAR','VARCHAR','BINARY','VARBINARY','TINYBLOB','TINYTEXT','TEXT','BLOB','MEDIUMTEXT','MEDIUMBLOB','LONGTEXT','LONGBLOB','ENUM','SET','BIT','TINYINT','BOOL','SMALLINT','MEDIUMINT','INT','BIGINT','FLOAT','DOUBLE','DECIMAL','DATE','DATETIME','TIMESTAMP','TIME','YEAR'), @@ -322,18 +320,18 @@ CREATE TABLE IF NOT EXISTS `mdb_view_columns` size BIGINT UNSIGNED, d BIGINT UNSIGNED, is_null_allowed BOOLEAN NOT NULL DEFAULT TRUE, - PRIMARY KEY (id), - FOREIGN KEY (view_id) REFERENCES mdb_view (id) ON DELETE CASCADE, + PRIMARY KEY (`id`), + FOREIGN KEY (`view_id`) REFERENCES mdb_view (`id`) ON DELETE CASCADE, UNIQUE (view_id, internal_name) ) WITH SYSTEM VERSIONING; CREATE TABLE IF NOT EXISTS `mdb_identifiers` ( - id UUID NOT NULL DEFAULT UUID(), - dbid UUID NOT NULL DEFAULT UUID(), - qid UUID, - vid UUID, - tid UUID, + id VARCHAR(36) NOT NULL DEFAULT UUID(), + dbid VARCHAR(36) NOT NULL, + qid VARCHAR(36) NOT NULL, + vid VARCHAR(36) NOT NULL, + tid VARCHAR(36) NOT NULL, publisher VARCHAR(255) NOT NULL, language VARCHAR(2), publication_year INT NOT NULL, @@ -349,37 +347,37 @@ CREATE TABLE IF NOT EXISTS `mdb_identifiers` result_number BIGINT, doi VARCHAR(255), created TIMESTAMP NOT NULL DEFAULT NOW(), - owned_by UUID NOT NULL DEFAULT UUID(), + owned_by VARCHAR(36) NOT NULL, last_modified TIMESTAMP, - PRIMARY KEY (id), /* must be a single id from persistent identifier concept */ - FOREIGN KEY (dbid) REFERENCES mdb_databases (id), - FOREIGN KEY (owned_by) REFERENCES mdb_users (id) + PRIMARY KEY (`id`), /* must be a single id from persistent identifier concept */ + FOREIGN KEY (`dbid`) REFERENCES mdb_databases (`id`), + FOREIGN KEY (`owned_by`) REFERENCES mdb_users (`id`) ) WITH SYSTEM VERSIONING; CREATE TABLE IF NOT EXISTS `mdb_identifier_licenses` ( - pid UUID NOT NULL DEFAULT UUID(), + pid VARCHAR(36) NOT NULL DEFAULT UUID(), license_id VARCHAR(255) NOT NULL, PRIMARY KEY (pid, license_id), - FOREIGN KEY (pid) REFERENCES mdb_identifiers (id), - FOREIGN KEY (license_id) REFERENCES mdb_licenses (identifier) + FOREIGN KEY (`pid`) REFERENCES mdb_identifiers (`id`), + FOREIGN KEY (`license_id`) REFERENCES mdb_licenses (`identifier`) ) WITH SYSTEM VERSIONING; CREATE TABLE IF NOT EXISTS `mdb_identifier_titles` ( - id UUID NOT NULL DEFAULT UUID(), - pid UUID NOT NULL DEFAULT UUID(), - title TEXT NOT NULL, + id VARCHAR(36) NOT NULL DEFAULT UUID(), + pid VARCHAR(36) NOT NULL, + title TEXT NOT NULL, title_type ENUM ('ALTERNATIVE_TITLE', 'SUBTITLE', 'TRANSLATED_TITLE', 'OTHER'), language VARCHAR(2), - PRIMARY KEY (id), - FOREIGN KEY (pid) REFERENCES mdb_identifiers (id) + PRIMARY KEY (`id`), + FOREIGN KEY (`pid`) REFERENCES mdb_identifiers (`id`) ) WITH SYSTEM VERSIONING; CREATE TABLE IF NOT EXISTS `mdb_identifier_funders` ( - id UUID NOT NULL DEFAULT UUID(), - pid UUID NOT NULL DEFAULT UUID(), + id VARCHAR(36) NOT NULL DEFAULT UUID(), + pid VARCHAR(36) NOT NULL, funder_name VARCHAR(255) NOT NULL, funder_identifier TEXT, funder_identifier_type ENUM ('CROSSREF_FUNDER_ID', 'GRID', 'ISNI', 'ROR', 'OTHER'), @@ -387,37 +385,37 @@ CREATE TABLE IF NOT EXISTS `mdb_identifier_funders` award_number VARCHAR(255), award_title TEXT, language VARCHAR(255), - PRIMARY KEY (id), - FOREIGN KEY (pid) REFERENCES mdb_identifiers (id) + PRIMARY KEY (`id`), + FOREIGN KEY (`pid`) REFERENCES mdb_identifiers (`id`) ) WITH SYSTEM VERSIONING; CREATE TABLE IF NOT EXISTS `mdb_identifier_descriptions` ( - id UUID NOT NULL DEFAULT UUID(), - pid UUID NOT NULL DEFAULT UUID(), - description TEXT NOT NULL, + id VARCHAR(36) NOT NULL DEFAULT UUID(), + pid VARCHAR(36) NOT NULL, + description TEXT NOT NULL, description_type ENUM ('ABSTRACT', 'METHODS', 'SERIES_INFORMATION', 'TABLE_OF_CONTENTS', 'TECHNICAL_INFO', 'OTHER'), language VARCHAR(2), - PRIMARY KEY (id), - FOREIGN KEY (pid) REFERENCES mdb_identifiers (id) + PRIMARY KEY (`id`), + FOREIGN KEY (`pid`) REFERENCES mdb_identifiers (`id`) ) WITH SYSTEM VERSIONING; CREATE TABLE IF NOT EXISTS `mdb_identifier_related` ( - id UUID NOT NULL DEFAULT UUID(), - pid UUID NOT NULL DEFAULT UUID(), + id VARCHAR(36) NOT NULL DEFAULT UUID(), + pid VARCHAR(36) NOT NULL DEFAULT UUID(), value VARCHAR(255) NOT NULL, type ENUM ('DOI','URL','URN','ARK','ARXIV','BIBCODE','EAN13','EISSN','HANDLE','IGSN','ISBN','ISTC','LISSN','LSID','PMID','PURL','UPC','W3ID') NOT NULL, relation ENUM ('IS_CITED_BY','CITES','IS_SUPPLEMENT_TO','IS_SUPPLEMENTED_BY','IS_CONTINUED_BY','CONTINUES','IS_DESCRIBED_BY','DESCRIBES','HAS_METADATA','IS_METADATA_FOR','HAS_VERSION','IS_VERSION_OF','IS_NEW_VERSION_OF','IS_PREVIOUS_VERSION_OF','IS_PART_OF','HAS_PART','IS_PUBLISHED_IN','IS_REFERENCED_BY','REFERENCES','IS_DOCUMENTED_BY','DOCUMENTS','IS_COMPILED_BY','COMPILES','IS_VARIANT_FORM_OF','IS_ORIGINAL_FORM_OF','IS_IDENTICAL_TO','IS_REVIEWED_BY','REVIEWS','IS_DERIVED_FROM','IS_SOURCE_OF','IS_REQUIRED_BY','REQUIRES','IS_OBSOLETED_BY','OBSOLETES') NOT NULL, - PRIMARY KEY (id), /* must be a single id from persistent identifier concept */ - FOREIGN KEY (pid) REFERENCES mdb_identifiers (id), + PRIMARY KEY (`id`), /* must be a single id from persistent identifier concept */ + FOREIGN KEY (`pid`) REFERENCES mdb_identifiers (`id`), UNIQUE (pid, value) ) WITH SYSTEM VERSIONING; CREATE TABLE IF NOT EXISTS `mdb_identifier_creators` ( - id UUID NOT NULL DEFAULT UUID(), - pid UUID NOT NULL DEFAULT UUID(), + id VARCHAR(36) NOT NULL DEFAULT UUID(), + pid VARCHAR(36) NOT NULL, given_names TEXT, family_name TEXT, creator_name VARCHAR(255) NOT NULL, @@ -429,34 +427,36 @@ CREATE TABLE IF NOT EXISTS `mdb_identifier_creators` affiliation_identifier TEXT, affiliation_identifier_scheme ENUM ('ROR', 'GRID', 'ISNI'), affiliation_identifier_scheme_uri TEXT, - PRIMARY KEY (id), - FOREIGN KEY (pid) REFERENCES mdb_identifiers (id) + PRIMARY KEY (`id`), + FOREIGN KEY (`pid`) REFERENCES mdb_identifiers (`id`) ) WITH SYSTEM VERSIONING; CREATE TABLE IF NOT EXISTS `mdb_access` ( aUserID VARCHAR(255) NOT NULL, - aDBID UUID REFERENCES mdb_databases (id), + aDBID VARCHAR(36) NOT NULL, attime TIMESTAMP, download BOOLEAN, created TIMESTAMP NOT NULL DEFAULT NOW(), - PRIMARY KEY (aUserID, aDBID) + PRIMARY KEY (aUserID, aDBID), + FOREIGN KEY (`aDBID`) REFERENCES mdb_databases (`id`) ) WITH SYSTEM VERSIONING; CREATE TABLE IF NOT EXISTS `mdb_have_access` ( - user_id UUID NOT NULL DEFAULT UUID(), - database_id UUID REFERENCES mdb_databases (id), + user_id VARCHAR(36) NOT NULL, + database_id VARCHAR(36) NOT NULL, access_type ENUM ('READ', 'WRITE_OWN', 'WRITE_ALL') NOT NULL, created TIMESTAMP NOT NULL DEFAULT NOW(), PRIMARY KEY (user_id, database_id), - FOREIGN KEY (user_id) REFERENCES mdb_users (id) + FOREIGN KEY (`database_id`) REFERENCES mdb_databases (`id`), + FOREIGN KEY (`user_id`) REFERENCES mdb_users (`id`) ) WITH SYSTEM VERSIONING; CREATE TABLE IF NOT EXISTS `mdb_image_types` ( - id UUID NOT NULL DEFAULT UUID(), - image_id UUID NOT NULL DEFAULT UUID(), + id VARCHAR(36) NOT NULL DEFAULT UUID(), + image_id VARCHAR(36) NOT NULL, display_name VARCHAR(255) NOT NULL, value VARCHAR(255) NOT NULL, size_min INT UNSIGNED, @@ -475,21 +475,21 @@ CREATE TABLE IF NOT EXISTS `mdb_image_types` is_generated BOOLEAN NOT NULL, is_quoted BOOLEAN NOT NULL, is_buildable BOOLEAN NOT NULL, - PRIMARY KEY (id), - FOREIGN KEY (image_id) REFERENCES `mdb_images` (`id`), - UNIQUE (value) + PRIMARY KEY (`id`), + FOREIGN KEY (`image_id`) REFERENCES `mdb_images` (`id`), + UNIQUE (`value`) ) WITH SYSTEM VERSIONING; CREATE TABLE IF NOT EXISTS `mdb_image_operators` ( - id UUID NOT NULL DEFAULT UUID(), - image_id UUID NOT NULL DEFAULT UUID(), + id VARCHAR(36) NOT NULL DEFAULT UUID(), + image_id VARCHAR(36) NOT NULL, display_name VARCHAR(255) NOT NULL, value VARCHAR(255) NOT NULL, documentation TEXT NOT NULL, - PRIMARY KEY (id), - FOREIGN KEY (image_id) REFERENCES `mdb_images` (`id`), - UNIQUE (value) + PRIMARY KEY (`id`), + FOREIGN KEY (`image_id`) REFERENCES `mdb_images` (`id`), + UNIQUE (image_id, value) ) WITH SYSTEM VERSIONING; COMMIT; diff --git a/dbrepo-metadata-db/2_setup-data.sql b/dbrepo-metadata-db/2_setup-data.sql index e806e1e181dbdcc3f0e4e29f837bffac7123317c..dc4917cd8bd1ce95be2159bb225b1524383081e7 100644 --- a/dbrepo-metadata-db/2_setup-data.sql +++ b/dbrepo-metadata-db/2_setup-data.sql @@ -1,8 +1,8 @@ BEGIN; -INSERT INTO `mdb_containers` (name, internal_name, image_id, host, port, ui_host, ui_port, sidecar_host, sidecar_port, - privileged_username, privileged_password) -VALUES ('mariadb:11.1.3-debian-11-r6', 'mariadb_11_1_3', 1, 'data-db', 3306, 'localhost', 3306, 'data-db-sidecar', 8080, - 'root', 'dbrepo'); +INSERT INTO `mdb_containers` (id, name, internal_name, image_id, host, port, ui_host, ui_port, privileged_username, + privileged_password) +VALUES ('6cfb3b8e-1792-4e46-871a-f3d103527203', 'mariadb:11.1.3-debian-11-r6', 'mariadb_11_1_3', + 'd79cb089-363c-488b-9717-649e44d8fcc5', 'data-db', 3306, 'localhost', 3306, 'root', 'dbrepo'); COMMIT; diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/container/ContainerDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/container/ContainerDto.java index bc42dd710598615b4ebbcfece8e146d6182098f1..35bfafdf464d0876e96924b2d98605e41ba14bda 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/container/ContainerDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/container/ContainerDto.java @@ -52,7 +52,6 @@ public class ContainerDto extends CacheableDto { @NotNull private ImageDto image; - @NotNull @Schema(example = "50") private Long quota; diff --git a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/container/Container.java b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/container/Container.java index cd934942a4252f9862e7a8af23f397f55003249c..a8675dcf6f4771391a20bb92be84459f0ba22f04 100644 --- a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/container/Container.java +++ b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/container/Container.java @@ -14,8 +14,6 @@ import java.time.Instant; import java.util.List; import java.util.UUID; -import static jakarta.persistence.GenerationType.IDENTITY; - @Data @Entity @Builder @@ -28,6 +26,7 @@ import static jakarta.persistence.GenerationType.IDENTITY; public class Container { @Id + @GeneratedValue(strategy = GenerationType.UUID) @JdbcTypeCode(java.sql.Types.VARCHAR) @Column(nullable = false, updatable = false, columnDefinition = "VARCHAR(36)") private UUID id; @@ -50,8 +49,8 @@ public class Container { @Column private Integer uiPort; - @Column(nullable = false, columnDefinition = "INT DEFAULT 50") - private Integer quota = 50; + @Column + private Integer quota; @Column private String uiAdditionalFlags; diff --git a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/container/image/ContainerImage.java b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/container/image/ContainerImage.java index 9c3ab4d025ede944f749050aa7ebb049d69fdf75..e291f3977921a020f858c5bcf3229207ed4d8dcf 100644 --- a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/container/image/ContainerImage.java +++ b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/container/image/ContainerImage.java @@ -30,6 +30,7 @@ import static jakarta.persistence.GenerationType.IDENTITY; public class ContainerImage { @Id + @GeneratedValue(strategy = GenerationType.UUID) @JdbcTypeCode(java.sql.Types.VARCHAR) @Column(nullable = false, updatable = false, columnDefinition = "VARCHAR(36)") private UUID id; diff --git a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/container/image/DataType.java b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/container/image/DataType.java index a50589a520d5e3f97f1123fa358b559f0adb41f3..2c5243752ef2dccdb9efa6b626c07566a789039b 100644 --- a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/container/image/DataType.java +++ b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/container/image/DataType.java @@ -21,6 +21,7 @@ import static jakarta.persistence.GenerationType.IDENTITY; public class DataType { @Id + @GeneratedValue(strategy = GenerationType.UUID) @JdbcTypeCode(java.sql.Types.VARCHAR) @Column(nullable = false, updatable = false, columnDefinition = "VARCHAR(36)") private UUID id; diff --git a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/container/image/Operator.java b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/container/image/Operator.java index fe08717aa13d0cf37fcae8b20f87ba5100f849ad..3dbeca6ae79ac4e79aafd5069ebc030ecf4d232c 100644 --- a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/container/image/Operator.java +++ b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/container/image/Operator.java @@ -19,6 +19,7 @@ import java.util.UUID; public class Operator { @Id + @GeneratedValue(strategy = GenerationType.UUID) @JdbcTypeCode(java.sql.Types.VARCHAR) @Column(nullable = false, updatable = false, columnDefinition = "VARCHAR(36)") private UUID id; diff --git a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/Database.java b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/Database.java index f96fc6c2e9365d607a59a274956a687f701517e3..2f358c5cb36165fd163a5c8a6ddfb41747179aac 100644 --- a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/Database.java +++ b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/Database.java @@ -42,6 +42,7 @@ import static jakarta.persistence.GenerationType.IDENTITY; public class Database implements Serializable { @Id + @GeneratedValue(strategy = GenerationType.UUID) @JdbcTypeCode(java.sql.Types.VARCHAR) @Column(nullable = false, updatable = false, columnDefinition = "VARCHAR(36)") private UUID id; diff --git a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/View.java b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/View.java index 6ec503b99677690b5e3cbe4e8c8acb3f1102e1e9..917f28506111ebde8a0d56360efff0a78222104a 100644 --- a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/View.java +++ b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/View.java @@ -35,6 +35,7 @@ import java.util.UUID; public class View { @Id + @GeneratedValue(strategy = GenerationType.UUID) @JdbcTypeCode(java.sql.Types.VARCHAR) @Column(nullable = false, updatable = false, columnDefinition = "VARCHAR(36)") private UUID id; diff --git a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/ViewColumn.java b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/ViewColumn.java index f021cca2147a5f5db85f9255b9c128507eed449d..990e6dc804ba89e996da7f2e120e5bf27d83142f 100644 --- a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/ViewColumn.java +++ b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/ViewColumn.java @@ -24,6 +24,7 @@ import static jakarta.persistence.GenerationType.IDENTITY; public class ViewColumn implements Comparable<ViewColumn> { @Id + @GeneratedValue(strategy = GenerationType.UUID) @JdbcTypeCode(java.sql.Types.VARCHAR) @Column(nullable = false, updatable = false, columnDefinition = "VARCHAR(36)") private UUID id; diff --git a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/table/Table.java b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/table/Table.java index 31587c1ea9fa3f29a21c353f6dd684fc0eb8c2d3..9cf54a15d880b300b199d663feddc50b84bc54a9 100644 --- a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/table/Table.java +++ b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/table/Table.java @@ -38,6 +38,7 @@ import static jakarta.persistence.GenerationType.IDENTITY; public class Table { @Id + @GeneratedValue(strategy = GenerationType.UUID) @JdbcTypeCode(java.sql.Types.VARCHAR) @Column(nullable = false, updatable = false, columnDefinition = "VARCHAR(36)") private UUID id; diff --git a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/table/columns/TableColumn.java b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/table/columns/TableColumn.java index e0cf96bd333972815e67e7c4c0d865a64c54b956..81b3046d0b7ae49dbb14156071313bd3367570b6 100644 --- a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/table/columns/TableColumn.java +++ b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/table/columns/TableColumn.java @@ -33,6 +33,7 @@ import static jakarta.persistence.GenerationType.IDENTITY; public class TableColumn implements Comparable<TableColumn> { @Id + @GeneratedValue(strategy = GenerationType.UUID) @JdbcTypeCode(java.sql.Types.VARCHAR) @Column(nullable = false, updatable = false, columnDefinition = "VARCHAR(36)") private UUID id; diff --git a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/table/columns/TableColumnConcept.java b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/table/columns/TableColumnConcept.java index 2339ba44eab823881cdc8b24b25f46328a5de825..8744385be57e80c8940feaf9a427a580b0136008 100644 --- a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/table/columns/TableColumnConcept.java +++ b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/table/columns/TableColumnConcept.java @@ -31,6 +31,7 @@ import static jakarta.persistence.GenerationType.IDENTITY; public class TableColumnConcept { @Id + @GeneratedValue(strategy = GenerationType.UUID) @JdbcTypeCode(java.sql.Types.VARCHAR) @Column(nullable = false, updatable = false, columnDefinition = "VARCHAR(36)") private UUID id; diff --git a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/table/columns/TableColumnUnit.java b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/table/columns/TableColumnUnit.java index 55c1fbd23e8e00fc602c9e949767deb42a4c9521..087ce4df9ace28576d77a45efa31f6fe076ef7b0 100644 --- a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/table/columns/TableColumnUnit.java +++ b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/table/columns/TableColumnUnit.java @@ -31,6 +31,7 @@ import static jakarta.persistence.GenerationType.IDENTITY; public class TableColumnUnit { @Id + @GeneratedValue(strategy = GenerationType.UUID) @JdbcTypeCode(java.sql.Types.VARCHAR) @Column(nullable = false, updatable = false, columnDefinition = "VARCHAR(36)") private UUID id; diff --git a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/table/constraints/foreignKey/ForeignKey.java b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/table/constraints/foreignKey/ForeignKey.java index 955a7d5b76048c72dc2cd90d8eba2b6127b7206b..a1a9aec1ac94b34bc1c6462ed4374b550bd1adb3 100644 --- a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/table/constraints/foreignKey/ForeignKey.java +++ b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/table/constraints/foreignKey/ForeignKey.java @@ -21,6 +21,7 @@ import java.util.UUID; public class ForeignKey { @Id + @GeneratedValue(strategy = GenerationType.UUID) @JdbcTypeCode(java.sql.Types.VARCHAR) @Column(name = "fkid", nullable = false, columnDefinition = "VARCHAR(36)") private UUID id; diff --git a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/table/constraints/foreignKey/ForeignKeyReference.java b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/table/constraints/foreignKey/ForeignKeyReference.java index 94d4d6d46a01c75197b9579cb177eb6e32120e28..bb7be45c4150628e7b8dbe07be4ddcd3c91dcefd 100644 --- a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/table/constraints/foreignKey/ForeignKeyReference.java +++ b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/table/constraints/foreignKey/ForeignKeyReference.java @@ -24,6 +24,7 @@ import static jakarta.persistence.GenerationType.IDENTITY; public class ForeignKeyReference { @Id + @GeneratedValue(strategy = GenerationType.UUID) @JdbcTypeCode(java.sql.Types.VARCHAR) @Column(nullable = false, updatable = false, columnDefinition = "VARCHAR(36)") private UUID id; diff --git a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/table/constraints/primaryKey/PrimaryKey.java b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/table/constraints/primaryKey/PrimaryKey.java index 9a613ffac6dc849dc579c6779131780f553fd9a4..37dcceaec7280df9bc309601f7299edd5d8f93e1 100644 --- a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/table/constraints/primaryKey/PrimaryKey.java +++ b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/table/constraints/primaryKey/PrimaryKey.java @@ -21,6 +21,7 @@ import java.util.UUID; public class PrimaryKey { @Id + @GeneratedValue(strategy = GenerationType.UUID) @JdbcTypeCode(java.sql.Types.VARCHAR) @Column(name = "pkid", nullable = false, columnDefinition = "VARCHAR(36)") private UUID id; diff --git a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/table/constraints/unique/Unique.java b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/table/constraints/unique/Unique.java index 7d7b7fdde5063c3436926217626e5f5cefcd1598..4f6a371f8ee12b555dc3bcb8c447300b895d50d1 100644 --- a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/table/constraints/unique/Unique.java +++ b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/table/constraints/unique/Unique.java @@ -22,6 +22,7 @@ import java.util.UUID; public class Unique { @Id + @GeneratedValue(strategy = GenerationType.UUID) @JdbcTypeCode(java.sql.Types.VARCHAR) @Column(name = "uid", nullable = false, columnDefinition = "VARCHAR(36)") private UUID id; diff --git a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/identifier/Creator.java b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/identifier/Creator.java index 6875a8d32d1ccd2d25ddd13b8f3c518eddf04f89..bf749fd51b0e2ff2648dd969b01fedaca9f895bf 100644 --- a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/identifier/Creator.java +++ b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/identifier/Creator.java @@ -21,6 +21,7 @@ import static jakarta.persistence.GenerationType.IDENTITY; public class Creator { @Id + @GeneratedValue(strategy = GenerationType.UUID) @JdbcTypeCode(java.sql.Types.VARCHAR) @Column(nullable = false, updatable = false, columnDefinition = "VARCHAR(36)") private UUID id; diff --git a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/identifier/Identifier.java b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/identifier/Identifier.java index ce202f8b997044f83e3e9646b22f94108442d9b0..d71897893171da81b5dd23f1937f622f0a475704 100644 --- a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/identifier/Identifier.java +++ b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/identifier/Identifier.java @@ -39,6 +39,7 @@ import static jakarta.persistence.GenerationType.IDENTITY; public class Identifier implements Serializable { @Id + @GeneratedValue(strategy = GenerationType.UUID) @JdbcTypeCode(java.sql.Types.VARCHAR) @Column(nullable = false, updatable = false, columnDefinition = "VARCHAR(36)") private UUID id; diff --git a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/identifier/IdentifierDescription.java b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/identifier/IdentifierDescription.java index 693ede514213f377fd5fffbf12e643cc61e30e88..e8628ce07e5352fcfa10ba4ceb2dd9918e5fdcdf 100644 --- a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/identifier/IdentifierDescription.java +++ b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/identifier/IdentifierDescription.java @@ -23,6 +23,7 @@ import static jakarta.persistence.GenerationType.IDENTITY; public class IdentifierDescription implements Serializable { @Id + @GeneratedValue(strategy = GenerationType.UUID) @JdbcTypeCode(java.sql.Types.VARCHAR) @Column(nullable = false, updatable = false, columnDefinition = "VARCHAR(36)") private UUID id; diff --git a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/identifier/IdentifierFunder.java b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/identifier/IdentifierFunder.java index ac7632f3198fe20b3fafbb80c256770304f1bcb3..93ef2536cea2a129dcf46ad244735ec6beb0fef6 100644 --- a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/identifier/IdentifierFunder.java +++ b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/identifier/IdentifierFunder.java @@ -22,6 +22,7 @@ import static jakarta.persistence.GenerationType.IDENTITY; public class IdentifierFunder implements Serializable { @Id + @GeneratedValue(strategy = GenerationType.UUID) @JdbcTypeCode(java.sql.Types.VARCHAR) @Column(nullable = false, updatable = false, columnDefinition = "VARCHAR(36)") private UUID id; diff --git a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/identifier/IdentifierTitle.java b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/identifier/IdentifierTitle.java index 5f91afb73625a2839a9618dac6c139a7197cbe66..2f8e94d61a4f7ec4be4bc97247effe0485e43f3b 100644 --- a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/identifier/IdentifierTitle.java +++ b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/identifier/IdentifierTitle.java @@ -23,6 +23,7 @@ import static jakarta.persistence.GenerationType.IDENTITY; public class IdentifierTitle implements Serializable { @Id + @GeneratedValue(strategy = GenerationType.UUID) @JdbcTypeCode(java.sql.Types.VARCHAR) @Column(nullable = false, updatable = false, columnDefinition = "VARCHAR(36)") private UUID id; diff --git a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/identifier/RelatedIdentifier.java b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/identifier/RelatedIdentifier.java index 244a0ec28aaaaf2e34ce452c89dc394a6cac6093..8b8bc9108426a5fe1a666ec78c0b6348e2a94a13 100644 --- a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/identifier/RelatedIdentifier.java +++ b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/identifier/RelatedIdentifier.java @@ -21,6 +21,7 @@ import java.util.UUID; public class RelatedIdentifier { @Id + @GeneratedValue(strategy = GenerationType.UUID) @JdbcTypeCode(java.sql.Types.VARCHAR) @Column(nullable = false, updatable = false, columnDefinition = "VARCHAR(36)") private UUID id; diff --git a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/maintenance/BannerMessage.java b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/maintenance/BannerMessage.java index c4f71251da85dc5f111273706f983cb8e3896faa..a447668a082561f9c18cd5eabcbbaefd79066b1f 100644 --- a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/maintenance/BannerMessage.java +++ b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/maintenance/BannerMessage.java @@ -25,6 +25,7 @@ import static jakarta.persistence.GenerationType.IDENTITY; public class BannerMessage { @Id + @GeneratedValue(strategy = GenerationType.UUID) @JdbcTypeCode(java.sql.Types.VARCHAR) @Column(nullable = false, updatable = false, columnDefinition = "VARCHAR(36)") private UUID id; diff --git a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/semantics/Ontology.java b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/semantics/Ontology.java index 46d86f6c1d916699ba019648c751fb51d98da0e6..da73616077b4a68a125eceb40ccb2177dd3d2ecf 100644 --- a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/semantics/Ontology.java +++ b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/semantics/Ontology.java @@ -29,6 +29,7 @@ import static jakarta.persistence.GenerationType.IDENTITY; public class Ontology { @Id + @GeneratedValue(strategy = GenerationType.UUID) @JdbcTypeCode(java.sql.Types.VARCHAR) @Column(nullable = false, updatable = false, columnDefinition = "VARCHAR(36)") private UUID id; diff --git a/dbrepo-metadata-service/rest-service/src/main/java/at/tuwien/endpoints/DatabaseEndpoint.java b/dbrepo-metadata-service/rest-service/src/main/java/at/tuwien/endpoints/DatabaseEndpoint.java index 7daa200f2bd19381adca442a0251ff310b7b51e7..ec0810b23ca31157fd143cfb402e0cbf148f6528 100644 --- a/dbrepo-metadata-service/rest-service/src/main/java/at/tuwien/endpoints/DatabaseEndpoint.java +++ b/dbrepo-metadata-service/rest-service/src/main/java/at/tuwien/endpoints/DatabaseEndpoint.java @@ -161,7 +161,7 @@ public class DatabaseEndpoint extends AbstractEndpoint { ContainerQuotaException { log.debug("endpoint create database, data.name={}", data.getName()); final Container container = containerService.find(data.getCid()); - if (container.getDatabases().size() + 1 > container.getQuota()) { + if (container.getQuota() != null && container.getDatabases().size() + 1 > container.getQuota()) { log.error("Failed to create database: quota of {} exceeded", container.getQuota()); throw new ContainerQuotaException("Failed to create database: quota of " + container.getQuota() + " exceeded"); } @@ -548,7 +548,8 @@ public class DatabaseEndpoint extends AbstractEndpoint { if (isSystem(principal)) { headers.set("X-Username", database.getContainer().getPrivilegedUsername()); headers.set("X-Password", database.getContainer().getPrivilegedPassword()); - headers.set("Access-Control-Expose-Headers", "X-Username X-Password"); + headers.set("X-Jdbc-Method", database.getContainer().getImage().getJdbcMethod()); + headers.set("Access-Control-Expose-Headers", "X-Username X-Password X-Jdbc-Method"); } else { removeInternalData(dto.getContainer()); } diff --git a/dbrepo-metadata-service/rest-service/src/main/java/at/tuwien/endpoints/TableEndpoint.java b/dbrepo-metadata-service/rest-service/src/main/java/at/tuwien/endpoints/TableEndpoint.java index 06c5fa41f51c771353ea6a4c18363655a6dd062d..c3f4ad1a71cf2d77bcbe9f241bb9150dd709da00 100644 --- a/dbrepo-metadata-service/rest-service/src/main/java/at/tuwien/endpoints/TableEndpoint.java +++ b/dbrepo-metadata-service/rest-service/src/main/java/at/tuwien/endpoints/TableEndpoint.java @@ -490,7 +490,8 @@ public class TableEndpoint extends AbstractEndpoint { if (isSystem(principal)) { headers.set("X-Username", table.getDatabase().getContainer().getPrivilegedUsername()); headers.set("X-Password", table.getDatabase().getContainer().getPrivilegedPassword()); - headers.set("Access-Control-Expose-Headers", "X-Username X-Password"); + headers.set("X-Jdbc-Method", table.getDatabase().getContainer().getImage().getJdbcMethod()); + headers.set("Access-Control-Expose-Headers", "X-Username X-Password X-Jdbc-Method"); } else { removeInternalData(dto.getDatabase().getContainer()); } diff --git a/dbrepo-metadata-service/rest-service/src/main/java/at/tuwien/endpoints/ViewEndpoint.java b/dbrepo-metadata-service/rest-service/src/main/java/at/tuwien/endpoints/ViewEndpoint.java index 9b8c73a154e299fb5c965869a1ee41241b43d183..2214343ee67ae5e8c0d1acca7857e08cb08f275b 100644 --- a/dbrepo-metadata-service/rest-service/src/main/java/at/tuwien/endpoints/ViewEndpoint.java +++ b/dbrepo-metadata-service/rest-service/src/main/java/at/tuwien/endpoints/ViewEndpoint.java @@ -201,7 +201,8 @@ public class ViewEndpoint extends AbstractEndpoint { headers.set("X-Type", database.getContainer().getImage().getJdbcMethod()); headers.set("X-Database", database.getInternalName()); headers.set("X-View", view.getInternalName()); - headers.set("Access-Control-Expose-Headers", "X-Username X-Password X-Host X-Port X-Type X-Database X-View"); + headers.set("X-Jdbc-Method", view.getDatabase().getContainer().getImage().getJdbcMethod()); + headers.set("Access-Control-Expose-Headers", "X-Username X-Password X-Host X-Port X-Type X-Database X-View X-Jdbc-Method"); } final ViewDto dto = metadataMapper.viewToViewDto(view); if (!isSystem(principal)) { diff --git a/dbrepo-metadata-service/rest-service/src/test/java/at/tuwien/endpoints/ViewEndpointUnitTest.java b/dbrepo-metadata-service/rest-service/src/test/java/at/tuwien/endpoints/ViewEndpointUnitTest.java index 29849105cfdcae19ab76b0c5ad81a5de43b41194..1fa3d599206b7c25f31b383be3efba6d8f4bdef8 100644 --- a/dbrepo-metadata-service/rest-service/src/test/java/at/tuwien/endpoints/ViewEndpointUnitTest.java +++ b/dbrepo-metadata-service/rest-service/src/test/java/at/tuwien/endpoints/ViewEndpointUnitTest.java @@ -190,7 +190,8 @@ public class ViewEndpointUnitTest extends AbstractUnitTest { assertEquals(List.of(IMAGE_1_JDBC), headers.get("X-Type")); assertEquals(List.of(DATABASE_3_INTERNALNAME), headers.get("X-Database")); assertEquals(List.of(VIEW_5_INTERNAL_NAME), headers.get("X-View")); - assertEquals(List.of("X-Username X-Password X-Host X-Port X-Type X-Database X-View"), headers.get("Access-Control-Expose-Headers")); + assertEquals(List.of(IMAGE_1_JDBC), headers.get("X-Jdbc-Method")); + assertEquals(List.of("X-Username X-Password X-Host X-Port X-Type X-Database X-View X-Jdbc-Method"), headers.get("Access-Control-Expose-Headers")); } @Test diff --git a/dbrepo-metadata-service/rest-service/src/test/java/at/tuwien/mvc/AuthenticationPrivilegedIntegrationMvcTest.java b/dbrepo-metadata-service/rest-service/src/test/java/at/tuwien/mvc/AuthenticationPrivilegedIntegrationMvcTest.java index 0365db6c4a09dfaedb742528b3bb08d4784d53f1..d86626a8efdacee3017ddcc51f7a92dfc3afe31f 100644 --- a/dbrepo-metadata-service/rest-service/src/test/java/at/tuwien/mvc/AuthenticationPrivilegedIntegrationMvcTest.java +++ b/dbrepo-metadata-service/rest-service/src/test/java/at/tuwien/mvc/AuthenticationPrivilegedIntegrationMvcTest.java @@ -115,7 +115,8 @@ public class AuthenticationPrivilegedIntegrationMvcTest extends AbstractUnitTest .andDo(print()) .andExpect(header().string("X-Username", CONTAINER_1_PRIVILEGED_USERNAME)) .andExpect(header().string("X-Password", CONTAINER_1_PRIVILEGED_PASSWORD)) - .andExpect(header().string("Access-Control-Expose-Headers", "X-Username X-Password")) + .andExpect(header().string("X-Jdbc-Method", IMAGE_1_JDBC)) + .andExpect(header().string("Access-Control-Expose-Headers", "X-Username X-Password X-Jdbc-Method")) .andExpect(status().isOk()); } @@ -131,7 +132,8 @@ public class AuthenticationPrivilegedIntegrationMvcTest extends AbstractUnitTest .andDo(print()) .andExpect(header().string("X-Username", CONTAINER_1_PRIVILEGED_USERNAME)) .andExpect(header().string("X-Password", CONTAINER_1_PRIVILEGED_PASSWORD)) - .andExpect(header().string("Access-Control-Expose-Headers", "X-Username X-Password")) + .andExpect(header().string("X-Jdbc-Method", IMAGE_1_JDBC)) + .andExpect(header().string("Access-Control-Expose-Headers", "X-Username X-Password X-Jdbc-Method")) .andExpect(status().isOk()); } @@ -148,7 +150,8 @@ public class AuthenticationPrivilegedIntegrationMvcTest extends AbstractUnitTest .andDo(print()) .andExpect(header().string("X-Username", CONTAINER_1_PRIVILEGED_USERNAME)) .andExpect(header().string("X-Password", CONTAINER_1_PRIVILEGED_PASSWORD)) - .andExpect(header().string("Access-Control-Expose-Headers", "X-Username X-Password")) + .andExpect(header().string("X-Jdbc-Method", IMAGE_1_JDBC)) + .andExpect(header().string("Access-Control-Expose-Headers", "X-Username X-Password X-Jdbc-Method")) .andExpect(status().isOk()); } @@ -178,7 +181,8 @@ public class AuthenticationPrivilegedIntegrationMvcTest extends AbstractUnitTest .andDo(print()) .andExpect(header().string("X-Username", CONTAINER_1_PRIVILEGED_USERNAME)) .andExpect(header().string("X-Password", CONTAINER_1_PRIVILEGED_PASSWORD)) - .andExpect(header().string("Access-Control-Expose-Headers", "X-Username X-Password")) + .andExpect(header().string("X-Jdbc-Method", IMAGE_1_JDBC)) + .andExpect(header().string("Access-Control-Expose-Headers", "X-Username X-Password X-Jdbc-Method")) .andExpect(status().isOk()); } diff --git a/dbrepo-metadata-service/services/src/main/java/at/tuwien/service/impl/AccessServiceImpl.java b/dbrepo-metadata-service/services/src/main/java/at/tuwien/service/impl/AccessServiceImpl.java index 1c302c206871234da50f2cc9de234d7c94a84d66..e5b59ebda8accad54421a1ed9834c7114b9ab911 100644 --- a/dbrepo-metadata-service/services/src/main/java/at/tuwien/service/impl/AccessServiceImpl.java +++ b/dbrepo-metadata-service/services/src/main/java/at/tuwien/service/impl/AccessServiceImpl.java @@ -72,8 +72,8 @@ public class AccessServiceImpl implements AccessService { .hdbid(database.getId()) .database(database) .huserid(user.getId()) - .type(metadataMapper.accessTypeDtoToAccessType(type)) .user(user) + .type(metadataMapper.accessTypeDtoToAccessType(type)) .build(); database.getAccesses() .add(access); diff --git a/dbrepo-metadata-service/services/src/main/java/at/tuwien/service/impl/DatabaseServiceImpl.java b/dbrepo-metadata-service/services/src/main/java/at/tuwien/service/impl/DatabaseServiceImpl.java index cc2da3c3743480480e21cd55c0842da6a0f169bf..7e3298ef09d236b55720183c576ecd8284e5dd3d 100644 --- a/dbrepo-metadata-service/services/src/main/java/at/tuwien/service/impl/DatabaseServiceImpl.java +++ b/dbrepo-metadata-service/services/src/main/java/at/tuwien/service/impl/DatabaseServiceImpl.java @@ -130,10 +130,10 @@ public class DatabaseServiceImpl implements DatabaseService { final Database entity1 = databaseRepository.save(entity); entity1.getAccesses() .add(metadataMapper.userToWriteAllAccess(entity1, user)); - entity1.getAccesses() - .addAll(internalUsers.stream() - .map(internalUser -> metadataMapper.userToWriteAllAccess(entity1, internalUser)) - .toList()); +// entity1.getAccesses() +// .addAll(internalUsers.stream() +// .map(internalUser -> metadataMapper.userToWriteAllAccess(entity1, internalUser)) +// .toList()); final Database database = databaseRepository.save(entity1); /* create in search service */ searchServiceGateway.update(database); diff --git a/dbrepo-search-service/Pipfile.lock b/dbrepo-search-service/Pipfile.lock index f6db779333032ad20a626e70890a1ce7852d67c1..4dd148a5e49ea67bed885631abe6a387c133682b 100644 --- a/dbrepo-search-service/Pipfile.lock +++ b/dbrepo-search-service/Pipfile.lock @@ -369,7 +369,7 @@ }, "dbrepo": { "hashes": [ - "sha256:b555d9cbbbc07f1bd8f449b7bb38b2f7221f86b897bff08dd7c34933befae865" + "sha256:779e7ee84ae91131e16100fee7143013b4c231dcd3990d418d024ff76af271e9" ], "path": "./lib/dbrepo-1.7.0.tar.gz" }, diff --git a/dbrepo-search-service/app.py b/dbrepo-search-service/app.py index 13a9be870405ad27463cb5e21681f76dd82947aa..8e265465326bea0a61a9772c93b22143243921a3 100644 --- a/dbrepo-search-service/app.py +++ b/dbrepo-search-service/app.py @@ -5,6 +5,8 @@ from json import dumps from typing import List, Any import requests +from clients.keycloak_client import User, KeycloakClient +from clients.opensearch_client import OpenSearchClient, flatten from dbrepo.api.dto import Database, ApiError from flasgger import LazyJSONEncoder, Swagger, swag_from from flask import Flask, request, Response @@ -16,9 +18,6 @@ from prometheus_flask_exporter import PrometheusMetrics from pydantic import ValidationError from pydantic.deprecated.json import pydantic_encoder -from clients.keycloak_client import User, KeycloakClient -from clients.opensearch_client import OpenSearchClient, flatten - logging.addLevelName(level=logging.NOTSET, levelName='TRACE') logging.basicConfig(level=logging.DEBUG) @@ -412,11 +411,11 @@ def post_general_search(field_type): return Response(dumps(response, default=pydantic_encoder)), 200, {'Content-Type': 'application/json'} -@app.route("/api/search/database/<int:database_id>", methods=["PUT"], endpoint="search_put_database") +@app.route("/api/search/database/<string:database_id>", methods=["PUT"], endpoint="search_put_database") @metrics.gauge(name='dbrepo_search_update_database', description='Time needed to update a database in the search database') @auth.login_required(role=['update-search-index']) -def update_database(database_id: int): +def update_database(database_id: str): logging.debug(f"updating database with id: {database_id}") try: payload: Database = Database.model_validate(request.json) @@ -429,11 +428,11 @@ def update_database(database_id: int): return database.model_dump(), 202 -@app.route("/api/search/database/<int:database_id>", methods=["DELETE"], endpoint="database_delete_database") +@app.route("/api/search/database/<string:database_id>", methods=["DELETE"], endpoint="database_delete_database") @metrics.gauge(name='dbrepo_search_delete_database', description='Time needed to delete a database in the search database') @auth.login_required(role=['admin']) -def delete_database(database_id: int): +def delete_database(database_id: str): try: OpenSearchClient().delete_database(database_id) return Response(dumps({})), 202 diff --git a/dbrepo-search-service/init/Pipfile.lock b/dbrepo-search-service/init/Pipfile.lock index 5136c21707d1e3f339c703e1d82aaef96e63d9a7..11510c1f53745a2c4bd2e01476fdef323f4423b8 100644 --- a/dbrepo-search-service/init/Pipfile.lock +++ b/dbrepo-search-service/init/Pipfile.lock @@ -259,7 +259,7 @@ }, "dbrepo": { "hashes": [ - "sha256:b555d9cbbbc07f1bd8f449b7bb38b2f7221f86b897bff08dd7c34933befae865" + "sha256:779e7ee84ae91131e16100fee7143013b4c231dcd3990d418d024ff76af271e9" ], "path": "./lib/dbrepo-1.7.0.tar.gz" }, diff --git a/dbrepo-search-service/init/database.json b/dbrepo-search-service/init/database.json index 59cbd78438a5fff391d1237c70a0384d7b397a83..175a50dd9b829d0ce855a5c9eceae694937009cc 100644 --- a/dbrepo-search-service/init/database.json +++ b/dbrepo-search-service/init/database.json @@ -131,7 +131,13 @@ } }, "id": { - "type": "long" + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } }, "image": { "properties": { @@ -154,9 +160,6 @@ } }, "id": { - "type": "long" - }, - "jdbc_method": { "type": "text", "fields": { "keyword": { @@ -215,18 +218,6 @@ "port": { "type": "long" }, - "sidecar_host": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "sidecar_port": { - "type": "long" - }, "ui_host": { "type": "text", "fields": { @@ -303,7 +294,13 @@ } }, "id": { - "type": "long" + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } }, "identifiers": { "properties": { @@ -371,7 +368,13 @@ } }, "id": { - "type": "long" + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } }, "name_identifier": { "type": "text", @@ -412,7 +415,13 @@ } }, "database_id": { - "type": "long" + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } }, "descriptions": { "properties": { @@ -426,12 +435,24 @@ } }, "id": { - "type": "long" + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } } } }, "id": { - "type": "long" + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } }, "licenses": { "properties": { @@ -512,7 +533,13 @@ "titles": { "properties": { "id": { - "type": "long" + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } }, "title": { "type": "text", @@ -535,7 +562,13 @@ } }, "view_id": { - "type": "long" + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } } } }, @@ -592,10 +625,22 @@ "type": "long" }, "database_id": { - "type": "long" + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } }, "id": { - "type": "long" + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } }, "internal_name": { "type": "text", @@ -634,7 +679,13 @@ "type": "float" }, "table_id": { - "type": "long" + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } } } }, @@ -645,26 +696,62 @@ "column": { "properties": { "database_id": { - "type": "long" + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } }, "id": { - "type": "long" + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } }, "table_id": { - "type": "long" + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } } } }, "id": { - "type": "long" + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } }, "table": { "properties": { "database_id": { - "type": "long" + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } }, "id": { - "type": "long" + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } } } } @@ -675,26 +762,62 @@ "columns": { "properties": { "database_id": { - "type": "long" + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } }, "id": { - "type": "long" + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } }, "table_id": { - "type": "long" + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } } } }, "id": { - "type": "long" + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } }, "table": { "properties": { "database_id": { - "type": "long" + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } }, "id": { - "type": "long" + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } } } } @@ -758,7 +881,13 @@ "type": "long" }, "database_id": { - "type": "long" + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } }, "description": { "type": "text", @@ -770,7 +899,13 @@ } }, "id": { - "type": "long" + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } }, "internal_name": { "type": "text", @@ -839,10 +974,22 @@ } }, "database_id": { - "type": "long" + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } }, "id": { - "type": "long" + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } }, "internal_name": { "type": "text", @@ -926,10 +1073,22 @@ } }, "database_id": { - "type": "long" + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } }, "id": { - "type": "long" + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } }, "identifiers": { "properties": { @@ -997,7 +1156,13 @@ } }, "id": { - "type": "long" + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } }, "name_identifier": { "type": "text", @@ -1038,7 +1203,13 @@ } }, "database_id": { - "type": "long" + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } }, "descriptions": { "properties": { @@ -1052,12 +1223,24 @@ } }, "id": { - "type": "long" + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } } } }, "id": { - "type": "long" + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } }, "licenses": { "properties": { @@ -1138,7 +1321,13 @@ "titles": { "properties": { "id": { - "type": "long" + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } }, "title": { "type": "text", @@ -1161,7 +1350,13 @@ } }, "view_id": { - "type": "long" + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } } } }, diff --git a/dbrepo-search-service/init/lib/dbrepo-1.7.0-py3-none-any.whl b/dbrepo-search-service/init/lib/dbrepo-1.7.0-py3-none-any.whl index 42c0e32ce8e4f895afa9e105ecdcb3d508ba2257..f75ec9ba7a7a4ad6c2897e38abdae20c815f56c7 100644 Binary files a/dbrepo-search-service/init/lib/dbrepo-1.7.0-py3-none-any.whl and b/dbrepo-search-service/init/lib/dbrepo-1.7.0-py3-none-any.whl differ diff --git a/dbrepo-search-service/init/lib/dbrepo-1.7.0.tar.gz b/dbrepo-search-service/init/lib/dbrepo-1.7.0.tar.gz index 8ecf0661cfdd270b33d7fe4e8bdce444569e995c..be1dcfe68165001dbeacd670709955723a01e323 100644 Binary files a/dbrepo-search-service/init/lib/dbrepo-1.7.0.tar.gz and b/dbrepo-search-service/init/lib/dbrepo-1.7.0.tar.gz differ diff --git a/dbrepo-search-service/lib/dbrepo-1.7.0-py3-none-any.whl b/dbrepo-search-service/lib/dbrepo-1.7.0-py3-none-any.whl index 42c0e32ce8e4f895afa9e105ecdcb3d508ba2257..f75ec9ba7a7a4ad6c2897e38abdae20c815f56c7 100644 Binary files a/dbrepo-search-service/lib/dbrepo-1.7.0-py3-none-any.whl and b/dbrepo-search-service/lib/dbrepo-1.7.0-py3-none-any.whl differ diff --git a/dbrepo-search-service/lib/dbrepo-1.7.0.tar.gz b/dbrepo-search-service/lib/dbrepo-1.7.0.tar.gz index 8ecf0661cfdd270b33d7fe4e8bdce444569e995c..be1dcfe68165001dbeacd670709955723a01e323 100644 Binary files a/dbrepo-search-service/lib/dbrepo-1.7.0.tar.gz and b/dbrepo-search-service/lib/dbrepo-1.7.0.tar.gz differ diff --git a/dbrepo-ui/components/database/DatabaseCreate.vue b/dbrepo-ui/components/database/DatabaseCreate.vue index 07fd9d34ea218a91bb6ffb634d210bd5493ad830..177e640aa966f74060a8645297194c6d48d7dd7a 100644 --- a/dbrepo-ui/components/database/DatabaseCreate.vue +++ b/dbrepo-ui/components/database/DatabaseCreate.vue @@ -46,7 +46,7 @@ return-object required> <template - v-if="engine" + v-if="engine && engine.quota" v-slot:details> {{ $t('pages.database.subpages.create.utilization.label') }} {{ engine.count }}/{{ engine.quota }} </template> @@ -139,7 +139,7 @@ export default { this.loadingContainers = true containerService.findAll() .then((containers) => { - const freeContainers = containers.filter(c => c.count < c.quota) + const freeContainers = containers.filter(c => c.quota === null || c.count < c.quota) const defaultContainers = freeContainers.filter(c => c.image.default) defaultContainers.sort(this.compareContainerUtilization) this.engines = defaultContainers diff --git a/dbrepo-ui/components/dialogs/EditMaintenanceMessage.vue b/dbrepo-ui/components/dialogs/EditMaintenanceMessage.vue index 4940e75d66b28254449ce3ddf834dfa9fce83c7f..d391ac153a290256db7f287d75d71c346379ce68 100644 --- a/dbrepo-ui/components/dialogs/EditMaintenanceMessage.vue +++ b/dbrepo-ui/components/dialogs/EditMaintenanceMessage.vue @@ -89,7 +89,7 @@ import { useCacheStore } from '@/stores/cache.js' export default { props: { id: { - type: Number, + type: String, default () { return null } diff --git a/dbrepo-ui/components/dialogs/Semantics.vue b/dbrepo-ui/components/dialogs/Semantics.vue index e68a4fa55d245cbcb6ad052a8952ad96a9de5e53..ff59effa956f6b9ed1bea61ec9bec5f92bd76312 100644 --- a/dbrepo-ui/components/dialogs/Semantics.vue +++ b/dbrepo-ui/components/dialogs/Semantics.vue @@ -147,8 +147,8 @@ export default { default: () => null }, tableId: { - type: Number, - default: () => -1 + type: String, + default: () => null }, mode: { type: String, diff --git a/dbrepo-ui/components/dialogs/ViewVisibility.vue b/dbrepo-ui/components/dialogs/ViewVisibility.vue index 6a37bf415348ac9b2fe1c705bd40e762596db26c..7ccdb12df6658de6e6216d632b7fc15619a4a2c6 100644 --- a/dbrepo-ui/components/dialogs/ViewVisibility.vue +++ b/dbrepo-ui/components/dialogs/ViewVisibility.vue @@ -11,7 +11,7 @@ <v-row dense> <v-col - md="6"> + lg="6"> <v-select v-model="modify.is_public" :items="dataOptions" @@ -25,7 +25,7 @@ :hint="$t('pages.database.resource.data.hint', { resource: 'view' })" /> </v-col> <v-col - md="6"> + lg="6"> <v-select v-model="modify.is_schema_public" :items="schemaOptions" diff --git a/dbrepo-ui/components/identifier/Citation.vue b/dbrepo-ui/components/identifier/Citation.vue index 9ee434c943da8c011e0bfece1c88c06b525845a9..a52cd87159b23f4cad7d64ae5dd4fe177a489b65 100644 --- a/dbrepo-ui/components/identifier/Citation.vue +++ b/dbrepo-ui/components/identifier/Citation.vue @@ -3,12 +3,12 @@ no-gutters> <v-col v-if="!loading" - md="10"> + lg="10"> {{ citation }} </v-col> <v-col v-if="!$vuetify.display.mdAndDown" - md="2" + lg="2" class="cite-style"> <v-select v-model="style" diff --git a/dbrepo-ui/components/identifier/DownloadButton.vue b/dbrepo-ui/components/identifier/DownloadButton.vue index 85b58dc818b49d2dfb43fe15bd229084122990dd..3f9fdd10d90ae2663fcbced834b82d2a0d471bd6 100644 --- a/dbrepo-ui/components/identifier/DownloadButton.vue +++ b/dbrepo-ui/components/identifier/DownloadButton.vue @@ -11,7 +11,7 @@ export default { props: { pid: { - type: Number, + type: String, default () { return null } diff --git a/dbrepo-ui/components/identifier/Persist.vue b/dbrepo-ui/components/identifier/Persist.vue index f37c5c6d7d9893562d94393fe6aa19ab3b448d79..89b1ca9d8ac35e21f4de9aa82a418f73bc96375d 100644 --- a/dbrepo-ui/components/identifier/Persist.vue +++ b/dbrepo-ui/components/identifier/Persist.vue @@ -867,10 +867,10 @@ export default { error: false, // XXX: `error` is never changed licenses: [], identifier: { - database_id: parseInt(this.$route.params.database_id), - query_id: parseInt(this.$route.params.subset_id), - view_id: parseInt(this.$route.params.view_id), - table_id: parseInt(this.$route.params.table_id), + database_id: this.$route.params.database_id, + query_id: this.$route.params.subset_id, + view_id: this.$route.params.view_id, + table_id: this.$route.params.table_id, titles: [], descriptions: [], publisher: this.$config.public.pid.default.publisher, diff --git a/dbrepo-ui/components/subset/Builder.vue b/dbrepo-ui/components/subset/Builder.vue index f670700f2f23aa2a08a6ecf8004fecfb899c6c00..e66f72e362a845c4aff83c67eada608a46d52023 100644 --- a/dbrepo-ui/components/subset/Builder.vue +++ b/dbrepo-ui/components/subset/Builder.vue @@ -42,7 +42,8 @@ v-if="isView" class="mt-1" dense> - <v-col lg="8"> + <v-col + lg="8"> <v-text-field v-model="view.name" :disabled="isExecuted" @@ -63,7 +64,7 @@ v-if="isView" dense> <v-col - md="4"> + lg="4"> <v-select v-model="view.is_public" :items="dataOptions" @@ -78,7 +79,7 @@ :hint="$t('pages.database.resource.data.hint')" /> </v-col> <v-col - md="4"> + lg="4"> <v-select v-model="view.is_schema_public" :items="schemaOptions" @@ -99,7 +100,8 @@ <v-window-item value="0"> <v-row dense> - <v-col lg="4"> + <v-col + lg="4"> <v-select v-model="table" :disabled="isExecuted" @@ -113,7 +115,8 @@ :hint="$t('pages.view.subpages.create.table.hint')" :rules="[v => !!v || $t('validation.required')]" /> </v-col> - <v-col lg="4"> + <v-col + lg="4"> <v-select v-model="select" item-title="internal_name" @@ -147,8 +150,10 @@ </v-select> </v-col> </v-row> - <v-row v-if="select.length > 0"> - <v-col lg="8"> + <v-row + v-if="select.length > 0"> + <v-col + lg="8"> <v-btn v-if="clauses.length === 0" size="small" @@ -160,7 +165,8 @@ </v-col> </v-row> <div class="mb-5"> - <v-row v-if="clauses.length > 0"> + <v-row + v-if="clauses.length > 0"> <v-col lg="8" class="text-center"> @@ -170,7 +176,8 @@ <div v-for="(clause, idx) in clauses" :key="idx"> <v-row v-if="clause.type === 'where'"> - <v-col lg="3"> + <v-col + lg="3"> <v-select v-model="clause.params[0]" :disabled="clausesDisabled" @@ -182,7 +189,8 @@ :hint="$t('pages.subset.subpages.create.filter.column.hint')" :items="select" /> </v-col> - <v-col lg="2"> + <v-col + lg="2"> <v-select v-model="clause.params[1]" :disabled="clausesDisabled" @@ -211,7 +219,8 @@ </template> </v-select> </v-col> - <v-col lg="3"> + <v-col + lg="3"> <v-text-field v-model="clause.params[2]" :disabled="clausesDisabled" @@ -219,7 +228,8 @@ :label="$t('pages.subset.subpages.create.filter.value.label')" :hint="$t('pages.subset.subpages.create.filter.value.hint')" /> </v-col> - <v-col lg="1"> + <v-col + lg="1"> <v-btn :disabled="clausesDisabled" class="mt-4" @@ -469,6 +479,7 @@ export default { }, mounted () { this.selectTable() + this.initViewVisibility() }, methods: { fetchTableColumns (tableId) { @@ -488,6 +499,13 @@ export default { toast.error(this.$t(code)) }) }, + initViewVisibility () { + if (!this.database) { + return + } + this.view.is_public = this.database.is_public + this.view.is_schema_public = this.database.is_schema_public + }, validViewName (name) { if (!name) { return false @@ -499,7 +517,7 @@ export default { if (this.$route.query.tid === undefined) { return } - const tid = parseInt(this.$route.query.tid) + const tid = this.$route.query.tid const selection = this.tables.filter(t => t.id === tid) if (selection.length > 0) { this.table = selection[0] @@ -509,9 +527,9 @@ export default { console.warn('Failed to find table with id', tid) } }, - async execute () { + execute () { if (this.isView) { - await this.createView() + this.createView() return } if (this.timestamp === '') { diff --git a/dbrepo-ui/components/subset/Results.vue b/dbrepo-ui/components/subset/Results.vue index 661c7d1a3d6e7502cf349a63cc695cf7d593f427..a4a2565d7004a92fa9b3b6c0eab2907c8a220306 100644 --- a/dbrepo-ui/components/subset/Results.vue +++ b/dbrepo-ui/components/subset/Results.vue @@ -80,7 +80,7 @@ export default { } }, methods: { - reExecute (id) { + reExecute (id, timestamp) { if (id === null) { return } @@ -110,7 +110,7 @@ export default { }) } else if (this.type === 'table') { const tableService = useTableService() - tableService.getData(this.$route.params.database_id, id, (this.options.page - 1), this.options.itemsPerPage, this.timestamp) + tableService.getData(this.$route.params.database_id, id, (this.options.page - 1), this.options.itemsPerPage, timestamp ? timestamp : this.timestamp) .then((result) => { this.mapResults(result) this.id = id @@ -156,7 +156,7 @@ export default { }) } }, - reExecuteCount (id) { + reExecuteCount (id, timestamp) { if (id === null) { return } @@ -181,7 +181,7 @@ export default { }) } else if (this.type === 'table') { const tableService = useTableService() - tableService.getCount(this.$route.params.database_id, id, this.timestamp) + tableService.getCount(this.$route.params.database_id, id, timestamp ? timestamp : this.timestamp) .then((count) => { this.total = count this.loadingCount = false diff --git a/dbrepo-ui/components/subset/SubsetToolbar.vue b/dbrepo-ui/components/subset/SubsetToolbar.vue index e6026090978a3745af50b7e9a3e7a559ae5363a5..2e6dae63025d72ad8890ad70ef69daca040cc333 100644 --- a/dbrepo-ui/components/subset/SubsetToolbar.vue +++ b/dbrepo-ui/components/subset/SubsetToolbar.vue @@ -110,7 +110,7 @@ export default { identifier () { /* mount pid */ if (this.pid) { - const filter = this.identifiers.filter(i => i.id === Number(this.pid)) + const filter = this.identifiers.filter(i => i.id === this.pid) if (filter.length > 0) { return filter[0] } diff --git a/dbrepo-ui/components/table/TableImport.vue b/dbrepo-ui/components/table/TableImport.vue index a4eb63733bb534e83166f76fbf006cf354828291..319fe3b37c798ccfcf471ba82951504030f3dd14 100644 --- a/dbrepo-ui/components/table/TableImport.vue +++ b/dbrepo-ui/components/table/TableImport.vue @@ -14,8 +14,10 @@ :disabled="disabled" @submit.prevent="submit"> <v-container> - <v-row dense> - <v-col md="8"> + <v-row + dense> + <v-col + lg="8"> <v-select v-model="tableImport.separator" :items="separators" @@ -30,8 +32,10 @@ :label="$t('pages.table.subpages.import.separator.label')"/> </v-col> </v-row> - <v-row dense> - <v-col md="8"> + <v-row + dense> + <v-col + lg="8"> <v-select v-model="tableImport.header" :items="headers" @@ -45,8 +49,10 @@ :label="$t('pages.table.subpages.import.skip.label')" /> </v-col> </v-row> - <v-row dense> - <v-col md="8"> + <v-row + dense> + <v-col + lg="8"> <v-select v-model="tableImport.quote" :items="quotes" @@ -59,8 +65,10 @@ :label="$t('pages.table.subpages.import.quote.label')"/> </v-col> </v-row> - <v-row dense> - <v-col md="8"> + <v-row + dense> + <v-col + lg="8"> <v-select v-model="tableImport.line_termination" :items="lineTerminationItems" @@ -117,7 +125,7 @@ v-if="step > 1 && suggestedAnalyseSeparator && providedSeparator !== analysedSeparator" dense> <v-col - md="8"> + lg="8"> <v-alert border="start" color="warning"> @@ -137,7 +145,7 @@ v-if="step > 1 && suggestedAnalyseLineTerminator && providedTerminator !== analysedTerminator" dense> <v-col - md="8"> + lg="8"> <v-alert border="start" color="warning"> @@ -153,7 +161,7 @@ v-if="!hasCompatibleSchema" dense> <v-col - md="8"> + lg="8"> <v-alert border="start" color="warning" @@ -236,7 +244,7 @@ <v-row dense> <v-col - md="8"> + lg="8"> <v-alert border="start" color="success"> diff --git a/dbrepo-ui/components/table/TableSchema.vue b/dbrepo-ui/components/table/TableSchema.vue index baf04272b40573eb7c9fd8ab96a0f8b2947c82e5..811efae792d9bb2dd82b542d23ee1949558ac034 100644 --- a/dbrepo-ui/components/table/TableSchema.vue +++ b/dbrepo-ui/components/table/TableSchema.vue @@ -6,7 +6,8 @@ :disabled="disabled"> <v-row v-if="showPrimaryKeyWarning"> - <v-col md="8"> + <v-col + lg="8"> <v-alert border="start" color="warning"> @@ -268,7 +269,7 @@ export default { } this.loadingColumnTypes = true const imageService = useImageService() - imageService.findById(this.database.container.id) + imageService.findById(this.database.container.image.id) .then((image) => { const types = image.data_types if (this.columns.filter(c => c.type === 'serial').length > 0) { diff --git a/dbrepo-ui/components/view/ViewToolbar.vue b/dbrepo-ui/components/view/ViewToolbar.vue index d9e0bfb6bf6740c19aac53f6b3ac8cc374be7011..9f44c8d4804d8b9ca8b81bdbab5e95b7ae5ce5c5 100644 --- a/dbrepo-ui/components/view/ViewToolbar.vue +++ b/dbrepo-ui/components/view/ViewToolbar.vue @@ -145,12 +145,12 @@ export default { if (!this.view) { return [] } - return this.view.identifiers.filter(s => s.view_id === Number(this.$route.params.view_id)) + return this.view.identifiers.filter(s => s.view_id === this.$route.params.view_id) }, identifier () { /* mount pid */ if (this.pid) { - const filter = this.identifiers.filter(i => i.id === Number(this.pid)) + const filter = this.identifiers.filter(i => i.id === this.pid) if (filter.length > 0) { const identifier = filter[0] console.debug('identifier set according to route pid', identifier) diff --git a/dbrepo-ui/composables/access-service.ts b/dbrepo-ui/composables/access-service.ts index 056efec1171933d7dcf0921c7eff34717d574333..169d5126b73de093e2f0f8824a397cab3ee09019 100644 --- a/dbrepo-ui/composables/access-service.ts +++ b/dbrepo-ui/composables/access-service.ts @@ -1,7 +1,7 @@ import {axiosErrorToApiError} from '@/utils' export const useAccessService = (): any => { - async function findOne(databaseId: number, userId: string): Promise<DatabaseAccessDto> { + async function findOne(databaseId: string, userId: string): Promise<DatabaseAccessDto> { const axios = useAxiosInstance() console.debug('find access of database with id', databaseId) return new Promise<DatabaseAccessDto>((resolve, reject) => { @@ -17,7 +17,7 @@ export const useAccessService = (): any => { }) } - async function create(databaseId: number, userId: number, payload: DatabaseGiveAccessDto): Promise<DatabaseAccessDto> { + async function create(databaseId: string, userId: string, payload: DatabaseGiveAccessDto): Promise<DatabaseAccessDto> { const axios = useAxiosInstance() console.debug('create access for user with id', userId, 'of database with id', databaseId) return new Promise<DatabaseAccessDto>((resolve, reject) => { @@ -33,7 +33,7 @@ export const useAccessService = (): any => { }) } - async function update(databaseId: number, userId: number, payload: DatabaseModifyAccessDto): Promise<DatabaseAccessDto> { + async function update(databaseId: string, userId: string, payload: DatabaseModifyAccessDto): Promise<DatabaseAccessDto> { const axios = useAxiosInstance() console.debug('update access for user with id', userId, 'of database with id', databaseId) return new Promise<DatabaseAccessDto>((resolve, reject) => { @@ -49,7 +49,7 @@ export const useAccessService = (): any => { }) } - async function remove(databaseId: number, userId: number): Promise<DatabaseAccessDto> { + async function remove(databaseId: string, userId: string): Promise<DatabaseAccessDto> { const axios = useAxiosInstance() console.debug('remove access for user with id', userId, 'of database with id', databaseId) return new Promise<DatabaseAccessDto>((resolve, reject) => { diff --git a/dbrepo-ui/composables/container-service.ts b/dbrepo-ui/composables/container-service.ts index f1280517566165b8f190b9bd05eea3b1d4ac98f1..e21622eab14d884840ff872ca4dd1ecab50aa30e 100644 --- a/dbrepo-ui/composables/container-service.ts +++ b/dbrepo-ui/composables/container-service.ts @@ -17,7 +17,7 @@ export const useContainerService = (): any => { }) } - async function findOne(containerId: number): Promise<ContainerDto> { + async function findOne(containerId: string): Promise<ContainerDto> { const axios = useAxiosInstance(); console.debug('find containers'); return new Promise<ContainerDto>((resolve, reject) => { diff --git a/dbrepo-ui/composables/database-service.ts b/dbrepo-ui/composables/database-service.ts index f318e073054d6a4283b654bbae985b4f903aec00..0609373923d3fd75d06cfb341cc350d99ad50b3f 100644 --- a/dbrepo-ui/composables/database-service.ts +++ b/dbrepo-ui/composables/database-service.ts @@ -17,7 +17,7 @@ export const useDatabaseService = (): any => { }); } - async function refreshTablesMetadata(databaseId: number): Promise<DatabaseDto> { + async function refreshTablesMetadata(databaseId: string): Promise<DatabaseDto> { const axios = useAxiosInstance(); console.debug('refresh database tables metadata'); return new Promise<DatabaseDto>((resolve, reject) => { @@ -33,7 +33,7 @@ export const useDatabaseService = (): any => { }); } - async function refreshViewsMetadata(databaseId: number): Promise<DatabaseDto> { + async function refreshViewsMetadata(databaseId: string): Promise<DatabaseDto> { const axios = useAxiosInstance(); console.debug('refresh database views metadata'); return new Promise<DatabaseDto>((resolve, reject) => { @@ -66,7 +66,7 @@ export const useDatabaseService = (): any => { }); } - async function findOne(id: number, rawError: boolean = false): Promise<DatabaseDto | null> { + async function findOne(id: string, rawError: boolean = false): Promise<DatabaseDto | null> { const axios = useAxiosInstance(); console.debug('find database with id', id); return new Promise((resolve, reject) => { @@ -85,7 +85,7 @@ export const useDatabaseService = (): any => { }); } - async function findPreviewImage(id: number): Promise<string> { + async function findPreviewImage(id: string): Promise<string> { const axios = useAxiosInstance(); console.debug('find database preview image with id', id); return new Promise((resolve, reject) => { @@ -101,7 +101,7 @@ export const useDatabaseService = (): any => { }); } - async function updateVisibility(id: number, payload: DatabaseModifyVisibilityDto): Promise<DatabaseDto | null> { + async function updateVisibility(id: string, payload: DatabaseModifyVisibilityDto): Promise<DatabaseDto | null> { const axios = useAxiosInstance() console.debug('update database visibility for database with id', id); return new Promise((resolve, reject) => { @@ -117,7 +117,7 @@ export const useDatabaseService = (): any => { }); } - async function updateImage(id: number, payload: DatabaseModifyImageDto): Promise<DatabaseDto | null> { + async function updateImage(id: string, payload: DatabaseModifyImageDto): Promise<DatabaseDto | null> { const axios = useAxiosInstance() console.debug('update database image for database with id', id); return new Promise((resolve, reject) => { @@ -133,7 +133,7 @@ export const useDatabaseService = (): any => { }); } - async function updateOwner(id: number, payload: DatabaseTransferDto): Promise<DatabaseDto | null> { + async function updateOwner(id: string, payload: DatabaseTransferDto): Promise<DatabaseDto | null> { const axios = useAxiosInstance() console.debug('update database owner for database with id', id); return new Promise((resolve, reject) => { diff --git a/dbrepo-ui/composables/identifier-service.ts b/dbrepo-ui/composables/identifier-service.ts index 6875a7cb7b2c168ecfb7357cc314219792930bf8..585356994be12526b4e7c83519a3f36db00b388a 100644 --- a/dbrepo-ui/composables/identifier-service.ts +++ b/dbrepo-ui/composables/identifier-service.ts @@ -2,7 +2,7 @@ import type {AxiosError, AxiosRequestConfig} from 'axios' import {axiosErrorToApiError} from '@/utils' export const useIdentifierService = (): any => { - async function findOne(id: number, accept: string): Promise<IdentifierDto> { + async function findOne(id: string, accept: string): Promise<IdentifierDto> { const axios = useAxiosInstance() console.debug('find identifier with id', id) const config: AxiosRequestConfig = { @@ -55,7 +55,7 @@ export const useIdentifierService = (): any => { }) } - async function remove(id: number): Promise<void> { + async function remove(id: string): Promise<void> { const axios = useAxiosInstance() console.debug('delete identifier', id) return new Promise<void>((resolve, reject) => { @@ -71,7 +71,7 @@ export const useIdentifierService = (): any => { }) } - async function publish(id: number): Promise<IdentifierDto> { + async function publish(id: string): Promise<IdentifierDto> { const axios = useAxiosInstance() console.debug('publish identifier', id) return new Promise<IdentifierDto>((resolve, reject) => { diff --git a/dbrepo-ui/composables/image-service.ts b/dbrepo-ui/composables/image-service.ts index 9af0304a1620bfda6aa801da61a7de9cb3cb647d..bcddbc5d7d04009850543d2b21dc843afe406cd8 100644 --- a/dbrepo-ui/composables/image-service.ts +++ b/dbrepo-ui/composables/image-service.ts @@ -1,7 +1,7 @@ import {axiosErrorToApiError} from '@/utils' export const useImageService = (): any => { - async function findById(id: number): Promise<ImageDto> { + async function findById(id: string): Promise<ImageDto> { const axios = useAxiosInstance(); console.debug('find image by id', id); return new Promise<ImageDto>((resolve, reject) => { diff --git a/dbrepo-ui/composables/message-service.ts b/dbrepo-ui/composables/message-service.ts index a170b3ba034e743c43ffea58e4731532ffcebb30..648cb6d388c5a1bfd2192dbedfe7fab14f55cd47 100644 --- a/dbrepo-ui/composables/message-service.ts +++ b/dbrepo-ui/composables/message-service.ts @@ -17,7 +17,7 @@ export const useMessageService = (): any => { }) } - async function findOne(id: number): Promise<BannerMessageDto> { + async function findOne(id: string): Promise<BannerMessageDto> { const axios = useAxiosInstance() console.debug('find message with id', id) return new Promise<BannerMessageDto>((resolve, reject) => { @@ -49,7 +49,7 @@ export const useMessageService = (): any => { }) } - async function update(id: number, data: BannerMessageUpdateDto): Promise<BannerMessageDto> { + async function update(id: string, data: BannerMessageUpdateDto): Promise<BannerMessageDto> { const axios = useAxiosInstance() console.debug('update message with id', id) return new Promise<BannerMessageDto>((resolve, reject) => { @@ -65,7 +65,7 @@ export const useMessageService = (): any => { }) } - async function remove(id: number): Promise<void> { + async function remove(id: string): Promise<void> { const axios = useAxiosInstance() console.debug('delete message with id', id) return new Promise<void>((resolve, reject) => { diff --git a/dbrepo-ui/composables/ontology-service.ts b/dbrepo-ui/composables/ontology-service.ts index da207d6c56d29722b33b67ee802fca55aa1ba6c0..67c6beaf256c7196e6bf6469f849d550c02c9fb4 100644 --- a/dbrepo-ui/composables/ontology-service.ts +++ b/dbrepo-ui/composables/ontology-service.ts @@ -17,7 +17,7 @@ export const useOntologyService = (): any => { }) } - async function findOne(id: number): Promise<OntologyDto> { + async function findOne(id: string): Promise<OntologyDto> { const axios = useAxiosInstance() console.debug('find ontology for id', id) return new Promise<OntologyDto>((resolve, reject) => { @@ -49,7 +49,7 @@ export const useOntologyService = (): any => { }) } - async function update(id: number, data: OntologyModifyDto): Promise<OntologyDto> { + async function update(id: string, data: OntologyModifyDto): Promise<OntologyDto> { const axios = useAxiosInstance() console.debug('update ontology with id', id) return new Promise<OntologyDto>((resolve, reject) => { @@ -65,7 +65,7 @@ export const useOntologyService = (): any => { }) } - async function remove(id: number): Promise<void> { + async function remove(id: string): Promise<void> { const axios = useAxiosInstance() console.debug('delete ontology with id', id) return new Promise<void>((resolve, reject) => { diff --git a/dbrepo-ui/composables/query-service.ts b/dbrepo-ui/composables/query-service.ts index e314993ecd233c486198f7995dff4da5389eb06f..c0d5c0db7c6bab8c949ec581a023a138f7c065ac 100644 --- a/dbrepo-ui/composables/query-service.ts +++ b/dbrepo-ui/composables/query-service.ts @@ -3,7 +3,7 @@ import type {AxiosRequestConfig} from 'axios' import {axiosErrorToApiError} from '@/utils' export const useQueryService = (): any => { - async function findAll(databaseId: number, persisted: boolean): Promise<QueryDto[]> { + async function findAll(databaseId: string, persisted: boolean): Promise<QueryDto[]> { const axios = useAxiosInstance() console.debug('find queries') return new Promise<QueryDto[]>((resolve, reject) => { @@ -23,7 +23,7 @@ export const useQueryService = (): any => { }) } - async function findOne(databaseId: number, queryId: number): Promise<QueryDto> { + async function findOne(databaseId: string, queryId: string): Promise<QueryDto> { const axios = useAxiosInstance() console.debug('find query with id', queryId, 'in database with id', databaseId) return new Promise<QueryDto>((resolve, reject) => { @@ -39,7 +39,7 @@ export const useQueryService = (): any => { }) } - async function update(databaseId: number, queryId: number, data: QueryPersistDto): Promise<QueryDto> { + async function update(databaseId: string, queryId: string, data: QueryPersistDto): Promise<QueryDto> { const axios = useAxiosInstance() console.debug('update query with id', queryId, 'in database with id', databaseId) return new Promise<QueryDto>((resolve, reject) => { @@ -55,7 +55,7 @@ export const useQueryService = (): any => { }) } - async function exportCsv(databaseId: number, queryId: number): Promise<any> { + async function exportCsv(databaseId: string, queryId: string): Promise<any> { const axios = useAxiosInstance() const config: AxiosRequestConfig = { responseType: 'blob', @@ -77,7 +77,7 @@ export const useQueryService = (): any => { }) } - async function execute(databaseId: number, data: ExecuteStatementDto, timestamp: Date | null, page: number, size: number): Promise<QueryResultDto> { + async function execute(databaseId: string, data: ExecuteStatementDto, timestamp: Date | null, page: number, size: number): Promise<QueryResultDto> { const axios = useAxiosInstance() console.debug('execute query in database with id', databaseId) return new Promise<QueryResultDto>((resolve, reject) => { @@ -85,7 +85,7 @@ export const useQueryService = (): any => { .then((response) => { console.info('Executed query with id', response.data.id, ' in database with id', databaseId) const result: QueryResultDto = { - id: 1, + id: response.headers['x-id'], headers: [], result: response.data } @@ -98,7 +98,7 @@ export const useQueryService = (): any => { }) } - async function reExecuteData(databaseId: number, queryId: number, page: number, size: number): Promise<QueryResultDto> { + async function reExecuteData(databaseId: string, queryId: string, page: number, size: number): Promise<QueryResultDto> { const axios = useAxiosInstance() console.debug('re-execute query in database with id', databaseId) return new Promise<QueryResultDto>((resolve, reject) => { @@ -106,7 +106,7 @@ export const useQueryService = (): any => { .then((response) => { console.info('Re-executed query in database with id', databaseId) const result: QueryResultDto = { - id: Number(response.headers['x-id']), + id: response.headers['x-id'], headers: response.headers['x-headers'] ? response.headers['x-headers'].split(',') : [], result: response.data } @@ -119,7 +119,7 @@ export const useQueryService = (): any => { }) } - async function reExecuteCount(databaseId: number, queryId: number): Promise<number> { + async function reExecuteCount(databaseId: string, queryId: string): Promise<number> { const axios = useAxiosInstance() console.debug('re-execute query in database with id', databaseId) return new Promise<number>((resolve, reject) => { diff --git a/dbrepo-ui/composables/table-service.ts b/dbrepo-ui/composables/table-service.ts index 5f290745245b46a8ce395a489f62aa9171800d5a..45ee0a7b934cb92c2d275b3cb1a23738d4fc0809 100644 --- a/dbrepo-ui/composables/table-service.ts +++ b/dbrepo-ui/composables/table-service.ts @@ -3,7 +3,7 @@ import {axiosErrorToApiError} from '@/utils' export const useTableService = (): any => { - function findAll(databaseId: number): Promise<TableBriefDto> { + function findAll(databaseId: string): Promise<TableBriefDto> { const axios = useAxiosInstance() console.debug('find tables') return new Promise<TableBriefDto>((resolve, reject) => { @@ -19,7 +19,7 @@ export const useTableService = (): any => { }) } - async function findOne(databaseId: number, tableId: number): Promise<TableDto> { + async function findOne(databaseId: string, tableId: string): Promise<TableDto> { const axios = useAxiosInstance() console.debug('find table with id', tableId, 'in database with id', databaseId); return new Promise<TableDto>((resolve, reject) => { @@ -35,7 +35,7 @@ export const useTableService = (): any => { }) } - async function updateSemantics(databaseId: number, tableId: number, columnId: number, data: ColumnSemanticsUpdateDto): Promise<ColumnDto> { + async function updateSemantics(databaseId: string, tableId: string, columnId: string, data: ColumnSemanticsUpdateDto): Promise<ColumnDto> { const axios = useAxiosInstance() console.debug('update column with id', columnId, 'table with id', tableId, 'in database with id', databaseId); return new Promise<ColumnDto>((resolve, reject) => { @@ -51,7 +51,7 @@ export const useTableService = (): any => { }) } - async function update(databaseId: number, tableId: number, data: TableUpdateDto): Promise<TableDto> { + async function update(databaseId: string, tableId: string, data: TableUpdateDto): Promise<TableDto> { const axios = useAxiosInstance() console.debug('update table with id', tableId, 'in database with id', databaseId); return new Promise<TableDto>((resolve, reject) => { @@ -67,7 +67,7 @@ export const useTableService = (): any => { }) } - async function importCsv(databaseId: number, tableId: number, data: ImportCsv): Promise<ImportDto> { + async function importCsv(databaseId: string, tableId: string, data: ImportCsv): Promise<ImportDto> { const axios = useAxiosInstance() console.debug('import csv to table with id', tableId, 'in database with id', databaseId); return new Promise<ImportDto>((resolve, reject) => { @@ -83,7 +83,7 @@ export const useTableService = (): any => { }) } - async function getData(databaseId: number, tableId: number, page: number, size: number, timestamp: Date): Promise<QueryResultDto> { + async function getData(databaseId: string, tableId: string, page: number, size: number, timestamp: Date): Promise<QueryResultDto> { const axios = useAxiosInstance() console.debug('get data for table with id', tableId, 'in database with id', databaseId); return new Promise<QueryResultDto>((resolve, reject) => { @@ -104,7 +104,7 @@ export const useTableService = (): any => { }) } - async function getCount(databaseId: number, tableId: number, timestamp: Date): Promise<number> { + async function getCount(databaseId: string, tableId: string, timestamp: Date): Promise<number> { const axios = useAxiosInstance() console.debug('get data count for table with id', tableId, 'in database with id', databaseId); return new Promise<number>((resolve, reject) => { @@ -121,7 +121,7 @@ export const useTableService = (): any => { }) } - async function exportData(databaseId: number, tableId: number, timestamp: Date): Promise<QueryResultDto> { + async function exportData(databaseId: string, tableId: string, timestamp: Date): Promise<QueryResultDto> { const axios = useAxiosInstance() const config: AxiosRequestConfig = { params: (timestamp && {timestamp}), @@ -144,7 +144,7 @@ export const useTableService = (): any => { }) } - async function create(databaseId: number, data: TableCreateDto): Promise<TableDto> { + async function create(databaseId: string, data: TableCreateDto): Promise<TableDto> { const axios = useAxiosInstance() console.debug('create table in database with id', databaseId, data) return new Promise<TableDto>((resolve, reject) => { @@ -160,7 +160,7 @@ export const useTableService = (): any => { }); } - async function remove(databaseId: number, tableId: number): Promise<void> { + async function remove(databaseId: string, tableId: string): Promise<void> { const axios = useAxiosInstance() console.debug('delete table with id', tableId, 'in database with id', databaseId) return new Promise<void>((resolve, reject) => { @@ -176,7 +176,7 @@ export const useTableService = (): any => { }); } - async function removeTuple(databaseId: number, tableId: number, data: TableCsvDeleteDto): Promise<void> { + async function removeTuple(databaseId: string, tableId: string, data: TableCsvDeleteDto): Promise<void> { const axios = useAxiosInstance() console.debug('delete tuple(s) in table with id', tableId, 'in database with id', databaseId) return new Promise<void>((resolve, reject) => { @@ -192,7 +192,7 @@ export const useTableService = (): any => { }); } - async function history(databaseId: number, tableId: number): Promise<TableHistoryDto[]> { + async function history(databaseId: string, tableId: string): Promise<TableHistoryDto[]> { const axios = useAxiosInstance() console.debug('Load history of table with id', tableId, 'in database with id', databaseId) return new Promise<TableHistoryDto[]>((resolve, reject) => { @@ -208,7 +208,7 @@ export const useTableService = (): any => { }); } - async function suggest(databaseId: number, tableId: number, columnId: number): Promise<TableColumnEntityDto[]> { + async function suggest(databaseId: string, tableId: string, columnId: string): Promise<TableColumnEntityDto[]> { const axios = useAxiosInstance() console.debug('suggest semantic entities for table column with id', columnId, 'of table with id', tableId, 'of database with id', databaseId) return new Promise<TableColumnEntityDto[]>((resolve, reject) => { diff --git a/dbrepo-ui/composables/tuple-service.ts b/dbrepo-ui/composables/tuple-service.ts index e54cbe6a0dc71407dc5339de79eace1eee762560..aa8407a2581a9b263cdd052fd30a5eb44f131446 100644 --- a/dbrepo-ui/composables/tuple-service.ts +++ b/dbrepo-ui/composables/tuple-service.ts @@ -1,7 +1,7 @@ import {axiosErrorToApiError} from '@/utils' export const useTupleService = (): any => { - async function create(databaseId: number, tableId: number, data: TableCsvDto): Promise<void> { + async function create(databaseId: string, tableId: string, data: TableCsvDto): Promise<void> { const axios = useAxiosInstance() console.debug('create tuple(s) in table with id', tableId, 'in database with id', databaseId) return new Promise<void>((resolve, reject) => { @@ -17,7 +17,7 @@ export const useTupleService = (): any => { }) } - async function update(databaseId: number, tableId: number, data: TableCsvDto): Promise<void> { + async function update(databaseId: string, tableId: string, data: TableCsvDto): Promise<void> { const axios = useAxiosInstance() console.debug('update tuple(s) in table with id', tableId, 'in database with id', databaseId) return new Promise<void>((resolve, reject) => { @@ -33,7 +33,7 @@ export const useTupleService = (): any => { }) } - async function remove(databaseId: number, tableId: number, data: TableCsvDeleteDto): Promise<void> { + async function remove(databaseId: string, tableId: string, data: TableCsvDeleteDto): Promise<void> { const axios = useAxiosInstance() console.debug('delete tuple(s) in table with id', tableId, 'in database with id', databaseId) return new Promise<void>((resolve, reject) => { diff --git a/dbrepo-ui/composables/view-service.ts b/dbrepo-ui/composables/view-service.ts index 417f5a645e978cc8f93e7fc524df22756c5b093e..9029a553ac782248d33707380f2ed72efcfc8032 100644 --- a/dbrepo-ui/composables/view-service.ts +++ b/dbrepo-ui/composables/view-service.ts @@ -2,7 +2,7 @@ import {axiosErrorToApiError} from '@/utils' import type {AxiosRequestConfig} from "axios"; export const useViewService = (): any => { - async function remove(databaseId: number, viewId: number): Promise<void> { + async function remove(databaseId: string, viewId: string): Promise<void> { const axios = useAxiosInstance() console.debug('delete view with id', viewId, 'in database with id', databaseId) return new Promise<void>((resolve, reject) => { @@ -18,7 +18,7 @@ export const useViewService = (): any => { }) } - async function findOne(databaseId: number, viewId: number): Promise<ViewDto> { + async function findOne(databaseId: string, viewId: string): Promise<ViewDto> { const axios = useAxiosInstance() console.debug('get view with id', viewId, 'in database with id', databaseId) return new Promise<ViewDto>((resolve, reject) => { @@ -34,7 +34,7 @@ export const useViewService = (): any => { }) } - async function create(databaseId: number, payload: ViewCreateDto): Promise<ViewDto> { + async function create(databaseId: string, payload: ViewCreateDto): Promise<ViewDto> { const axios = useAxiosInstance() console.debug('create view in database with id', databaseId) return new Promise<ViewDto>((resolve, reject) => { @@ -50,7 +50,7 @@ export const useViewService = (): any => { }) } - async function update(databaseId: number, viewId: number, payload: ViewUpdateDto): Promise<ViewDto> { + async function update(databaseId: string, viewId: string, payload: ViewUpdateDto): Promise<ViewDto> { const axios = useAxiosInstance() console.debug('update view with id', viewId) return new Promise<ViewDto>((resolve, reject) => { @@ -66,7 +66,7 @@ export const useViewService = (): any => { }) } - async function reExecuteData(databaseId: number, viewId: number, page: number | null, size: number | null): Promise<QueryResultDto> { + async function reExecuteData(databaseId: string, viewId: string, page: number | null, size: number | null): Promise<QueryResultDto> { const axios = useAxiosInstance() console.debug('re-execute view with id', viewId, 'in database with id', databaseId) return new Promise<QueryResultDto>((resolve, reject) => { @@ -87,7 +87,7 @@ export const useViewService = (): any => { }) } - async function reExecuteCount(databaseId: number, viewId: number): Promise<number> { + async function reExecuteCount(databaseId: string, viewId: string): Promise<number> { const axios = useAxiosInstance() console.debug('re-execute view with id', viewId, 'in database with id', databaseId) return new Promise<number>((resolve, reject) => { @@ -104,7 +104,7 @@ export const useViewService = (): any => { }) } - async function exportData(databaseId: number, viewId: number): Promise<QueryResultDto> { + async function exportData(databaseId: string, viewId: string): Promise<QueryResultDto> { const axios = useAxiosInstance() const config: AxiosRequestConfig = { responseType: 'blob', diff --git a/dbrepo-ui/dto/index.ts b/dbrepo-ui/dto/index.ts index 605a7c0db9984525632570c70e76dd542845f225..2f20f174299cc789abe52c94f39d121dd8faa30d 100644 --- a/dbrepo-ui/dto/index.ts +++ b/dbrepo-ui/dto/index.ts @@ -1,5 +1,5 @@ interface DatabaseDto { - id: number; + id: string; name: string; creator: UserDto; owner: UserDto; @@ -22,7 +22,7 @@ interface DatabaseDto { interface DatabaseCreateDto { name: string; - container_id: number; + container_id: string; is_public: boolean; } @@ -69,7 +69,7 @@ interface ContainerBriefDto { } interface ImageDto { - id: number; + id: string; registry: string; name: string; version: string; @@ -82,15 +82,15 @@ interface ImageDto { } interface OperatorDto { - id: number; - image_id: number; + id: string; + image_id: string; display_name: string; documentation: string; value: string; } interface TableBriefDto { - id: number; + id: string; name: string; description: string; internal_name: string; @@ -107,18 +107,18 @@ interface TableUpdateDto { } interface ColumnBriefDto { - id: number; + id: string; name: string; alias: string; - database_id: number; - table_id: number; + database_id: string; + table_id: string; internal_name: string; column_type: string; } interface TableDto { - id: number; - database_id: number; + id: string; + database_id: string; name: string; identifiers: IdentifierDto[]; creator: UserDto; @@ -170,18 +170,18 @@ interface DataTypesDto { } interface UniqueDto { - uid: number; + uid: string; table: TableBriefDto; columns: ColumnDto[]; } interface IdentifierCreateDto { - database_id: number; + database_id: string; doi: string | null; } interface IdentifierSaveDto { - id: number; + id: string; type: string; doi: string | null; titles: IdentifierSaveTitleDto[] | []; @@ -191,10 +191,10 @@ interface IdentifierSaveDto { publisher: string | null; language: string | null; creators: CreatorSaveDto[] | []; - database_id: number | null; - query_id: number | null; - view_id: number | null; - table_id: number | null; + database_id: string | null; + query_id: string | null; + view_id: string | null; + table_id: string | null; publication_day: number | null; publication_month: number | null; publication_year: number | null; @@ -223,11 +223,11 @@ interface IdentifierFunderSaveDto { } interface IdentifierDto { - id: number; - database_id: number | null; - query_id: number | null; - table_id: number | null; - view_id: number | null; + id: string; + database_id: string; + query_id: string | null; + table_id: string | null; + view_id: string | null; type: IdentifierTypeDto; titles: IdentifierTitleDto[] | []; descriptions: IdentifierDescriptionDto[] | []; @@ -263,11 +263,11 @@ enum IdentifierStatusTypeDto { } interface IdentifierBriefDto { - id: number; - database_id: number | null; - query_id: number | null; - table_id: number | null; - view_id: number | null; + id: string; + database_id: string | null; + query_id: string | null; + table_id: string | null; + view_id: string | null; type: IdentifierTypeDto; creators: CreatorBriefDto[] | []; titles: IdentifierTitleDto[] | []; @@ -280,21 +280,21 @@ interface IdentifierBriefDto { } interface IdentifierTitleDto { - id: number; + id: string; title: string; language: string; type: string; } interface IdentifierDescriptionDto { - id: number; + id: string; description: string; language: string; type: string; } interface IdentifierFunderDto { - id: number; + id: string; funder_name: string; funder_identifier: string; funder_identifier_type: string; @@ -309,7 +309,7 @@ enum NameTypeDto { } interface CreatorDto { - id: number; + id: string; firstname: string; lastname: string; affiliation: string; @@ -324,7 +324,7 @@ interface CreatorDto { } interface CreatorBriefDto { - id: number; + id: string; affiliation: string; creator_name: string; name_type: NameTypeDto | null; @@ -335,7 +335,7 @@ interface CreatorBriefDto { } interface RelatedIdentifierDto { - id: number; + id: string; value: string; type: string; relation: string; @@ -362,7 +362,7 @@ interface RelatedIdentifierSaveDto { } interface ColumnDto { - id: number; + id: string; name: string; alias: string; size: number; @@ -379,8 +379,8 @@ interface ColumnDto { unit: UnitDto; enums: string[]; sets: string[]; - database_id: number; - table_id: number; + database_id: string; + table_id: string; internal_name: string; is_primary_key: boolean; index_length: number; @@ -391,7 +391,7 @@ interface ColumnDto { } interface ConceptDto { - id: number; + id: string; uri: string; name: string; description: string; @@ -400,7 +400,7 @@ interface ConceptDto { } interface UnitDto { - id: number; + id: string; uri: string; name: string; description: string; @@ -446,14 +446,14 @@ interface ViewUpdateDto { } interface QueryDto { - id: number; + id: string; creator: UserDto; execution: Date; query: string; type: string | null; identifiers: IdentifierDto[]; created: Date; - database_id: number; + database_id: string; query_normalized: string | null; query_hash: string; is_persisted: boolean; @@ -515,8 +515,8 @@ interface KeycloakErrorDto { } interface ViewBriefDto { - id: number; - database_id: number; + id: string; + database_id: string; name: string; identifier: any[]; query: string; @@ -530,8 +530,8 @@ interface ViewBriefDto { } interface ViewDto { - id: number; - database_id: number; + id: string; + database_id: string; name: string; identifiers: IdentifierDto[]; query: string; @@ -545,14 +545,14 @@ interface ViewDto { } interface ImageBriefDto { - id: number; + id: string; name: string; version: string; jdbc_method: string; } interface ImageDto { - id: number; + id: string; registry: string; name: string; version: string; @@ -600,7 +600,7 @@ interface ImportCsv { } interface QueryResultDto { - id: number | null; + id: string | null; result: any; headers: string[]; } @@ -660,7 +660,7 @@ interface ForeignKeyCreateDto { } interface OntologyDto { - id: number; + id: string; uri: string; prefix: string; sparql: boolean; @@ -686,7 +686,7 @@ interface OntologyCreateDto { } interface UnitDto { - id: number; + id: string; uri: string; name: string; description: string; @@ -695,7 +695,7 @@ interface UnitDto { } interface ConceptDto { - id: number; + id: string; uri: string; name: string; description: string; @@ -704,9 +704,9 @@ interface ConceptDto { } interface TableColumnEntityDto { - database_id: number; - table_id: number; - column_id: number; + database_id: string; + table_id: string; + column_id: string; uri: string; label: string; description: string; @@ -739,7 +739,7 @@ interface BannerMessageUpdateDto { } interface BannerMessageDto { - id: number; + id: string; type: string; message: string; link: string; diff --git a/dbrepo-ui/dto/jwt.ts b/dbrepo-ui/dto/jwt.ts deleted file mode 100644 index a47085114e3c80c229e80b43fb27adc94fd9d3d3..0000000000000000000000000000000000000000 --- a/dbrepo-ui/dto/jwt.ts +++ /dev/null @@ -1,20 +0,0 @@ -interface Token { - exp: number; - iat: number; - jti: string; - iss: string; - aud: string; - sub: string; - typ: string; - azp: string; - session_state: string; - realm_access: RealmAccess; - scope: string; - sid: string; - uid: string; - preferred_username: string; -} - -interface RealmAccess { - roles: string[]; -} diff --git a/dbrepo-ui/layouts/default.vue b/dbrepo-ui/layouts/default.vue index 85be5cd6b0bee36a78e451a33abace288bef7219..7267242288c5eadaf184fdb1afe4e485a03f78dc 100644 --- a/dbrepo-ui/layouts/default.vue +++ b/dbrepo-ui/layouts/default.vue @@ -313,14 +313,14 @@ export default { return } if (this.identifier) { - if (newObj.query_id && this.identifier.query_id !== Number(newObj.query_id)) { + if (newObj.query_id && this.identifier.query_id !== newObj.query_id) { this.cacheStore.setIdentifier(null) - } else if (newObj.table_id && this.identifier.table_id !== Number(newObj.table_id)) { + } else if (newObj.table_id && this.identifier.table_id !== newObj.table_id) { this.cacheStore.setIdentifier(null) - } else if (newObj.view_id && this.identifier.view_id !== Number(newObj.view_id)) { + } else if (newObj.view_id && this.identifier.view_id !== newObj.view_id) { this.cacheStore.setIdentifier(null) } - if (this.$route.query.pid && this.identifier.id !== Number(this.$route.query.pid)) { + if (this.$route.query.pid && this.identifier.id !== this.$route.query.pid) { this.cacheStore.setIdentifier(null) } } diff --git a/dbrepo-ui/locales/en-US.json b/dbrepo-ui/locales/en-US.json index d17da2341db70b270a9cf780773ea7900afa4c03..c3da75d79b5462bd088844e35580413b02e46e9a 100644 --- a/dbrepo-ui/locales/en-US.json +++ b/dbrepo-ui/locales/en-US.json @@ -1305,8 +1305,9 @@ "revoked": "Revoked {access} access successfully" }, "data": { - "add": "Successfully added data entry", - "update": "Successfully updated data entry" + "add": "Successfully added data tuple", + "update": "Successfully updated data tuple", + "deleted": "Successfully deleted {total} data tuple(s)" }, "table": { "created": "Created table {table} successfully", diff --git a/dbrepo-ui/pages/database/[database_id]/info.vue b/dbrepo-ui/pages/database/[database_id]/info.vue index 025cc9c4c438523c876c346f6ccb219933a5362c..9f2d42655304118c5b585d8618f157fbc86d9627 100644 --- a/dbrepo-ui/pages/database/[database_id]/info.vue +++ b/dbrepo-ui/pages/database/[database_id]/info.vue @@ -177,7 +177,7 @@ if (data.value && data.value.length > 0) { useServerHead(identifierService.identifiersToServerHead(data.value)) useServerSeoMeta(identifierService.identifiersToServerSeoMeta(data.value)) } -const identifier = ref(data.value && data.value.length > 0 ? (pid && data.value.filter(i => i.id === Number(pid)).length > 0 ? data.value.filter(i => i.id === Number(pid))[0] : data.value[0]) : null) +const identifier = ref(data.value && data.value.length > 0 ? (pid && data.value.filter(i => i.id === pid).length > 0 ? data.value.filter(i => i.id === pid)[0] : data.value[0]) : null) const cacheStore = useCacheStore() cacheStore.setIdentifier(identifier) @@ -253,7 +253,7 @@ export default { if (!this.database || !this.database.identifiers) { return [] } - return this.database.identifiers.filter(i => i.query_id === Number(this.$route.params.subset_id)) + return this.database.identifiers.filter(i => i.query_id === this.$route.params.subset_id) }, pid () { return this.$route.query.pid diff --git a/dbrepo-ui/pages/database/[database_id]/persist/[identifier_id]/index.vue b/dbrepo-ui/pages/database/[database_id]/persist/[identifier_id]/index.vue index 505a7651232b071a03dd2b7ea481ff306e8dc3b4..1adbe4bf9bdb5cb31a633cd4b05bd8b28006e40b 100644 --- a/dbrepo-ui/pages/database/[database_id]/persist/[identifier_id]/index.vue +++ b/dbrepo-ui/pages/database/[database_id]/persist/[identifier_id]/index.vue @@ -58,7 +58,7 @@ export default { if (!this.database) { return false } - const filter = this.database.identifiers.filter(i => i.id === Number(this.$route.params.identifier_id)) + const filter = this.database.identifiers.filter(i => i.id === this.$route.params.identifier_id) return filter.length === 1 ? filter[0] : null }, canPersistIdentifier () { diff --git a/dbrepo-ui/pages/database/[database_id]/settings.vue b/dbrepo-ui/pages/database/[database_id]/settings.vue index 8905ede1d2f88c8b2411f65655c4443827c23315..3d82b13bdaa7a988039724342900f57d5f0d2251 100644 --- a/dbrepo-ui/pages/database/[database_id]/settings.vue +++ b/dbrepo-ui/pages/database/[database_id]/settings.vue @@ -20,7 +20,8 @@ <v-row v-if="previewImage" dense> - <v-col md="8"> + <v-col + lg="8"> <v-alert v-if="file" border="start" @@ -45,8 +46,10 @@ @click="removeDatabaseImage" /> </v-col> </v-row> - <v-row dense> - <v-col md="8"> + <v-row + dense> + <v-col + lg="8"> <v-file-input v-model="file" accept="image/*" @@ -134,7 +137,7 @@ <v-row dense> <v-col - md="4"> + lg="4"> <v-select v-model="modifyVisibility.is_public" :items="dataOptions" @@ -148,7 +151,7 @@ :hint="$t('pages.database.resource.data.hint', { resource: 'database' })" /> </v-col> <v-col - md="4"> + lg="4"> <v-select v-model="modifyVisibility.is_schema_public" :items="schemaOptions" @@ -184,7 +187,8 @@ rounded="0"> <v-card-text> <v-row> - <v-col md="8"> + <v-col + lg="8"> <v-select v-model="modifyOwner.id" :items="users" diff --git a/dbrepo-ui/pages/database/[database_id]/subset/[subset_id]/info.vue b/dbrepo-ui/pages/database/[database_id]/subset/[subset_id]/info.vue index db5d45b4610de195f2a16d213eea60674c8dcf86..d3b5f624d7425992e4858caa2e000dcc82c1ec59 100644 --- a/dbrepo-ui/pages/database/[database_id]/subset/[subset_id]/info.vue +++ b/dbrepo-ui/pages/database/[database_id]/subset/[subset_id]/info.vue @@ -94,7 +94,7 @@ if (data.value && data.value.length > 0) { useServerHead(identifierService.identifiersToServerHead(data.value)) useServerSeoMeta(identifierService.identifiersToServerSeoMeta(data.value)) } -const identifier = ref(data.value && data.value.length > 0 ? (pid && data.value.filter(i => i.id === Number(pid)).length > 0 ? data.value.filter(i => i.id === Number(pid))[0] : data.value[0]) : null) +const identifier = ref(data.value && data.value.length > 0 ? (pid && data.value.filter(i => i.id === pid).length > 0 ? data.value.filter(i => i.id === pid)[0] : data.value[0]) : null) const cacheStore = useCacheStore() cacheStore.setIdentifier(identifier) @@ -162,11 +162,14 @@ export default { subset () { return this.cacheStore.getSubset }, + access () { + return this.cacheStore.getAccess + }, identifiers () { if (!this.database || !this.database.subsets) { return [] } - return this.database.subsets.filter(i => i.query_id === Number(this.$route.params.subset_id)) + return this.database.subsets.filter(i => i.query_id === this.$route.params.subset_id) }, canViewInfo () { if (!this.database) { diff --git a/dbrepo-ui/pages/database/[database_id]/subset/[subset_id]/persist/[identifier_id]/index.vue b/dbrepo-ui/pages/database/[database_id]/subset/[subset_id]/persist/[identifier_id]/index.vue index 78878a0015f61ea3dadf38258b747b20fa8e94d9..e97ac3eb885973c0f69addc0a98aaf03c604855e 100644 --- a/dbrepo-ui/pages/database/[database_id]/subset/[subset_id]/persist/[identifier_id]/index.vue +++ b/dbrepo-ui/pages/database/[database_id]/subset/[subset_id]/persist/[identifier_id]/index.vue @@ -69,7 +69,7 @@ export default { if (!this.subset) { return false } - const filter = this.subset.identifiers.filter(i => i.id === Number(this.$route.params.identifier_id)) + const filter = this.subset.identifiers.filter(i => i.id === this.$route.params.identifier_id) return filter.length === 1 ? filter[0] : null }, canPersistIdentifier () { diff --git a/dbrepo-ui/pages/database/[database_id]/table/[table_id]/data.vue b/dbrepo-ui/pages/database/[database_id]/table/[table_id]/data.vue index 13ee3951c80fae3bb0a3f8391133b53aec57bf79..75e95370077bada111db1319a08630a4a55f29bd 100644 --- a/dbrepo-ui/pages/database/[database_id]/table/[table_id]/data.vue +++ b/dbrepo-ui/pages/database/[database_id]/table/[table_id]/data.vue @@ -45,7 +45,7 @@ class="ml-2" :disabled="loadingData" :loading="loadingData" - @click="reload" /> + @click="reload()" /> <v-btn :prepend-icon="$vuetify.display.mdAndUp ? 'mdi-update' : null" variant="flat" @@ -68,7 +68,7 @@ class="mt-0 mb-0" type="table" :select="canSelectTuples" - :timestamp="versionISO || lastReload.toISOString()" + :timestamp="lastReload.toISOString()" @selection="updateSelect" /> </v-card> <v-dialog @@ -310,7 +310,7 @@ export default { } const tupleService = useTupleService() wait.push(tupleService.remove(this.$route.params.database_id, this.$route.params.table_id, { keys: constraints }) - .catch(({code, message}) => { + .catch(({ code }) => { const toast = useToastInstance() if (typeof code !== 'string') { return @@ -321,7 +321,7 @@ export default { Promise.all(wait) .then(() => { const toast = useToastInstance() - toast.success(`Deleted ${this.selection.length} row(s)`) + toast.success(this.$t('success.data.deleted', { total: this.selection.length })) this.$emit('modified', { success: true, action: 'delete' }) this.selection = [] this.$refs.queryResults.resetSelection() @@ -400,8 +400,8 @@ export default { if (!this.canViewTableData) { return } - this.$refs.queryResults.reExecute(Number(this.$route.params.table_id)) - this.$refs.queryResults.reExecuteCount(Number(this.$route.params.table_id)) + this.$refs.queryResults.reExecute(this.$route.params.table_id, this.lastReload) + this.$refs.queryResults.reExecuteCount(this.$route.params.table_id, this.lastReload) }, isFileField (column) { return ['blob', 'longblob', 'mediumblob', 'tinyblob'].includes(column.type) diff --git a/dbrepo-ui/pages/database/[database_id]/table/[table_id]/info.vue b/dbrepo-ui/pages/database/[database_id]/table/[table_id]/info.vue index 687358f0290177012dc89f36e23666d6dd6d48d0..18662f55ddf87daafb6d055a17d67f93fb2be737 100644 --- a/dbrepo-ui/pages/database/[database_id]/table/[table_id]/info.vue +++ b/dbrepo-ui/pages/database/[database_id]/table/[table_id]/info.vue @@ -131,7 +131,7 @@ if (data.value && data.value.length > 0) { useServerHead(identifierService.identifiersToServerHead(data.value)) useServerSeoMeta(identifierService.identifiersToServerSeoMeta(data.value)) } -const identifier = ref(data.value && data.value.length > 0 ? (pid && data.value.filter(i => i.id === Number(pid)).length > 0 ? data.value.filter(i => i.id === Number(pid))[0] : data.value[0]) : null) +const identifier = ref(data.value && data.value.length > 0 ? (pid && data.value.filter(i => i.id === pid).length > 0 ? data.value.filter(i => i.id === pid)[0] : data.value[0]) : null) const cacheStore = useCacheStore() cacheStore.setIdentifier(identifier) @@ -244,7 +244,7 @@ export default { if (!this.table || !this.table.identifiers) { return [] } - return this.table.identifiers.filter(i => i.query_id === Number(this.$route.params.subset_id)) + return this.table.identifiers.filter(i => i.query_id === this.$route.params.subset_id) }, brokerExtraInfo () { return this.$config.public.broker.extra diff --git a/dbrepo-ui/pages/database/[database_id]/table/[table_id]/persist/[identifier_id]/index.vue b/dbrepo-ui/pages/database/[database_id]/table/[table_id]/persist/[identifier_id]/index.vue index e2d16e8db44efb0f558fa2c42e1225fc9e6b8355..2d7b94744c57a933ca6b139803091f5989eb29fd 100644 --- a/dbrepo-ui/pages/database/[database_id]/table/[table_id]/persist/[identifier_id]/index.vue +++ b/dbrepo-ui/pages/database/[database_id]/table/[table_id]/persist/[identifier_id]/index.vue @@ -67,7 +67,7 @@ export default { if (!this.table) { return false } - const filter = this.table.identifiers.filter(i => i.id === Number(this.$route.params.identifier_id)) + const filter = this.table.identifiers.filter(i => i.id === this.$route.params.identifier_id) return filter.length === 1 ? filter[0] : null }, canPersistIdentifier () { diff --git a/dbrepo-ui/pages/database/[database_id]/table/[table_id]/settings.vue b/dbrepo-ui/pages/database/[database_id]/table/[table_id]/settings.vue index 0f0a8feab62a7fb065c3ecb6af6b63b83a9884be..4667a7f30c7f1d3add1bfb608ef2c472b9daa681 100644 --- a/dbrepo-ui/pages/database/[database_id]/table/[table_id]/settings.vue +++ b/dbrepo-ui/pages/database/[database_id]/table/[table_id]/settings.vue @@ -18,7 +18,7 @@ <v-card-text> <v-row> <v-col - md="8"> + lg="8"> <v-textarea v-model="modify.description" rows="2" @@ -34,7 +34,7 @@ <v-row dense> <v-col - md="4"> + lg="4"> <v-select v-model="modify.is_public" :items="dataOptions" @@ -48,7 +48,7 @@ :hint="$t('pages.database.resource.data.hint', { resource: 'table' })" /> </v-col> <v-col - md="4"> + lg="4"> <v-select v-model="modify.is_schema_public" :items="schemaOptions" @@ -90,7 +90,7 @@ <v-card-text> <v-row> <v-col - md="8"> + lg="8"> <v-btn size="small" variant="flat" diff --git a/dbrepo-ui/pages/database/[database_id]/table/create/dataset.vue b/dbrepo-ui/pages/database/[database_id]/table/create/dataset.vue index 24aed7f2ffc6b77edfae4a90e1c4dc7607f97955..a2498d799b2ea0ee2ceb8649f4eee7101ad759a8 100644 --- a/dbrepo-ui/pages/database/[database_id]/table/create/dataset.vue +++ b/dbrepo-ui/pages/database/[database_id]/table/create/dataset.vue @@ -21,7 +21,7 @@ <v-card-text> <v-row> <v-col - md="8"> + lg="8"> <v-alert border="start" color="info"> @@ -54,7 +54,8 @@ <v-container> <v-row dense> - <v-col md="4"> + <v-col + lg="4"> <v-text-field v-model="tableCreate.name" :rules="[ @@ -69,7 +70,8 @@ :hint="$t('pages.table.subpages.import.name.hint')" :label="$t('pages.table.subpages.import.name.label')"/> </v-col> - <v-col md="4"> + <v-col + lg="4"> <v-text-field v-model="generatedTableName" :rules="[ @@ -88,7 +90,8 @@ </v-row> <v-row dense> - <v-col md="8"> + <v-col + lg="8"> <v-textarea v-model="tableCreate.description" rows="2" @@ -104,7 +107,7 @@ <v-row dense> <v-col - md="4"> + lg="4"> <v-select v-model="tableCreate.is_public" name="public" @@ -120,7 +123,7 @@ </v-select> </v-col> <v-col - md="4"> + lg="4"> <v-select v-model="tableCreate.is_schema_public" name="schema-public" @@ -175,7 +178,7 @@ <v-container> <v-row dense> <v-col - md="8"> + lg="8"> <v-alert border="start" color="success"> diff --git a/dbrepo-ui/pages/database/[database_id]/table/create/schema.vue b/dbrepo-ui/pages/database/[database_id]/table/create/schema.vue index 804ae03c15072719f7612fd46eeca80d45b1a2b8..1c48d143ca83eafeaa6ed21eac3ee9b3190e94aa 100644 --- a/dbrepo-ui/pages/database/[database_id]/table/create/schema.vue +++ b/dbrepo-ui/pages/database/[database_id]/table/create/schema.vue @@ -32,8 +32,10 @@ :disabled="table" @submit.prevent="submit"> <v-container> - <v-row dense> - <v-col md="4"> + <v-row + dense> + <v-col + lg="4"> <v-text-field v-model="tableCreate.name" :rules="[ @@ -48,7 +50,8 @@ :hint="$t('pages.table.subpages.import.name.hint')" :label="$t('pages.table.subpages.import.name.label')" /> </v-col> - <v-col md="4"> + <v-col + lg="4"> <v-text-field v-model="generatedTableName" :rules="[ @@ -65,8 +68,10 @@ :label="$t('pages.table.subpages.import.generated.label')" /> </v-col> </v-row> - <v-row dense> - <v-col md="8"> + <v-row + dense> + <v-col + lg="8"> <v-textarea v-model="tableCreate.description" rows="2" @@ -82,7 +87,7 @@ <v-row dense> <v-col - md="4"> + lg="4"> <v-select v-model="tableCreate.is_public" name="public" @@ -98,7 +103,7 @@ </v-select> </v-col> <v-col - md="4"> + lg="4"> <v-select v-model="tableCreate.is_schema_public" name="schema-public" @@ -146,7 +151,8 @@ <v-container> <v-row dense> - <v-col md="8"> + <v-col + lg="8"> <v-alert border="start" color="success"> diff --git a/dbrepo-ui/pages/database/[database_id]/view/[view_id]/data.vue b/dbrepo-ui/pages/database/[database_id]/view/[view_id]/data.vue index f732661f369710b4637f01952f5fab930e9e4812..43e8f491d9cfdb4896b4c824aa39291c0a9a5944 100644 --- a/dbrepo-ui/pages/database/[database_id]/view/[view_id]/data.vue +++ b/dbrepo-ui/pages/database/[database_id]/view/[view_id]/data.vue @@ -104,8 +104,8 @@ export default { }, methods: { reload () { - this.$refs.queryResults.reExecute(Number(this.$route.params.view_id)) - this.$refs.queryResults.reExecuteCount(Number(this.$route.params.view_id)) + this.$refs.queryResults.reExecute(this.$route.params.view_id) + this.$refs.queryResults.reExecuteCount(this.$route.params.view_id) }, download () { this.downloadLoading = true diff --git a/dbrepo-ui/pages/database/[database_id]/view/[view_id]/info.vue b/dbrepo-ui/pages/database/[database_id]/view/[view_id]/info.vue index 3c0c40e33ce7546e351ea3252a051a0ebb56049e..395be401c08730d0b9880fbbe21c61ccf6bf2db7 100644 --- a/dbrepo-ui/pages/database/[database_id]/view/[view_id]/info.vue +++ b/dbrepo-ui/pages/database/[database_id]/view/[view_id]/info.vue @@ -72,7 +72,7 @@ if (data.value && data.value.length > 0) { useServerHead(identifierService.identifiersToServerHead(data.value)) useServerSeoMeta(identifierService.identifiersToServerSeoMeta(data.value)) } -const identifier = ref(data.value && data.value.length > 0 ? (pid && data.value.filter(i => i.id === Number(pid)).length > 0 ? data.value.filter(i => i.id === Number(pid))[0] : data.value[0]) : null) +const identifier = ref(data.value && data.value.length > 0 ? (pid && data.value.filter(i => i.id === pid).length > 0 ? data.value.filter(i => i.id === pid)[0] : data.value[0]) : null) const cacheStore = useCacheStore() cacheStore.setIdentifier(identifier) @@ -143,7 +143,7 @@ export default { if (!this.view || !this.view.identifiers) { return [] } - return this.view.identifiers.filter(i => i.query_id === Number(this.$route.params.subset_id)) + return this.view.identifiers.filter(i => i.query_id === this.$route.params.subset_id) }, views () { if (!this.database) { diff --git a/dbrepo-ui/pages/database/[database_id]/view/[view_id]/persist/[identifier_id]/index.vue b/dbrepo-ui/pages/database/[database_id]/view/[view_id]/persist/[identifier_id]/index.vue index 540bbbdb5e454c725c6d5b9dc6a1da6498e5f8bc..5a1faeb431bf92be87a3b8bab8dc50c952f737e8 100644 --- a/dbrepo-ui/pages/database/[database_id]/view/[view_id]/persist/[identifier_id]/index.vue +++ b/dbrepo-ui/pages/database/[database_id]/view/[view_id]/persist/[identifier_id]/index.vue @@ -69,7 +69,7 @@ export default { if (!this.view) { return false } - const filter = this.view.identifiers.filter(i => i.id === Number(this.$route.params.identifier_id)) + const filter = this.view.identifiers.filter(i => i.id === this.$route.params.identifier_id) return filter.length === 1 ? filter[0] : null }, canPersistIdentifier () { diff --git a/dbrepo-ui/pages/database/[database_id]/view/[view_id]/settings.vue b/dbrepo-ui/pages/database/[database_id]/view/[view_id]/settings.vue index d027a4347b5300025f83d23adba52d78278a443f..41285c4d3be02f005736e61c44c534dce0a041e0 100644 --- a/dbrepo-ui/pages/database/[database_id]/view/[view_id]/settings.vue +++ b/dbrepo-ui/pages/database/[database_id]/view/[view_id]/settings.vue @@ -17,7 +17,7 @@ <v-row dense> <v-col - md="4"> + lg="4"> <v-select v-model="modify.is_public" :items="dataOptions" @@ -31,7 +31,7 @@ :hint="$t('pages.database.resource.data.hint', { resource: 'view' })" /> </v-col> <v-col - md="4"> + lg="4"> <v-select v-model="modify.is_schema_public" :items="schemaOptions" @@ -72,7 +72,7 @@ <v-card-text> <v-row> <v-col - md="8"> + lg="8"> <v-btn size="small" variant="flat" diff --git a/dbrepo-ui/pages/user/info.vue b/dbrepo-ui/pages/user/info.vue index 9c8dbf873d5b7ec4c13a4cde7a42a61790fdc4a3..0f52ca7fcc97e5336e713695feef1dc636b9fb3d 100644 --- a/dbrepo-ui/pages/user/info.vue +++ b/dbrepo-ui/pages/user/info.vue @@ -14,7 +14,8 @@ variant="flat"> <v-card-text> <v-row dense> - <v-col md="6"> + <v-col + lg="6"> <v-text-field v-model="model.id" disabled @@ -25,7 +26,8 @@ <v-row v-if="cacheUser" dense> - <v-col md="6"> + <v-col + lg="6"> <v-text-field v-model="cacheUser.preferred_username" disabled @@ -56,7 +58,8 @@ </v-col> </v-row> <v-row dense> - <v-col md="6"> + <v-col + lg="6"> <v-text-field v-model="model.orcid" :disabled="!canModifyInformation" @@ -71,7 +74,8 @@ </v-col> </v-row> <v-row dense> - <v-col md="6"> + <v-col + lg="6"> <v-text-field v-model="model.firstname" :disabled="!canModifyInformation || identityProvider" @@ -83,7 +87,8 @@ </v-col> </v-row> <v-row dense> - <v-col md="6"> + <v-col + lg="6"> <v-text-field v-model="model.lastname" :disabled="!canModifyInformation || identityProvider" @@ -95,7 +100,8 @@ </v-col> </v-row> <v-row dense> - <v-col md="6"> + <v-col + lg="6"> <v-text-field v-model="model.affiliation" :disabled="!canModifyInformation" diff --git a/docker-compose.yml b/docker-compose.yml index 675794464f0cfad8006ded5fe0662bbed2927990..5ab6df06af90c6e46c519be04428c39dd7c69f10 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -485,6 +485,7 @@ services: volumes: - dashboard-service-data:/opt/bitnami/grafana/data environment: + BITNAMI_DEBUG: true GF_SERVER_DOMAIN: "dashboard-service" GF_SECURITY_DISABLE_INITIAL_ADMIN_CREATION: "true" LDAP_ADMIN_USERNAME: "${IDENTITY_SERVICE_ADMIN_USERNAME:-admin}" diff --git a/helm/dbrepo/files/create-event-listener.jar b/helm/dbrepo/files/create-event-listener.jar index a9437e2cc19fae55c40e5ab0ddf772e20f11ab81..3230bc2de1aa82754770364457fda657e7db3279 100644 Binary files a/helm/dbrepo/files/create-event-listener.jar and b/helm/dbrepo/files/create-event-listener.jar differ diff --git a/lib/python/dbrepo/api/dto.py b/lib/python/dbrepo/api/dto.py index 9e042b966d9a452c29625fbc162886fbf89b2cf8..ac071cb412aa4f2b63306f1d8150397188a181fb 100644 --- a/lib/python/dbrepo/api/dto.py +++ b/lib/python/dbrepo/api/dto.py @@ -13,7 +13,7 @@ Timestamp = Annotated[ class Image(BaseModel): - id: int + id: str registry: str name: str version: str @@ -25,15 +25,14 @@ class Image(BaseModel): class ImageBrief(BaseModel): - id: int + id: str name: str version: str - jdbc_method: str class CreateDatabase(BaseModel): name: str - container_id: int + container_id: str is_public: bool is_schema_public: bool @@ -46,7 +45,7 @@ class UpdateView(BaseModel): class CreateContainer(BaseModel): name: str host: str - image_id: int + image_id: str privileged_username: str privileged_password: str ui_host: Optional[str] = None @@ -80,7 +79,7 @@ class UserBrief(BaseModel): class Container(BaseModel): - id: int + id: str name: str internal_name: str host: str @@ -91,7 +90,7 @@ class Container(BaseModel): class ContainerBrief(BaseModel): - id: int + id: str name: str image: ImageBrief internal_name: str @@ -100,18 +99,18 @@ class ContainerBrief(BaseModel): class ColumnBrief(BaseModel): - id: int + id: str name: str - database_id: int - table_id: int + database_id: str + table_id: str internal_name: str type: ColumnType alias: Optional[str] = None class TableBrief(BaseModel): - id: int - database_id: int + id: str + database_id: str name: str description: Optional[str] = None internal_name: str @@ -403,7 +402,7 @@ class IdentifierTitle(BaseModel): """ Title of an identifier. See external documentation: https://support.datacite.org/docs/datacite-metadata-schema-v44-mandatory-properties#3-title. """ - id: int + id: str title: str language: Optional[Language] = None type: Optional[TitleType] = None @@ -416,11 +415,11 @@ class CreateIdentifierTitle(BaseModel): class SaveIdentifierTitle(CreateIdentifierTitle): - id: int + id: str class IdentifierDescription(BaseModel): - id: int + id: str description: str language: Optional[Language] = None type: Optional[DescriptionType] = None @@ -433,11 +432,11 @@ class CreateIdentifierDescription(BaseModel): class SaveIdentifierDescription(CreateIdentifierDescription): - id: int + id: str class IdentifierFunder(BaseModel): - id: int + id: str funder_name: str funder_identifier: Optional[str] = None funder_identifier_type: Optional[str] = None @@ -456,7 +455,7 @@ class CreateIdentifierFunder(BaseModel): class SaveIdentifierFunder(CreateIdentifierFunder): - id: int + id: str class License(BaseModel): @@ -550,7 +549,7 @@ class AffiliationIdentifierSchemeType(str, Enum): class Creator(BaseModel): - id: int + id: str creator_name: str firstname: Optional[str] = None lastname: Optional[str] = None @@ -565,7 +564,7 @@ class Creator(BaseModel): class CreatorBrief(BaseModel): - id: int + id: str creator_name: str affiliation: Optional[str] = None name_type: Optional[str] = None @@ -590,11 +589,11 @@ class CreateIdentifierCreator(BaseModel): class SaveIdentifierCreator(CreateIdentifierCreator): - id: int + id: str class RelatedIdentifier(BaseModel): - id: int + id: str value: str type: RelatedIdentifierType relation: RelatedIdentifierRelation @@ -607,11 +606,11 @@ class CreateRelatedIdentifier(BaseModel): class SaveRelatedIdentifier(CreateRelatedIdentifier): - id: int + id: str class CreateIdentifier(BaseModel): - database_id: int + database_id: str type: IdentifierType creators: List[CreateIdentifierCreator] publication_year: int @@ -622,9 +621,9 @@ class CreateIdentifier(BaseModel): doi: Optional[str] = None language: Optional[str] = None licenses: Optional[List[License]] = field(default_factory=list) - query_id: Optional[int] = None - table_id: Optional[int] = None - view_id: Optional[int] = None + query_id: Optional[str] = None + table_id: Optional[str] = None + view_id: Optional[str] = None query: Optional[str] = None query_normalized: Optional[str] = None execution: Optional[str] = None @@ -636,12 +635,12 @@ class CreateIdentifier(BaseModel): class IdentifierSave(CreateIdentifier): - id: int + id: str class Identifier(BaseModel): - id: int - database_id: int + id: str + database_id: str type: IdentifierType owner: UserBrief status: IdentifierStatusType @@ -654,9 +653,9 @@ class Identifier(BaseModel): doi: Optional[str] = None language: Optional[str] = None licenses: Optional[List[License]] = field(default_factory=list) - query_id: Optional[int] = None - table_id: Optional[int] = None - view_id: Optional[int] = None + query_id: Optional[str] = None + table_id: Optional[str] = None + view_id: Optional[str] = None query: Optional[str] = None query_normalized: Optional[str] = None execution: Optional[str] = None @@ -668,8 +667,8 @@ class Identifier(BaseModel): class IdentifierBrief(BaseModel): - id: int - database_id: int + id: str + database_id: str type: IdentifierType owned_by: str status: IdentifierStatusType @@ -677,14 +676,14 @@ class IdentifierBrief(BaseModel): publisher: str titles: List[IdentifierTitle] doi: Optional[str] = None - query_id: Optional[int] = None - table_id: Optional[int] = None - view_id: Optional[int] = None + query_id: Optional[str] = None + table_id: Optional[str] = None + view_id: Optional[str] = None class View(BaseModel): - id: int - database_id: int + id: str + database_id: str name: str query: str query_hash: str @@ -711,8 +710,8 @@ class History(BaseModel): class ViewBrief(BaseModel): - id: int - database_id: int + id: str + database_id: str name: str internal_name: str is_public: bool @@ -724,7 +723,7 @@ class ViewBrief(BaseModel): class ConceptBrief(BaseModel): - id: int + id: str uri: str name: Optional[str] = None description: Optional[str] = None @@ -759,7 +758,7 @@ class TableStatistics(BaseModel): class UnitBrief(BaseModel): - id: int + id: str uri: str name: Optional[str] = None description: Optional[str] = None @@ -920,12 +919,12 @@ class IdentifierType(str, Enum): class Query(BaseModel): - id: int + id: str owner: UserBrief execution: Timestamp query: str type: QueryType - database_id: int + database_id: str query_hash: str is_persisted: bool result_hash: str @@ -957,10 +956,10 @@ class DataType(BaseModel): class Column(BaseModel): - id: int + id: str name: str - database_id: int - table_id: int + database_id: str + table_id: str ord: int internal_name: str is_null_allowed: bool @@ -986,10 +985,10 @@ class Column(BaseModel): class ViewColumn(BaseModel): - id: int + id: str name: str ord: int - database_id: int + database_id: str internal_name: str type: ColumnType is_null_allowed: bool @@ -1005,8 +1004,8 @@ class ViewColumn(BaseModel): class Table(BaseModel): - id: int - database_id: int + id: str + database_id: str name: str owner: UserBrief columns: List[Column] @@ -1027,7 +1026,7 @@ class Table(BaseModel): class DatabaseBrief(BaseModel): - id: int + id: str name: str contact: UserBrief owner_id: str @@ -1040,7 +1039,7 @@ class DatabaseBrief(BaseModel): class Database(BaseModel): - id: int + id: str name: str owner: UserBrief contact: UserBrief @@ -1060,13 +1059,13 @@ class Database(BaseModel): class Unique(BaseModel): - id: int + id: str table: TableBrief columns: List[ColumnBrief] class ForeignKeyReference(BaseModel): - id: int + id: str foreign_key: ForeignKeyBrief column: ColumnBrief referenced_column: ColumnBrief @@ -1084,11 +1083,11 @@ class ReferenceType(str, Enum): class ForeignKeyBrief(BaseModel): - id: int + id: str class ForeignKey(BaseModel): - id: int + id: str name: str references: List[ForeignKeyReference] table: TableBrief @@ -1106,7 +1105,7 @@ class CreateForeignKey(BaseModel): class PrimaryKey(BaseModel): - id: int + id: str table: TableBrief column: ColumnBrief