Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
d33e035
Update Media Card to check for supported features
zsarnett Feb 11, 2020
87559c0
Review Updates
zsarnett Feb 13, 2020
f6b1023
Disabled Style Updates
zsarnett Feb 13, 2020
67706a3
Support for requesting the image from the server
zsarnett Feb 16, 2020
30e5611
Stupid mistake
zsarnett Feb 16, 2020
51ce481
Sort list of available events
scop Feb 16, 2020
2718ada
Review updates
zsarnett Feb 17, 2020
9a7f7f1
Review updates again because I am a fool
zsarnett Feb 17, 2020
da1dd45
Update for playlist information if music isnt present
zsarnett Feb 17, 2020
be9ec50
When no image occurs mark the image as undefined
zsarnett Feb 17, 2020
0964130
rookie mistake
zsarnett Feb 17, 2020
322eef1
Add more info to system log (#4899)
balloob Feb 17, 2020
1cc3936
Typing functions
zsarnett Feb 17, 2020
2ab2ade
Import compare
scop Feb 17, 2020
52ea3a5
Merge pull request #4895 from scop/sort-available-events
bramkragten Feb 17, 2020
af3626b
Merge pull request #4850 from zsarnett/media-card-updates
bramkragten Feb 17, 2020
0994302
[ci skip] Translation update
homeassistant Feb 18, 2020
52ae01e
Fix description and title of options flow (#4910)
bramkragten Feb 18, 2020
4675579
Add safe mode support (#4908)
balloob Feb 18, 2020
e265d95
Fix multiselect without data (#4906)
bramkragten Feb 18, 2020
0a41a4f
[ci skip] Translation update
homeassistant Feb 19, 2020
2c58a9f
Sensor Stroke Width Fix (#4916)
zsarnett Feb 19, 2020
aa94e45
Sensor Card - Top Margin 16px -> 8px (#4917)
zsarnett Feb 19, 2020
68baeb8
Media Card Seek Functionality (#4907)
zsarnett Feb 19, 2020
4be1040
Convert History Graph Card to Typescript (#4882)
zsarnett Feb 19, 2020
7046cba
✨ Add buttons row (#4714)
iantrich Feb 19, 2020
23f34fa
Bumped version to 20200219.0
bramkragten Feb 19, 2020
924c780
Update hui-media-control-card.ts (#4919)
bramkragten Feb 19, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"fuse.js": "^3.4.4",
"google-timezones-json": "^1.0.2",
"hls.js": "^0.12.4",
"home-assistant-js-websocket": "^4.4.0",
"home-assistant-js-websocket": "4.4.1",
"intl-messageformat": "^2.2.0",
"js-yaml": "^3.13.1",
"leaflet": "^1.4.0",
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name="home-assistant-frontend",
version="20200217.0",
version="20200219.0",
description="The Home Assistant frontend",
url="https://github.com/home-assistant/home-assistant-polymer",
author="The Home Assistant Authors",
Expand Down
7 changes: 4 additions & 3 deletions src/components/ha-form/ha-form-multi_select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export class HaFormMultiSelect extends LitElement implements HaFormElement {
? this.schema.options
: Object.entries(this.schema.options!);

const data = this.data || [];
return html`
<paper-menu-button horizontal-align="right" vertical-offset="8">
<div class="dropdown-trigger" slot="dropdown-trigger">
Expand All @@ -49,7 +50,7 @@ export class HaFormMultiSelect extends LitElement implements HaFormElement {
id="input"
type="text"
readonly
value=${this.data
value=${data
.map((value) => this.schema.options![value] || value)
.join(", ")}
label=${this.label}
Expand All @@ -68,7 +69,7 @@ export class HaFormMultiSelect extends LitElement implements HaFormElement {
multi
slot="dropdown-content"
attr-for-selected="item-value"
.selectedValues=${this.data}
.selectedValues=${data}
@selected-items-changed=${this._valueChanged}
@iron-select=${this._onSelect}
>
Expand All @@ -79,7 +80,7 @@ export class HaFormMultiSelect extends LitElement implements HaFormElement {
return html`
<paper-icon-item .itemValue=${value}>
<paper-checkbox
.checked=${this.data.includes(value)}
.checked=${data.includes(value)}
slot="item-icon"
></paper-checkbox>
${this._optionLabel(item)}
Expand Down
2 changes: 1 addition & 1 deletion src/data/cached-history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { HomeAssistant } from "../types";
import { HassEntity } from "home-assistant-js-websocket";
import { LocalizeFunc } from "../common/translations/localize";

interface CacheConfig {
export interface CacheConfig {
refresh: number;
cacheKey: string;
hoursToShow: number;
Expand Down
10 changes: 10 additions & 0 deletions src/data/integration.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { LocalizeFunc } from "../common/translations/localize";

export const integrationDocsUrl = (domain: string) =>
`https://www.home-assistant.io/integrations/${domain}`;

export const integrationIssuesUrl = (domain: string) =>
`https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+${domain}%22`;

export const domainToName = (localize: LocalizeFunc, domain: string) =>
localize(`domain.${domain}`) || domain;
11 changes: 11 additions & 0 deletions src/data/media-player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,19 @@ import { HomeAssistant } from "../types";
import { timeCachePromiseFunc } from "../common/util/time-cache-function-promise";

export const SUPPORT_PAUSE = 1;
export const SUPPORT_SEEK = 2;
export const SUPPORT_VOLUME_SET = 4;
export const SUPPORT_VOLUME_MUTE = 8;
export const SUPPORT_PREVIOUS_TRACK = 16;
export const SUPPORT_NEXT_TRACK = 32;
export const SUPPORT_TURN_ON = 128;
export const SUPPORT_TURN_OFF = 256;
export const SUPPORT_PLAY_MEDIA = 512;
export const SUPPORT_VOLUME_BUTTONS = 1024;
export const SUPPORT_SELECT_SOURCE = 2048;
export const SUPPORT_STOP = 4096;
export const SUPPORTS_PLAY = 16384;
export const SUPPORT_SELECT_SOUND_MODE = 65536;
export const OFF_STATES = ["off", "idle"];

export interface MediaPlayerThumbnail {
Expand Down
6 changes: 6 additions & 0 deletions src/data/system_log.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { HomeAssistant } from "../types";

export interface LoggedError {
name: string;
message: string;
level: string;
source: string;
Expand All @@ -14,3 +15,8 @@ export interface LoggedError {

export const fetchSystemLog = (hass: HomeAssistant) =>
hass.callApi<LoggedError[]>("GET", "error/all");

export const getLoggedErrorIntegration = (item: LoggedError) =>
item.name.startsWith("homeassistant.components.")
? item.name.split(".")[2]
: undefined;
4 changes: 2 additions & 2 deletions src/dialogs/config-flow/show-dialog-options-flow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ export const showOptionsFlowDialog = (
renderShowFormStepHeader(hass, step) {
return (
hass.localize(
`component.${step.handler}.options.step.${step.step_id}.title`
`component.${configEntry.domain}.options.step.${step.step_id}.title`
) || hass.localize(`ui.dialogs.options_flow.form.header`)
);
},

renderShowFormStepDescription(hass, step) {
const description = localizeKey(
hass.localize,
`component.${step.handler}.config.step.${step.step_id}.description`,
`component.${configEntry.domain}.options.step.${step.step_id}.description`,
step.description_placeholders
);
return description
Expand Down
1 change: 1 addition & 0 deletions src/fake_data/demo_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ export const demoConfig: HassConfig = {
version: "DEMO",
whitelist_external_dirs: [],
config_source: "storage",
safe_mode: false,
};
1 change: 1 addition & 0 deletions src/panels/config/areas/dialog-area-registry-detail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
TemplateResult,
property,
} from "lit-element";
import "@material/mwc-button";
import "@polymer/paper-dialog-scrollable/paper-dialog-scrollable";
import "@polymer/paper-input/paper-input";

Expand Down
3 changes: 2 additions & 1 deletion src/panels/developer-tools/event/events-list.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { html } from "@polymer/polymer/lib/utils/html-tag";
import { PolymerElement } from "@polymer/polymer/polymer-element";

import { compare } from "../../../common/string/compare";
import { EventsMixin } from "../../../mixins/events-mixin";
import LocalizeMixin from "../../../mixins/localize-mixin";

Expand Down Expand Up @@ -58,7 +59,7 @@ class EventsList extends EventsMixin(LocalizeMixin(PolymerElement)) {
super.connectedCallback();
this.hass.callApi("GET", "events").then(
function(events) {
this.events = events;
this.events = events.sort((e1, e2) => compare(e1.event, e2.event));
}.bind(this)
);
}
Expand Down
14 changes: 6 additions & 8 deletions src/panels/developer-tools/info/integrations-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ import {
} from "lit-element";
import { HomeAssistant } from "../../../types";
import memoizeOne from "memoize-one";
import {
integrationDocsUrl,
integrationIssuesUrl,
} from "../../../data/integration";

@customElement("integrations-card")
class IntegrationsCard extends LitElement {
Expand All @@ -28,18 +32,12 @@ class IntegrationsCard extends LitElement {
<tr>
<td>${domain}</td>
<td>
<a
href=${`https://www.home-assistant.io/integrations/${domain}`}
target="_blank"
>
<a href=${integrationDocsUrl(domain)} target="_blank">
Documentation
</a>
</td>
<td>
<a
href=${`https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+${domain}%22`}
target="_blank"
>
<a href=${integrationIssuesUrl(domain)} target="_blank">
Issues
</a>
</td>
Expand Down
47 changes: 46 additions & 1 deletion src/panels/developer-tools/logs/dialog-system-log-detail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ import { SystemLogDetailDialogParams } from "./show-dialog-system-log-detail";
import { PolymerChangedEvent } from "../../../polymer-types";
import { haStyleDialog } from "../../../resources/styles";
import { HomeAssistant } from "../../../types";
import {
integrationDocsUrl,
integrationIssuesUrl,
domainToName,
} from "../../../data/integration";
import { formatSystemLogTime } from "./util";
import { getLoggedErrorIntegration } from "../../../data/system_log";

class DialogSystemLogDetail extends LitElement {
@property() public hass!: HomeAssistant;
Expand All @@ -30,6 +37,8 @@ class DialogSystemLogDetail extends LitElement {
}
const item = this._params.item;

const integration = getLoggedErrorIntegration(item);

return html`
<ha-paper-dialog
with-backdrop
Expand All @@ -44,7 +53,34 @@ class DialogSystemLogDetail extends LitElement {
)}
</h2>
<paper-dialog-scrollable>
<p>${new Date(item.timestamp * 1000)}</p>
<p>
Logger: ${item.name}
${integration
? html`
<br />
Integration: ${domainToName(this.hass.localize, integration)}
(<a href=${integrationDocsUrl(integration)} target="_blank"
>documentation</a
>,
<a href=${integrationIssuesUrl(integration)} target="_blank"
>issues</a
>)
`
: ""}
<br />
${item.count > 0
? html`
First occured:
${formatSystemLogTime(
item.first_occured,
this.hass!.language
)}
(${item.count} occurences) <br />
`
: ""}
Last logged:
${formatSystemLogTime(item.timestamp, this.hass!.language)}
</p>
${item.message
? html`
<pre>${item.message}</pre>
Expand Down Expand Up @@ -73,6 +109,15 @@ class DialogSystemLogDetail extends LitElement {
ha-paper-dialog {
direction: ltr;
}
a {
color: var(--primary-color);
}
p {
margin-top: 0;
}
pre {
margin-bottom: 0;
}
`,
];
}
Expand Down
38 changes: 21 additions & 17 deletions src/panels/developer-tools/logs/system-log-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,14 @@ import "../../../components/ha-card";
import "../../../components/buttons/ha-call-service-button";
import "../../../components/buttons/ha-progress-button";
import { HomeAssistant } from "../../../types";
import { LoggedError, fetchSystemLog } from "../../../data/system_log";
import { formatDateTimeWithSeconds } from "../../../common/datetime/format_date_time";
import { formatTimeWithSeconds } from "../../../common/datetime/format_time";
import {
LoggedError,
fetchSystemLog,
getLoggedErrorIntegration,
} from "../../../data/system_log";
import { showSystemLogDetailDialog } from "./show-dialog-system-log-detail";

const formatLogTime = (date, language: string) => {
const today = new Date().setHours(0, 0, 0, 0);
const dateTime = new Date(date * 1000);
const dateTimeDay = new Date(date * 1000).setHours(0, 0, 0, 0);

return dateTimeDay < today
? formatDateTimeWithSeconds(dateTime, language)
: formatTimeWithSeconds(dateTime, language);
};
import { formatSystemLogTime } from "./util";
import { domainToName } from "../../../data/integration";

@customElement("system-log-card")
export class SystemLogCard extends LitElement {
Expand All @@ -42,6 +36,9 @@ export class SystemLogCard extends LitElement {
}

protected render(): TemplateResult {
const integrations = this._items
? this._items.map((item) => getLoggedErrorIntegration(item))
: [];
return html`
<div class="system-log-intro">
<ha-card>
Expand All @@ -61,25 +58,32 @@ export class SystemLogCard extends LitElement {
</div>
`
: this._items.map(
(item) => html`
(item, idx) => html`
<paper-item @click=${this._openLog} .logItem=${item}>
<paper-item-body two-line>
<div class="row">
${item.message}
</div>
<div secondary>
${formatLogTime(
${formatSystemLogTime(
item.timestamp,
this.hass!.language
)}
${item.source} (${item.level})
${integrations[idx]
? domainToName(
this.hass!.localize,
integrations[idx]!
)
: item.source}
(${item.level})
${item.count > 1
? html`
-
${this.hass.localize(
"ui.panel.developer-tools.tabs.logs.multiple_messages",
"time",
formatLogTime(
formatSystemLogTime(
item.first_occured,
this.hass!.language
),
Expand Down
13 changes: 13 additions & 0 deletions src/panels/developer-tools/logs/util.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { formatDateTimeWithSeconds } from "../../../common/datetime/format_date_time";

import { formatTimeWithSeconds } from "../../../common/datetime/format_time";

export const formatSystemLogTime = (date, language: string) => {
const today = new Date().setHours(0, 0, 0, 0);
const dateTime = new Date(date * 1000);
const dateTimeDay = new Date(date * 1000).setHours(0, 0, 0, 0);

return dateTimeDay < today
? formatDateTimeWithSeconds(dateTime, language)
: formatTimeWithSeconds(dateTime, language);
};
Loading