-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3876 from jlledom/THREESCALE-1789-rebased-managed…
…-operator-ui THREESCALE-1789: Add "Managed by operator" banner (UI)
- Loading branch information
Showing
10 changed files
with
53 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,43 @@ | ||
# frozen_string_literal: true | ||
|
||
module PatternflyComponentsHelper | ||
def pf_inline_alert(text, variant: nil) | ||
icon_name = case variant | ||
when :info then 'info-circle' | ||
when :success then 'check-circled' | ||
when :warning, :danger then 'exclamation-triangle' | ||
else 'bell' | ||
|
||
def icon_name(variant) | ||
case variant | ||
when :info then 'info-circle' | ||
when :success then 'check-circled' | ||
when :warning, :danger then 'exclamation-triangle' | ||
else 'bell' | ||
end | ||
end | ||
|
||
def icon_tag(variant) | ||
tag.div class: 'pf-c-alert__icon' do | ||
tag.i class: "fas fa-fw fa-#{icon_name(variant)}", 'aria-hidden': 'true' | ||
end | ||
end | ||
|
||
icon = tag.div class: 'pf-c-alert__icon' do | ||
tag.i class: "fas fa-fw fa-#{icon_name}", 'aria-hidden': 'true' | ||
def title_tag(title) | ||
tag.div class: 'pf-c-alert__title' do | ||
tag.p title | ||
end | ||
end | ||
|
||
title = tag.p class: 'pf-c-alert__title' do | ||
text | ||
def body_tag(body) | ||
tag.div class: 'pf-c-alert__description' do | ||
tag.p body | ||
end | ||
end | ||
|
||
def pf_inline_alert(title, body, variant: nil) | ||
tag.div class: "pf-c-alert pf-m-#{variant} pf-m-inline" do | ||
icon + title | ||
icon_tag(variant) + title_tag(title) + body_tag(body) | ||
end | ||
end | ||
|
||
def pf_inline_alert_plain(title, variant: nil) | ||
tag.div class: "pf-c-alert pf-m-#{variant} pf-m-inline pf-m-plain" do | ||
icon_tag(variant) + title_tag(title) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
- if resource.respond_to?(:managed_by) && resource.managed_by.present? | ||
- var = defined?(variant) ? variant : :info | ||
- if defined?(plain) | ||
= pf_inline_alert_plain t('.managed_title', value: resource.managed_by), variant: var | ||
- else | ||
- body = (defined?(description) && description) ? t('.managed_description') : nil | ||
= pf_inline_alert t('.managed_title', value: resource.managed_by), body, variant: var |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters