workarea-admin 3.5.23 → 3.5.25

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e3383b5c3dcd1133b0dd3d1db3e5f7f88accd4ed03091558be38e7cfe789742c
4
- data.tar.gz: 7c0eded18d5111109507f5b60f1abab417f78225382d5585c5d76175212e5393
3
+ metadata.gz: 0a649d1cba8728c8b979eeeef3750e773851272517069f56c09203900e3e57d6
4
+ data.tar.gz: bbd0c3d025a9a58c6366f7267157eae4aff5018d39e7728e8a9e30b4c3e4d15d
5
5
  SHA512:
6
- metadata.gz: 72363af418b41e0b20cecc252d6aec6826f0becc25472e591008f1a29042acf90ac3210ced12041d79b09b3b3b8296346e9e58857454226a4276abfe6a172e57
7
- data.tar.gz: ad2a62d784e93e6c74b266b833637777eb6c6630dffdf02992d4a7a3f7a5deafe9671e5855040dcd4f0fa30b552cb349d1ba9f2508c3f2b1290b9f6e120053d5
6
+ metadata.gz: 6dbae9d3250a480c3da57725d1019c7c4203008e472ce83b6f90d21dd5caf6ac7df19d24098d4fe7ba3c3a2201072d37951cda6398f7aeba34816f827a16afc5
7
+ data.tar.gz: c768147f8682d314fa9ff3abc50712c5811d9614cb5aa5ceeb38452b86c5ddc26239c743602b89c2fcbc4c65a40b3900969b2e8784203c0c2909f85fee574a3f
@@ -13,12 +13,20 @@ module Workarea
13
13
  @undo_release.attributes = params[:release]
14
14
 
15
15
  if @undo_release.save
16
- @release.changesets.each do |changeset|
17
- changeset.build_undo(release: @undo_release.model).save!
16
+ @release.changesets.limit(Workarea.config.per_page).each do |changeset|
17
+ if changeset.releasable.present?
18
+ changeset.build_undo(release: @undo_release.model).save!
19
+ changeset.releasable.run_callbacks(:save)
20
+ end
18
21
  end
19
22
 
23
+ BuildReleaseUndoChangesets.perform_async(
24
+ @undo_release.id,
25
+ @release.id
26
+ ) if @release.changeset_count > Workarea.config.per_page
27
+
20
28
  flash[:success] = t('workarea.admin.create_release_undos.flash_messages.saved')
21
- redirect_to review_release_undo_path(@release)
29
+ redirect_to review_release_undo_path(@release, @undo_release)
22
30
  else
23
31
  render :new, status: :unprocessable_entity
24
32
  end
@@ -35,8 +43,14 @@ module Workarea
35
43
  end
36
44
 
37
45
  def find_undo_release
38
- model = @release.model.undo || @release.build_undo(params[:release])
39
- @undo_release = ReleaseViewModel.new(model, view_model_options)
46
+ model =
47
+ if params[:id].present?
48
+ @release.model.undos.find(params[:id])
49
+ else
50
+ @release.build_undo
51
+ end
52
+
53
+ @undo_release = ReleaseViewModel.wrap(model, view_model_options)
40
54
  end
41
55
  end
42
56
  end
@@ -43,9 +43,6 @@ module Workarea
43
43
  end
44
44
  end
45
45
 
46
- def original
47
- end
48
-
49
46
  def publish
50
47
  self.current_release = nil
51
48
  PublishRelease.perform_async(@release.id)
@@ -59,7 +56,7 @@ module Workarea
59
56
  @release.destroy
60
57
 
61
58
  flash[:success] = t('workarea.admin.releases.flash_messages.removed')
62
- redirect_to releases_path
59
+ redirect_back_or releases_path
63
60
  end
64
61
 
65
62
  def calendar_feed
@@ -2,13 +2,29 @@ module Workarea
2
2
  module Admin::ChangesetsHelper
3
3
  def changeset_icon(changeset, options = {})
4
4
  type = changeset.root.model_name.element
5
- inline_svg(icon_path(type), options)
5
+ inline_svg(
6
+ releasable_icon_path(type),
7
+ options.reverse_merge(fallback: default_releasable_icon_path)
8
+ )
6
9
  end
7
10
 
8
- private
11
+ def releaseable_icon(model, options = {})
12
+ type = model.model_name.element
13
+ inline_svg(
14
+ releasable_icon_path(type),
15
+ options.reverse_merge(fallback: default_releasable_icon_path)
16
+ )
17
+ end
18
+
19
+ def releasable_icon_path(type)
20
+ return default_releasable_icon_path unless type.present?
21
+
22
+ Workarea.config.releasable_icons[type.to_sym] ||
23
+ "workarea/admin/icons/#{type}.svg"
24
+ end
9
25
 
10
- def icon_path(type)
11
- Workarea.config.releasable_icons[type.to_sym] || "workarea/admin/icons/#{type}.svg"
26
+ def default_releasable_icon_path
27
+ 'workarea/admin/icons/release.svg'
12
28
  end
