Skip to content

Commit fca49c4

Browse files
author
Fabian Wunsch
committed
Merge remote-tracking branch 'origin/master' into order-details
2 parents 3f061af + 8b417d6 commit fca49c4

File tree

138 files changed

+12913
-7222
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+12913
-7222
lines changed

.docker/partdb-entrypoint.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,48 @@ fi
4242
# Start PHP-FPM (the PHP_VERSION is replaced by the configured version in the Dockerfile)
4343
service phpPHP_VERSION-fpm start
4444

45+
46+
# Run migrations if automigration is enabled via env variable DB_AUTOMIGRATE
47+
if [ "$DB_AUTOMIGRATE" = "true" ]; then
48+
echo "Waiting for database to be ready..."
49+
ATTEMPTS_LEFT_TO_REACH_DATABASE=60
50+
until [ $ATTEMPTS_LEFT_TO_REACH_DATABASE -eq 0 ] || DATABASE_ERROR=$(sudo -E -u www-data php bin/console dbal:run-sql -q "SELECT 1" 2>&1); do
51+
if [ $? -eq 255 ]; then
52+
# If the Doctrine command exits with 255, an unrecoverable error occurred
53+
ATTEMPTS_LEFT_TO_REACH_DATABASE=0
54+
break
55+
fi
56+
sleep 1
57+
ATTEMPTS_LEFT_TO_REACH_DATABASE=$((ATTEMPTS_LEFT_TO_REACH_DATABASE - 1))
58+
echo "Still waiting for database to be ready... Or maybe the database is not reachable. $ATTEMPTS_LEFT_TO_REACH_DATABASE attempts left."
59+
done
60+
61+
if [ $ATTEMPTS_LEFT_TO_REACH_DATABASE -eq 0 ]; then
62+
echo "The database is not up or not reachable:"
63+
echo "$DATABASE_ERROR"
64+
exit 1
65+
else
66+
echo "The database is now ready and reachable"
67+
fi
68+
69+
# Check if there are any available migrations to do, by executing doctrine:migrations:up-to-date
70+
# and checking if the exit code is 0 (up to date) or 1 (not up to date)
71+
if sudo -E -u www-data php bin/console doctrine:migrations:up-to-date --no-interaction; then
72+
echo "Database is up to date, no migrations necessary."
73+
else
74+
echo "Migrations available..."
75+
echo "Do backup of database..."
76+
77+
sudo -E -u www-data mkdir -p /var/www/html/uploads/.automigration-backup/
78+
# Backup the database
79+
sudo -E -u www-data php bin/console partdb:backup -n --database /var/www/html/uploads/.automigration-backup/backup-$(date +%Y-%m-%d_%H-%M-%S).zip
80+
81+
# Check if there are any migration files
82+
sudo -E -u www-data php bin/console doctrine:migrations:migrate --no-interaction
83+
fi
84+
85+
fi
86+
4587
# first arg is `-f` or `--some-option` (taken from https://github.com/docker-library/php/blob/master/8.2/bullseye/apache/docker-php-entrypoint)
4688
if [ "${1#-}" != "$1" ]; then
4789
set -- apache2-foreground "$@"

.docker/symfony.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@
4444
PassEnv PROVIDER_MOUSER_KEY PROVIDER_MOUSER_SEARCH_OPTION PROVIDER_MOUSER_SEARCH_LIMIT PROVIDER_MOUSER_SEARCH_WITH_SIGNUP_LANGUAGE
4545
PassEnv PROVIDER_LCSC_ENABLED PROVIDER_LCSC_CURRENCY
4646
PassEnv PROVIDER_OEMSECRETS_KEY PROVIDER_OEMSECRETS_COUNTRY_CODE PROVIDER_OEMSECRETS_CURRENCY PROVIDER_OEMSECRETS_ZERO_PRICE PROVIDER_OEMSECRETS_SET_PARAM PROVIDER_OEMSECRETS_SORT_CRITERIA
47+
PassEnv PROVIDER_REICHELT_ENABLED PROVIDER_REICHELT_CURRENCY PROVIDER_REICHELT_COUNTRY PROVIDER_REICHELT_LANGUAGE PROVIDER_REICHELT_INCLUDE_VAT
48+
PassEnv PROVIDER_POLLIN_ENABLED
4749
PassEnv EDA_KICAD_CATEGORY_DEPTH
50+
PassEnv SHOW_PART_IMAGE_OVERLAY
4851

4952
# For most configuration files from conf-available/, which are
5053
# enabled or disabled at a global level, it is possible to

.env

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ PROVIDER_TME_CURRENCY=EUR
143143
PROVIDER_TME_LANGUAGE=en
144144
# The country to get results for
145145
PROVIDER_TME_COUNTRY=DE
146-
# Set this to 1 to get gross prices (including VAT) instead of net prices
146+
# [DEPRECATED] Set this to 1 to get gross prices (including VAT) instead of net prices
147+
# With private API keys, this option cannot be used anymore is ignored by Part-DB. The VAT inclusion depends on your TME account settings.
147148
PROVIDER_TME_GET_GROSS_PRICES=1
148149

