diff --git a/.gitignore b/.gitignore index 6e659a99404..8ea7efa5afb 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ public source/_data/analytics_data.json source/_data/blueprint_exchange_data.json source/_data/version_data.json +source/_data/alerts_data.json source/_stash source/stylesheets/screen.css source/.jekyll-cache/ diff --git a/Rakefile b/Rakefile index d5d3a4fa4d4..19100afcf4a 100644 --- a/Rakefile +++ b/Rakefile @@ -33,6 +33,8 @@ task :generate do abort("Generating CSS failed") unless success success = system "rake analytics_data" abort("Generating analytics data failed") unless success + success = system "rake alerts_data" + abort("Generating alerts data failed") unless success success = system "rake version_data" abort("Generating version data failed") unless success success = system "rake blueprint_exchange_data" @@ -74,6 +76,7 @@ task :preview, :listen do |t, args| system "compass compile --css-dir #{source_dir}/stylesheets" unless File.exist?("#{source_dir}/stylesheets/screen.css") system "rake analytics_data" system "rake version_data" + system "rake alerts_data" system "rake blueprint_exchange_data" jekyllPid = Process.spawn({"OCTOPRESS_ENV"=>"preview"}, "jekyll build -t --watch --incremental") compassPid = Process.spawn("compass watch") @@ -191,6 +194,19 @@ task :analytics_data do end end + +desc "Download data from alerts.home-assistant.io" +task :alerts_data do + uri = URI('https://alerts.home-assistant.io/alerts.json') + + remote_data = JSON.parse(Net::HTTP.get(uri)) + + File.open("#{source_dir}/_data/alerts_data.json", "w") do |file| + file.write(JSON.generate(remote_data)) + end +end + + desc "Download version data from version.home-assistant.io" task :version_data do uri = URI('https://version.home-assistant.io/stable.json') diff --git a/sass/custom/_paulus.scss b/sass/custom/_paulus.scss index e0d8677522e..b42d118939c 100644 --- a/sass/custom/_paulus.scss +++ b/sass/custom/_paulus.scss @@ -51,6 +51,17 @@ $primary-color: #049cdb; } } +.integration-alert { + margin: -1em 0; + background-color: wheat; + padding: 4px; + + a { + text-decoration: none !important; + } + +} + @media only screen and (max-width: $menu-collapse) { .search-container { z-index: 20; diff --git a/source/_includes/asides/component_navigation.html b/source/_includes/asides/component_navigation.html index de34932eff2..48e12ec653e 100644 --- a/source/_includes/asides/component_navigation.html +++ b/source/_includes/asides/component_navigation.html @@ -1,6 +1,5 @@ {% assign percentage = 100.0 | times: site.data.analytics_data.integrations[page.ha_domain] | divided_by: site.data.analytics_data.reports_integrations | round: 1 %}
-
{%- if page.logo -%} @@ -13,12 +12,6 @@ {%- endif -%}
- {%- if page.ha_domain -%} -
- -
- {%- endif -%} -
The {{ page.name | default: page.title }} integration was introduced in Home Assistant {{ page.ha_release | default: "unknown" }}, and it's used by @@ -61,5 +54,3 @@ {%- endif -%}
- - diff --git a/source/_layouts/default.html b/source/_layouts/default.html index 15d7d57be4b..a4c3a65ca72 100644 --- a/source/_layouts/default.html +++ b/source/_layouts/default.html @@ -1,9 +1,9 @@ {% include site/head.html %} - +
{% if page.hero_unit %} diff --git a/source/_layouts/page.html b/source/_layouts/page.html index d11479071c8..227c55488b3 100644 --- a/source/_layouts/page.html +++ b/source/_layouts/page.html @@ -10,9 +10,22 @@ layout: default }}{% endif %} + {% if page.collection == "integrations" %} + {% assign active_alert = "" %} + {% for alert in site.data.alerts_data %} + {% if alert.integrations and alert.integrations[0].package == page.ha_domain %} + {% assign active_alert = alert.alert_url %} + {% endif %} + {% endfor %} + {% if active_alert != "" %} +
+ ⚠️ There is an active alert for this integration! +
+ {% endif %} + {% endif %}
{% endif %} {{ content }} {% include feedback.html %} - + \ No newline at end of file