Compare commits

..

18 Commits

Author SHA1 Message Date
copilot-swe-agent[bot]
c5210a33c4 Force asset build stages to run on native platform with --platform=$BUILDPLATFORM
Added --platform=$BUILDPLATFORM to composer-deps and assets stages to ensure they run on the native build platform (amd64) instead of being built separately for each target architecture (amd64, arm64, arm/v7).

This is the critical change that makes the optimization work:
- Without this flag, Docker Buildx builds these stages for each target platform
- With this flag, stages run once on native platform and results are copied to all targets
- Eliminates ARM emulation overhead for CPU-intensive asset compilation

Co-authored-by: jbtronics <5410681+jbtronics@users.noreply.github.com>
2025-12-07 21:06:09 +00:00
copilot-swe-agent[bot]
6a1792d46a Simplify asset build: copy entire project instead of individual files
Refactored to copy the entire project directory in composer-deps and assets stages instead of cherry-picking specific files. This:
- Eliminates the separate translations stage
- Avoids missing file issues
- Simplifies the build process
- Maintains performance benefit of building assets once on native platform

Both stages now use COPY . . to get all project files, avoiding the complexity of tracking which files are needed.

Co-authored-by: jbtronics <5410681+jbtronics@users.noreply.github.com>
2025-12-07 20:48:51 +00:00
copilot-swe-agent[bot]
9402382d56 Copy .env file to translations stage for Symfony console commands
Symfony console requires .env file to bootstrap. Added COPY .env to translations stage so cache:warmup can run successfully.

Co-authored-by: jbtronics <5410681+jbtronics@users.noreply.github.com>
2025-12-07 21:43:35 +01:00
copilot-swe-agent[bot]
a604ec8476 Add translations stage to generate Symfony translations for webpack
Webpack build requires var/translations files generated by Symfony's cache warmup. Added intermediate 'translations' stage that:
- Copies composer dependencies and app files
- Generates autoloader
- Runs cache warmup to create translation files
- Assets stage now copies these translations before building

This fixes the webpack build errors about missing translation exports.

Co-authored-by: jbtronics <5410681+jbtronics@users.noreply.github.com>
2025-12-07 21:43:35 +01:00
copilot-swe-agent[bot]
564b8f2891 Add git package to Dockerfile base stage
Git is required by composer when installing packages from source. This dependency was exposed by the multi-stage build changes where composer-deps stage uses --no-scripts and the final stage needs to complete the installation.

Co-authored-by: jbtronics <5410681+jbtronics@users.noreply.github.com>
2025-12-07 21:43:35 +01:00
copilot-swe-agent[bot]
84fa326839 Remove redundant --chown flag from COPY in Dockerfile
The assets are copied while running as www-data user, so the --chown flag is redundant. This makes it consistent with the frankenphp version.

Co-authored-by: jbtronics <5410681+jbtronics@users.noreply.github.com>
2025-12-07 21:43:35 +01:00
copilot-swe-agent[bot]
2e79df3155 Optimize Docker build: Build assets outside ARM emulation
- Add multi-stage build with separate composer-deps and assets stages
- Assets are built once on native platform (node:22-bookworm-slim)
- Pre-built assets copied into final images for all platforms
- Remove Node.js/Yarn installation from final images (smaller size)
- Use --ignore-platform-reqs for composer in assets stage
- Applies to both Dockerfile and Dockerfile-frankenphp

Co-authored-by: jbtronics <5410681+jbtronics@users.noreply.github.com>
2025-12-07 21:43:35 +01:00
copilot-swe-agent[bot]
380a11dafe Initial plan 2025-12-07 21:43:34 +01:00
Jan Böhmer
9565a9d548 Fixed error with mass creation, when elements on different level had the same name
Fixes issue #1104
2025-12-07 21:40:57 +01:00
Jan Böhmer
b457298152 Do not clear the mass import form if errors appeared 2025-12-07 21:33:41 +01:00
Jan Böhmer
319ac406a8 Update the mass creation form, so that you can see the newly created entities in dropdown
Fixes issue #1103
2025-12-07 20:50:09 +01:00
Jan Böhmer
065396d1e9 Correctly determine the number of mass created entities
Fixes issue #1102
2025-12-07 20:44:32 +01:00
Jan Böhmer
15243dbcc8 Allow to autodetermine categories and pathes from info provider import using a full path
This fixes issue #1113
2025-12-07 20:39:03 +01:00
Jan Böhmer
e1090d46e3 Fixed error that attachment path had to have exactly 2048 chars 2025-12-07 20:34:47 +01:00
Jan Böhmer
8d903c9586 Merge remote-tracking branch 'origin/master' 2025-12-07 20:25:45 +01:00
Jan Böhmer
39ff4f81c0 Use image attachments as preview images for partkeepr imports
Fixes issue #1115
2025-12-07 20:25:39 +01:00
Jan Böhmer
c60b406157 Fixed partkeepr import with databases that do not feature custom states 2025-12-07 20:21:19 +01:00
Copilot
a66a1b1c33 Document KiCad's rejection of self-signed certificates (#1140)
* Initial plan

* Add documentation about KiCad self-signed certificate issues

Co-authored-by: jbtronics <5410681+jbtronics@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: jbtronics <5410681+jbtronics@users.noreply.github.com>
2025-12-07 19:31:16 +01:00
9 changed files with 110 additions and 50 deletions

View File

@@ -1,6 +1,40 @@
ARG BASE_IMAGE=debian:bookworm-slim
ARG PHP_VERSION=8.4
# ---
# Build assets stage - runs on native platform (not emulated)
# This stage builds the frontend assets (JavaScript, CSS) using Node.js and Yarn
# The --platform=$BUILDPLATFORM ensures this stage runs on the native build platform (amd64)
# and not under emulation for ARM builds
FROM --platform=$BUILDPLATFORM composer:latest AS composer-deps
WORKDIR /build
# Copy entire project to install dependencies and generate translations
COPY . .
# Install composer dependencies (needed for Symfony UX assets and cache warmup)
RUN composer install --no-dev --no-scripts --no-autoloader --prefer-dist --ignore-platform-reqs && \
composer dump-autoload --no-dev --classmap-authoritative && \
php bin/console cache:clear --no-warmup && \
php bin/console cache:warmup
# ---
FROM --platform=$BUILDPLATFORM node:22-bookworm-slim AS assets
WORKDIR /build
# Copy entire project with vendor and generated translations from composer-deps stage
COPY --from=composer-deps /build ./
# Install dependencies and build assets
RUN yarn install --network-timeout 600000 && \
yarn build && \
yarn cache clean
# ---
FROM ${BASE_IMAGE} AS base
ARG PHP_VERSION
@@ -36,6 +70,7 @@ RUN apt-get update && apt-get -y install \
php${PHP_VERSION}-sqlite3 \
php${PHP_VERSION}-mysql \
php${PHP_VERSION}-pgsql \
git \
gpg \
sudo \
&& apt-get -y autoremove && apt-get clean autoclean && rm -rf /var/lib/apt/lists/* \
@@ -45,15 +80,6 @@ RUN apt-get update && apt-get -y install \
# delete the "index.html" that installing Apache drops in here
&& rm -rvf /var/www/html/*
# Install node and yarn
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
curl -sL https://deb.nodesource.com/setup_22.x | bash - && \
apt-get update && apt-get install -y \
nodejs \
yarn \
&& apt-get -y autoremove && apt-get clean autoclean && rm -rf /var/lib/apt/lists/*
# Install composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
@@ -149,14 +175,13 @@ RUN a2dissite 000-default.conf && \
a2enconf docker-php && \
a2enmod rewrite
# Install composer and yarn dependencies for Part-DB
# Install composer dependencies for Part-DB
USER www-data
RUN composer install -a --no-dev && \
composer clear-cache
RUN yarn install --network-timeout 600000 && \
yarn build && \
yarn cache clean && \
rm -rf node_modules/
# Copy pre-built assets from the assets stage
COPY --from=assets /build/public/build ./public/build
# Use docker env to output logs to stdout
ENV APP_ENV=docker

View File

@@ -1,3 +1,37 @@
# ---
# Build assets stage - runs on native platform (not emulated)
# This stage builds the frontend assets (JavaScript, CSS) using Node.js and Yarn
# The --platform=$BUILDPLATFORM ensures this stage runs on the native build platform (amd64)
# and not under emulation for ARM builds
FROM --platform=$BUILDPLATFORM composer:latest AS composer-deps
WORKDIR /build
# Copy entire project to install dependencies and generate translations
COPY . .
# Install composer dependencies (needed for Symfony UX assets and cache warmup)
RUN composer install --no-dev --no-scripts --no-autoloader --prefer-dist --ignore-platform-reqs && \
composer dump-autoload --no-dev --classmap-authoritative && \
php bin/console cache:clear --no-warmup && \
php bin/console cache:warmup
# ---
FROM --platform=$BUILDPLATFORM node:22-bookworm-slim AS assets
WORKDIR /build
# Copy entire project with vendor and generated translations from composer-deps stage
COPY --from=composer-deps /build ./
# Install dependencies and build assets
RUN yarn install --network-timeout 600000 && \
yarn build && \
yarn cache clean
# ---
FROM dunglas/frankenphp:1-php8.4 AS frankenphp_upstream
RUN apt-get update && apt-get -y install \
@@ -13,33 +47,6 @@ RUN apt-get update && apt-get -y install \
zip \
&& apt-get -y autoremove && apt-get clean autoclean && rm -rf /var/lib/apt/lists/*;
RUN set -eux; \
# Prepare keyrings directory
mkdir -p /etc/apt/keyrings; \
\
# Import Yarn GPG key
curl -fsSL https://dl.yarnpkg.com/debian/pubkey.gpg \
| tee /etc/apt/keyrings/yarn.gpg >/dev/null; \
chmod 644 /etc/apt/keyrings/yarn.gpg; \
\
# Add Yarn repo with signed-by
echo "deb [signed-by=/etc/apt/keyrings/yarn.gpg] https://dl.yarnpkg.com/debian stable main" \
| tee /etc/apt/sources.list.d/yarn.list; \
\
# Run NodeSource setup script (unchanged)
curl -sL https://deb.nodesource.com/setup_22.x | bash -; \
\
# Install Node.js + Yarn
apt-get update; \
apt-get install -y --no-install-recommends \
nodejs \
yarn; \
\
# Cleanup
apt-get -y autoremove; \
apt-get clean autoclean; \
rm -rf /var/lib/apt/lists/*
# Install PHP
RUN set -eux; \
@@ -90,10 +97,8 @@ RUN set -eux; \
composer run-script --no-dev post-install-cmd; \
chmod +x bin/console; sync;
RUN yarn install --network-timeout 600000 && \
yarn build && \
yarn cache clean && \
rm -rf node_modules/
# Copy pre-built assets from the assets stage
COPY --from=assets /build/public/build ./public/build
# Use docker env to output logs to stdout
ENV APP_ENV=docker

View File

@@ -366,6 +366,14 @@ abstract class BaseAdminController extends AbstractController
}
}
//Count how many actual new entities were created (id is null until persisted)
$created_count = 0;
foreach ($results as $result) {
if (null === $result->getID()) {
$created_count++;
}
}
//Persist valid entities to DB
foreach ($results as $result) {
$em->persist($result);
@@ -373,8 +381,14 @@ abstract class BaseAdminController extends AbstractController
$em->flush();
if (count($results) > 0) {
$this->addFlash('success', t('entity.mass_creation_flash', ['%COUNT%' => count($results)]));
$this->addFlash('success', t('entity.mass_creation_flash', ['%COUNT%' => $created_count]));
}
if (count($errors)) {
//Recreate mass creation form, so we get the updated parent list and empty lines
$mass_creation_form = $this->createForm(MassCreationForm::class, ['entity_class' => $this->entity_class]);
}
}
return $this->render($this->twig_template, [

View File

@@ -169,7 +169,7 @@ abstract class Attachment extends AbstractNamedDBElement
#[ORM\Column(type: Types::STRING, length: 2048, nullable: true)]
#[Groups(['attachment:read'])]
#[ApiProperty(example: 'http://example.com/image.jpg')]
#[Assert\Length(2048)]
#[Assert\Length(max: 2048)]
protected ?string $external_path = null;
/**

View File

@@ -243,6 +243,14 @@ class StructuralDBElementRepository extends AttachmentContainingDBElementReposit
return $result[0];
}
//If the name contains category delimiters like ->, try to find the element by its full path
if (str_contains($name, '->')) {
$tmp = $this->getEntityByPath($name, '->');
if (count($tmp) > 0) {
return $tmp[count($tmp) - 1];
}
}
//If we find nothing, return null
return null;
}

View File

@@ -167,7 +167,7 @@ class EntityImporter
}
//Only return objects once
return array_values(array_unique($valid_entities));
return array_values(array_unique($valid_entities, SORT_REGULAR));
}
/**

View File

@@ -152,7 +152,7 @@ class PKDatastructureImporter
public function importPartCustomStates(array $data): int
{
if (!isset($data['partcustomstate'])) {
throw new \RuntimeException('$data must contain a "partcustomstate" key!');
return 0; //Not all PartKeepr installations have custom states
}
$partCustomStateData = $data['partcustomstate'];

View File

@@ -150,6 +150,11 @@ trait PKImportHelperTrait
$target->addAttachment($attachment);
$this->em->persist($attachment);
//If the attachment is an image, and the target has no master picture yet, set it
if ($attachment->isPicture() && $target->getMasterPictureAttachment() === null) {
$target->setMasterPictureAttachment($attachment);
}
}
$this->em->flush();

View File

@@ -91,7 +91,10 @@ class PKPartImporter
$this->setAssociationField($entity, 'partUnit', MeasurementUnit::class, $part['partUnit_id']);
}
$this->setAssociationField($entity, 'partCustomState', MeasurementUnit::class, $part['partCustomState_id']);
if (isset($part['partCustomState_id'])) {
$this->setAssociationField($entity, 'partCustomState', MeasurementUnit::class,
$part['partCustomState_id']);
}
//Create a part lot to store the stock level and location
$lot = new PartLot();