Repository navigation
fix(products): a product without a panel no longer shows resources it was never given - #188
Merged
Panelica merged 3 commits intoOct 12, 2026
Conversation
Owner
|
Thank you, @ertugrulkeyvan, merged. A product without a module no longer picks up the panel's default limits just by being saved, so the price list stops offering resources nobody chose, and a product of another panel can no longer be given Panelica limits through a crafted request. Checked before merging: an empty field is never written, the type check runs after the product is updated (so switching a product to Panelica in the same save still keeps its limits), the defaults the Panelica module falls back to are the same eighteen numbers the form shows, only the edit page has this card, three of your tests fail on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A product without a module no longer picks up Panelica's default limits by being saved, and the price list no longer offers them.
The product edit page has a Panelica resources card. It is shown for Panelica products and for products with no module yet, and every number in it was filled in with the panel's default: 1024 MB RAM, 100% CPU, 5120 MB disk, 51200 MB bandwidth, 1 website, and so on.
On a product without a module, nobody chose those numbers, but saving the product for any reason wrote them into
config_options.Product::resourceSummary()then listed them on the price list and the order page: "1 GB RAM · 1 vCPU · 5 GB disk · 50 GB bandwidth · 1 website". This shows on a product that is, say, a manually delivered VPS with 8 GB, or a service with no server at all.We hit it while drafting a catalogue: the moment a description was edited, every plan card showed the same 1 GB / 1 vCPU / 5 GB. The disk and bandwidth numbers are also the limits overage billing falls back to.
After this:
PanelicaModuleapplies the same defaults itself, so creating an account is unchanged either way.Products that already carry such numbers keep them. They cannot be told apart from limits someone chose, so this does not remove them.
How
admin/products/edit.blade.php: a field's value is the saved one, else the default only on a Panelica product, else empty; the default is always shown as the placeholder.ProductController::update: theres_sectionblock runs only for'',customandpanelica, the modules the card is shown for, pluscustom, which the existing tests save resources on.The work is split into three commits: the form, the controller and the tests.
Tests
tests/Feature/ProductResourceDefaultsTest.php, 5 tests:1024as the placeholder.resourceSummary()is empty.1024filled in.Three of them fail on
main.ProductResourceConfigTestandProductTestpass unchanged.Full suite: 4162 passed. The one failure is the
CurrencyAndBackupTestdb backup test, which fails onmaintoo in my local setup.