From 9d79456d9ff5b9afbc3cbe79f7df8b44a9f59807 Mon Sep 17 00:00:00 2001 From: Barry Brands Date: Fri, 1 Nov 2024 14:37:36 +0100 Subject: [PATCH 1/6] Fix limit on most requests --- pwa/src/apiService/apiService.ts | 2 ++ pwa/src/apiService/resources/application.ts | 6 +++--- pwa/src/apiService/resources/attribute.ts | 4 ++-- pwa/src/apiService/resources/cronjob.ts | 6 +++--- pwa/src/apiService/resources/dashboardCards.tsx | 4 ++-- pwa/src/apiService/resources/database.ts | 6 +++--- pwa/src/apiService/resources/endpoint.ts | 6 +++--- pwa/src/apiService/resources/mapping.ts | 7 +++---- pwa/src/apiService/resources/object.ts | 2 +- pwa/src/apiService/resources/organization.ts | 6 +++--- pwa/src/apiService/resources/schema.ts | 6 +++--- pwa/src/apiService/resources/securityGroup.ts | 4 ++-- pwa/src/apiService/resources/source.ts | 6 +++--- pwa/src/apiService/resources/synchronization.ts | 4 ++-- pwa/src/apiService/resources/template.ts | 6 +++--- pwa/src/apiService/resources/user.ts | 6 +++--- 16 files changed, 41 insertions(+), 40 deletions(-) diff --git a/pwa/src/apiService/apiService.ts b/pwa/src/apiService/apiService.ts index 74e82f79..707eb756 100644 --- a/pwa/src/apiService/apiService.ts +++ b/pwa/src/apiService/apiService.ts @@ -36,6 +36,8 @@ interface PromiseMessage { error?: string; } +export const DEFAULT_LIMIT = 200; + export type TSendFunction = ( instance: AxiosInstance, method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "DOWNLOAD", diff --git a/pwa/src/apiService/resources/application.ts b/pwa/src/apiService/resources/application.ts index b7ec7ac6..5d965d23 100644 --- a/pwa/src/apiService/resources/application.ts +++ b/pwa/src/apiService/resources/application.ts @@ -1,5 +1,5 @@ import { AxiosInstance } from "axios"; -import { TSendFunction } from "../apiService"; +import { DEFAULT_LIMIT, TSendFunction } from "../apiService"; export default class Application { private _instance: AxiosInstance; @@ -11,13 +11,13 @@ export default class Application { } public getAll = async (): Promise => { - const { data } = await this._send(this._instance, "GET", "/admin/applications"); + const { data } = await this._send(this._instance, "GET", `/admin/applications?limit=${DEFAULT_LIMIT}`); return data; }; public getAllSelectOptions = async (): Promise => { - const { data } = await this._send(this._instance, "GET", "/admin/applications?limit=200"); + const { data } = await this._send(this._instance, "GET", `/admin/applications?limit=${DEFAULT_LIMIT}`); return data?.map((application: any) => ({ label: application.name, value: application.id })); }; diff --git a/pwa/src/apiService/resources/attribute.ts b/pwa/src/apiService/resources/attribute.ts index 3bbc728e..16bf3284 100644 --- a/pwa/src/apiService/resources/attribute.ts +++ b/pwa/src/apiService/resources/attribute.ts @@ -1,5 +1,5 @@ import { AxiosInstance } from "axios"; -import { TSendFunction } from "../apiService"; +import { DEFAULT_LIMIT, TSendFunction } from "../apiService"; export default class Attribute { private _instance: AxiosInstance; @@ -11,7 +11,7 @@ export default class Attribute { } public getAll = async (): Promise => { - const { data } = await this._send(this._instance, "GET", "/admin/attributes"); + const { data } = await this._send(this._instance, "GET", `/admin/attributes?limit=${DEFAULT_LIMIT}`); return data; }; diff --git a/pwa/src/apiService/resources/cronjob.ts b/pwa/src/apiService/resources/cronjob.ts index c526bc13..30ce9dfa 100644 --- a/pwa/src/apiService/resources/cronjob.ts +++ b/pwa/src/apiService/resources/cronjob.ts @@ -1,5 +1,5 @@ import { AxiosInstance } from "axios"; -import { TSendFunction } from "../apiService"; +import { DEFAULT_LIMIT, TSendFunction } from "../apiService"; export default class Cronjob { private _instance: AxiosInstance; @@ -11,13 +11,13 @@ export default class Cronjob { } public getAll = async (): Promise => { - const { data } = await this._send(this._instance, "GET", "/admin/cronjobs"); + const { data } = await this._send(this._instance, "GET", `/admin/cronjobs?limit=${DEFAULT_LIMIT}`); return data; }; public getAllSelectOptions = async (): Promise => { - const { data } = await this._send(this._instance, "GET", "/admin/cronjobs?limit=200"); + const { data } = await this._send(this._instance, "GET", `/admin/cronjobs?limit=${DEFAULT_LIMIT}`); return data?.map((cronjob: any) => ({ label: cronjob.name, value: cronjob.id })); }; diff --git a/pwa/src/apiService/resources/dashboardCards.tsx b/pwa/src/apiService/resources/dashboardCards.tsx index b9d4975e..7fcd178d 100644 --- a/pwa/src/apiService/resources/dashboardCards.tsx +++ b/pwa/src/apiService/resources/dashboardCards.tsx @@ -1,5 +1,5 @@ import { AxiosInstance } from "axios"; -import { TSendFunction } from "../apiService"; +import { DEFAULT_LIMIT, TSendFunction } from "../apiService"; export type TEntity = | "Action" @@ -25,7 +25,7 @@ export default class DashboardCards { } public getAll = async (): Promise => { - const { data } = await this._send(this._instance, "GET", "/admin/dashboardCards", undefined, { + const { data } = await this._send(this._instance, "GET", `/admin/dashboardCards", undefined, { error: "Could not fetch Dashboardcards.", }); diff --git a/pwa/src/apiService/resources/database.ts b/pwa/src/apiService/resources/database.ts index 29472ea9..4c9afcf6 100644 --- a/pwa/src/apiService/resources/database.ts +++ b/pwa/src/apiService/resources/database.ts @@ -1,5 +1,5 @@ import { AxiosInstance } from "axios"; -import { TSendFunction } from "../apiService"; +import { DEFAULT_LIMIT, TSendFunction } from "../apiService"; export default class Database { private _instance: AxiosInstance; @@ -11,13 +11,13 @@ export default class Database { } public getAll = async (): Promise => { - const { data } = await this._send(this._instance, "GET", "/admin/databases"); + const { data } = await this._send(this._instance, "GET", `/admin/databases?limit=${DEFAULT_LIMIT}`); return data; }; public getAllSelectOptions = async (): Promise => { - const { data } = await this._send(this._instance, "GET", "/admin/databases?limit=200"); + const { data } = await this._send(this._instance, "GET", `/admin/databases?limit=${DEFAULT_LIMIT}`); return data?.map((database: any) => ({ label: database.name, value: database.id })); }; diff --git a/pwa/src/apiService/resources/endpoint.ts b/pwa/src/apiService/resources/endpoint.ts index db12462e..0874d048 100644 --- a/pwa/src/apiService/resources/endpoint.ts +++ b/pwa/src/apiService/resources/endpoint.ts @@ -1,5 +1,5 @@ import { AxiosInstance } from "axios"; -import { TSendFunction } from "../apiService"; +import { DEFAULT_LIMIT, TSendFunction } from "../apiService"; export default class Endpoint { private _instance: AxiosInstance; @@ -11,13 +11,13 @@ export default class Endpoint { } public getAll = async (): Promise => { - const { data } = await this._send(this._instance, "GET", "/admin/endpoints"); + const { data } = await this._send(this._instance, "GET", `/admin/endpoints?limit=${DEFAULT_LIMIT}`); return data; }; public getAllSelectOptions = async (): Promise => { - const { data } = await this._send(this._instance, "GET", "/admin/endpoints"); + const { data } = await this._send(this._instance, "GET", `/admin/endpoints?limit=${DEFAULT_LIMIT}`); return data?.map((endpoint: any) => ({ label: endpoint.name, value: endpoint.id })); }; diff --git a/pwa/src/apiService/resources/mapping.ts b/pwa/src/apiService/resources/mapping.ts index d38cca03..599bab95 100644 --- a/pwa/src/apiService/resources/mapping.ts +++ b/pwa/src/apiService/resources/mapping.ts @@ -1,5 +1,5 @@ import { AxiosInstance } from "axios"; -import { TSendFunction } from "../apiService"; +import { DEFAULT_LIMIT, TSendFunction } from "../apiService"; export default class Mapping { private _instance: AxiosInstance; @@ -11,7 +11,7 @@ export default class Mapping { } public getAll = async (): Promise => { - const { data } = await this._send(this._instance, "GET", "/admin/mappings"); + const { data } = await this._send(this._instance, "GET", `/admin/mappings?limit=${DEFAULT_LIMIT}`); return data; }; @@ -23,12 +23,11 @@ export default class Mapping { }; public getAllSelectOptions = async (): Promise => { - const { data } = await this._send(this._instance, "GET", "/admin/mappings?limit=200"); + const { data } = await this._send(this._instance, "GET", "/admin/mappings?limit=${DEFAULT_LIMIT}`); return data?.map((mapping: any) => ({ label: mapping.name, value: mapping.id })); }; - public delete = async (variables: { id: string }): Promise => { const { id } = variables; diff --git a/pwa/src/apiService/resources/object.ts b/pwa/src/apiService/resources/object.ts index 20693fc8..34f4b89a 100644 --- a/pwa/src/apiService/resources/object.ts +++ b/pwa/src/apiService/resources/object.ts @@ -70,7 +70,7 @@ export default class Sources { }; public getAllSelectOptions = async (): Promise => { - const { data } = await this._send(this._instance, "GET", "/admin/objects?limit=200"); + const { data } = await this._send(this._instance, "GET", "/admin/objects?limit=${DEFAULT_LIMIT}`); return data?.results?.map((object: any) => ({ label: object.titel, value: object.id })); }; diff --git a/pwa/src/apiService/resources/organization.ts b/pwa/src/apiService/resources/organization.ts index 2f74cd98..2b558207 100644 --- a/pwa/src/apiService/resources/organization.ts +++ b/pwa/src/apiService/resources/organization.ts @@ -1,5 +1,5 @@ import { AxiosInstance } from "axios"; -import { TSendFunction } from "../apiService"; +import { DEFAULT_LIMIT, TSendFunction } from "../apiService"; export default class Organization { private _instance: AxiosInstance; @@ -11,13 +11,13 @@ export default class Organization { } public getAll = async (): Promise => { - const { data } = await this._send(this._instance, "GET", "/admin/organizations"); + const { data } = await this._send(this._instance, "GET", `/admin/organizations?limit=${DEFAULT_LIMIT}`); return data; }; public getAllSelectOptions = async (): Promise => { - const { data } = await this._send(this._instance, "GET", "/admin/organizations?limit=200"); + const { data } = await this._send(this._instance, "GET", `/admin/organizations?limit=${DEFAULT_LIMIT}`); return data?.map((organization: any) => ({ label: organization.name, value: organization.id })); }; diff --git a/pwa/src/apiService/resources/schema.ts b/pwa/src/apiService/resources/schema.ts index f43d38ee..0680911e 100644 --- a/pwa/src/apiService/resources/schema.ts +++ b/pwa/src/apiService/resources/schema.ts @@ -1,5 +1,5 @@ import { AxiosInstance } from "axios"; -import { TSendFunction } from "../apiService"; +import { DEFAULT_LIMIT, TSendFunction } from "../apiService"; import { TDownloadType, downloadTypes } from "../../data/downloadTypes"; export default class Schema { @@ -12,13 +12,13 @@ export default class Schema { } public getAll = async (): Promise => { - const { data } = await this._send(this._instance, "GET", "/admin/entities?limit=200"); + const { data } = await this._send(this._instance, "GET", `/admin/entities?limit=${DEFAULT_LIMIT}`); return data; }; public getAllSelectOptions = async (): Promise => { - const { data } = await this._send(this._instance, "GET", "/admin/entities?limit=200"); + const { data } = await this._send(this._instance, "GET", `/admin/entities?limit=${DEFAULT_LIMIT}`); return data?.map((schema: any) => ({ label: schema.name, value: schema.id })); }; diff --git a/pwa/src/apiService/resources/securityGroup.ts b/pwa/src/apiService/resources/securityGroup.ts index 32490f2d..ef01b8f1 100644 --- a/pwa/src/apiService/resources/securityGroup.ts +++ b/pwa/src/apiService/resources/securityGroup.ts @@ -1,5 +1,5 @@ import { AxiosInstance } from "axios"; -import { TSendFunction } from "../apiService"; +import { DEFAULT_LIMIT, TSendFunction } from "../apiService"; export default class SecurityGroup { private _instance: AxiosInstance; @@ -11,7 +11,7 @@ export default class SecurityGroup { } public getAll = async (): Promise => { - const { data } = await this._send(this._instance, "GET", "/admin/user_groups"); + const { data } = await this._send(this._instance, "GET", `/admin/user_groups?limit=${DEFAULT_LIMIT}`); return data; }; diff --git a/pwa/src/apiService/resources/source.ts b/pwa/src/apiService/resources/source.ts index d29b4668..e0c53d88 100644 --- a/pwa/src/apiService/resources/source.ts +++ b/pwa/src/apiService/resources/source.ts @@ -1,5 +1,5 @@ import { AxiosInstance } from "axios"; -import { TSendFunction } from "../apiService"; +import { DEFAULT_LIMIT, TSendFunction } from "../apiService"; export default class Source { private _instance: AxiosInstance; @@ -11,13 +11,13 @@ export default class Source { } public getAll = async (): Promise => { - const { data } = await this._send(this._instance, "GET", "/admin/gateways?order[name]=ASC"); + const { data } = await this._send(this._instance, "GET", `/admin/gateways?order[name]=ASC&limit=200"); return data; }; public getAllSelectOptions = async (): Promise => { - const { data } = await this._send(this._instance, "GET", "/admin/gateways?limit=200"); + const { data } = await this._send(this._instance, "GET", `/admin/gateways?limit=${DEFAULT_LIMIT}`); return data?.map((source: any) => ({ label: source.name, value: source.id })); }; diff --git a/pwa/src/apiService/resources/synchronization.ts b/pwa/src/apiService/resources/synchronization.ts index 9358f341..119c1363 100644 --- a/pwa/src/apiService/resources/synchronization.ts +++ b/pwa/src/apiService/resources/synchronization.ts @@ -1,6 +1,6 @@ import { AxiosInstance } from "axios"; import { paramsToQueryParams } from "../../services/paramsToQueryParams"; -import { TSendFunction } from "../apiService"; +import { DEFAULT_LIMIT, TSendFunction } from "../apiService"; export default class Synchroniation { private _instance: AxiosInstance; @@ -12,7 +12,7 @@ export default class Synchroniation { } public getAll = async (): Promise => { - const { data } = await this._send(this._instance, "GET", "/admin/synchronizations"); + const { data } = await this._send(this._instance, "GET", `/admin/synchronizations?limit=${DEFAULT_LIMIT}`); return data; }; diff --git a/pwa/src/apiService/resources/template.ts b/pwa/src/apiService/resources/template.ts index c06c6912..65bca857 100644 --- a/pwa/src/apiService/resources/template.ts +++ b/pwa/src/apiService/resources/template.ts @@ -1,5 +1,5 @@ import { AxiosInstance } from "axios"; -import { TSendFunction } from "../apiService"; +import { DEFAULT_LIMIT, TSendFunction } from "../apiService"; export default class Template { private _instance: AxiosInstance; @@ -11,13 +11,13 @@ export default class Template { } public getAll = async (): Promise => { - const { data } = await this._send(this._instance, "GET", "/admin/templates"); + const { data } = await this._send(this._instance, "GET", `/admin/templates?limit=200`); return data; }; public getAllSelectOptions = async (): Promise => { - const { data } = await this._send(this._instance, "GET", "/admin/templates?limit=200"); + const { data } = await this._send(this._instance, "GET", `/admin/templates?limit=${DEFAULT_LIMIT}`); return data?.map((template: any) => ({ label: template.name, value: template.id })); }; diff --git a/pwa/src/apiService/resources/user.ts b/pwa/src/apiService/resources/user.ts index 6b51774e..09060bf4 100644 --- a/pwa/src/apiService/resources/user.ts +++ b/pwa/src/apiService/resources/user.ts @@ -1,5 +1,5 @@ import { AxiosInstance } from "axios"; -import { TSendFunction } from "../apiService"; +import { DEFAULT_LIMIT, TSendFunction } from "../apiService"; export default class User { private _instance: AxiosInstance; @@ -11,13 +11,13 @@ export default class User { } public getAll = async (): Promise => { - const { data } = await this._send(this._instance, "GET", "/admin/users"); + const { data } = await this._send(this._instance, "GET", `/admin/users?limit=${DEFAULT_LIMIT}`); return data; }; public getAllSelectOptions = async (): Promise => { - const { data } = await this._send(this._instance, "GET", "/admin/users?limit=200"); + const { data } = await this._send(this._instance, "GET", `/admin/users?limit=${DEFAULT_LIMIT}`); return data?.map((user: any) => ({ label: user.name, value: user.id })); }; From 0e8d35a7bee334fb08392ff65237694134a9df17 Mon Sep 17 00:00:00 2001 From: Barry Brands Date: Fri, 1 Nov 2024 14:49:40 +0100 Subject: [PATCH 2/6] Added install docker job --- .github/workflows/dockerimage.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/dockerimage.yml b/.github/workflows/dockerimage.yml index d20171a2..cc5f5184 100644 --- a/.github/workflows/dockerimage.yml +++ b/.github/workflows/dockerimage.yml @@ -18,6 +18,11 @@ jobs: steps: - uses: actions/checkout@v1 - uses: actions/setup-node@v1 + - name: Install Docker Compose + run: | + sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose + sudo chmod +x /usr/local/bin/docker-compose + - name: Export release code if: (success() || failure()) id: releasecode #version number in a more comprehensible format: 0.1.YearMonthDay in UTC From f47ac078af09a7145f5dfa735acfd67f3a610353 Mon Sep 17 00:00:00 2001 From: Barry Brands Date: Fri, 1 Nov 2024 14:53:05 +0100 Subject: [PATCH 3/6] fix source.ts --- pwa/src/apiService/resources/source.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pwa/src/apiService/resources/source.ts b/pwa/src/apiService/resources/source.ts index e0c53d88..7c642bcc 100644 --- a/pwa/src/apiService/resources/source.ts +++ b/pwa/src/apiService/resources/source.ts @@ -11,7 +11,7 @@ export default class Source { } public getAll = async (): Promise => { - const { data } = await this._send(this._instance, "GET", `/admin/gateways?order[name]=ASC&limit=200"); + const { data } = await this._send(this._instance, "GET", `/admin/gateways?order[name]=ASC&limit=${DEFAULT_LIMIT}`); return data; }; From 7ecccbc5d5cfafb1f8772c94ad30c89d7407de5d Mon Sep 17 00:00:00 2001 From: Barry Brands Date: Fri, 1 Nov 2024 15:06:59 +0100 Subject: [PATCH 4/6] fix object.ts --- pwa/src/apiService/resources/object.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pwa/src/apiService/resources/object.ts b/pwa/src/apiService/resources/object.ts index 34f4b89a..9ea86c1e 100644 --- a/pwa/src/apiService/resources/object.ts +++ b/pwa/src/apiService/resources/object.ts @@ -1,5 +1,5 @@ import { AxiosInstance } from "axios"; -import { TSendFunction } from "../apiService"; +import { DEFAULT_LIMIT, TSendFunction } from "../apiService"; import { TDownloadType, downloadTypes } from "../../data/downloadTypes"; export default class Sources { private _instance: AxiosInstance; @@ -70,7 +70,7 @@ export default class Sources { }; public getAllSelectOptions = async (): Promise => { - const { data } = await this._send(this._instance, "GET", "/admin/objects?limit=${DEFAULT_LIMIT}`); + const { data } = await this._send(this._instance, "GET", `/admin/objects?limit=${DEFAULT_LIMIT}`); return data?.results?.map((object: any) => ({ label: object.titel, value: object.id })); }; From ab98e440d340a6c30992db2db81b53e774755044 Mon Sep 17 00:00:00 2001 From: Barry Brands Date: Fri, 1 Nov 2024 15:14:15 +0100 Subject: [PATCH 5/6] mapping.ts fix --- pwa/src/apiService/resources/mapping.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pwa/src/apiService/resources/mapping.ts b/pwa/src/apiService/resources/mapping.ts index 599bab95..be524347 100644 --- a/pwa/src/apiService/resources/mapping.ts +++ b/pwa/src/apiService/resources/mapping.ts @@ -23,7 +23,7 @@ export default class Mapping { }; public getAllSelectOptions = async (): Promise => { - const { data } = await this._send(this._instance, "GET", "/admin/mappings?limit=${DEFAULT_LIMIT}`); + const { data } = await this._send(this._instance, "GET", `/admin/mappings?limit=${DEFAULT_LIMIT}`); return data?.map((mapping: any) => ({ label: mapping.name, value: mapping.id })); }; From c678811e8fc91007ca383923ab8cf585ec080877 Mon Sep 17 00:00:00 2001 From: Barry Brands Date: Fri, 1 Nov 2024 15:39:48 +0100 Subject: [PATCH 6/6] fix dashboardcards --- pwa/src/apiService/resources/dashboardCards.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pwa/src/apiService/resources/dashboardCards.tsx b/pwa/src/apiService/resources/dashboardCards.tsx index 7fcd178d..17ad7ecb 100644 --- a/pwa/src/apiService/resources/dashboardCards.tsx +++ b/pwa/src/apiService/resources/dashboardCards.tsx @@ -25,7 +25,7 @@ export default class DashboardCards { } public getAll = async (): Promise => { - const { data } = await this._send(this._instance, "GET", `/admin/dashboardCards", undefined, { + const { data } = await this._send(this._instance, "GET", "/admin/dashboardCards", undefined, { error: "Could not fetch Dashboardcards.", });