Move the alert location (#18646)

This commit is contained in:
Joakim Sørensen 2021-07-28 19:02:59 +02:00 committed by GitHub
parent 8afee38e3e
commit 4d3d8ba472
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 43 additions and 11 deletions

1
.gitignore vendored
View File

@ -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/

View File

@ -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')

View File

@ -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;

View File

@ -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 %}
<section class="aside-module grid__item one-whole lap-one-half">
<div class='brand-logo-container section'>
{%- if page.logo -%}
<img src='/images/supported_brands/{{ page.logo }}' />
@ -13,12 +12,6 @@
{%- endif -%}
</div>
{%- if page.ha_domain -%}
<div class="section">
<kb-alert-link integration="{{ page.ha_domain }}"></kb-alert-link>
</div>
{%- endif -%}
<div class='section'>
The {{ page.name | default: page.title }} integration was introduced in Home Assistant {{ page.ha_release | default: "unknown" }},
and it's used by <a title="Open analytics.home-assistant.io" href="https://analytics.home-assistant.io/#integrations" target="_blank" rel="noopener">
@ -61,5 +54,3 @@
{%- endif -%}
</section>
<script src="https://alerts.home-assistant.io/ce-alert-link.js"></script>

View File

@ -1,9 +1,9 @@
{% include site/head.html %}
<body {% if page.body_id %} id="{{ page.body_id }}"{% endif %}>
<header class='site-header'>
{% include site/header.html %}
</header>
<div class="page-content">
{% if page.hero_unit %}

View File

@ -10,9 +10,22 @@ layout: default
}}{% endif %}
</h1>
</header>
{% 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 != "" %}
<div class="integration-alert">
<a href="{{active_alert}}" target="_blank">⚠️ There is an active alert for this integration!</a>
</div>
{% endif %}
{% endif %}
<hr class="divider" />
{% endif %}
{{ content }}
{% include feedback.html %}
</article>
</article>