Skip to content

Refactor monitoring resources and enhance dashboard filters#3754

Closed
Darkace01 wants to merge 4 commits intoDokploy:canaryfrom
Darkace01:feat/monitoring-project-resource-filters
Closed

Refactor monitoring resources and enhance dashboard filters#3754
Darkace01 wants to merge 4 commits intoDokploy:canaryfrom
Darkace01:feat/monitoring-project-resource-filters

Conversation

@Darkace01
Copy link

What is this PR about?

This PR refactors the monitoring resources by extracting the mapping logic into a separate file and adds unit tests for various scenarios. It also sets up the initial development container and enhances the monitoring dashboard with project and resource filters for improved usability.

Checklist

Before submitting this PR, please make sure that:

  • You created a dedicated branch based on the canary branch.
  • You have read the suggestions in the CONTRIBUTING.md file https://github.com/Dokploy/dokploy/blob/canary/CONTRIBUTING.md#pull-request
  • You have tested this PR in your local instance. If you have not tested it yet, please do so before submitting. This helps avoid wasting maintainers' time reviewing code that has not been verified by you.

Issues related (if applicable)

closes #123

Screenshots (if applicable)

…it tests

Extract monitoring resources mapping into monitoring-resources.ts and replace inline mapping in monitoring.tsx with the new helper. Add unit tests monitoring-resources.test.ts to cover null input and mapping of applications, compose entries, and database services.
Copilot AI review requested due to automatic review settings February 19, 2026 14:27
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 19, 2026

Too many files changed for review. (1083 files found, 100 file limit)

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors monitoring resources by extracting resource mapping logic into a reusable utility function with unit tests, and enhances the monitoring dashboard with project and resource filtering capabilities. It also updates the development container configuration.

Changes:

  • Extracted resource mapping logic from the monitoring component into a separate utility function with comprehensive unit tests
  • Added project and resource filter dropdowns to the monitoring dashboard for improved navigation
  • Updated devcontainer configuration to include Python 3.11

Reviewed changes

Copilot reviewed 3 out of 1083 changed files in this pull request and generated 3 comments.

File Description
apps/dokploy/components/dashboard/monitoring/paid/servers/show-paid-monitoring.tsx Adds project and resource filtering UI, integrates container monitoring, and implements resource selection logic
apps/dokploy/test/monitoring-resources.test.ts Adds unit tests for the monitoring resources utility function
.devcontainer/devcontainer.json Adds Python 3.11 feature to the development container

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +140 to +221
const resources = useMemo<MonitoringResource[]>(() => {
if (!projects) {
return [];
}

const allResources = projects.flatMap((project) => {
const projectId = project.projectId;
const projectName = project.name;

return project.environments.flatMap((environment) => [
...environment.applications.map((app) => ({
key: `application-${app.applicationId}`,
projectId,
projectName,
appName: app.appName,
label: app.name,
type: "Application",
serverId: app.serverId,
})),
...environment.compose.map((service) => ({
key: `compose-${service.composeId}`,
projectId,
projectName,
appName: service.appName,
label: service.name,
type: "Compose",
serverId: service.serverId,
})),
...environment.postgres.map((service) => ({
key: `postgres-${service.postgresId}`,
projectId,
projectName,
appName: service.appName,
label: service.name,
type: "Postgres",
serverId: service.serverId,
})),
...environment.redis.map((service) => ({
key: `redis-${service.redisId}`,
projectId,
projectName,
appName: service.appName,
label: service.name,
type: "Redis",
serverId: service.serverId,
})),
...environment.mysql.map((service) => ({
key: `mysql-${service.mysqlId}`,
projectId,
projectName,
appName: service.appName,
label: service.name,
type: "MySQL",
serverId: service.serverId,
})),
...environment.mongo.map((service) => ({
key: `mongo-${service.mongoId}`,
projectId,
projectName,
appName: service.appName,
label: service.name,
type: "MongoDB",
serverId: service.serverId,
})),
...environment.mariadb.map((service) => ({
key: `mariadb-${service.mariadbId}`,
projectId,
projectName,
appName: service.appName,
label: service.name,
type: "MariaDB",
serverId: service.serverId,
})),
]);
});

return allResources.filter(
(resource) =>
Boolean(resource.appName) &&
(!serverId || resource.serverId === serverId),
);
}, [projects, serverId]);
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This resource mapping logic duplicates the implementation being tested in the new utility file. The PR description mentions extracting this logic into a separate file, but the component still contains the inline implementation instead of using the extracted utility function. Consider replacing this useMemo block with a call to buildMonitoringResources.

Copilot uses AI. Check for mistakes.
Comment on lines +59 to +60

expect(appResource?.label).toBe("App A");
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assertion is duplicated on line 55 and adds no additional value. Remove this redundant test assertion.

Suggested change
expect(appResource?.label).toBe("App A");

Copilot uses AI. Check for mistakes.
Comment on lines +18 to +19
},
"ghcr.io/devcontainers/features/python:1": { "version": "3.11" }
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description does not explain why Python 3.11 is being added to the development container. This addition appears unrelated to the monitoring refactoring work and lacks justification in the PR context.

Suggested change
},
"ghcr.io/devcontainers/features/python:1": { "version": "3.11" }
}

Copilot uses AI. Check for mistakes.
@Darkace01 Darkace01 closed this Feb 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants