Skip to content

Fixes #30034 - Adding markdown for login message - #7725

Closed
patilsuraj767 wants to merge 4 commits into
theforeman:developfrom
patilsuraj767:login-footer-formatting
Closed

patilsuraj767 wants to merge 4 commits into
theforeman:developfrom
patilsuraj767:login-footer-formatting

Conversation

@patilsuraj767

Copy link
Copy Markdown
Contributor

Added markdown support for login message.

LoginPage

SettingsPage

@theforeman-bot

Copy link
Copy Markdown
Member

Can one of the admins verify this patch?

2 similar comments
@theforeman-bot

Copy link
Copy Markdown
Member

Can one of the admins verify this patch?

@theforeman-bot

Copy link
Copy Markdown
Member

Can one of the admins verify this patch?

@theforeman-bot

Copy link
Copy Markdown
Member

Issues: #30034

@patilsuraj767
patilsuraj767 force-pushed the login-footer-formatting branch from bf073ad to 65b2f35 Compare June 6, 2020 20:10
@tbrisker

tbrisker commented Jun 7, 2020

Copy link
Copy Markdown
Member

ok to test

@kgaikwad kgaikwad left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @patilsuraj767!
Added few inline comments and queries.

Comment thread app/models/setting/general.rb Outdated
set('db_pending_seed', N_("Should the `foreman-rake db:seed` be executed on the next run of the installer modules?"), true, N_('DB pending seed')),
set('proxy_request_timeout', N_("Open and read timeout for HTTP requests from Foreman to Smart Proxy (in seconds)"), 60, N_('Smart Proxy request timeout')),
set('login_text', N_("Text to be shown in the login-page footer"), nil, N_('Login page footer text')),
set('login_text', N_("Text to be shown in the login-page footer"), nil, N_('Login page footer text'), nil, {:field => 'textarea'}),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Instead of option key field, why you are not passing settings_type key?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Make sense in naming option key to settings_type. I will make the changes.

Comment thread app/helpers/settings_helper.rb Outdated

placeholder = setting.has_default? ? setting.default : "No default value was set"
return edit_textarea(setting, :value, {:title => setting.full_name_with_default, :helper => :show_value, :placeholder => placeholder}) if setting.settings_type == 'array'
return edit_textarea(setting, :value, {:title => setting.full_name_with_default, :helper => :show_value, :placeholder => placeholder}) if setting.settings_type == 'array' || setting.settings_type == 'textarea'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
return edit_textarea(setting, :value, {:title => setting.full_name_with_default, :helper => :show_value, :placeholder => placeholder}) if setting.settings_type == 'array' || setting.settings_type == 'textarea'
return edit_textarea(setting, :value, {:title => setting.full_name_with_default, :helper => :show_value, :placeholder => placeholder}) if ['array', 'textarea'].include?(setting.settings_type)

Comment thread app/models/setting.rb
graphql_type '::Types::Setting'

TYPES = %w{integer boolean hash array string}
TYPES = %w{integer boolean hash array string textarea}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Any change required at line-324 ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not sure, As per my understanding def has_default? on line-324 is only used to set the title of the textarea. As by default login message is not set title is rendering correctly to Default: Not set.

SettingsPage2

Comment thread package.json Outdated
"jed": "^1.1.1",
"react-intl": "^2.8.0"
"react-intl": "^2.8.0",
"react-markdown": "^4.3.1"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can you please add this dependency to @theforeman/vendor?
https://github.com/theforeman/foreman-js/tree/master/packages/vendor-core

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@amirfefer I have created the PR in foreman-js but Travis is failing due to something.
Can you help? Do I also need to upload package-lock.json?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I see that the PR is merged 👍
can you please bump foreman-js sub-packages to version 4.7.0 and remove react-markdown?

Comment thread package.json Outdated
"jed": "^1.1.1",
"react-intl": "^2.8.0"
"react-intl": "^2.8.0",
"react-markdown": "^4.3.1"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I see that the PR is merged 👍
can you please bump foreman-js sub-packages to version 4.7.0 and remove react-markdown?

@kgaikwad

Copy link
Copy Markdown
Member

@amirfefer, @patilsuraj767,
Discussion going on around this improvement so I would suggest not to merge this PR and hold for sometime.

@amirfefer

Copy link
Copy Markdown
Member

@patilsuraj767 , @kgaikwad - what is the status here?
If it on hold, we can close it and reopen it in another time

@patilsuraj767

Copy link
Copy Markdown
Contributor Author

@patilsuraj767 , @kgaikwad - what is the status here?
If it on hold, we can close it and reopen it in another time

Yes, we can close this for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants