Skip to content

Commit

Permalink
PF5
Browse files Browse the repository at this point in the history
  • Loading branch information
MariaAga committed Aug 13, 2024
1 parent 6aac916 commit c0a810a
Show file tree
Hide file tree
Showing 134 changed files with 874 additions and 635 deletions.
23 changes: 12 additions & 11 deletions app/assets/stylesheets/base-pf4.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,25 @@
html {
font-family: sans-serif;
line-height: 1.15;
font-size: unset !important;
}

body {
font-family: var(--pf-global--FontFamily--sans-serif);
font-size: var(--pf-global--FontSize--sm);
font-weight: var(--pf-global--FontWeight--normal);
line-height: var(--pf-global--LineHeight--md);
font-family: var(--pf-v5-global--FontFamily--text);
font-size: var(--pf-v5-global--FontSize--sm);
font-weight: var(--pf-v5-global--FontWeight--normal);
line-height: var(--pf-v5-global--LineHeight--md);
text-align: left;
}

a {
font-weight: var(--pf-global--link--FontWeight);
color: var(--pf-global--link--Color);
text-decoration: var(--pf-global--link--TextDecoration);
font-weight: var(--pf-v5-global--link--FontWeight);
color: var(--pf-v5-global--link--Color);
text-decoration: var(--pf-v5-global--link--TextDecoration);

&:hover {
--pf-global--link--Color: var(--pf-global--link--Color--hover);
--pf-global--link--TextDecoration: var(--pf-global--link--TextDecoration--hover);
--pf-v5-global--link--Color: var(--pf-v5-global--link--Color--hover);
--pf-v5-global--link--TextDecoration: var(--pf-v5-global--link--TextDecoration--hover);
}
}

Expand All @@ -51,6 +52,6 @@ a {
}
}

