Remove analytics translations (#9002)

This commit is contained in:
Joakim Sørensen 2021-04-27 22:44:28 +02:00 committed by GitHub
parent 83e65e2cc6
commit 93a1adaa56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 40 additions and 95 deletions

View File

@ -6,5 +6,6 @@ export const analyticsLearnMore = (hass: HomeAssistant) => html`<a
.href=${documentationUrl(hass, "/integrations/analytics/")}
target="_blank"
rel="noreferrer"
>${hass.localize("ui.panel.config.core.section.core.analytics.learn_more")}</a
>`;
>
How we process your data
</a>`;

View File

@ -8,7 +8,6 @@ import {
property,
TemplateResult,
} from "lit-element";
import { isComponentLoaded } from "../common/config/is_component_loaded";
import { fireEvent } from "../common/dom/fire_event";
import { Analytics, AnalyticsPreferences } from "../data/analytics";
import { haStyle } from "../resources/styles";
@ -17,7 +16,18 @@ import "./ha-checkbox";
import type { HaCheckbox } from "./ha-checkbox";
import "./ha-settings-row";
const ADDITIONAL_PREFERENCES = ["usage", "statistics"];
const ADDITIONAL_PREFERENCES = [
{
key: "usage",
title: "Usage",
description: "Details of what you use with Home Assistant",
},
{
key: "statistics",
title: "Statistical data",
description: "Counts containing total number of datapoints",
},
];
declare global {
interface HASSDomEvents {
@ -48,14 +58,10 @@ export class HaAnalytics extends LitElement {
</ha-checkbox>
</span>
<span slot="heading" data-for="base">
${this.hass.localize(
`ui.panel.config.core.section.core.analytics.preference.base.title`
)}
Basic analytics
</span>
<span slot="description" data-for="base">
${this.hass.localize(
`ui.panel.config.core.section.core.analytics.preference.base.description`
)}
This includes information about your system.
</span>
</ha-settings-row>
${ADDITIONAL_PREFERENCES.map(
@ -64,44 +70,23 @@ export class HaAnalytics extends LitElement {
<span slot="prefix">
<ha-checkbox
@change=${this._handleRowCheckboxClick}
.checked=${this.analytics?.preferences[preference]}
.preference=${preference}
name=${preference}
.checked=${this.analytics?.preferences[preference.key]}
.preference=${preference.key}
name=${preference.key}
>
</ha-checkbox>
${!baseEnabled
? html`<paper-tooltip animation-delay="0" position="right"
>${this.hass.localize(
"ui.panel.config.core.section.core.analytics.needs_base"
)}
? html`<paper-tooltip animation-delay="0" position="right">
You need to enable basic analytics for this option to be
available
</paper-tooltip>`
: ""}
</span>
<span slot="heading" data-for=${preference}>
${preference === "usage"
? isComponentLoaded(this.hass, "hassio")
? this.hass.localize(
`ui.panel.config.core.section.core.analytics.preference.usage_supervisor.title`
)
: this.hass.localize(
`ui.panel.config.core.section.core.analytics.preference.usage.title`
)
: this.hass.localize(
`ui.panel.config.core.section.core.analytics.preference.${preference}.title`
)}
<span slot="heading" data-for=${preference.key}>
${preference.title}
</span>
<span slot="description" data-for=${preference}>
${preference !== "usage"
? this.hass.localize(
`ui.panel.config.core.section.core.analytics.preference.${preference}.description`
)
: isComponentLoaded(this.hass, "hassio")
? this.hass.localize(
`ui.panel.config.core.section.core.analytics.preference.usage_supervisor.description`
)
: this.hass.localize(
`ui.panel.config.core.section.core.analytics.preference.usage.description`
)}
<span slot="description" data-for=${preference.key}>
${preference.description}
</span>
</ha-settings-row>`
)}
@ -117,14 +102,10 @@ export class HaAnalytics extends LitElement {
</ha-checkbox>
</span>
<span slot="heading" data-for="diagnostics">
${this.hass.localize(
`ui.panel.config.core.section.core.analytics.preference.diagnostics.title`
)}
Diagnostics
</span>
<span slot="description" data-for="diagnostics">
${this.hass.localize(
`ui.panel.config.core.section.core.analytics.preference.diagnostics.description`
)}
Share crash reports when unexpected errors occur.
</span>
</ha-settings-row>
`;
@ -161,7 +142,10 @@ export class HaAnalytics extends LitElement {
preferences[preference] = checkbox.checked;
if (ADDITIONAL_PREFERENCES.includes(preference) && checkbox.checked) {
if (
ADDITIONAL_PREFERENCES.some((entry) => entry.key === preference) &&
checkbox.checked
) {
preferences.base = true;
} else if (preference === "base" && !checkbox.checked) {
preferences.usage = false;

View File

@ -32,13 +32,9 @@ class OnboardingAnalytics extends LitElement {
protected render(): TemplateResult {
return html`
<p>
${this.hass.localize(
"ui.panel.config.core.section.core.analytics.introduction",
"link",
html`<a href="https://analytics.home-assistant.io" target="_blank"
>analytics.home-assistant.io</a
>`
)}
Share anonymized information from your installation to help make Home
Assistant better and help us convince manufacturers to add local control
and privacy-focused features.
</p>
<ha-analytics
@analytics-preferences-changed=${this._preferencesChanged}

View File

@ -40,21 +40,13 @@ class ConfigAnalytics extends LitElement {
: undefined;
return html`
<ha-card
.header=${this.hass.localize(
"ui.panel.config.core.section.core.analytics.header"
)}
>
<ha-card header="Analytics">
<div class="card-content">
${error ? html`<div class="error">${error}</div>` : ""}
<p>
${this.hass.localize(
"ui.panel.config.core.section.core.analytics.introduction",
"link",
html`<a href="https://analytics.home-assistant.io" target="_blank"
>analytics.home-assistant.io</a
>`
)}
Share anonymized information from your installation to help make
Home Assistant better and help us convince manufacturers to add
local control and privacy-focused features.
</p>
<ha-analytics
@analytics-preferences-changed=${this._preferencesChanged}

View File

@ -997,34 +997,6 @@
"save_button": "Save",
"external_url": "External URL",
"internal_url": "Internal URL"
},
"analytics": {
"header": "Analytics",
"introduction": "Share your installation information to help make Home Assistant better and help us convince manufacturers to add local control and privacy-focused features.",
"needs_base": "You need to enable base analytics for this option to be available",
"preference": {
"base": {
"title": "Basic analytics",
"description": "Instance ID, version and installation type."
},
"diagnostics": {
"title": "Diagnostics",
"description": "Share crash reports when unexpected errors occur."
},
"usage": {
"title": "Used Integrations",
"description": "Names and version information."
},
"usage_supervisor": {
"title": "Used integrations and add-ons",
"description": "Names, versions and capabilities."
},
"statistics": {
"title": "Usage statistics",
"description": "Total used entities, users and other elements."
}
},
"learn_more": "How we process your data"
}
}
}