Skip to content

Commit

Permalink
Replace bento shared views with bootstrap
Browse files Browse the repository at this point in the history
In this deliverable, we are removing bento. For that reason, we
are moving the sharted views from webui2 to webui namespace.
  • Loading branch information
David Kang committed Sep 2, 2019
1 parent d5e33e4 commit 443cdaa
Show file tree
Hide file tree
Showing 22 changed files with 518 additions and 31 deletions.
36 changes: 36 additions & 0 deletions src/api/app/views/webui/shared/_buildresult_box.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
:ruby
index ||= ''
ajax_data = {}
ajax_data['project'] = h(project) if defined?(project)
ajax_data['package'] = h(package) if defined?(package)
ajax_data['index'] = h(index) if defined?(index)

.card
.bg-light{ id: "buildresult#{index}-urls", data: { buildresult_url: defined?(package) ? package_buildresult_path : project_buildresult_path } }
%ul.nav.nav-tabs.pt-2.px-3.flex-nowrap{ id: "buildresult#{index}-box", role: 'tablist', data: ajax_data }
%li.nav-item
= link_to("#build#{index}", id: "build#{index}-tab", class: 'nav-link active text-nowrap',
data: { toggle: 'tab' }, role: 'tab', aria: { controls: "build#{index}", selected: true }) do
Build Results
- if defined?(package)
%li.nav-item
= link_to("#rpm#{index}", id: "rpm#{index}-tab", class: 'nav-link text-nowrap', data: { toggle: 'tab' },
role: 'tab', aria: { controls: "rpm#{index}", selected: false }) do
RPM Lint
.card-body
.tab-content
.tab-pane.fade.show.active{ id: "build#{index}", role: 'tabpanel', aria: { labelledby: "build#{index}-tab" } }
.btn.btn-outline-primary.mb-2.build-refresh{ onclick: "updateBuildResult('#{index}')", accesskey: 'r', title: 'Refresh Build Results' }
Refresh
%i.fas.fa-sync-alt{ id: "build#{index}-reload" }
.result
- if defined?(package)
.tab-pane.fade{ id: "rpm#{index}", role: 'tabpanel', aria: { labelledby: "rpm#{index}-tab" } }
.btn.btn-outline-primary.mb-2{ onclick: "updateRpmlintResult('#{index}')", title: 'Refresh Rpmlint Results' }
Refresh
%i.fas.fa-sync-alt{ id: "rpm#{index}-reload" }
.result
:javascript
updateBuildResult('#{index}');
if ($('#rpm#{index}').length === 1) updateRpmlintResult('#{index}');
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.dialog-buttons
= remove_dialog_tag('Cancel')
= submit_tag('Accept')
- submit_tag_text ||= 'Accept'

%a.btn.btn-outline-danger.px-4{ data: { dismiss: 'modal' } }
Cancel
= submit_tag(submit_tag_text, class: 'btn btn-primary px-4')
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- url = "#{download_url}/#{project.to_s.gsub(/:/, ':/')}/#{repository}"
%li.list-inline-item
= link_to(url, title: 'Go to download repository', class: 'nav-link') do
%i.fas.fa-download
Go to download repository
54 changes: 54 additions & 0 deletions src/api/app/views/webui/shared/_editor.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
:ruby
save ||= {}
style ||= {}
style.reverse_merge!(read_only: false, big_editor: true)
uid ||= next_codemirror_uid
content_for(:head_style, codemirror_style(style))

%div{ class: "card #{'editable' unless style[:read_only]}" }
- unless style[:read_only]
.sticky-top.bg-light{ id: "top_#{uid}" }
.card-header
.d-flex.justify-content-between
.btn-group.pl-2
%button.btn.btn-secondary{ id: "undo_#{uid}", onclick: "editors[#{uid}].Undo(this);", disabled: true }
%i.fa.fa-undo
Undo
%button.btn.btn-secondary{ id: "redo_#{uid}", onclick: "editors[#{uid}].Redo(this);", disabled: true }
%i.fa.fa-redo
Redo
%button.btn.btn-warning{ data: { 'target': "#settings#{uid}", 'toggle': 'modal' } }
%i.fa.fa-cog
.progress.short-progress.rounded-0.d-none{ id: "loading_#{uid}" }
.progress-bar.progress-bar-striped.progress-bar-animated.w-100

