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

Refactor bottom_actions Package view: Break it in small partials #5867

Merged
merged 1 commit into from
Sep 19, 2018

Conversation

vpereira
Copy link
Contributor

  • bottom_actions/bugzilla_owner
  • bottom_actions/branch_package
  • bottom_actions/submit_package
  • bottom_actions/edit_description
  • bottom_actions/delete_package
  • bottom_actions/cloud_upload
  • bottom_actions/trigger_services
  • bottom_actions/view_kiwi
  • bottom_actions/request_deletion
  • bottom_action/request_devel_project_change
  • bottom_action/request_role_adiction

@vpereira
Copy link
Contributor Author

@DavidKang DavidKang added Frontend Things related to the OBS RoR app Refactoring 🏭 labels Sep 17, 2018
Delete package
= render partial: 'webui2/webui/package/bottom_actions/edit_description', locals: { project: project, package: package, spec_count: spec_count }
= render partial: 'webui2/webui/package/bottom_actions/delete_package'

- Feature.with(:kiwi_image_editor) do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see the point of having these conditions out of the partial

Copy link
Contributor Author

@vpereira vpereira Sep 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be able to understand the workflow of a view? i.e you are just rendering the views A,B if current_user can modify it, just render view C,D if current_rev isn't nil. So you don't have to open all partials to understand it. You can just open the "main partial" to understand it. All the others are dumb, no logic.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @vpereira. The partials are also not rendered if not needed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not entirely agree, but I don't want block this PR.

%i.fas.fa-compact-disc.text-primary
View Image
= render partial: 'webui2/webui/package/bottom_actions/view_kiwi', locals: { package_id: package.id }

- if Feature.active?(:cloud_upload) && !User.current.is_nobody?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

&& !User.current.is_nobody? is not needed here because it's already checked above in unless User.current.is_nobody?

Delete package
= render partial: 'webui2/webui/package/bottom_actions/edit_description', locals: { project: project, package: package, spec_count: spec_count }
= render partial: 'webui2/webui/package/bottom_actions/delete_package'

- Feature.with(:kiwi_image_editor) do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @vpereira. The partials are also not rendered if not needed.

- bottom_actions/bugzilla_owner
- bottom_actions/branch_package
- bottom_actions/submit_package
- bottom_actions/edit_description
- bottom_actions/delete_package
- bottom_actions/cloud_upload
- bottom_actions/trigger_services
- bottom_actions/view_kiwi
- bottom_actions/request_deletion
- bottom_action/request_devel_project_change
- bottom_action/request_role_adiction
@mdeniz
Copy link
Contributor

mdeniz commented Sep 18, 2018

I would consider clarifying more the execution flow by grouping the buttons in "high" level partials. That way you will have something like this:

%ul.list-inline.mb-0
  - if bugowners_mail.present? && configuration['bugzilla_url']
    = render partial: 'webui2/webui/package/bottom_actions/bugzilla_owner', locals: { bugowners_mail: bugowners_mail, package_name: package.name, project_name: project.name }

  - unless User.current.is_nobody?
    - if current_rev
      = render partial: 'webui2/webui/package/bottom_actions/actual_revision', locals: { package: package, project: project, revision: revision }

    - if User.current.can_modify?(package)
      = render partial: 'webui2/webui/package/bottom_actions/user_can_modify', locals: { project: project, package: package, spec_count: spec_count, package_id: package.id, cloud_upload_index_path: cloud_upload_index_path }
    - else
      = render partial: 'webui2/webui/package/bottom_actions/user_cant_modify'

      //TODO: only users w/o rights should see this, maintainers should get a different dialog:
    - if package.develpackage
      = render partial: 'webui2/webui/package/bottom_actions/request_devel_project_change', locals: { package: package, project: project }

@vpereira vpereira merged commit 3ed2f97 into openSUSE:master Sep 19, 2018
@vpereira vpereira deleted the refactor_bottom_actions branch September 19, 2018 06:41
@mdeniz
Copy link
Contributor

mdeniz commented Sep 19, 2018

@vpereira thank you for your answer 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Frontend Things related to the OBS RoR app Refactoring 🏭
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants