Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix limit on most requests #385

Merged
merged 6 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/dockerimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions pwa/src/apiService/apiService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions pwa/src/apiService/resources/application.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -11,13 +11,13 @@ export default class Application {
}

public getAll = async (): Promise<any> => {
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<any> => {
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 }));
};
Expand Down
4 changes: 2 additions & 2 deletions pwa/src/apiService/resources/attribute.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -11,7 +11,7 @@ export default class Attribute {
}

public getAll = async (): Promise<any> => {
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;
};
Expand Down
6 changes: 3 additions & 3 deletions pwa/src/apiService/resources/cronjob.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -11,13 +11,13 @@ export default class Cronjob {
}

public getAll = async (): Promise<any> => {
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<any> => {
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 }));
};
Expand Down
2 changes: 1 addition & 1 deletion pwa/src/apiService/resources/dashboardCards.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AxiosInstance } from "axios";
import { TSendFunction } from "../apiService";
import { DEFAULT_LIMIT, TSendFunction } from "../apiService";

export type TEntity =
| "Action"
Expand Down
6 changes: 3 additions & 3 deletions pwa/src/apiService/resources/database.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -11,13 +11,13 @@ export default class Database {
}

public getAll = async (): Promise<any> => {
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<any> => {
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 }));
};
Expand Down
6 changes: 3 additions & 3 deletions pwa/src/apiService/resources/endpoint.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -11,13 +11,13 @@ export default class Endpoint {
}

public getAll = async (): Promise<any> => {
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<any> => {
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 }));
};
Expand Down
7 changes: 3 additions & 4 deletions pwa/src/apiService/resources/mapping.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -11,7 +11,7 @@ export default class Mapping {
}

public getAll = async (): Promise<any> => {
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;
};
Expand All @@ -23,12 +23,11 @@ export default class Mapping {
};

public getAllSelectOptions = async (): Promise<any> => {
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<any> => {
const { id } = variables;

Expand Down
4 changes: 2 additions & 2 deletions pwa/src/apiService/resources/object.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -70,7 +70,7 @@ export default class Sources {
};

public getAllSelectOptions = async (): Promise<any> => {
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 }));
};
Expand Down
6 changes: 3 additions & 3 deletions pwa/src/apiService/resources/organization.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -11,13 +11,13 @@ export default class Organization {
}

public getAll = async (): Promise<any> => {
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<any> => {
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 }));
};
Expand Down
6 changes: 3 additions & 3 deletions pwa/src/apiService/resources/schema.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -12,13 +12,13 @@ export default class Schema {
}

public getAll = async (): Promise<any> => {
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<any> => {
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 }));
};
Expand Down
4 changes: 2 additions & 2 deletions pwa/src/apiService/resources/securityGroup.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -11,7 +11,7 @@ export default class SecurityGroup {
}

public getAll = async (): Promise<any> => {
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;
};
Expand Down
6 changes: 3 additions & 3 deletions pwa/src/apiService/resources/source.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -11,13 +11,13 @@ export default class Source {
}

public getAll = async (): Promise<any> => {
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=${DEFAULT_LIMIT}`);

return data;
};

public getAllSelectOptions = async (): Promise<any> => {
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 }));
};
Expand Down
4 changes: 2 additions & 2 deletions pwa/src/apiService/resources/synchronization.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -12,7 +12,7 @@ export default class Synchroniation {
}

public getAll = async (): Promise<any> => {
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;
};
Expand Down
6 changes: 3 additions & 3 deletions pwa/src/apiService/resources/template.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -11,13 +11,13 @@ export default class Template {
}

public getAll = async (): Promise<any> => {
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<any> => {
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 }));
};
Expand Down
6 changes: 3 additions & 3 deletions pwa/src/apiService/resources/user.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -11,13 +11,13 @@ export default class User {
}

public getAll = async (): Promise<any> => {
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<any> => {
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 }));
};
Expand Down
Loading