Workarea 3.0.7
Fixes Scheduled Jobs for Removed/Renamed Workers
Workarea 3.0.7 modifies the workarea-core/config/initializers/05_scheduled_jobs.rb initializer to remove Sidekiq cron jobs that reference workers that were previously removed or renamed.
The change removes cron jobs for the Workarea::UpdateDashboards
and Workarea::Admin::StatusReporter
workers and adds a job for the Workarea::StatusReporter
worker.
After upgrading, the removed jobs may still exist within Sidekiq as retried or scheduled jobs and will raise exceptions when Sidekiq tries to run them. You must manually clear these jobs from Sidekiq within each environment.
Fixes Styling of Validation Messages in Storefront
Prior to 3.0.7, client-side validation messages in the Storefront are unstyled because the class value expected by the stylesheet, value__error, isn't present in the DOM. The class value is missing in these versions because the value component was dropped from the Admin in Workarea 3.0, and the Admin and Storefront share client-side validation behavior, which was updated to match the Admin for Workarea 3.0.
To fix this issue, Workarea 3.0.7 removes the shared validation behavior from Core and adds validation behavior to the Admin and Storefront engines directly. The changes are summarized below.
- The configuration value
WORKAREA.config.forms.errorLabelClasses
is removed from the Core config file, workarea/core/config.js, and added separately to the Admin and Storefront config files, workarea/admin/config.js.erb and workarea/storefront/config.js.erb. - The
WORKAREA.forms
JavaScript module is removed from Core, workarea/core/modules/forms.js, and added separately to Admin and Storefront, workarea/admin/modules/forms.js and workarea/storefront/modules/forms.js. - The Admin and Storefront JavaScript manifests, workarea/admin/application.js.erb and workarea/storefront/application.js.erb, are modified to reflect the above changes.
- The Storefront application layout, workarea/storefront/application.html.haml, is modified to add missing value components needed to style validation messages for the search and email signup forms.
If your application is overriding any of the above assets, update your copies as needed to fix validation styling in the Storefront.
Improves UI for Backordered Until Field
Workarea 3.0.7 modifies the workarea/admin/inventory_skus/new.html.haml and workarea/admin/bulk_action_product_edits/edit.html.haml Admin views, adding a data-datepicker-field
attribute to the backordered_until
field (named Backorder Ship Date in the English translation of the Admin). This change provides a calendar UI for this field when focused.
This change also modifies the workarea/admin/inventory_skus/_cards.html.haml Admin partial to output a backordered_until
value for an inventory SKU when present.
If your application is overriding any of these views, apply the changes manually to benefit from these improvements.
Fixes Display of Admin Filters when Wrapping
Workarea 3.0.7 modifies the workarea/admin/components/_browsing_controls.scss Admin stylesheet to fix the display of Admin filters when they wrap to a second line.
If your application is overriding this stylesheet, you'll need to apply this patch manually to your copy.
Fixes Duplicate ID Values in Admin Content Editing HTML
Workarea 3.0.7 modifies the following Admin partials to fix duplicate ID values in the HTML rendered for the content editing page.
- workarea/admin/content/_edit.html.haml
- workarea/admin/content/_form.html.haml
If your application is overriding either of these partials, you should apply this patch manually to your copies of the files.
Adds Append Points
Workarea 3.0.7 adds the following append point to the Admin.
admin.user_properties within workarea/admin/users/edit.html.haml
And adds the following append point to the Storefront.
storefront.style_guide_components.property within workarea/storefront/style_guides/components/_property.html.haml
If your application is overriding either of the above views/partials, you may want to add these append points to your copies so that plugins can take advantage of these extension points.
Stores Relative Paths for Product Images in Elasticsearch
Prior to 3.0.7, Workarea stores absolute URLs for product images in Elasticsearch. Workarea 3.0.7 uses relative paths instead, which avoids the need to re-index when moving data between environments.
The PR changes the Core query Workarea::ProductPrimaryImageUrl
. It modifies the implementation of Workarea::ProductPrimaryImageUrl#url
and adds Workarea::ProductPrimaryImageUrl#image
(extracted from #url
) and Workarea::ProductPrimaryImageUrl#path
.
The change also modifies the Core helper Workarea::ApplicationHelper
. It edits the implementation of Workarea::ApplicationHelper#product_image_url
and adds Workarea::ApplicationHelper#product_image_path
(extracted from #product_image_url
).
Furthermore, the change modifies the search model method Workarea::Search::Storefront::Product#primary_image
.
In the Storefront, the PR changes the view model Workarea::Storefront::SearchSuggestionViewModel
. It modifies the implementation of Workarea::Storefront::SearchSuggestionViewModel#image
, adds Workarea::Storefront::SearchSuggestionViewModel#asset_host
, and also makes the following methods public.
Workarea::Storefront::SearchSuggestionViewModel#source
Workarea::Storefront::SearchSuggestionViewModel#name
Workarea::Storefront::SearchSuggestionViewModel#type
Workarea::Storefront::SearchSuggestionViewModel#image
Workarea::Storefront::SearchSuggestionViewModel#suggestion_type
Workarea::Storefront::SearchSuggestionViewModel#analytics
Workarea::Storefront::SearchSuggestionViewModel#product
Workarea::Storefront::SearchSuggestionViewModel#url
Finally, the change adds a new view model test case, Workarea::Storefront::SearchSuggestionViewModelTest
.
If your application is extending any of the methods affected by this change, you should review the PR and update your application code accordingly to benefit from this change.
Changes Uniqueness Strategy for Workers
Workarea 3.0.7 modifies the following workers to use the until_executing
uniqueness strategy for unique jobs. In earlier versions, these workers use the until_and_while_executing
strategy, which can reportedly lead to race conditions that cause workers to not be enqueued.
Workarea::BulkIndexProducts
Workarea::IndexAdminSearch
Workarea::IndexCategorization
Workarea::IndexCategory
Workarea::IndexCategoryChanges
Workarea::IndexFulfillmentChanges
Workarea::IndexPage
Workarea::IndexProduct
Workarea::IndexProductChildren
Workarea::IndexSearchCustomizations
Workarea::IndexSkus
Workarea::KeepProductIndexFresh
If your application is extending the worker options on any of the above workers, you may want to apply this change to your application code to avoid workers not being enqueued.
Improves Performance of Indexing Category Changes
Workarea 3.0.7 modifies the Workarea::IndexCategoryChanges
worker to improve performance. The change adds an ignore_if
option to the worker, and modifies the implementation of Workarea::IndexCategoryChanges#perform
.
If your application is extending this worker, you may want to update your application code to ensure you are benefiting from this performance improvement.
Adds Caching for Default Category of a Product
Workarea 3.0.7 modifies Workarea::Categorization
query, adding a cache within Workarea::Categorization#default_model
to resolve performance issues reported by systems integrators.
# workarea-core/app/queries/workarea/categorization.rb
module Workarea
class Categorization
# ...
def default_model
key = "#{@product.cache_key}/default_category"
@default_model ||= Rails.cache.fetch(key, expires_in: 1.day) do
to_models.sort_by(&:created_at).first
end
end
# ...
end
end
If your application is extending this method, ensure your implementation does not conflict with these changes.
Fixes Tax Price Adjustment Amount
Workarea::Pricing::TaxApplier#assign_item_tax
is responsible for writing a price adjustment that adjusts tax to a shipping. Prior to 3.0.7, the amount of that adjustment is incorrect under certain conditions (order affected by multiple tax codes and a discount). Workarea 3.0.7 applies the following changes to fix the issue.
- Modifies implementation of Core model method
Workarea::Pricing::TaxApplier#assign_item_tax
- Adds Core model method
Workarea::PriceAdjustmentSet#grouped_by_parent
- Adds Core model test
Workarea::Pricing::TaxApplierTest#test_with_multiple_tax_codes_and_discount
If your application is extending the tax applier, update your implementation accordingly to fix this issue.
Adds Argument for Wait for XHR Timeout Threshold
Workarea 3.0.7 modifies Workarea::SystemTest#wait_for_xhr
, allowing the maximum wait time to be passed as an argument.
# workarea-testing/lib/workarea/system_test.rb
# ...
module Workarea
class SystemTest < IntegrationTest
# ...
def wait_for_xhr(time=Capybara.default_max_wait_time)
Timeout.timeout(time) do
loop until finished_all_xhr_requests?
end
end
# ...
end
end
Use this argument to call the method with an arbitrary timeout threshold that differs from the configured default.