Merge branch 'develop' into fix/logs-rights

This commit is contained in:
Alexander Holliday authored and GitHub committed 2025-06-25 12:41:30 +08:00
commit 65eb22bbe0
9 files changed
+66 -30

No files matched your search

@@ -11,6 +11,9 @@ jobs:
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Extract version from tag - name: Extract version from tag
id: extract_tag id: extract_tag
run: echo "version=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT" run: echo "version=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
@@ -93,6 +96,8 @@ jobs:
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
@@ -119,12 +124,16 @@ jobs:
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
labels: | labels: |
org.opencontainers.image.source=https://github.com/bluewave-labs/checkmate org.opencontainers.image.source=https://github.com/bluewave-labs/checkmate
build-args: |
VITE_APP_VERSION=${{ steps.extract_tag.outputs.version }}
docker-build-and-push-server-mono: docker-build-and-push-server-mono:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Extract version - name: Extract version
id: extract_tag id: extract_tag
@@ -143,6 +152,7 @@ jobs:
-t ghcr.io/bluewave-labs/checkmate-backend-mono:${{ steps.extract_tag.outputs.version }} \ -t ghcr.io/bluewave-labs/checkmate-backend-mono:${{ steps.extract_tag.outputs.version }} \
-f ./docker/dist-mono/server.Dockerfile \ -f ./docker/dist-mono/server.Dockerfile \
--label org.opencontainers.image.source=https://github.com/bluewave-labs/checkmate \ --label org.opencontainers.image.source=https://github.com/bluewave-labs/checkmate \
--build-arg VITE_APP_VERSION=${{ steps.extract_tag.outputs.version }} \
. .
- name: Push Server Docker image - name: Push Server Docker image
+21
View File
@@ -10,6 +10,8 @@ jobs:
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Log in to GitHub Container Registry - name: Log in to GitHub Container Registry
uses: docker/login-action@v3 uses: docker/login-action@v3
@@ -18,12 +20,16 @@ jobs:
username: ${{ github.actor }} username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
- name: Get version
id: vars
run: echo "VERSION=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
- name: Build Client Docker image - name: Build Client Docker image
run: | run: |
docker build \ docker build \
-t ghcr.io/bluewave-labs/checkmate-client:latest \ -t ghcr.io/bluewave-labs/checkmate-client:latest \
-f ./docker/dist/client.Dockerfile \ -f ./docker/dist/client.Dockerfile \
--label org.opencontainers.image.source=https://github.com/bluewave-labs/checkmate \ --label org.opencontainers.image.source=https://github.com/bluewave-labs/checkmate \
--build-arg VITE_APP_VERSION=${{ env.VERSION }} \
. .
- name: Push Client Docker image - name: Push Client Docker image
@@ -85,6 +91,8 @@ jobs:
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
@@ -96,6 +104,10 @@ jobs:
username: ${{ github.actor }} username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
- name: Get version
id: vars
run: echo "VERSION=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
- name: Build and push multi-arch Docker image - name: Build and push multi-arch Docker image
uses: docker/build-push-action@v5 uses: docker/build-push-action@v5
with: with:
@@ -107,12 +119,16 @@ jobs:
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
labels: | labels: |
org.opencontainers.image.source=https://github.com/bluewave-labs/checkmate org.opencontainers.image.source=https://github.com/bluewave-labs/checkmate
build-args: |
VITE_APP_VERSION=${{ env.VERSION }}
docker-build-and-push-server-mono: docker-build-and-push-server-mono:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Log in to GitHub Container Registry - name: Log in to GitHub Container Registry
uses: docker/login-action@v3 uses: docker/login-action@v3
@@ -121,12 +137,17 @@ jobs:
username: ${{ github.actor }} username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
- name: Get version
id: vars
run: echo "VERSION=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
- name: Build Server Docker image - name: Build Server Docker image
run: | run: |
docker build \ docker build \
-t ghcr.io/bluewave-labs/checkmate-backend-mono:latest \ -t ghcr.io/bluewave-labs/checkmate-backend-mono:latest \
-f ./docker/dist-mono/server.Dockerfile \ -f ./docker/dist-mono/server.Dockerfile \
--label org.opencontainers.image.source=https://github.com/bluewave-labs/checkmate \ --label org.opencontainers.image.source=https://github.com/bluewave-labs/checkmate \
--build-arg VITE_APP_VERSION=${{ env.VERSION }} \
. .
- name: Push Server Docker image - name: Push Server Docker image
+6
View File
@@ -10,6 +10,8 @@ jobs:
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Log in to GitHub Container Registry - name: Log in to GitHub Container Registry
uses: docker/login-action@v3 uses: docker/login-action@v3
@@ -18,12 +20,16 @@ jobs:
username: ${{ github.actor }} username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
- name: Get version
id: vars
run: echo "VERSION=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
- name: Build Client Docker image - name: Build Client Docker image
run: | run: |
docker build \ docker build \
-t ghcr.io/bluewave-labs/checkmate:frontend-demo \ -t ghcr.io/bluewave-labs/checkmate:frontend-demo \
-f ./docker/prod/client.Dockerfile \ -f ./docker/prod/client.Dockerfile \
--label org.opencontainers.image.source=https://github.com/bluewave-labs/checkmate \ --label org.opencontainers.image.source=https://github.com/bluewave-labs/checkmate \
--build-arg VITE_APP_VERSION=${{ env.VERSION }} \
. .
- name: Push Client Docker image - name: Push Client Docker image
+6
View File
@@ -10,6 +10,8 @@ jobs:
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Log in to GitHub Container Registry - name: Log in to GitHub Container Registry
uses: docker/login-action@v3 uses: docker/login-action@v3
@@ -18,12 +20,16 @@ jobs:
username: ${{ github.actor }} username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
- name: Get version
id: vars
run: echo "VERSION=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
- name: Build Client Docker image - name: Build Client Docker image
run: | run: |
docker build \ docker build \
-t ghcr.io/bluewave-labs/checkmate:frontend-staging \ -t ghcr.io/bluewave-labs/checkmate:frontend-staging \
-f ./docker/staging/client.Dockerfile \ -f ./docker/staging/client.Dockerfile \
--label org.opencontainers.image.source=https://github.com/bluewave-labs/checkmate \ --label org.opencontainers.image.source=https://github.com/bluewave-labs/checkmate \
--build-arg VITE_APP_VERSION=${{ env.VERSION }} \
. .
- name: Push Client Docker image - name: Push Client Docker image
+2 -2
View File
@@ -73,7 +73,7 @@ const getChecksByMonitor = async ({
rowsPerPage = parseInt(rowsPerPage); rowsPerPage = parseInt(rowsPerPage);
// Match // Match
const matchStage = { const matchStage = {
monitorId: ObjectId.createFromHexString(monitorId), monitorId: new ObjectId(monitorId),
...(typeof status !== "undefined" && { status }), ...(typeof status !== "undefined" && { status }),
...(dateRangeLookup[dateRange] && { ...(dateRangeLookup[dateRange] && {
createdAt: { createdAt: {
@@ -161,7 +161,7 @@ const getChecksByTeam = async ({
page = parseInt(page); page = parseInt(page);
rowsPerPage = parseInt(rowsPerPage); rowsPerPage = parseInt(rowsPerPage);
const matchStage = { const matchStage = {
teamId: ObjectId.createFromHexString(teamId), teamId: new ObjectId(teamId),
status: false, status: false,
...(dateRangeLookup[dateRange] && { ...(dateRangeLookup[dateRange] && {
createdAt: { createdAt: {
+1 -1
View File
@@ -19,7 +19,7 @@ const getMonitorsByTeamIdExecutionStats = async (req) => {
order = "asc"; order = "asc";
} }
// Build match stage // Build match stage
const matchStage = { teamId: ObjectId.createFromHexString(req.params.teamId) }; const matchStage = { teamId: new ObjectId(req.params.teamId) };
if (type !== undefined) { if (type !== undefined) {
matchStage.type = Array.isArray(type) ? { $in: type } : type; matchStage.type = Array.isArray(type) ? { $in: type } : type;
} }
+3 -5
View File
@@ -523,7 +523,7 @@ const getMonitorsByTeamId = async ({
order = "asc"; order = "asc";
} }
// Build match stage // Build match stage
const matchStage = { teamId: ObjectId.createFromHexString(teamId) }; const matchStage = { teamId: new ObjectId(teamId) };
if (type !== undefined) { if (type !== undefined) {
matchStage.type = Array.isArray(type) ? { $in: type } : type; matchStage.type = Array.isArray(type) ? { $in: type } : type;
} }
@@ -563,8 +563,7 @@ const getMonitorsByTeamId = async ({
const getMonitorsAndSummaryByTeamId = async ({ type, explain, teamId }) => { const getMonitorsAndSummaryByTeamId = async ({ type, explain, teamId }) => {
try { try {
const parsedTeamId = ObjectId.createFromHexString(teamId); const matchStage = { teamId: new ObjectId(teamId) };
const matchStage = { teamId: parsedTeamId };
if (type !== undefined) { if (type !== undefined) {
matchStage.type = Array.isArray(type) ? { $in: type } : type; matchStage.type = Array.isArray(type) ? { $in: type } : type;
} }
@@ -606,9 +605,8 @@ const getMonitorsWithChecksByTeamId = async ({
field = "name"; field = "name";
order = "asc"; order = "asc";
} }
const parsedTeamId = ObjectId.createFromHexString(teamId);
// Build match stage // Build match stage
const matchStage = { teamId: parsedTeamId }; const matchStage = { teamId: new ObjectId(teamId) };
if (type !== undefined) { if (type !== undefined) {
matchStage.type = Array.isArray(type) ? { $in: type } : type; matchStage.type = Array.isArray(type) ? { $in: type } : type;
} }
@@ -4,7 +4,7 @@ const buildUptimeDetailsPipeline = (monitorId, dates, dateString) => {
return [ return [
{ {
$match: { $match: {
monitorId: ObjectId.createFromHexString(monitorId), monitorId: new ObjectId(monitorId),
createdAt: { $gte: dates.start, $lte: dates.end }, createdAt: { $gte: dates.start, $lte: dates.end },
}, },
}, },
@@ -407,6 +407,16 @@ const buildHardwareDetailsPipeline = (monitor, dates, dateString) => {
], ],
}, },
}, },
{ $unwind: "$checks" },
{ $sort: { "checks._id": 1 } },
{
$group: {
_id: "$_id",
checks: { $push: "$checks" },
aggregateData: { $first: "$aggregateData" },
upChecks: { $first: "$upChecks" },
},
},
{ {
$project: { $project: {
aggregateData: { aggregateData: {
@@ -415,12 +425,7 @@ const buildHardwareDetailsPipeline = (monitor, dates, dateString) => {
upChecks: { upChecks: {
$arrayElemAt: ["$upChecks", 0], $arrayElemAt: ["$upChecks", 0],
}, },
checks: { checks: 1,
$sortArray: {
input: "$checks",
sortBy: { _id: 1 },
},
},
}, },
}, },
]; ];
@@ -734,7 +739,7 @@ const buildGetMonitorsByTeamIdPipeline = (req) => {
order = "asc"; order = "asc";
} }
// Build the match stage // Build the match stage
const matchStage = { teamId: ObjectId.createFromHexString(req.params.teamId) }; const matchStage = { teamId: new ObjectId(req.params.teamId) };
if (type !== undefined) { if (type !== undefined) {
matchStage.type = Array.isArray(type) ? { $in: type } : type; matchStage.type = Array.isArray(type) ? { $in: type } : type;
} }
+4 -14
View File
@@ -134,6 +134,9 @@ const getStatusPage = async (url) => {
}, },
}, },
}, },
{ $match: { "monitors.orderIndex": { $ne: -1 } } },
{ $sort: { "monitors.orderIndex": 1 } },
{ {
$group: { $group: {
_id: "$_id", _id: "$_id",
@@ -156,20 +159,7 @@ const getStatusPage = async (url) => {
showAdminLoginLink: 1, showAdminLoginLink: 1,
url: 1, url: 1,
}, },
monitors: { monitors: 1,
$filter: {
input: {
$sortArray: {
input: "$monitors",
sortBy: { orderIndex: 1 },
},
},
as: "monitor",
cond: {
$ne: ["$$monitor.orderIndex", -1],
},
},
},
}, },
}, },
]); ]);