13
29
  end
14
30
  end
@@ -0,0 +1,39 @@
1
+ module Workarea
2
+ module Admin
3
+ class ChangesetSummaryViewModel < ApplicationViewModel
4
+ delegate :model_name, to: :model_class
5
+
6
+ def count
7
+ model['count']
8
+ end
9
+
10
+ def type
11
+ model['_id']
12
+ end
13
+
14
+ def type_filter
15
+ search_model&.type || model_name.param_key
16
+ end
17
+
18
+ def label
19
+ type_filter.titleize.pluralize(count)
20
+ end
21
+
22
+ def searchable?
23
+ search_model.present?
24
+ end
25
+
26
+ private
27
+
28
+ def model_class
29
+ @model_class ||= type.constantize
30
+ end
31
+
32
+ def search_model
33
+ return @search_model if defined?(@serch_model)
34
+
35
+ @search_model = Search::Admin.for(model_class.new)
36
+ end
37
+ end
38
+ end
39
+ end
@@ -7,9 +7,29 @@ module Workarea
7
7
  @timeline ||= TimelineViewModel.new(model)
8
8
  end
9
9
 
10
+ def changeset_count
11
+ @changeset_count ||= model.changesets.count
12
+ end
13
+
14
+ def additional_changesets_count
15
+ [changeset_count - Workarea.config.per_page, 0].max
16
+ end
17
+
18
+ def show_changeset_summary?
19
+ changeset_count > Workarea.config.per_page
20
+ end
21
+
22
+ def changeset_summary
23
+ @changeset_summary ||=
24
+ Release::Changeset.summary(model.id).map do |type|
25
+ ChangesetSummaryViewModel.new(type)
26
+ end
27
+ end
28
+
10
29
  def changesets_with_releasable
11
30
  @changesets_with_releasable ||= model
12
31
  .changesets
32
+ .latest
13
33
  .map { |c| ChangesetViewModel.wrap(c) }
14
34
  .select { |changeset| changeset.root.present? }
15
35
  .reject { |changeset| changeset.releasable.blank? }
@@ -23,9 +43,8 @@ module Workarea
23
43
  calendar_at&.to_date
24
44
  end
25
45
 
26
- def undo
27
- return unless undo?
28
- @undo ||= ReleaseViewModel.wrap(model.undo, options)
46
+ def undos
47
+ @undos ||= ReleaseViewModel.wrap(model.undos, options)
29
48
  end
30
49
 
31
50
  def undoes
@@ -13,12 +13,37 @@
13
13
  .view__container
14
14
  = render_cards_for(@release, :planned_changes)
15
15
 
16
- - if @release.changesets_with_releasable.blank?
16
+ - if @release.changeset_count.zero?
17
17
  .section.align-center
18
18
  %p.heading.heading--3= t('workarea.admin.changesets.no_changesets')
19
19
  %p.heading.heading--3= link_to t('workarea.admin.changesets.plan_some_changes'), release_releasables_path(@release)
20
20
 
21
+ .browsing-controls.browsing-controls--with-divider
22
+ %p.browsing-controls__count{ data: { browsing_controls_count: @release.changeset_count } }
23
+ = t('workarea.admin.changesets.pluralize_change', count: @release.changeset_count)
24
+
25
+
21
26
  .grid.grid--center
27
+ - if @release.show_changeset_summary?
28
+ .grid__cell.grid__cell--80-at-medium
29
+ .section
30
+ .grid.grid--center.grid--auto
31
+ - @release.changeset_summary.each do |summary|
32
+ .grid__cell
33
+ - if summary.searchable?
34
+ .card.card--button
35
+ = link_to search_path(type: [summary.type_filter], upcoming_changes: [@release.id]), class: 'card__header' do
36
+ .card__header-text #{summary.count} #{summary.label}
37
+ = releaseable_icon summary, { class: 'card__icon'}
38
+ - else
39
+ .card
40
+ .card__header
41
+ .card__header-text #{summary.count} #{summary.label}
42
+ = releaseable_icon summary, { class: 'card__icon'}
43
+
44
+ .grid__cell.grid__cell--80-at-medium
45
+ %h2.align-center= t('workarea.admin.changesets.recent')
46
+
22
47
  .grid__cell.grid__cell--80-at-medium
23
48
  %ul.list-reset
24
49
  - @release.changesets_with_releasable.each do |changeset|
@@ -42,3 +67,7 @@
42
67
  .release-changeset__body
43
68
  - changeset.changed_fields.each do |field|
44
69
  = render_changeset_field(changeset, field)
70
+
71
+ - if @release.show_changeset_summary?
72
+ %li.text.text--large.align-center
73
+ = link_to t('workarea.admin.cards.more', amount: @release.additional_changesets_count ), search_path(upcoming_changes: [@release.id])
@@ -9,7 +9,7 @@
9
9
  - @undo_release.errors.full_messages.each do |message|
10
10
  = render_message 'error', message
11
11
 
12
- = form_tag release_undo_path(@release), method: 'post' do
12
+ = form_tag release_undos_path(@release), method: 'post' do
13
13
  .section
14
14
  .property.property--required
15
15
  = label_tag 'release_name', t('workarea.admin.fields.name'), class: 'property__name'
@@ -26,12 +26,15 @@
26
26
  .grid__cell.grid__cell--50-at-medium
27
27
  .property
28
28
  = label_tag 'release_publish_at', t('workarea.admin.fields.undo_at'), class: 'property__name'
29
- .box.box--rounded= hidden_field_tag 'release[publish_at]', @undo_release.publish_at, data: { datetimepicker_field: { inline: true } }
29
+ .box.box--rounded= hidden_field_tag 'release[publish_at]', @undo_release.publish_at, data: { datetimepicker_field: { inline: true, uiOptions: { minDate: (@release.publish_at.present? ? @release.publish_at.to_s(:date_only) : 0) } } }
30
30
 
31
31
  .workflow-bar
32
32
  .grid.grid--middle
33
33
  .grid__cell.grid__cell--20
34
- = link_to t('workarea.admin.form.cancel'), undo_release_path(@release), class: 'workflow-bar__button workflow-bar__button--delete'
34
+ - if @undo_release.persisted?
35
+ = link_to t('workarea.admin.form.cancel'), release_path(@undo_release, return_to: release_path(@release)), class: 'workflow-bar__button workflow-bar__button--delete', data: { method: 'delete', confirm: t('workarea.admin.create_release_undos.workflow.delete_confirmation') }
36
+ - else
37
+ = link_to t('workarea.admin.form.cancel'), release_path(@release), class: 'workflow-bar__button workflow-bar__button--delete'
35
38
 
36
39
  .grid__cell.grid__cell--60
37
40
  %ol.workflow-bar__steps
@@ -34,15 +34,21 @@
34
34
  - changeset.changed_fields.each do |field|
35
35
  = render_changeset_field(changeset, field)
36
36
 
37
+ - if @release.show_changeset_summary?
38
+ %li.text.text--large.align-center
39
+ = t('workarea.admin.cards.more', amount: @release.additional_changesets_count )
40
+
41
+ %p= t('workarea.admin.create_release_undos.review.change_count_message')
42
+
37
43
  .workflow-bar
38
44
  .grid.grid--middle
39
45
  .grid__cell.grid__cell--20
40
- = link_to t('workarea.admin.form.cancel'), release_path(@undo_release), class: 'workflow-bar__button workflow-bar__button--delete', data: { method: 'delete', confirm: t('workarea.admin.create_release_undos.workflow.delete_confirmation') }
46
+ = link_to t('workarea.admin.form.cancel'), release_path(@undo_release, return_to: release_path(@release)), class: 'workflow-bar__button workflow-bar__button--delete', data: { method: 'delete', confirm: t('workarea.admin.create_release_undos.workflow.delete_confirmation') }
41
47
 
42
48
  .grid__cell.grid__cell--60
43
49
  %ol.workflow-bar__steps
44
50
  %li.workflow-bar__step
45
- 1) #{link_to t('workarea.admin.create_release_undos.workflow.setup'), new_release_undo_path(@release)}
51
+ 1) #{link_to t('workarea.admin.create_release_undos.workflow.setup'), new_release_undo_path(@release, id: @undo_release.id)}
46
52
  %li.workflow-bar__step
47
53
  %strong 2) #{t('workarea.admin.create_release_undos.workflow.review')}
48
54
 
@@ -62,80 +62,21 @@
62
62
 
63
63
  - if local_assigns[:active].blank?
64
64
  .card__body
65
- - if model.changesets_with_releasable.empty?
65
+ - if model.changeset_count.zero?
66
66
  %p.card__empty-note= t('workarea.admin.releases.cards.planned_changes.empty_note')
67
67
  = link_to release_changesets_path(model), class: 'card__button' do
68
68
  %span.button.button--small= t('workarea.admin.releases.cards.planned_changes.button')
69
69
  - else
70
- - model.changesets_with_releasable.take(3).each do |changeset|
71
-
72
- .activity
73
- .activity__header
74
- .activity__avatar
75
- = changeset_icon changeset, { class: 'svg-icon'}
76
- .activity__name= changeset.name
77
- .activity__time
78
- = changeset.publish_humanized
79
- - if changeset.release_date.present?
80
- = local_time(changeset.release_date, :long)
81
- .activity__message
82
- .release-changeset.release-changeset--activity
83
- .release-changeset__body
84
- - changeset.changed_fields.each do |field|
85
- = render_changeset_field(changeset, field)
70
+ %table
71
+ %tbody
72
+ - model.changeset_summary.each do |summary|
73
+ %tr
74
+ %td.align-right
75
+ %strong= summary.count
76
+ %td= summary.label
86
77
 
87
78
  = link_to release_changesets_path(model), class: 'card__button' do
88
79
  %span.button.button--small= t('workarea.admin.releases.cards.planned_changes.button')
89
80
 
90
- .grid__cell
91
- - if model.undoes?
92
- .card{ class: card_classes(:original, local_assigns[:active]) }
93
- = link_to original_release_path(model), class: 'card__header' do
94
- %span.card__header-text= t('workarea.admin.releases.cards.original.title')
95
- = inline_svg 'workarea/admin/icons/planned_changes.svg', class: 'card__icon'
96
-
97
- - if local_assigns[:active].blank?
98
- .card__body
99
- .card__empty-note
100
- %p= t('workarea.admin.releases.cards.original.undoes_html', link: link_to(model.undoes.name, release_path(model.undoes)))
101
-
102
- - if model.undoes.publish_at.present? && model.undoes.publish_at.future?
103
- %p= t('workarea.admin.releases.cards.undo.set_to_publish_html', link: link_to(model.undoes.name, release_path(model.undoes)), at: local_time_ago(model.undoes.publish_at))
104
- - elsif model.undoes.published_at.present?
105
- %p= t('workarea.admin.releases.cards.undo.published_html', link: link_to(model.undoes.name, release_path(model.undoes)), at: local_time_ago(model.undoes.published_at))
106
- - else
107
- %p= t('workarea.admin.releases.cards.undo.unscheduled_html', link: link_to(model.undoes.name, release_path(model.undoes)))
108
-
109
- = link_to original_release_path(model), class: 'card__button' do
110
- %span.button.button--small= t('workarea.admin.releases.cards.original.learn_more')
111
-
112
- - else
113
- .card{ class: card_classes(:undo, local_assigns[:active]) }
114
- = link_to undo_release_path(model), class: 'card__header' do
115
- %span.card__header-text= t('workarea.admin.releases.cards.undo.title')
116
- = inline_svg 'workarea/admin/icons/planned_changes.svg', class: 'card__icon'
117
-
118
- - if local_assigns[:active].blank?
119
- .card__body
120
- .card__empty-note
121
- - if model.undo.blank?
122
- %p= t('workarea.admin.releases.cards.undo.not_setup')
123
-
124
- = link_to undo_release_path(model), class: 'card__button' do
125
- %span.button.button--small= t('workarea.admin.releases.cards.undo.build_an_undo')
126
-
127
- - else
128
- %p= t('workarea.admin.releases.cards.undo.undo_html', link: link_to(model.undo.name, release_path(model.undo)), at: local_time_ago(model.undo.created_at))
129
-
130
- - if model.undo.publish_at.present? && model.undo.publish_at.future?
131
- %p= t('workarea.admin.releases.cards.undo.set_to_publish_html', link: link_to(model.undo.name, release_path(model.undo)), at: local_time_ago(model.undo.publish_at))
132
- - elsif model.undo.published_at.present?
133
- %p= t('workarea.admin.releases.cards.undo.published_html', link: link_to(model.undo.name, release_path(model.undo)), at: local_time_ago(model.undo.published_at))
134
- - else
135
- %p= t('workarea.admin.releases.cards.undo.unscheduled_html', link: link_to(model.undo.name, release_path(model.undo)))
136
-
137
- = link_to undo_release_path(model), class: 'card__button' do
138
- %span.button.button--small= t('workarea.admin.releases.cards.undo.learn_more')
139
-
140
81
  .grid__cell
141
82
  = render 'workarea/admin/comments/card', commentable: model, active: local_assigns[:active]
@@ -20,6 +20,11 @@
20
20
  .grid__cell.grid__cell--80
21
21
  .grid.grid--auto.grid--right
22
22
  - if !@release.has_changes?
23
+ .grid__cell
24
+ = link_to t('workarea.admin.releases.show.build_undo'), '#no-changes-to-undo-info', disabled: 'disabled', data: { tooltip: '' }, class: 'workflow-bar__button'
25
+ #no-changes-to-undo-info.tooltip-content
26
+ %p= t('workarea.admin.releases.show.no_changes_to_undo')
27
+
23
28
  .grid__cell
24
29
  = link_to t('workarea.admin.releases.show.visit_storefront_to_preview'), '#no-changes-to-preview-info', disabled: 'disabled', data: { tooltip: '' }, class: 'workflow-bar__button workflow-bar__button--update workflow-bar__button--disabled'
25
30
  #no-changes-to-preview-info.tooltip-content
@@ -31,6 +36,9 @@
31
36
  %p= t('workarea.admin.releases.show.no_changes_to_publish')
32
37
 
33
38
  - else
39
+ .grid__cell
40
+ = link_to t('workarea.admin.releases.show.build_undo'), new_release_undo_path(@release), class: 'workflow-bar__button'
41
+
34
42
  .grid__cell
35
43
  - if @release.published? && !@release.scheduled?
36
44
  = link_to t('workarea.admin.releases.show.visit_storefront_to_preview'), '#cannot-preview-info', disabled: 'disabled', data: { tooltip: '' }, class: 'workflow-bar__button workflow-bar__button--update workflow-bar__button--disabled'
@@ -581,8 +581,12 @@ en:
581
581
  no_changesets: There aren't any planned changes for this release.