149150
# Octopart / Nexar Provider:
@@ -215,6 +216,27 @@ PROVIDER_OEMSECRETS_SET_PARAM=1
215216
#If unset or set to any other value, no sorting is performed.
216217
PROVIDER_OEMSECRETS_SORT_CRITERIA=C
217218

219+
220+
# Reichelt provider:
221+
# Reichelt.com offers no official API, so this info provider webscrapes the website to extract info
222+
# It could break at any time, use it at your own risk
223+
# We dont require an API key for Reichelt, just set this to 1 to enable Reichelt support
224+
PROVIDER_REICHELT_ENABLED=0
225+
# The country to get prices for
226+
PROVIDER_REICHELT_COUNTRY=DE
227+
# The language to get results in (en, de, fr, nl, pl, it, es)
228+
PROVIDER_REICHELT_LANGUAGE=en
229+
# Include VAT in prices (set to 1 to include VAT, 0 to exclude VAT)
230+
PROVIDER_REICHELT_INCLUDE_VAT=1
231+
# The currency to get prices in (only for countries with countries other than EUR)
232+
PROVIDER_REICHELT_CURRENCY=EUR
233+
234+
# Pollin provider:
235+
# Pollin.de offers no official API, so this info provider webscrapes the website to extract info
236+
# It could break at any time, use it at your own risk
237+
# We dont require an API key for Pollin, just set this to 1 to enable Pollin support
238+
PROVIDER_POLLIN_ENABLED=0
239+
218240
##################################################################################
219241
# EDA integration related settings
220242
##################################################################################
@@ -283,6 +305,9 @@ FIXER_API_KEY=CHANGEME
283305
# When this is empty the content of config/banner.md is used as banner
284306
BANNER=""
285307

308+
# Enable the part image overlay which shows name and filename of the picture
309+
SHOW_PART_IMAGE_OVERLAY=1
310+
286311
APP_ENV=prod
287312
APP_SECRET=a03498528f5a5fc089273ec9ae5b2849
288313

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.15.1
1+
1.17.2

assets/ckeditor/plugins/PartDBLabel/PartDBLabelUI.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ const PLACEHOLDERS = [
128128
['[[BARCODE_QR]]', 'QR code linking to this element'],
129129
['[[BARCODE_C128]]', 'Code 128 barcode linking to this element'],
130130
['[[BARCODE_C39]]', 'Code 39 barcode linking to this element'],
131+
['[[BARCODE_C93]]', 'Code 93 barcode linking to this element'],
132+
['[[BARCODE_DATAMATRIX]]', 'Datamatrix code linking to this element'],
131133
]
132134
},
133135
{

assets/ckeditor/plugins/PartDBLabel/lang/de.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ Object.assign( window.CKEDITOR_TRANSLATIONS[ 'de' ].dictionary, {
6969
'QR code linking to this element': 'QR Code verknüpft mit diesem Element',
7070
'Code 128 barcode linking to this element': 'Code 128 Barcode verknüpft mit diesem Element',
7171
'Code 39 barcode linking to this element': 'Code 39 Barcode verknüpft mit diesem Element',
72+
'Code 93 barcode linking to this element': 'Code 93 Barcode verknüpft mit diesem Element',
73+
'Datamatrix code linking to this element': 'Datamatrix Code verknüpft mit diesem Element',
7274

7375
'Location ID': 'Lagerort ID',
7476
'Name': 'Name',

assets/controllers/elements/attachment_autocomplete_controller.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ import "tom-select/dist/css/tom-select.bootstrap5.css";
2323
import '../../css/components/tom-select_extensions.css';
2424
import TomSelect from "tom-select";
2525

26+
import TomSelect_click_to_edit from '../../tomselect/click_to_edit/click_to_edit'
27+
import TomSelect_autoselect_typed from '../../tomselect/autoselect_typed/autoselect_typed'
28+
29+
TomSelect.define('click_to_edit', TomSelect_click_to_edit)
30+
TomSelect.define('autoselect_typed', TomSelect_autoselect_typed)
31+
2632
export default class extends Controller {
2733
_tomSelect;
2834

@@ -46,6 +52,12 @@ export default class extends Controller {
4652
}
4753
return '<div>' + escape(data.label) + '</div>';
4854
}
55+
},
56+
plugins: {
57+
'autoselect_typed': {},
58+
'click_to_edit': {},
59+
'clear_button': {},
60+
"restore_on_backspace": {}
4961
}
5062
};
5163

assets/controllers/elements/static_file_autocomplete_controller.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ import "tom-select/dist/css/tom-select.bootstrap5.css";
2323
import '../../css/components/tom-select_extensions.css';
2424
import TomSelect from "tom-select";
2525

26+
import TomSelect_click_to_edit from '../../tomselect/click_to_edit/click_to_edit'
27+
import TomSelect_autoselect_typed from '../../tomselect/autoselect_typed/autoselect_typed'
28+
29+
TomSelect.define('click_to_edit', TomSelect_click_to_edit)
30+
TomSelect.define('autoselect_typed', TomSelect_autoselect_typed)
31+
2632
/**
2733
* This is the frontend controller for StaticFileAutocompleteType form element.
2834
* Basically it loads a text file from the given url (via data-url) and uses it as a source for the autocomplete.
@@ -46,7 +52,13 @@ export default class extends Controller {
4652
orderField: 'text',
4753

4854
//This a an ugly solution to disable the delimiter parsing of the TomSelect plugin
49-
delimiter: 'VERY_L0NG_D€LIMITER_WHICH_WILL_NEVER_BE_ENCOUNTERED_IN_A_STRING'
55+
delimiter: 'VERY_L0NG_D€LIMITER_WHICH_WILL_NEVER_BE_ENCOUNTERED_IN_A_STRING',
56+
plugins: {
57+
'autoselect_typed': {},
58+
'click_to_edit': {},
59+
'clear_button': {},
60+
'restore_on_backspace': {}
61+
}
5062
};
5163

5264
if (this.element.dataset.url) {

assets/controllers/elements/structural_entity_select_controller.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ import {Controller} from "@hotwired/stimulus";
2424

2525
import {trans, ENTITY_SELECT_GROUP_NEW_NOT_ADDED_TO_DB} from '../../translator.js'
2626

27+
import TomSelect_autoselect_typed from '../../tomselect/autoselect_typed/autoselect_typed'
28+
TomSelect.define('autoselect_typed', TomSelect_autoselect_typed)
29+
2730
export default class extends Controller {
2831
_tomSelect;
2932

@@ -37,11 +40,15 @@ export default class extends Controller {
3740
const allowAdd = this.element.getAttribute("data-allow-add") === "true";
3841
const addHint = this.element.getAttribute("data-add-hint") ?? "";
3942

43+
44+
45+
4046
let settings = {
4147
allowEmptyOption: true,
4248
selectOnTab: true,
4349
maxOptions: null,
4450
create: allowAdd ? this.createItem.bind(this) : false,
51+
createFilter: this.createFilter.bind(this),
4552

4653
// This three options allow us to paste element names with commas: (see issue #538)
4754
maxItems: 1,
@@ -81,8 +88,17 @@ export default class extends Controller {
8188
//Add callbacks to update validity
8289
onInitialize: this.updateValidity.bind(this),
8390
onChange: this.updateValidity.bind(this),
91+
92+
plugins: {
93+
"autoselect_typed": {},
94+
}
8495
};
8596

97+
//Add clear button plugin, if an empty option is present
98+
if (this.element.querySelector("option[value='']") !== null) {
99+
settings.plugins["clear_button"] = {};
100+
}
101+
86102
this._tomSelect = new TomSelect(this.element, settings);
87103
//Do not do a sync here as this breaks the initial rendering of the empty option
88104
//this._tomSelect.sync();
@@ -113,6 +129,31 @@ export default class extends Controller {
113129
});
114130
}
115131

132+
createFilter(input) {
133+
134+
//Normalize the input (replace spacing around arrows)
135+
if (input.includes("->")) {
136+
const inputs = input.split("->");
137+
inputs.forEach((value, index) => {
138+
inputs[index] = value.trim();
139+
});
140+
input = inputs.join("->");
141+
} else {
142+
input = input.trim();
143+
}
144+
145+
const options = this._tomSelect.options;
146+
//Iterate over all options and check if the input is already present
147+
for (let index in options) {
148+
const option = options[index];
149+
if (option.path === input) {
150+
return false;
151+
}
152+
}
153+
154+
return true;
155+
}
156+
116157

117158
updateValidity() {
118159
//Mark this input as invalid, if the selected option is disabled

assets/controllers/elements/tagsinput_controller.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,21 @@ import "tom-select/dist/css/tom-select.bootstrap5.css";
2323
import '../../css/components/tom-select_extensions.css';
2424
import TomSelect from "tom-select";
2525

26+
import TomSelect_click_to_edit from '../../tomselect/click_to_edit/click_to_edit'
27+
import TomSelect_autoselect_typed from '../../tomselect/autoselect_typed/autoselect_typed'
28+
29+
TomSelect.define('click_to_edit', TomSelect_click_to_edit)
30+
TomSelect.define('autoselect_typed', TomSelect_autoselect_typed)
31+
2632
export default class extends Controller {
2733
_tomSelect;
2834

2935
connect() {
3036
let settings = {
3137
plugins: {
32-
remove_button:{
33-
}
38+
remove_button:{},
39+
'autoselect_typed': {},
40+
'click_to_edit': {},
3441
},
3542
persistent: false,
3643
selectOnTab: true,

0 commit comments

Comments
 (0)