.pf-c-alert h4 {
line-height: var(--pf-global--LineHeight--md);
.pf-v5-c-alert h4 {
line-height: var(--pf-v5-global--LineHeight--md);
}
8 changes: 4 additions & 4 deletions app/assets/stylesheets/base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ html {
margin-left: 250px;
&.user-banner-present {
--banner-height: calc(
2 * var(--pf-global--spacer--xs) +
(var(--pf-global--LineHeight--md) * var(--pf-global--FontSize--sm))
2 * var(--pf-v5-global--spacer--xs) +
(var(--pf-v5-global--LineHeight--md) * var(--pf-v5-global--FontSize--sm))
); // banner height is line height and a small padding
top: calc(
var(--header-height) + var(--banner-height)
Expand All @@ -31,7 +31,7 @@ html {
flex-wrap: wrap;
justify-content: space-between;
}
&.pf-c-page {
&.pf-v5-c-page {
display: block;
grid-template-columns: unset;
grid-template-areas: unset;
Expand All @@ -48,7 +48,7 @@ body {
#react-app-root {
height: 100%;
width: 100%;
.pf-c-page {
.pf-v5-c-page {
// pf grid rule stops at @media (min-width: 1200px)
display: grid;
grid-template-columns: max-content 1fr;
Expand Down
4 changes: 2 additions & 2 deletions app/assets/stylesheets/navigation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
}
}

.pf-c-masthead {
background: var(--pf-c-masthead--BackgroundColor) image-url('navbar.png');
.pf-v5-c-masthead {
background: var(--pf-v5-c-masthead--BackgroundColor) image-url('navbar.png');
.user-icon {
margin-right: 10px;
}
Expand Down
2 changes: 1 addition & 1 deletion app/assets/stylesheets/patternfly_and_overrides.scss
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ a {
}
}

.pf-c-backdrop {
.pf-v5-c-backdrop {
z-index: 2000;
}

Expand Down
42 changes: 26 additions & 16 deletions app/assets/stylesheets/patternfly_colors_overrides.scss
Original file line number Diff line number Diff line change
@@ -1,25 +1,35 @@
@import './colors.scss';

.foreman-theme {
.pf-c-page__sidebar {
--pf-c-page__sidebar--Width: 250px;
--pf-c-page__sidebar--BackgroundColor: #{$nav-pf-vertical-bg-color};
.pf-v5-c-page__sidebar {
--pf-v5-c-page__sidebar--Width: 250px;
--pf-v5-c-page__sidebar--BackgroundColor: #{$nav-pf-vertical-bg-color};
#navigation-search .pf-v5-c-text-input-group {
background-color: var(--pf-v5-global--palette--white);
.pf-v5-c-text-input-group__icon{
color: var(--pf-v5-global--palette--black-500);
}
.pf-v5-c-text-input-group__text-input {
// color: var(--pf-v5-global--palette--black-500);
color: var(--pf-v5-global--palette--black-1000);
}
}
}
.pf-c-nav__link {
--pf-c-nav__link--BackgroundColor: #{$nav-pf-vertical-bg-color};
--pf-c-nav__link--m-current--BackgroundColor: #{$nav-pf-vertical-active-bg-color};
--pf-c-nav__link--hover--BackgroundColor: #{$nav-pf-vertical-hover-bg-color};
--pf-c-nav__link--focus--BackgroundColor: #{$nav-pf-vertical-hover-bg-color};
--pf-c-nav__link--active--BackgroundColor: #{$nav-pf-vertical-active-bg-color};
--pf-c-nav__link--after--BorderColor: #f0f0f0;
--pf-c-nav__link--before--BorderColor: #f0f0f0;
--pf-c-nav__link--Color: #{$navbar-default-link-color};
.pf-v5-c-nav__link {
--pf-v5-c-nav__link--BackgroundColor: #{$nav-pf-vertical-bg-color};
--pf-v5-c-nav__link--m-current--BackgroundColor: #{$nav-pf-vertical-active-bg-color};
--pf-v5-c-nav__link--hover--BackgroundColor: #{$nav-pf-vertical-hover-bg-color};
--pf-v5-c-nav__link--focus--BackgroundColor: #{$nav-pf-vertical-hover-bg-color};
--pf-v5-c-nav__link--active--BackgroundColor: #{$nav-pf-vertical-active-bg-color};
--pf-v5-c-nav__link--after--BorderColor: #f0f0f0;
--pf-v5-c-nav__link--before--BorderColor: #f0f0f0;
--pf-v5-c-nav__link--Color: #{$navbar-default-link-color};
}

.pf-c-nav__subnav {
--pf-c-nav--c-divider--BackgroundColor: #{$nav-pf-vertical-active-bg-color};
.pf-v5-c-nav__subnav {
--pf-v5-c-nav--c-divider--BackgroundColor: #{$nav-pf-vertical-active-bg-color};
}
.pf-c-nav__item {
--pf-c-nav__item--before--BorderColor: #{$nav-pf-vertical-active-bg-color};
.pf-v5-c-nav__item {
--pf-v5-c-nav__item--before--BorderColor: #{$nav-pf-vertical-active-bg-color};
}
}
6 changes: 3 additions & 3 deletions app/views/layouts/_application_content.html.erb
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<div id="main">
<div id="content">
<section class="pf-c-page__main-breadcrumb">
<section class="pf-v5-c-page__main-breadcrumb">
<% if content_for?(:breadcrumbs) %>
<%= yield(:breadcrumbs) %>
<% else %>
<%= mount_breadcrumbs %>
<% end %>
</section>
<%= yield(:before_search_bar) %>
<div class="pf-c-page__main-section pf-m-light rails-table-toolbar">
<div class="pf-v5-c-page__main-section pf-m-light rails-table-toolbar">
<div class="title_filter">
<%= mount_search_bar if searchable? %>
<%= yield(:search_bar) %>
Expand All @@ -25,7 +25,7 @@
</div>
</div>
</div>
<div class="pf-c-page__main-section pf-m-light">
<div class="pf-v5-c-page__main-section pf-m-light">
<%= yield %>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/base.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<% end %>
<div
id="rails-app-content"
class="pf-c-page <%= Foreman.settings.find('instance_title') ? 'user-banner-present' : '' %>"
class="pf-v5-c-page <%= Foreman.settings.find('instance_title') ? 'user-banner-present' : '' %>"
>

<%= yield(:content) %>
Expand Down
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@
},
"dependencies": {
"@module-federation/utilities": "^1.7.0",
"@patternfly/patternfly": "^5.1.0",
"@patternfly/react-charts": "^5.3.22",
"@patternfly/react-core": "^5.1.1",
"@patternfly/react-icons": "^5.1.1",
"@patternfly/react-styles": "^5.1.1",
"@patternfly/react-table": "^5.1.1",
"@patternfly/react-tokens": "^5.1.1",
"@theforeman/vendor": "^13.1.0",
"graphql-tag": "^2.11.0",
"intl": "~1.2.5",
Expand Down
2 changes: 1 addition & 1 deletion test/integration/audit_js_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class AuditJSTest < IntegrationTestWithJavascript
test "Check per page settings in context" do
Setting['entries_per_page'] = 8
visit audits_path
per_page = page.find('.pf-c-pagination')['data-per-page']
per_page = page.find('.pf-v5-c-pagination')['data-per-page']
assert_equal per_page, '8'
end
end
Expand Down
4 changes: 2 additions & 2 deletions test/integration/breadcrumbs_switcher_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class BreadcrumbsSwitcherTest < IntegrationTestWithJavascript
click_button 'open breadcrumb switcher'
fill_in('Filter breadcrumb items', :with => 'three')
wait_for_ajax
page.assert_selector('.pf-c-menu__item-main', count: 1)
page.assert_selector('.pf-c-menu__item-main', text: 'three')
page.assert_selector('.pf-v5-c-menu__item-main', count: 1)
page.assert_selector('.pf-v5-c-menu__item-main', text: 'three')
end
end
2 changes: 1 addition & 1 deletion test/integration/compute_profile_js_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ComputeProfileJSTest < IntegrationTestWithJavascript
# amazon123 exists in fixture compute_attributes.yml
click_link("amazon123 (eu-west-1-EC2)")

assert page.has_selector?('.pf-c-page__main-breadcrumb .active', :text => compute_profiles(:one).name), "#{compute_profiles(:one).name} was expected in the breadcrumb active, but was not found"
assert page.has_selector?('.pf-v5-c-page__main-breadcrumb .active', :text => compute_profiles(:one).name), "#{compute_profiles(:one).name} was expected in the breadcrumb active, but was not found"
selected_profile = find("#s2id_compute_attribute_compute_profile_id .select2-chosen").text
assert_equal compute_profiles(:one).name, selected_profile

Expand Down
4 changes: 2 additions & 2 deletions test/integration/config_report_js_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ConfigReportJSTest < IntegrationTestWithJavascript
report
visit config_reports_path
click_link(report.host.name)
has_selector?(".foreman-search-bar .pf-c-text-input-group__text-input", text: "host = #{report.host.name}", wait: 3)
assert_equal "host = #{report.host.name}", find('.foreman-search-bar .pf-c-text-input-group__text-input').value
has_selector?(".foreman-search-bar .pf-v5-c-text-input-group__text-input", text: "host = #{report.host.name}", wait: 3)
assert_equal "host = #{report.host.name}", find('.foreman-search-bar .pf-v5-c-text-input-group__text-input').value
end
end
12 changes: 6 additions & 6 deletions test/integration/fact_value_js_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ def setup
within(:xpath, "//tr[contains(.,'#{@fact_name.name}')]") do
click_link(@host.fqdn)
end
has_selector?(".foreman-search-bar .pf-c-text-input-group__text-input", text: "host = #{@host.fqdn}", wait: 3)
assert_equal "host = #{@host.fqdn}", find('.foreman-search-bar .pf-c-text-input-group__text-input').value
has_selector?(".foreman-search-bar .pf-v5-c-text-input-group__text-input", text: "host = #{@host.fqdn}", wait: 3)
assert_equal "host = #{@host.fqdn}", find('.foreman-search-bar .pf-v5-c-text-input-group__text-input').value
end
test "fact_name fact links" do
visit fact_values_path
find(:xpath, "//tr[contains(.,'#{@fact_name.name}')]//td[2]//a").click
has_selector?(".foreman-search-bar .pf-c-text-input-group__text-input", text: "name = #{@fact_name.name}", wait: 3)
assert_equal "name = #{@fact_name.name}", find('.foreman-search-bar .pf-c-text-input-group__text-input').value
has_selector?(".foreman-search-bar .pf-v5-c-text-input-group__text-input", text: "name = #{@fact_name.name}", wait: 3)
assert_equal "name = #{@fact_name.name}", find('.foreman-search-bar .pf-v5-c-text-input-group__text-input').value
end
test "value fact links" do
visit fact_values_path
click_link(@value.value)
has_selector?(".foreman-search-bar .pf-c-text-input-group__text-input", text: "facts.#{@fact_name.name} = \"#{@value.value}\"", wait: 3)
assert_equal "facts.#{@fact_name.name} = \"#{@value.value}\"", find('.foreman-search-bar .pf-c-text-input-group__text-input').value
has_selector?(".foreman-search-bar .pf-v5-c-text-input-group__text-input", text: "facts.#{@fact_name.name} = \"#{@value.value}\"", wait: 3)
assert_equal "facts.#{@fact_name.name} = \"#{@value.value}\"", find('.foreman-search-bar .pf-v5-c-text-input-group__text-input').value
end
end
4 changes: 2 additions & 2 deletions test/integration/host_js_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class HostJSTest < IntegrationTestWithJavascript
test "assert breadcrumbs" do
visit current_hosts_path
click_link @host.fqdn
find('.pf-c-breadcrumb__item', :text => @host.fqdn)
find('.pf-v5-c-breadcrumb__item', :text => @host.fqdn)
end

test "switch between hosts" do
Expand Down Expand Up @@ -112,7 +112,7 @@ class HostJSTest < IntegrationTestWithJavascript
visit host_details_page_path(host)
find('#hostdetails-kebab').click
click_button 'Delete'
find('button.pf-c-button.pf-m-danger').click # the red delete button, not the menu item
find('button.pf-v5-c-button.pf-m-danger').click # the red delete button, not the menu item
assert_current_path current_hosts_path
assert_raises(ActiveRecord::RecordNotFound) do
Host.find(host.id)
Expand Down
2 changes: 1 addition & 1 deletion test/integration/model_js_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
class ModelIntegrationTest < IntegrationTestWithJavascript
test "create new page" do
visit models_path
click_on "Create new", class: 'pf-c-button'
click_on "Create new", class: 'pf-v5-c-button'
assert_current_path new_model_path
fill_in "model_name", :with => "IBM 123"
fill_in "model_hardware_model", :with => "IBMabcde"
Expand Down
2 changes: 1 addition & 1 deletion test/integration/notifications_drawer_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def notifications_open_and_close_flow

def navigate_somewhere_with_turbolinks
# check the outside click with turbolinks
page.find('a.pf-c-masthead__brand').click
page.find('a.pf-v5-c-masthead__brand').click
# wait for loader to dissapear
page.has_no_selector?('div.spinner')
end
Expand Down
4 changes: 2 additions & 2 deletions test/integration/operatingsystem_js_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ class OperatingsystemJSTest < IntegrationTestWithJavascript
actions.find("ul > li > a.delete").click

confirm_modal = page.find("#app-confirm-modal")
assert_equal "Confirm", confirm_modal.find(".pf-c-modal-box__title-text").text
assert_equal "Delete #{os.title}?", confirm_modal.find(".pf-c-modal-box__body").text
assert_equal "Confirm", confirm_modal.find(".pf-v5-c-modal-box__title-text").text
assert_equal "Delete #{os.title}?", confirm_modal.find(".pf-v5-c-modal-box__body").text

confirm_button = confirm_modal.find("footer > button:nth-child(1)")
assert_equal "Confirm", confirm_button.text
Expand Down
2 changes: 1 addition & 1 deletion test/integration/search_bar_js_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ class SearchBarTest < IntegrationTestWithJavascript
work_around_selenium_file_detector_bug
# needs to be interactive element
find('table thead').find('a', text: 'Name').send_keys("/")
assert_includes(page.evaluate_script("document.activeElement.classList"), "pf-c-text-input-group__text-input")
assert_includes(page.evaluate_script("document.activeElement.classList"), "pf-v5-c-text-input-group__text-input")
end
end
14 changes: 7 additions & 7 deletions test/integration_test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def assert_breadcrumb_text(text)

def assert_new_button(index_path, new_link_text, new_path)
visit index_path
click_link(new_link_text, :class => /^((?!pf-c-nav__link).)*$/)
click_link(new_link_text, :class => /^((?!pf-v5-c-nav__link).)*$/)
assert_current_path new_path
end

Expand Down Expand Up @@ -267,11 +267,11 @@ def refute_available_organization_menu(organization)

def refute_available_organization_dropdown(organization)
within('#location-dropdown') do
find('.pf-c-context-selector__toggle').click
within('.pf-c-context-selector__menu>div>ul', visible: :all) do
find('.pf-v5-c-context-selector__toggle').click
within('.pf-v5-c-context-selector__menu>div>ul', visible: :all) do
assert page.has_no_link?(organization)
end
find('.pf-c-context-selector__toggle').click
find('.pf-v5-c-context-selector__toggle').click
end
end

Expand All @@ -298,21 +298,21 @@ def select_organization(organization)

def select_organization_dropdown(organization)
within('#organization-dropdown') do
find('.pf-c-context-selector__toggle').click
find('.pf-v5-c-context-selector__toggle').click
find("button.organization_menuitem", text: organization).click
end
end

def select_organization_menu(organization)
within('.organization-menu') do
first('button').click
find("li.pf-c-nav__item", text: organization).click
find("li.pf-v5-c-nav__item", text: organization).click
end
end

def select_location_dropdown(location)
within('#location-dropdown') do
find('.pf-c-context-selector__toggle').click
find('.pf-v5-c-context-selector__toggle').click
find("button.location_menuitem", text: location).click
end
end
Expand Down
2 changes: 1 addition & 1 deletion webpack/assets/javascripts/hosts/tableCheckboxes.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ export function buildRedirect(url) {

function paginationMetaData() {
const { total, perPage } = document.getElementsByClassName(
'pf-c-pagination'
'pf-v5-c-pagination'
)[0].dataset;
return { total: Number(total), perPage: Number(perPage) };
}
Expand Down
2 changes: 1 addition & 1 deletion webpack/assets/javascripts/react_app/common/colors.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ $pf-gold-400: #f0ab00;
$pf-green-400: #3f9c35;
$pf-green-600: #1e4f18;
$pf-blue-400: #0088ce;
$pf-color-white: #fff;
$pf-v5-color-white: #fff;
$pf-border-gray: #d1d1d1;

$nav-pf-vertical-active-bg-color: #026991;
Expand Down
2 changes: 1 addition & 1 deletion webpack/assets/javascripts/react_app/common/variables.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@import '~@theforeman/vendor/scss/variables.scss';

$header-max-width: calc(#{$pf-global--breakpoint--lg} + 70px); //TODO move into @theforeman/vendor/scss/variables
$header-max-width: calc(#{$pf-v5-global--breakpoint--lg} + 70px); //TODO move into @theforeman/vendor/scss/variables
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
cursor: pointer;
}
}
.chart-box-modal .pf-c-modal-box__body {
.chart-box-modal .pf-v5-c-modal-box__body {
text-align: center;
}
Loading

0 comments on commit c0a810a

Please sign in to comment.