582
582
  plan_some_changes: Go plan some changes!
583
583
  planned_changes_for: Planned Changes For
584
+ pluralize_change:
585
+ one: '%{count} Change'
586
+ other: '%{count} Changes'
584
587
  published_on: Published On
585
588
  publishes_on: Publishes On
589
+ recent: Recent Changes
586
590
  releases: Releases
587
591
  unscheduled: Unscheduled
588
592
  catalog_product_copies:
@@ -1216,6 +1220,7 @@ en:
1216
1220
  review:
1217
1221
  title: Review Undo Changes for %{name}
1218
1222
  changes_description_html: These changes have been saved on the %{undo} release. They are the opposite of the changes in the %{original} release. You can view, edit, or delete these changes like changes in a normal release.
1223
+ change_count_message: The full list of changes is generating and too large to display. To make further changes, finish creating the release then view the changes card.
1219
1224
  workflow:
1220
1225
  setup: Setup
1221
1226
  review: Review
@@ -3105,19 +3110,6 @@ en:
3105
3110
  changes: Changes
3106
3111
  empty_note: You can view and manage changes for this release once they are planned.
3107
3112
  planned: Planned
3108
- undo:
3109
- title: Undo
3110
- not_setup: This release doesn't have an undo setup.
3111
- build_an_undo: Build an Undo
3112
- set_to_publish_html: "%{link} is set to publish at <strong>%{at}</strong>."
3113
- published_html: "%{link} published at <strong>%{at}</strong>."
3114
- unscheduled_html: "%{link} is unscheduled."
3115
- undo_html: The %{link} release was created <strong>%{at}</strong> to undo this release.
3116
- learn_more: Learn More
3117
- original:
3118
- title: Original Release
3119
- undoes_html: This release undoes the %{link} release.
3120
- learn_more: Learn More
3121
3113
  edit:
3122
3114
  index_link: Release calendar
3123
3115
  last_published_at: Last Published at
@@ -3183,6 +3175,7 @@ en:
3183
3175
  view: View
3184
3176
  view_release: View Release
3185
3177
  show:
3178
+ build_undo: Build Undo
3186
3179
  index_link: Release calendar
3187
3180
  plan_changes_to_preview: Plan some changes to preview this release
3188
3181
  publish_now: Publish Now
@@ -3195,8 +3188,6 @@ en:
3195
3188
  no_changes_to_publish: There are no changes to publish for this release. Click on the Plan Changes card to start!
3196
3189
  no_changes_to_undo: There are no changes to undo for this release. Click on the Plan Changes card to start!
3197
3190
  user_cannot_publish_info: You do not have permission to publish a release.
3198
- cannot_undo_info: You cannot undo a release that's not published or already undone.
3199
- user_cannot_undo_info: You do not have permission to undo a release.
3200
3191
  summary:
3201
3192
  change:
3202
3193
  one: "%{count} Change"
@@ -3221,24 +3212,6 @@ en:
3221
3212
  starts_on: Starts on %{date}
3222
3213
  ends_on: Ends on %{date}
3223
3214
  no_undo_date: There is no undo date set for this release.
3224
- undo:
3225
- page_title: Undo %{name}
3226
- index_link: Release calendar
3227
- plan_changes: Plan Changes
3228
- no_changes_html: There are no changes to undo for this release! Head to %{plan_changes} to make some.
3229
- undoing: Undoing a Release
3230
- description: You can setup an undo to automatically revert the changes in this release at a future point in time. After being setup, this "undo release" will behave like any other release. You'll be able to edit, reschdule, or modify the changes as you please.
3231
- build_an_undo_now: Build an Undo Now
3232
- created_description_html: "%{undo} was created %{at} to undo the %{original} release."
3233
- no_changes_for_this_release: No changes for this release now.
3234
- view_the_undo_release: View the Undo Release
3235
- original:
3236
- page_title: Original Release for %{name}
3237
- index_link: Release calendar
3238
- title: Original Release
3239
- created_description_html: "%{undo} was created %{at} to undo the %{original} release."
3240
- no_changes_for_this_release: No changes for this release now.
3241
- view_the_original_release: View the Original Release
3242
3215
  reports:
3243
3216
  all_reports: View All Reports
3244
3217
  average_order_value:
@@ -108,15 +108,13 @@ Workarea::Admin::Engine.routes.draw do
108
108
  resources :releases do
109
109
  resources :changesets, only: [:index, :destroy]
110
110
  resources :releasables, only: [:index, :show]
111
- resource :undo, controller: 'create_release_undos', only: [:new, :create] do
112
- get :review
113
- post :complete
111
+
112
+ resources :undos, controller: 'create_release_undos', only: [:new, :create] do
113
+ member { get :review }
114
114
  end
115
115
 
116
116
  member do
117
117
  get 'edit_for/:type', action: :edit_for, as: :edit_for
118
- get :undo
119
- get :original
120
118
  patch :publish
121
119
  end
122
120
 