:ruby
data = {}
data['save-url'] = save[:url] if save[:url]
data['save-method'] = save[:method] if save[:method]
data['data'] = save[:data] if save[:data]
text = force_utf8_and_transform_nonprintables(text)

= text_area_tag("editor_#{uid}", text, cols: '0', rows: '0', data: data, class: 'form-control')

- unless style[:read_only]
.bg-light{ id: "bottom_#{uid}" }
.card-footer
.d-flex.justify-content-end
%p
line:
%span{ id: "ln_#{uid}" } 0
char:
%span{ id: "ch_#{uid}" } 0
.d-flex.mb-2
%textarea.form-control{ id: "comment_#{uid}", disabled: true, placeholder: 'Describe your changes' }
.d-flex.justify-content-end
%button.btn.btn-danger.save{ id: "save_#{uid}", disabled: true }
%i.fa.fa-save
Save

- unless style[:read_only]
= render partial: 'shared/editor_modal', locals: { uid: uid }

- content_for :ready_function do
use_codemirror(#{uid}, #{style[:read_only]}, '#{mode}', #{style[:big_editor]});
55 changes: 55 additions & 0 deletions src/api/app/views/webui/shared/_editor_modal.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
.modal.fade{ id: "settings#{uid}" }
.modal-dialog
.modal-content
.modal-header
%h5.modal-title Editor settings
%button.close{ 'data-dismiss': 'modal' }
%span ×
.modal-body
.input-group
.input-group-prepend
.input-group-text
Text size
= select_tag("fontsize_#{uid}", options_for_select(%w[0.5em 0.6em 0.75em 0.9em 1em 1.2em 1.5em]),
onchange: "editors[#{uid}].updateFontsize(this)", class: 'custom-select')

.modal-body
.input-group
.input-group-prepend
.input-group-text
Highlighting
:ruby
modes = [
['changes', 'rpm-changes', { id: "rpm-changes_#{uid}" }],
['spec', 'rpm-spec', { id: "rpm-spec-#{uid}" }],
['diff', { id: "diff_#{uid}" }],
['shell', 'text/x-sh', { id: "shell_#{uid}" }],
['prjconf', 'prjconf', { id: "prjconf_#{uid}" }],
['baselibs', 'baselibsconf', { id: "baselibs_#{uid}" }],
['perl', { id: "perl_#{uid}" }],
['css', 'css', { id: "css_#{uid}" }],
['html', 'htmlmixed', { id: "html_#{uid}" }],
['js', 'javascript', { id: "js_#{uid}" }],
['php', 'application/x-httpd-php-open', { id: "php_#{uid}" }],
['xml', { id: "xml_#{uid}" }],
['---', '', { id: "x_#{uid}", selected: true }]
]
= select_tag("mode_#{uid}", options_for_select(modes),
onchange: "editors[#{uid}].updateMode(this)", class: 'custom-select')
.modal-body
.input-group
.input-group-prepend
.input-group-text
Tab width
= select_tag("tabsize_#{uid}", options_for_select(2..8),
onchange: "editors[#{uid}].updateTabsize(this)", class: 'custom-select')
.modal-body
.row
.col
%label Line wrapping:
%button.btn.btn-block.btn-danger{ onclick: "editors[#{uid}].Wrap(this)" }
off
.col
%label Parenthesis matching:
%button.btn.btn-block.btn-danger{ id: "match_#{uid}", onclick: "editors[#{uid}].Match(this);" }
off
17 changes: 17 additions & 0 deletions src/api/app/views/webui/shared/_flag_popover.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.d-none{ data: { url: change_repository_flag_path(project: project, package: package) }, id: 'flag-popover-container' }
.flag-set-enable
= link_to('javascript:;', class: 'popover_flag_action', data: { cmd: 'set-disable' }) do
%i.fas.fa-ban.text-danger
Disable
.flag-set-disable
= link_to('javascript:;', class: 'popover_flag_action', data: { cmd: 'set-enable' }) do
%i.fas.fa-check.text-success
Enable
.flag-remove-enable
= link_to('javascript:;', class: 'popover_flag_action', data: { cmd: 'remove' }) do
%i.fas{ class: 'fa-check text-success' }
Take default (enable)
.flag-remove-disable
= link_to('javascript:;', class: 'popover_flag_action', data: { cmd: 'remove' }) do
%i.fas{ class: 'fa-ban text-danger' }
Take default (disable)
6 changes: 6 additions & 0 deletions src/api/app/views/webui/shared/_open_requests.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- if requests.present?
- path = package ? package_requests_path(project, package) : project_requests_path(project)
- path = request_show_path(requests[0]) if requests.size == 1
%li
%i.fas.fa-info-circle.text-info
= link_to(pluralize(requests.size, 'open request'), path)
27 changes: 27 additions & 0 deletions src/api/app/views/webui/shared/_package_branch_form.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
- if show_project_field
%p
%strong Change Branch Destination
.form-group
%label{ for: 'target_project' }
%strong Branch project name
= text_field_tag 'target_project', target_project, size: 80, maxlength: 200, class: 'form-control'
.form-group
%label{ for: 'target_package' }
%strong Branch package name
= text_field_tag 'target_package', package.try(:name), size: 80, maxlength: 200, class: 'form-control'
.custom-control.custom-checkbox
= check_box_tag(:current_revision, false, false, class: 'custom-control-input')
= label_tag(:current_revision, class: 'custom-control-label') do
Stay on this revision
- if revision
(##{revision})
= hidden_field_tag(:revision, revision) if revision
- if show_project_field && Configuration.cleanup_after_days
.custom-control.custom-checkbox
%input.custom-control-input#disable-autocleanup{ type: 'checkbox' }
%label.custom-control-label{ for: 'disable-autocleanup' } Disable Autocleanup
= hidden_field_tag(:autocleanup, true)
:javascript
$('#disable-autocleanup').click(function(){
$('#autocleanup').val($('#disable-autocleanup').prop('checked') ? 'false' : 'true');
});
32 changes: 32 additions & 0 deletions src/api/app/views/webui/shared/_patchinfos_table.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
%table.responsive.table.table-sm.table-bordered.table-hover.w-100#open-patchinfos-table{ title: 'Running Maintenance Updates' }
%thead
%tr
%th Project
%th Package
%th Issues
%th Actions
%tbody
- involved_patchinfos.each do |patchinfo|
%tr
- shortened_prj, shortened_pkg = elide_two(patchinfo[:package][:project], patchinfo[:package][:name], 60)
%td= link_to(shortened_prj, project_show_path(patchinfo[:package][:project]))
%td= link_to(shortened_pkg, package_show_path(patchinfo[:package][:project], patchinfo[:package][:name]))
%td
- size = patchinfo[:issues].size
- patchinfo[:issues].each_with_index do |item, index|
= succeed "#{',' if index < size - 1}" do
= link_to item[:label], item[:url], title: item[:summary]
%td
= link_to(project_monitor_path(patchinfo[:package][:project], pkgname: patchinfo[:package][:name])) do
%i.fas.fa-heartbeat.text-danger{ title: 'Monitor' }

= javascript_tag do
:plain
$(function() {
$('#open-patchinfos-table').dataTable({
iDisplayLength: 10,
stateSave: true,
stateDuration: #{2.days}
});
});

38 changes: 38 additions & 0 deletions src/api/app/views/webui/shared/_repositories.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
= render(partial: 'shared/flag_popover', locals: { project: project, package: package })

.row.mt-5
.col
%h5
Build Flag
%span.flagerror
= render partial: 'shared/repositories_flag_table',
locals: { flags: flags[:build], project: project, package: package,
architectures: architectures, table_id: 'flag_table_build' }
.col
%h5
Publish Flag
%span.flagerror
= render partial: 'shared/repositories_flag_table',
locals: { flags: flags[:publish], project: project, package: package,
architectures: architectures, table_id: 'flag_table_publish' }
.row
.col
%h5
Debuginfo Flag
%span.flagerror
= render partial: 'shared/repositories_flag_table',
locals: { flags: flags[:debuginfo], project: project, package: package,
architectures: architectures, table_id: 'flag_table_debuginfo' }
.col
%h5
Use for Build Flag
%span.flagerror
= render partial: 'shared/repositories_flag_table',
locals: { flags: flags[:useforbuild], project: project, package: package,
architectures: architectures, table_id: 'flag_table_useforbuild' }

- if user_can_modify
- content_for :ready_function do
:plain
setSpinnersForFlags();
setupFlagPopup();
22 changes: 22 additions & 0 deletions src/api/app/views/webui/shared/_repositories_flag_table.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.table-responsive
%table.table.table-hover.table-sm{ id: table_id }
%thead.thead-light
%tr
%th.w-auto Repository
%th.w-auto.text-center All
- architectures.each do |architecture|
%th.w-auto.text-center= architecture.name
%tbody
- ([nil] + project.repositories).each do |repository|
%tr
%td.reponame.text-word-break-all
- repository_name = repository.try(&:name)
- if repository.nil?
All
- elsif package
= link_to(repository_name, package_binaries_path(project: project, package: package, repository: repository_name))
- else
= link_to(repository_name, action: :state, project: project, repository: repository_name)
- ([nil] + architectures).each do |architecture|
%td.text-center{ class: architecture && repository ? nil : 'all_flag' }
= flag_column(flags, repository_name, architecture.try(&:name))
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
%p
Display
= select_tag('request_type_select',
options_for_select(Webui::RequestHelper::AVAILABLE_TYPES, @default_request_type),
data: { table: 'all_requests_table' })
requests in state
= select_tag('request_state_select',
options_for_select(Webui::RequestHelper::AVAILABLE_STATES, @default_request_state),
data: { table: 'all_requests_table' })
%span#request-count
\:
= image_tag('ajax-loader.gif', id: 'spinner', class: 'hidden')
.row
.form-group.input-group.col-sm-12.col-md-6
.input-group-prepend
= label_tag('request_type_select', 'Display', class: 'control-label input-group-text')
= select_tag('request_type_select',
options_for_select(Webui::RequestHelper::AVAILABLE_TYPES, selected_type),
data: { table: 'all_requests_table' },
class: 'form-control custom-select dataTables_length')

.form-group.input-group.col-sm-12.col-md
.input-group-prepend
= label_tag('request_state_select', 'Requests in state', class: 'control-label input-group-text')
= select_tag('request_state_select',
options_for_select(Webui::RequestHelper::AVAILABLE_STATES, selected_state),
data: { table: 'all_requests_table' },
class: 'form-control custom-select dataTables_length')



7 changes: 3 additions & 4 deletions src/api/app/views/webui/shared/_requests_table.html.haml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
%table.requests-datatable.compact{ 'data-source' => source_url,
'id' => id,
'width' => '100%' }
%table.responsive.requests-datatable.table.table-sm.table-bordered.table-hover.w-100{ data: { source: source_url,
'page-length': local_assigns[:page_length] }, id: id }
%thead
%tr
%th Created
Expand All @@ -10,4 +9,4 @@
%th Type
%th Priority
%th
%tbody
%tbody
26 changes: 26 additions & 0 deletions src/api/app/views/webui/shared/_sign_up.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
- if CONFIG['proxy_auth_mode'] == :on
- if CONFIG['proxy_auth_register_page'].blank?
%p Sorry, signing up is currently disabled
- else
%p= link_to 'Use this link to Sign Up', CONFIG['proxy_auth_register_page']
- else
= form_tag({ controller: 'user', action: 'register', method: :post }, class: 'sign-up', autocomplete: 'off') do
.form-group
= label_tag 'login', 'Username:'
%abbr.text-danger{ title: 'required' } *
= text_field_tag 'login', nil, placeholder: 'Username', autocomplete: 'off', class: 'form-control', required: true
.form-group
= label_tag 'email', 'Email:'
%abbr.text-danger{ title: 'required' } *
= text_field_tag 'email', nil, placeholder: 'Email address', autocomplete: 'off', class: 'form-control', type: 'email', required: true
.form-group
= label_tag 'password', 'Password:'
%abbr.text-danger{ title: 'required' } *
= password_field_tag :password, nil, id: 'pwd', placeholder: 'Enter a password', autocomplete: 'off', class: 'form-control', required: true
.form-group
= label_tag 'password_confirmation', 'Password confirmation:'
%abbr.text-danger{ title: 'required' } *
= password_field_tag(:password_confirmation, nil, id: 'pwd_confirmation', placeholder: 'Password confirmation', autocomplete: 'off',
class: 'form-control', required: true)
= hidden_field_tag 'register', 'true'
= submit_tag submit_btn_text, class: 'btn btn-primary'
11 changes: 0 additions & 11 deletions src/api/app/views/webui/shared/_truncated_diff_hint.html.erb

This file was deleted.

Loading

0 comments on commit 443cdaa

Please sign in to comment.