From ec194e2be93e73357702f1c6db78227633746cb3 Mon Sep 17 00:00:00 2001 From: Andreas Zuber Date: Mon, 10 Dec 2018 19:42:08 +0100 Subject: [PATCH] Remove puppetlabs references (#384) * Replace puppetlabs references with working links to the open source project * Create a help controller to display help pages The help icon above the node status block was pointing to a non-existing url for a long time now. Luckily this page was in the converted docs. I integrated the page directly as a help overlay with the colorbox which is already used for the file diff view. --- app/assets/javascripts/dashboard.js | 4 ++++ app/controllers/files_controller.rb | 4 ++-- app/controllers/help_controller.rb | 7 +++++++ app/helpers/application_helper.rb | 5 +++++ app/views/help/_node_status.html.haml | 19 +++++++++++++++++++ app/views/layouts/application.html.haml | 2 +- .../shared/_node_manager_sidebar.html.haml | 3 +-- config/initializers/app_version_init.rb | 2 +- config/routes.rb | 2 ++ docs/manual/bootstrapping.markdown | 2 +- 10 files changed, 43 insertions(+), 7 deletions(-) create mode 100644 app/controllers/help_controller.rb create mode 100644 app/views/help/_node_status.html.haml diff --git a/app/assets/javascripts/dashboard.js b/app/assets/javascripts/dashboard.js index a395547db..02328f45c 100644 --- a/app/assets/javascripts/dashboard.js +++ b/app/assets/javascripts/dashboard.js @@ -270,6 +270,10 @@ function display_file_popup(url) { jQuery.colorbox({href: url, width: '80%', height: '80%', iframe: true}); } +function help_overlay(content) { + jQuery.colorbox({href: content, width: '60%', height: '80%'}) +} + function init_sidebar_links() { jQuery( '.node_summary .primary tr' ).each( function() { jQuery( this ) diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 4fd6cfb0f..e543b79fd 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -41,11 +41,11 @@ def safe_get(url) if e.response.code == "403" text = "

Connection not authorized: #{e}

You may not have generated your certificates. - View documentation

" + View documentation

" else text = "

File contents not available: #{e}

Your agents may not be submitting files to a central filebucket. - View documentation

" + View documentation

" end render html: ActionController::Base.helpers.sanitize(text), status: e.response.code rescue Errno::ECONNREFUSED => e diff --git a/app/controllers/help_controller.rb b/app/controllers/help_controller.rb new file mode 100644 index 000000000..44361486e --- /dev/null +++ b/app/controllers/help_controller.rb @@ -0,0 +1,7 @@ +class HelpController < ApplicationController + def node_status + respond_to do |format| + format.html { render(partial: 'node_status') } + end + end +end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 6644b3c7c..9cb3b4c66 100755 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -270,4 +270,9 @@ def generate_unique_id def add_body_class(klass) (@body_classes ||= []).push(klass).uniq! end + + def help_overlay(action) + url = url_for controller: :help, action: action + link_to 'Help', '#', onclick: "help_overlay('#{url}'); return false;", class: 'popup-md5' + end end diff --git a/app/views/help/_node_status.html.haml b/app/views/help/_node_status.html.haml new file mode 100644 index 000000000..d945dbb2e --- /dev/null +++ b/app/views/help/_node_status.html.haml @@ -0,0 +1,19 @@ +%h2= 'In Puppet Dashboard, every node is in one of six states:' + +%span{style: 'font-family: Helvetica, Arial, Verdana; font-size: larger; color: #888;'}= 'Unresponsive:' +%p= "This node hasn't reported to the puppet master recently; something may be wrong. The cutoff for considering a node unresponsive defaults to one hour, and can be configured in `settings.yml` with the `no_longer_reporting_cutoff` setting." + +%span{style: 'font-family: Helvetica, Arial, Verdana; font-size: larger; color: #c21;'}= 'Failed:' +%p= "During its last Puppet run, this node encountered some error from which it couldn't recover. Something is probably wrong, and investigation is recommended." + +%span{style: 'font-family: Helvetica, Arial, Verdana; font-size: larger; color: #e72;'}= 'Pending:' +%p= "During its last Puppet run, this node _would_ have made changes, but it was either running in no-op mode or found a discrepancy in a resource whose `noop` metaparameter was set to `true`." + +%span{style: 'font-family: Helvetica, Arial, Verdana; font-size: larger; color: #069;'}= 'Changed:' +%p= "This node's last Puppet run was successful, and changes were made to bring the node into compliance." + +%span{style: 'font-family: Helvetica, Arial, Verdana; font-size: larger; color: #093;'}= 'Unchanged:' +%p= "This node's last Puppet run was successful, and it was fully compliant; no changes were necessary." + +%span{style: 'font-family: Helvetica, Arial, Verdana; font-size: larger; color: #aaa;'}= 'Unreported:' +%p= "Although Dashboard is aware of this node's existence, it has never submitted a Puppet report. It may be a newly-commissioned node, it may have never come online, or its copy of Puppet may not be configured correctly." diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 8a27c6845..f3153bdea 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -38,6 +38,6 @@ = yield #footer %p - = link_to raw("© Copyright #{Time.now.year} Puppet Labs"), 'http://puppetlabs.com/' + = link_to raw("Puppet Dashboard"), 'https://github.com/sodabrew/puppet-dashboard' — = link_to h(APP_VERSION), APP_VERSION_LINK diff --git a/app/views/shared/_node_manager_sidebar.html.haml b/app/views/shared/_node_manager_sidebar.html.haml index ce577ad9d..ba754cdbf 100644 --- a/app/views/shared/_node_manager_sidebar.html.haml +++ b/app/views/shared/_node_manager_sidebar.html.haml @@ -17,8 +17,7 @@ .group %h3{:class => active_if(controller_name == "nodes" && action_name == "index")}= link_to "Nodes", nodes_path %p.help - %a{ :href => 'http://links.puppetlabs.com/dashboard1.2_node_summary_help', :target => '_blank' } - Help + = help_overlay('node_status') .node_summary %table.primary - node_summary = Node.count_by_status diff --git a/config/initializers/app_version_init.rb b/config/initializers/app_version_init.rb index e9324891e..f908ee0b0 100644 --- a/config/initializers/app_version_init.rb +++ b/config/initializers/app_version_init.rb @@ -20,7 +20,7 @@ def get_app_version_link if File.exists?(Rails.root.join('VERSION_LINK')) return File.read(Rails.root.join('VERSION_LINK')).strip else - return "https://github.com/puppetlabs/puppet-dashboard/commits/#{APP_VERSION.sub(/.*?g([0-9a-f]*)/, "\\1")}" + return "https://github.com/sodabrew/puppet-dashboard/commits/#{APP_VERSION.sub(/.*?g([0-9a-f]*)/, "\\1")}" end end diff --git a/config/routes.rb b/config/routes.rb index 64fa717c4..7d9ff9f66 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -77,4 +77,6 @@ get 'release_notes', to: 'pages#release_notes' get 'radiator(.:format)', to: 'radiator#index' + + get 'help/node_status', to: 'help#node_status' end diff --git a/docs/manual/bootstrapping.markdown b/docs/manual/bootstrapping.markdown index 0300ee6ac..aabbfb2c7 100644 --- a/docs/manual/bootstrapping.markdown +++ b/docs/manual/bootstrapping.markdown @@ -113,7 +113,7 @@ On Debian-based systems, install Puppet Dashboard via Apt: If you're unable to use the Dashboard packages on your system, the next best way to install Dashboard is from the Puppet Labs Git repo. In the directory where you want Dashboard installed (we suggest `/opt/` or `/usr/share/`), run: - git clone git://github.com/puppetlabs/puppet-dashboard.git + git clone git://github.com/sodabrew/puppet-dashboard.git cd puppet-dashboard git checkout v1.2.0