@@ -0,0 +1,24 @@
1
+ require 'test_helper'
2
+
3
+ module Workarea
4
+ module Admin
5
+ class ChangesetsHelperTest < ViewTest
6
+ def test_releasable_icon_path
7
+ assert_equal(
8
+ releasable_icon_path(nil),
9
+ 'workarea/admin/icons/release.svg'
10
+ )
11
+
12
+ assert_equal(
13
+ releasable_icon_path('product'),
14
+ 'workarea/admin/icons/products.svg'
15
+ )
16
+
17
+ assert_equal(
18
+ releasable_icon_path('variants'),
19
+ 'workarea/admin/icons/variants.svg'
20
+ )
21
+ end
22
+ end
23
+ end
24
+ end
@@ -10,19 +10,44 @@ module Workarea
10
10
  release = create_release
11
11
 
12
12
  release.as_current { releasable.update_attributes!(name: 'Bar') }
13
+ release.changesets.create!(releasable: Catalog::Product.new) # test missing releasable
13
14
 
14
- post admin.release_undo_path(release),
15
+ post admin.release_undos_path(release),
15
16
  params: { release: { name: 'Undo Bar', tag_list: 'foo,bar,baz' } }
16
17
 
17
18
  assert_equal(2, Release.count)
18
19
  undo_release = Release.desc(:created_at).first
19
20
 
20
- assert_equal(undo_release, release.reload.undo)
21
+ assert_equal(undo_release, release.reload.undos.first)
21
22
  assert_equal('Undo Bar', undo_release.name)
22
23
  assert_equal(%w(foo bar baz), undo_release.tags)
23
24
  assert_equal(1, undo_release.changesets.size)
24
25
  assert_equal(1, undo_release.changesets.first.changeset.size)
25
26
  assert_equal(releasable, undo_release.changesets.first.releasable)
27
+ assert_equal([releasable], Search::AdminSearch.new(upcoming_changes: [undo_release.id]).results)
28
+ end
29
+
30
+ def test_create_for_large_changesets
31
+ Sidekiq::Testing.fake!
32
+
33
+ Workarea.config.per_page = 1
34
+
35
+ releasable_one = create_page(name: 'Foo')
36
+ releasable_two = create_page(name: 'Bar')
37
+ release = create_release
38
+
39
+ release.as_current do
40
+ releasable_one.update!(name: 'Changed Foo')
41
+ releasable_two.update!(name: 'Changed Bar')
42
+ end
43
+
44
+ post admin.release_undos_path(release),
45
+ params: { release: { name: 'Undo Test' } }
46
+
47
+ assert_equal(2, Release.count)
48
+ undo_release = Release.desc(:created_at).first
49
+ assert_equal(1, undo_release.changesets.size)
50
+ assert_equal(1, BuildReleaseUndoChangesets.jobs.size)
26
51
  end
27
52
  end
28
53
  end
@@ -124,6 +124,11 @@ module Workarea
124
124
  end
125
125
 
126
126
  visit admin.release_path(Release.first)
127
+ assert(page.has_content?('2 Products'))
128
+ assert(page.has_content?('1 Pricing Sku'))
129
+ assert(page.has_content?('1 Discount'))
130
+ assert(page.has_content?('1 System Page'))
131
+
127
132
  click_link t('workarea.admin.releases.cards.planned_changes.planned')
128
133
  assert(page.has_content?('Test Page'))
129
134
  assert(page.has_content?('Foo Bar'))
@@ -228,10 +233,7 @@ module Workarea
228
233
 
229
234
  visit admin.list_releases_path
230
235
  click_link 'Foo Release'
231
- click_link t('workarea.admin.releases.cards.undo.title')
232
-
233
- assert(page.has_content?(t('workarea.admin.releases.undo.undoing')))
234
- click_link "#{t('workarea.admin.releases.undo.build_an_undo_now')} →"
236
+ click_link t('workarea.admin.releases.show.build_undo')
235
237
 
236
238
  fill_in 'release[name]', with: 'Foo Bar Undo'
237
239
  click_button t('workarea.admin.create_release_undos.workflow.create_undo')
@@ -240,19 +242,9 @@ module Workarea
240
242
 
241
243
  click_link "#{t('workarea.admin.create_release_undos.workflow.done')} →"
242
244
  assert(page.has_content?('Foo Bar Undo'))
245
+ assert(page.has_content?('1 Content Page'))
243
246
 
244
- click_link t('workarea.admin.releases.cards.original.title')
245
- assert(page.has_content?('Foo Release'))
246
- assert(page.has_content?('Test Page'))
247
- assert(page.has_content?('Foo Bar'))
248
-
249
- within('.text.text--large', match: :first) { click_link 'Foo Release' }
250
- assert(page.has_content?('Foo Release'))
251
- assert(page.has_content?('Test Page'))
252
- assert(page.has_content?('Foo Bar'))
253
-
254
- click_link t('workarea.admin.releases.cards.undo.title')
255
- assert(page.has_content?('Foo Bar Undo'))
247
+ click_link t('workarea.admin.releases.cards.planned_changes.planned')
256
248
  assert(page.has_content?('Test Page'))
