-
Notifications
You must be signed in to change notification settings - Fork 993
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #21737 - move about page to react
- Loading branch information
Showing
28 changed files
with
515 additions
and
142 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,4 @@ | ||
class PluginsController < ApplicationController | ||
def empty_state | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
module AboutHelper | ||
def plugins | ||
@plugins.map do |plugin| | ||
{:name => plugin.name, :description => plugin.description, | ||
:author => plugin.author, :version => plugin.version } | ||
end | ||
end | ||
|
||
def proxies | ||
@smart_proxies.map do |proxy| | ||
{:id => {:name => proxy.name, :id => proxy.id}, | ||
:features => proxy.features.map(&:name).to_sentence} | ||
end | ||
end | ||
|
||
def providers | ||
nil unless SETTINGS[:unattended] | ||
@providers.map do |provider| | ||
{:provider => provider[:friendly_name], | ||
:status => provider[:status] == :installed} | ||
end | ||
end | ||
|
||
def compute_resources | ||
nil unless SETTINGS[:unattended] | ||
@compute_resources.map do |compute| | ||
{:id => {:name => compute.name, :id => compute.id}, | ||
:type => compute.provider_friendly_name} | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
extends "layouts/empty_state" | ||
object false | ||
node do |u| | ||
{:description => "Foreman supports creating and managing hosts on a number of virtualization and cloud services - referred to as “compute resources” - as well as bare metal hosts."} | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
object false | ||
node do |u| | ||
klass_name = @klass.class.name.underscore | ||
{ :header => klass_name.humanize, :docUrl => "https://www.theforeman.org/manuals/1.15/index.html##{klass_name}", | ||
:action => {:title => _("Create #{klass_name.humanize}"), :url => self.send("new_#{klass_name}_path") } } | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
object false | ||
node do |u| | ||
{ :header => _("Plugin"), :description => "Plugins are tools to extend and modify the functionality of Foreman. Plugins offer custom functions and features so that each user can tailor their environment to their specific needs.", | ||
:docUrl => "https://www.theforeman.org/manuals/1.15/index.html#Plugins", | ||
:action => {:title => _("Get a plugin"), :url => "https://projects.theforeman.org/projects/foreman/wiki/List_of_Plugins" } } | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
extends "layouts/empty_state" | ||
object false | ||
node do |u| | ||
{:description => "The Smart Proxy provides an easy way to add or extended existing subsystems, via | ||
DHCP, DNS, Puppet, etc."} | ||
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
50 changes: 50 additions & 0 deletions
50
webpack/assets/javascripts/react_app/components/about/compute/index.js
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,50 @@ | ||
import React from 'react'; | ||
import Status from '../../common/status'; | ||
import Table from '../../common/table'; | ||
import helpers from '../../../common/helpers'; | ||
|
||
class AboutComputeTable extends React.Component { | ||
render() { | ||
const columns = [ | ||
{ | ||
header: 'Name', | ||
accessor: 'id', | ||
isKey: true, | ||
width: '40%', | ||
formatter: (cell, row) => ( | ||
<a href={helpers.urlBuilder('compute_resources', '', cell.id)}> | ||
{cell.name} | ||
</a> | ||
), | ||
}, | ||
{ | ||
header: 'Type', | ||
accessor: 'type', | ||
width: '40%', | ||
}, | ||
{ | ||
header: 'Status', | ||
accessor: 'id', | ||
width: '20%', | ||
formatter: (cell, row) => ( | ||
<Status | ||
data={{ | ||
type: 'compute_resurce', | ||
id: cell.id, | ||
url: helpers.urlBuilder( | ||
'compute_resources', | ||
'ping', | ||
cell.id, | ||
), | ||
}} | ||
/> | ||
), | ||
}, | ||
]; | ||
|
||
return ( | ||
<Table emptyState={{ model: 'compute_resources' }} data={this.props.data} columns={columns} /> | ||
); | ||
} | ||
} | ||
export default AboutComputeTable; |
25 changes: 25 additions & 0 deletions
25
webpack/assets/javascripts/react_app/components/about/index.js
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,25 @@ | ||
|
||
import React from 'react'; | ||
import ForemanTabs from '../common/tabs'; | ||
import AboutComputeTable from './compute'; | ||
import AboutPluginTable from './plugin'; | ||
import AboutProviderTable from './provider'; | ||
import AboutProxyTable from './proxies'; | ||
|
||
class About extends React.Component { | ||
render() { | ||
const { | ||
compute, proxy, provider, plugin, | ||
} = this.props.data; | ||
const tabs = [__('Smart Proxies'), __('Available Providers'), __('Compute Resources'), __('Plugins')]; | ||
|
||
return <ForemanTabs id='about_tabs' tabs={tabs} > | ||
<AboutProxyTable data={proxy} /> | ||
<AboutProviderTable data={provider} /> | ||
<AboutComputeTable data={compute} /> | ||
<AboutPluginTable data={plugin} /> | ||
</ForemanTabs>; | ||
} | ||
} | ||
|
||
export default About; |
Oops, something went wrong.