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 Vips thumbnails aspect ratio and implement thumbnail preview feature on the frontend #762

Merged
merged 85 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
af0a9c2
Add libsvg to worker.dockerfile
lehecht Nov 27, 2023
f47fbec
Upgrade PHP dependencies
mzur Dec 6, 2023
48e2fb2
Fix precomputed password hashes in tests
mzur Dec 6, 2023
c7c73c8
Fix ApiTokenFactory
mzur Dec 6, 2023
941f709
Merge pull request #715 from biigle/patch-1
mzur Dec 6, 2023
a573b26
create fileCount-method for the filters
mtiessen1175 Dec 5, 2023
2651e11
add an array-equality check in hasRule()
mtiessen1175 Dec 5, 2023
5fb4d91
handle null values in equalityCheck
mtiessen1175 Dec 5, 2023
4b2007e
Apply code-linting from code review
mtiessen1175 Dec 7, 2023
5cc56c7
always show fileCount for filters
mtiessen1175 Dec 7, 2023
31a3ac0
modify name and structure of functions for better readability
mtiessen1175 Dec 7, 2023
1ef89da
Update developing.md
mzur Dec 8, 2023
1fa5370
split fileCount and dataName functions and add different style
mtiessen1175 Dec 8, 2023
6ff89d1
remove unnecessary if-statement
mtiessen1175 Dec 8, 2023
8915307
add return value for absent data-name
mtiessen1175 Dec 8, 2023
91ac92b
Merge pull request #716 from biigle/geo_module
mzur Dec 11, 2023
5c248a7
Remove separate vector database
mzur Dec 12, 2023
779564d
Fix CS issue
mzur Dec 12, 2023
9e18403
Merge pull request #720 from biigle/merge-pgvector
mzur Dec 13, 2023
3a57428
Add length restriction to request URL
lehecht Dec 14, 2023
fdd75ee
Add test for invalid url
lehecht Dec 14, 2023
5067d9f
Edit comment
lehecht Dec 15, 2023
ded7660
Fix 'composer fix' errors
lehecht Dec 15, 2023
26e8618
Merge pull request #722 from biigle/update-volume-validation
mzur Dec 15, 2023
a57b2e5
Fix active spinning wheel after video finished loading
lehecht Dec 15, 2023
997328a
Merge pull request #723 from biigle/spinning-wheel-bug
mzur Dec 15, 2023
ca35160
Fix video timeline reset bug by using timeupdate event
lehecht Dec 22, 2023
1c3d255
Check feature's availability before removing it
lehecht Dec 22, 2023
6d43aa8
Remove null (gap) to prevent validation errors
lehecht Dec 22, 2023
c28bc69
Fix flag display
lehecht Dec 28, 2023
c640be1
Merge pull request #729 from biigle/flagging-bug
mzur Jan 2, 2024
54b4870
Remove null at array start to prevent validation error
lehecht Jan 3, 2024
7a2c43a
Revert "Fix video timeline reset bug by using timeupdate event"
lehecht Jan 3, 2024
e9299a0
Fix timeline reset bug by resetting video time
lehecht Jan 3, 2024
5834dbb
Add check for empty arrays
lehecht Jan 5, 2024
b06f899
Fix bug with multiple consecutive null
lehecht Jan 5, 2024
f034203
Change worker Docker image to Debian with PyTorch
mzur Jan 5, 2024
9e44a80
Update requirements file
mzur Jan 9, 2024
f2a618b
Fix typo
mzur Jan 9, 2024
8d31ff6
Update update-schema.yml
mzur Jan 9, 2024
dc4d2ff
Bump follow-redirects from 1.14.8 to 1.15.4
dependabot[bot] Jan 9, 2024
ee3945a
Merge pull request #731 from biigle/dependabot/npm_and_yarn/follow-re…
mzur Jan 9, 2024
314eaa9
Disable seeking when switiching to new video
lehecht Jan 11, 2024
b8e69e8
Swap arguments to reset video screen for bugfix
mzur Jan 12, 2024
e2b53e0
Merge pull request #726 from biigle/video-time-display-bug
mzur Jan 12, 2024
8beb565
Revert "Fix bug with multiple consecutive null"
lehecht Jan 15, 2024
7fa0a90
Delete and update features from annotationSource
lehecht Jan 15, 2024
ba1fe40
Implement alternative solution to handle duplicate null keyframes
mzur Jan 15, 2024
02d209a
Revert "Delete and update features from annotationSource"
lehecht Jan 16, 2024
77bf4c0
Revert "Check feature's availability before removing it"
lehecht Jan 16, 2024
85858d9
Change color only when refreshing annotation
lehecht Jan 16, 2024
8bc7131
Remove unnecessary code
lehecht Jan 17, 2024
5099077
Merge pull request #727 from biigle/point-splitting-bug
mzur Jan 17, 2024
a84530f
Fix volume URL validation
mzur Jan 17, 2024
6d2b843
Update fic update volume URL validation rules
mzur Jan 17, 2024
8669b0b
Merge pull request #733 from biigle/patch-1
mzur Jan 17, 2024
576f6df
Move empty array handling
lehecht Jan 18, 2024
7a7aec9
Update for new ProcessAnnotatedFile job of biigle/largo
mzur Jan 18, 2024
36ef086
Implement delay to (somewhat) ensure order of processing
mzur Jan 18, 2024
50334c8
Set creating_async before saving volume
lehecht Jan 19, 2024
7746e0e
Update tests
lehecht Jan 19, 2024
6342078
Merge pull request #734 from biigle/async-cloned-volume
mzur Jan 19, 2024
16d1f2a
Add test case for points with gap validation behavior
mzur Jan 19, 2024
63df78a
Merge pull request #728 from biigle/annotation-deletion-bug
mzur Jan 19, 2024
0caf075
Bump pillow from 10.0.1 to 10.2.0
dependabot[bot] Jan 22, 2024
17c3d59
Merge pull request #736 from biigle/dependabot/pip/pillow-10.2.0
mzur Jan 23, 2024
2133d4c
Update Pillow version in dockerfile
mzur Jan 23, 2024
ef4a72c
Add Dependabot config
mzur Jan 23, 2024
7972b85
Merge pull request #737 from biigle/patch-1
mzur Jan 23, 2024
c62ac9e
Update dependabot config
mzur Jan 23, 2024
68659fe
Implement AnnotationLabelAttached event
mzur Jan 24, 2024
f87213a
Merge pull request #711 from biigle/docker-workerfile
mzur Jan 25, 2024
164395a
Merge branch 'master' into largo-sim-sort
mzur Jan 25, 2024
5ce3bc9
Update Python requirements specifications
mzur Jan 25, 2024
3c310cc
Merge branch 'master' into largo-sim-sort
mzur Jan 25, 2024
ea69fc3
Merge pull request #730 from biigle/largo-sim-sort
mzur Jan 25, 2024
13641e4
fix error on console command creating new user without admin rights
ToukL Jan 29, 2024
bbea48c
Fix Vips thumbnails buffer aspect ratio issue.
gkourie Jan 25, 2024
1b6c587
Implement Thumbnail Preview feature on frontend
gkourie Jan 27, 2024
68d3d17
Merge pull request #764 from ToukL/master
mzur Jan 30, 2024
731f01c
Add missing pandas requirement
mzur Jan 30, 2024
f547b9d
Merge pull request #765 from biigle/patch-1
mzur Jan 30, 2024
8d866b2
Fix issue with flashing thumbnail when sprite is not found
gkourie Feb 1, 2024
da6f0ea
Add limit to sprite loading retry attempts
gkourie Feb 4, 2024
1ad58de
Merge branch 'biigle:master' into master
gkourie Feb 4, 2024
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
15 changes: 9 additions & 6 deletions requirements.txt → .docker/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# This file is just used to get security alerts from GitHub. Make sure the versions match
# in .docker/worker.dockerfile.
numpy==1.22.*
# in worker.dockerfile.
numpy==1.24.*
opencv-contrib-python-headless==4.6.0
scipy==1.10.0
scikit-learn
matplotlib==3.5.2
scipy==1.10.*
scikit-learn==1.2.*
matplotlib==3.6.*
PyExcelerate==0.6.7
Pillow==10.0.1
Pillow==10.2.0
Shapely==1.8.1
torch==2.1.*
torchvision==0.16.*
pandas==1.5.3
149 changes: 68 additions & 81 deletions .docker/worker.dockerfile
Original file line number Diff line number Diff line change
@@ -1,32 +1,37 @@
# PHP 8.1.13
#FROM php:8.1-alpine
FROM php@sha256:f9e31f22bdd89c1334a03db5c8800a5f3b1e1fe042d470adccf58a29672c6202
# PHP 8.1.27
# FROM php:8.1
FROM php@sha256:9b5dfb7deef3e48d67b2599e4d3967bb3ece19fd5ba09cb8e7ee10f5facf36e0
MAINTAINER Martin Zurowietz <martin@cebitec.uni-bielefeld.de>
LABEL org.opencontainers.image.source https://github.com/biigle/core