257
249
  assert(page.has_content?('Foo Bar'))
258
250
  end
@@ -341,6 +333,43 @@ module Workarea
341
333
  assert(page.has_content?('Release Six'))
342
334
  end
343
335
  end
336
+
337
+ def test_viewing_large_changesets
338
+ Workarea.config.per_page = 2
339
+
340
+ release = create_release
341
+ product_one = create_product(id: 'PROD1', name: 'Product One')
342
+ product_two = create_product(id: 'PROD2', name: 'Product Two')
343
+ content_page = create_page(name: 'Test Page')
344
+
345
+ release.as_current do
346
+ product_one.variants.first.update!(details: { 'Color' => 'Orange' })
347
+ product_two.update!(name: 'Test Product Changed')
348
+ content_page.update!(name: 'Test Page Changed')
349
+ end
350
+
351
+ visit admin.release_path(release)
352
+
353
+ assert(page.has_content?('2 Products'))
354
+ assert(page.has_content?('1 Content Page'))
355
+
356
+ click_link t('workarea.admin.releases.cards.planned_changes.planned')
357
+
358
+ assert(page.has_content?('2 Products'))
359
+ assert(page.has_content?('1 Content Page'))
360
+
361
+ assert(page.has_content?('Test Product Changed'))
362
+ assert(page.has_content?('Test Page Changed'))
363
+ assert(page.has_no_content?('Orange'))
364
+
365
+ assert(page.has_content?(t('workarea.admin.changesets.recent')))
366
+ assert(page.has_content?(t('workarea.admin.cards.more', amount: 1)))
367
+
368
+ click_link '2 Products'
369
+
370
+ assert(page.has_content?('Product One'))
371
+ assert(page.has_content?('Product Two'))
372
+ end
344
373
  end
345
374
  end
346
375
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: workarea-admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.23
4
+ version: 3.5.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Crouse
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-25 00:00:00.000000000 Z
11
+ date: 2020-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: workarea-core
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 3.5.23
19
+ version: 3.5.25
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 3.5.23
26
+ version: 3.5.25
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: workarea-storefront
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 3.5.23
33
+ version: 3.5.25
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 3.5.23
40
+ version: 3.5.25
41
41
  description: Provides site administration functionality for the Workarea Commerce
42
42
  Platform.
43
43
  email:
@@ -551,6 +551,7 @@ files:
551
551
  - app/view_models/workarea/admin/bulk_action_sequential_product_edit_view_model.rb
552
552
  - app/view_models/workarea/admin/category_view_model.rb
553
553
  - app/view_models/workarea/admin/changes_view_model.rb
554
+ - app/view_models/workarea/admin/changeset_summary_view_model.rb
554
555
  - app/view_models/workarea/admin/changeset_view_model.rb
555
556
  - app/view_models/workarea/admin/code_list_view_model.rb
556
557
  - app/view_models/workarea/admin/comment_view_model.rb
@@ -1065,9 +1066,7 @@ files:
1065
1066
  - app/views/workarea/admin/releases/index.html.haml
1066
1067
  - app/views/workarea/admin/releases/list.html.haml
1067
1068
  - app/views/workarea/admin/releases/new.html.haml
1068
- - app/views/workarea/admin/releases/original.html.haml
1069
1069
  - app/views/workarea/admin/releases/show.html.haml
1070
- - app/views/workarea/admin/releases/undo.html.haml
1071
1070
  - app/views/workarea/admin/reports/_export.html.haml
1072
1071
  - app/views/workarea/admin/reports/_group_by_time.html.haml
1073
1072
  - app/views/workarea/admin/reports/average_order_value.html.haml
@@ -1289,6 +1288,7 @@ files:
1289
1288
  - test/dummy/tmp/screenshots/.keep
1290
1289
  - test/helpers/workarea/admin/application_helper_test.rb
1291
1290
  - test/helpers/workarea/admin/buttons_helper_test.rb
1291
+ - test/helpers/workarea/admin/changesets_helper_test.rb
1292
1292
  - test/helpers/workarea/admin/content_helper_test.rb
1293
1293
  - test/helpers/workarea/admin/facets_helper_test.rb
1294
1294
  - test/helpers/workarea/admin/icons_helper_test.rb
@@ -1528,7 +1528,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1528
1528
  - !ruby/object:Gem::Version
1529
1529
  version: '0'
1530
1530
  requirements: []
1531
- rubygems_version: 3.0.3
1531
+ rubygems_version: 3.2.3
1532
1532
  signing_key:
1533
1533
  specification_version: 4
1534
1534
  summary: Admin for the Workarea Commerce Platform
@@ -1,50 +0,0 @@
1
- - @page_title = t('workarea.admin.releases.original.page_title', name: @release.name)
2
-
3
- .view
4
- .view__header
5
- .grid.grid--middle.grid--right
6
- .grid__cell.grid__cell--50
7
- .view__heading
8
- = link_to "↑ #{t('workarea.admin.releases.original.index_link')}", releases_path
9
- %h1= link_to @release.name, url_for(@release)
10
- .grid__cell.grid__cell--25
11
- = render_aux_navigation_for(@release)
12
-
13
- .view__container
14
- = render_cards_for(@release, :original)
15
-
16
- .view__container.view__container--narrow
17
- .section
18
- .grid.grid--center
19
- .grid__cell.grid__cell--25
20
- %p.text.text--large= t('workarea.admin.releases.original.created_description_html', undo: link_to(@release.name, @release), original: link_to(@release.undoes.name, @release.undoes), at: local_time_ago(@release.created_at))
21
- .grid__cell.grid__cell--25.align-center
22
- .card{ class: card_classes(:planned_changes) }
23
- = link_to @release.undoes, class: 'card__header' do
24
- %span.card__header-text= @release.undoes.name
25
- = inline_svg 'workarea/admin/icons/planned_changes.svg', class: 'card__icon'
26
-
27
- .card__body
28
- - if @release.undoes.changesets_with_releasable.empty?
29
- %p.card__empty-note= t('workarea.admin.releases.original.no_changes_for_this_release')
30
- - else
31
- - @release.undoes.changesets_with_releasable.take(3).each do |changeset|
32
- .activity
33
- .activity__header
34
- .activity__avatar
35
- = changeset_icon changeset, { class: 'svg-icon'}
36
- .activity__name= changeset.release.name
37
- .activity__time
38
- = changeset.publish_humanized
39
- - if changeset.release_date.present?
40
- = local_time(changeset.release_date, :long)
41
- .activity__message
42
- .release-changeset.release-changeset--activity
43
- .release-changeset__body
44
- - changeset.changed_fields.each do |field|
45
- = render_changeset_field(changeset, field)
46
-
47
- = link_to @release.undoes, class: 'card__button' do
48
- %span.button.button--small= t('workarea.admin.releases.original.view_the_original_release')
49
-
50
-
@@ -1,64 +0,0 @@
1
- - @page_title = t('workarea.admin.releases.undo.page_title', name: @release.name)
2
-
3
- .view
4
- .view__header
5
- .grid.grid--middle.grid--right
6
- .grid__cell.grid__cell--50
7
- .view__heading
8
- = link_to "↑ #{t('workarea.admin.releases.undo.index_link')}", releases_path
9
- %h1= link_to @release.name, url_for(@release)
10
- .grid__cell.grid__cell--25
11
- = render_aux_navigation_for(@release)
12
-
13
- .view__container
14
- = render_cards_for(@release, :undo)
15
-
16
- .view__container.view__container--narrow
17
- .section
18
- - if @release.changesets_with_releasable.empty?
19
- .grid.grid--center
20
- .grid__cell.grid__cell--50
21
- %h2.align-center= t('workarea.admin.releases.undo.undoing')
22
- %p.align-center= t('workarea.admin.releases.undo.no_changes_html', plan_changes: link_to(t('workarea.releases.undo.plan_changes'), release_releasables_path(@release)))
23
-
24
- - elsif @release.undo.blank?
25
- .grid.grid--center
26
- .grid__cell.grid__cell--50
27
- %h2.align-center= t('workarea.admin.releases.undo.undoing')
28
- %p.align-center= t('workarea.admin.releases.undo.description')
29
- %p.align-center= link_to "#{t('workarea.admin.releases.undo.build_an_undo_now')} →", new_release_undo_path(@release), class: 'button'
30
- - else
31
- .grid.grid--center
32
- .grid__cell.grid__cell--25
33
- %p.text.text--large= t('workarea.admin.releases.undo.created_description_html', undo: link_to(@release.undo.name, @release.undo), original: link_to(@release.name, @release), at: local_time_ago(@release.created_at))
34
- .grid__cell.grid__cell--25.align-center
35
- .card{ class: card_classes(:planned_changes) }
36
- = link_to @release.undo, class: 'card__header' do
37
- %span.card__header-text= @release.undo.name
38
- = inline_svg 'workarea/admin/icons/planned_changes.svg', class: 'card__icon'
39
-
40
- .card__body
41
- - if @release.undo.changesets_with_releasable.empty?
42
- %p.card__empty-note= t('workarea.admin.releases.undo.no_changes_for_this_release')
43
- - else
44
- - @release.undo.changesets_with_releasable.take(3).each do |changeset|
45
- .activity
46
- .activity__header
47
- .activity__avatar
48
- = changeset_icon changeset, { class: 'svg-icon'}
49
- .activity__name= changeset.release.name
50
- .activity__time
51
- = changeset.publish_humanized
52
- - if changeset.release_date.present?
53
- = local_time(changeset.release_date, :long)
54
- .activity__message
55
- .release-changeset.release-changeset--activity
56
- .release-changeset__body
57
- - changeset.changed_fields.each do |field|
58
- = render_changeset_field(changeset, field)
59
-
60
- = link_to @release.undo, class: 'card__button' do
61
- %span.button.button--small= t('workarea.admin.releases.undo.view_the_undo_release')
62
-
63
-
64
-