ARG OPENCV_VERSION=4.6.0-r3
RUN apk add --no-cache \
eigen \
RUN LC_ALL=C.UTF-8 apt-get update \
&& apt-get install -y --no-install-recommends \
ffmpeg \
lapack \
openblas \
py3-numpy \
python3 \
py3-opencv="$OPENCV_VERSION"
python3-numpy \
python3-opencv \
python3-scipy \
python3-sklearn \
python3-matplotlib \
python3-shapely \
python3-pandas \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -r /var/lib/apt/lists/*

RUN ln -s "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
ADD ".docker/all-php.ini" "$PHP_INI_DIR/conf.d/all.ini"

RUN apk add --no-cache \
libxml2 \
libzip \
openssl \
postgresql \
&& apk add --no-cache --virtual .build-deps \
RUN LC_ALL=C.UTF-8 apt-get update \
&& apt-get install -y --no-install-recommends \
libxml2-dev \
libzip-dev \
postgresql-dev \
&& docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql \
libpq-dev \
&& apt-get install -y --no-install-recommends \
libxml2 \
libzip4 \
postgresql-client \
&& docker-php-ext-configure pgsql -with-pgsql=/usr/bin/pgsql \
&& docker-php-ext-install -j$(nproc) \
exif \
pcntl \
Expand All @@ -35,15 +40,29 @@ RUN apk add --no-cache \
pgsql \
soap \
zip \
&& apk del --purge .build-deps
&& apt-get purge -y \
libxml2-dev \
libzip-dev \
libpq-dev \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -r /var/lib/apt/lists/*

# Configure proxy if there is any. See: https://stackoverflow.com/a/2266500/1796523
RUN [ -z "$HTTP_PROXY" ] || pear config-set http_proxy $HTTP_PROXY
RUN apk add --no-cache yaml \
&& apk add --no-cache --virtual .build-deps g++ make autoconf yaml-dev \

RUN LC_ALL=C.UTF-8 apt-get update \
&& apt-get install -y --no-install-recommends \
libyaml-dev \
&& apt-get install -y --no-install-recommends \
libyaml-0-2 \
&& pecl install yaml \
&& docker-php-ext-enable yaml \
&& apk del --purge .build-deps
&& printf "\n" | docker-php-ext-enable yaml \
&& apt-get purge -y \
libyaml-dev \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -r /var/lib/apt/lists/*

ARG PHPREDIS_VERSION=5.3.7
RUN curl -L -o /tmp/redis.tar.gz https://github.com/phpredis/phpredis/archive/${PHPREDIS_VERSION}.tar.gz \
Expand All @@ -53,70 +72,38 @@ RUN curl -L -o /tmp/redis.tar.gz https://github.com/phpredis/phpredis/archive/${
&& mv phpredis-${PHPREDIS_VERSION} /usr/src/php/ext/redis \
&& docker-php-ext-install -j$(nproc) redis

ENV PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:${PKG_CONFIG_PATH}"
# Install vips from source because the apk package does not have dzsave support! Install
# libvips and the vips PHP extension in one go so the *-dev dependencies are reused.
ARG LIBVIPS_VERSION=8.12.2
ARG PHP_VIPS_EXT_VERSION=1.0.13
RUN apk add --no-cache --virtual .build-deps \
autoconf \
automake \
build-base \
expat-dev \
glib-dev \
libgsf-dev \
libjpeg-turbo-dev \
libpng-dev \
tiff-dev \
&& apk add --no-cache \
expat \
glib \
libgsf \
libjpeg-turbo \
libpng \
tiff \
&& cd /tmp \
&& curl -L https://github.com/libvips/libvips/releases/download/v${LIBVIPS_VERSION}/vips-${LIBVIPS_VERSION}.tar.gz -o vips-${LIBVIPS_VERSION}.tar.gz \
&& tar -xzf vips-${LIBVIPS_VERSION}.tar.gz \
&& cd vips-${LIBVIPS_VERSION} \
&& ./configure \
--without-python \
--enable-debug=no \
--disable-dependency-tracking \
--disable-static \
&& make -j $(nproc) \
&& make -s install-strip \
&& cd /tmp \
&& curl -L https://github.com/libvips/php-vips-ext/raw/master/vips-${PHP_VIPS_EXT_VERSION}.tgz -o vips-${PHP_VIPS_EXT_VERSION}.tgz \
&& echo '' | pecl install vips-${PHP_VIPS_EXT_VERSION}.tgz \
# ENV PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:${PKG_CONFIG_PATH}"

RUN LC_ALL=C.UTF-8 apt-get update \
&& apt-get install -y --no-install-recommends \
libvips-dev \
&& apt-get install -y --no-install-recommends \
libvips42 \
&& pecl install vips \
&& docker-php-ext-enable vips \
&& rm -r /tmp/* \
&& apk del --purge .build-deps \
&& rm -rf /var/cache/apk/*
&& apt-get purge -y \
libvips-dev \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -r /var/lib/apt/lists/*

# Unset proxy configuration again.
RUN [ -z "$HTTP_PROXY" ] || pear config-set http_proxy ""

# Other Python dependencies are added with the OpenCV build above.
RUN apk add --no-cache py3-scipy py3-scikit-learn py3-matplotlib py3-shapely

# Set this library path so the Python modules are linked correctly.
# See: https://github.com/python-pillow/Pillow/issues/1763#issuecomment-204252397
ENV LIBRARY_PATH=/lib:/usr/lib
# Install Python dependencies. Note that these also depend on some image processing libs
# that were installed along with vips.
RUN apk add --no-cache --virtual .build-deps \
python3-dev \
py3-pip \
py3-wheel \
build-base \
libjpeg-turbo-dev \
libpng-dev \
&& pip3 install --no-cache-dir \
RUN LC_ALL=C.UTF-8 apt-get update \
&& apt-get install -y --no-install-recommends \
python3-pip \
&& pip3 install --no-cache-dir --break-system-packages \
PyExcelerate==0.6.7 \
Pillow==10.0.1 \
&& apk del --purge .build-deps \
&& rm -rf /var/cache/apk/*
Pillow==10.2.0 \
&& pip3 install --no-cache-dir --break-system-packages --index-url https://download.pytorch.org/whl/cpu \
torch==2.1.* \
torchvision==0.16.* \
&& apt-get purge -y \
python3-pip \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -r /var/lib/apt/lists/*

WORKDIR /var/www

Expand Down
6 changes: 0 additions & 6 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ DB_DATABASE="biigle"
DB_USERNAME="biigle"
DB_PASSWORD="secret"

VECTOR_DB_HOST="vector_database"
VECTOR_DB_PORT=5432
VECTOR_DB_DATABASE="biigle"
VECTOR_DB_USERNAME="biigle"
VECTOR_DB_PASSWORD="secret"

VOLUME_ADMIN_STORAGE_DISKS=local

BROADCAST_DRIVER=pusher
Expand Down
26 changes: 26 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: 2
updates:
- package-ecosystem: pip
directory: "/.docker"
schedule:
interval: "weekly"
# Disable version updates
open-pull-requests-limit: 0
- package-ecosystem: composer
directory: "/"
schedule:
interval: "weekly"
# Disable version updates
open-pull-requests-limit: 0
- package-ecosystem: npm
directory: "/"
schedule:
interval: "weekly"
# Disable version updates
open-pull-requests-limit: 0
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: "weekly"
# Disable version updates
open-pull-requests-limit: 0
2 changes: 0 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ jobs:
- name: Start test database
run: |
docker-compose up -d --no-build database_testing
docker-compose up -d --no-build vector_database_testing
sleep 5

- name: Run tests
Expand Down Expand Up @@ -80,7 +79,6 @@ jobs:
- name: Start test database
run: |
docker-compose up -d --no-build database_testing
docker-compose up -d --no-build vector_database_testing
sleep 5

- name: Run tests
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Trigger schema update
run: |
curl -X POST --fail \
-H "Authorization: token ${{ secrets.TOKEN }}" \
-H "Authorization: token ${{ secrets.BIIGLE_SCHEMA_API_TOKEN }}" \
-H "Content-Type: application/json" \
--data '{"event_type": "build_application"}' \
https://api.github.com/repos/biigle/schema/dispatches
2 changes: 1 addition & 1 deletion DEVELOPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ composer create-project biigle/core:dev-dev-modules \

Note the `--ignore-platform-reqs` flag to keep Composer from complaining about missing requirements. These requirements will be met by the Docker containers.

This will set up the project in the `dev-modules` branch of this repository. The `dev-modules` branch is configured with all BIIGLE modules which makes it easy to start module development. If you want to develop a feature directly in `biigle/core`, please switch to the `master` branch (or create your own branch based on `master`).
This will set up the project in the `dev-modules` branch of this repository. The `dev-modules` branch is configured with all BIIGLE modules which makes it easy to start module development. If you want to develop a feature directly in `biigle/core`, please switch to the `master` branch (or create your own branch based on `master`). Pull requests from a `dev-modules`-based branch will not be accepted.

### 2. Build and run the application

Expand Down
2 changes: 2 additions & 0 deletions app/Console/Commands/NewUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public function handle()

if ($this->confirm('Should the user be global admin? [y|N]')) {
$u->role_id = Role::adminId();
} else {
$u->role_id = Role::editorId();
}

if ($this->confirm('Do you wish to auto-generate a password? [y|N]')) {
Expand Down
17 changes: 17 additions & 0 deletions app/Events/AnnotationLabelAttached.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace Biigle\Events;

use Biigle\AnnotationLabel;
use Illuminate\Contracts\Events\ShouldDispatchAfterCommit;
use Illuminate\Foundation\Events\Dispatchable;

class AnnotationLabelAttached implements ShouldDispatchAfterCommit
{
use Dispatchable;

public function __construct(public AnnotationLabel $annotationLabel)
{
//
}
}
3 changes: 3 additions & 0 deletions app/Http/Controllers/Api/ImageAnnotationLabelController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Biigle\Http\Controllers\Api;

use Biigle\Events\AnnotationLabelAttached;
use Biigle\Http\Requests\StoreImageAnnotationLabel;
use Biigle\ImageAnnotation;
use Biigle\ImageAnnotationLabel;
Expand Down Expand Up @@ -184,6 +185,8 @@ public function store(StoreImageAnnotationLabel $request)
// should not be returned
unset($annotationLabel->annotation);

AnnotationLabelAttached::dispatch($annotationLabel);

return response($annotationLabel, 201);
} catch (QueryException $e) {
// Although we check for existence above, this error happened some time.
Expand Down
3 changes: 3 additions & 0 deletions app/Http/Controllers/Api/VideoAnnotationLabelController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Biigle\Http\Controllers\Api;

use Biigle\Events\AnnotationLabelAttached;
use Biigle\Http\Requests\DestroyVideoAnnotationLabel;
use Biigle\Http\Requests\StoreVideoAnnotationLabel;
use Biigle\VideoAnnotationLabel;
Expand Down Expand Up @@ -65,6 +66,8 @@ public function store(StoreVideoAnnotationLabel $request)
// should not be returned
unset($annotationLabel->annotation);

AnnotationLabelAttached::dispatch($annotationLabel);

return response($annotationLabel, 201);
} catch (QueryException $e) {
// Although we check for existence above, this error happened some time.
Expand Down
41 changes: 31 additions & 10 deletions app/Http/Controllers/Views/Videos/VideoController.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,36 @@ public function show(Request $request, $id)
'too-large' => VIDEO::ERROR_TOO_LARGE,
]);

return view('videos.show', compact(
'user',
'video',
'volume',
'videos',
'shapes',
'labelTrees',
'annotationSessions',
'errors'
));
$fileIds = $volume->orderedFiles()->pluck('uuid', 'id');

$thumbUriTemplate = thumbnail_url(':uuid', config('videos.thumbnail_storage_disk'));

$spritesThumbnailsPerSprite = config('videos.sprites_thumbnails_per_sprite');
$spritesThumbnailInterval = config('videos.sprites_thumbnail_interval');
$spritesMaxThumbnails = config('videos.sprites_max_thumbnails');
$spritesMinThumbnails = config('videos.sprites_min_thumbnails');
$spritesThumbnailWidth = config('videos.sprites_thumbnail_width');
$spritesThumbnailHeight = config('videos.sprites_thumbnail_height');
return view(
'videos.show',
compact(
'user',
'video',
'volume',
'videos',
'shapes',
'labelTrees',
'annotationSessions',
'errors',
'fileIds',
'thumbUriTemplate',
'spritesThumbnailsPerSprite',
'spritesThumbnailInterval',
'spritesMaxThumbnails',
'spritesMinThumbnails',
'spritesThumbnailWidth',
'spritesThumbnailHeight'
)
);
}
}
2 changes: 1 addition & 1 deletion app/Http/Requests/StoreVolume.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function rules()
return [
'name' => 'required|max:512',
'media_type' => ['filled', Rule::in(array_keys(MediaType::INSTANCES))],
'url' => ['required', 'max:256', new VolumeUrl],
'url' => ['required', 'string', 'max:256', new VolumeUrl],
'files' => [
'required',
'array',
Expand Down
Loading