Make "Events" dev tools use screen space better (#7449)

This commit is contained in:
Philip Allgaier 2021-04-26 12:09:50 +02:00 committed by GitHub
parent 96d6e337be
commit cba3992d2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 57 additions and 39 deletions

View File

@ -177,8 +177,9 @@ class HassioAddonDashboard extends LitElement {
const requestedAddon = extractSearchParam("addon"); const requestedAddon = extractSearchParam("addon");
if (requestedAddon) { if (requestedAddon) {
const addonsInfo = await fetchHassioAddonsInfo(this.hass); const addonsInfo = await fetchHassioAddonsInfo(this.hass);
const validAddon = addonsInfo.addons const validAddon = addonsInfo.addons.some(
.some((addon) => addon.slug === requestedAddon); (addon) => addon.slug === requestedAddon
);
if (!validAddon) { if (!validAddon) {
this._error = this.supervisor.localize("my.error_addon_not_found"); this._error = this.supervisor.localize("my.error_addon_not_found");
} else { } else {

View File

@ -242,14 +242,18 @@ class HassioAddonInfo extends LitElement {
? html` ? html`
Current version: ${this.addon.version} Current version: ${this.addon.version}
<div class="changelog" @click=${this._openChangelog}> <div class="changelog" @click=${this._openChangelog}>
(<span class="changelog-link">${ (<span class="changelog-link"
this.supervisor.localize("addon.dashboard.changelog")}</span >${this.supervisor.localize(
"addon.dashboard.changelog"
)}</span
>) >)
</div> </div>
` `
: html`<span class="changelog-link" @click=${this._openChangelog}>${ : html`<span class="changelog-link" @click=${this._openChangelog}
this.supervisor.localize("addon.dashboard.changelog") >${this.supervisor.localize(
}</span>`} "addon.dashboard.changelog"
)}</span
>`}
</div> </div>
<div class="description light-color"> <div class="description light-color">

View File

@ -30,8 +30,9 @@ class IntegrationsCard extends LitElement {
private _sortedIntegrations = memoizeOne((components: string[]) => { private _sortedIntegrations = memoizeOne((components: string[]) => {
return Array.from( return Array.from(
new Set( new Set(
components components.map((comp) =>
.map((comp) => (comp.includes(".") ? comp.split(".")[1] : comp)) comp.includes(".") ? comp.split(".")[1] : comp
)
) )
).sort(); ).sort();
}); });

View File

@ -76,9 +76,7 @@ class DialogZHADeviceChildren extends LitElement {
}, },
}; };
public showDialog( public showDialog(params: ZHADeviceChildrenDialogParams): void {
params: ZHADeviceChildrenDialogParams
): void {
this._device = params.device; this._device = params.device;
this._fetchData(); this._fetchData();
} }

View File

@ -24,17 +24,21 @@ class HaPanelDevEvent extends EventsMixin(LocalizeMixin(PolymerElement)) {
return html` return html`
<style include="ha-style iron-flex iron-positioning"></style> <style include="ha-style iron-flex iron-positioning"></style>
<style> <style>
.content {
padding: 16px;
max-width: 1200px;
margin: auto;
}
:host { :host {
-ms-user-select: initial; -ms-user-select: initial;
-webkit-user-select: initial; -webkit-user-select: initial;
-moz-user-select: initial; -moz-user-select: initial;
@apply --paper-font-body1; @apply --paper-font-body1;
padding: 16px;
display: block; display: block;
} }
.ha-form { .inputs {
margin-right: 16px;
max-width: 400px; max-width: 400px;
} }
@ -42,14 +46,17 @@ class HaPanelDevEvent extends EventsMixin(LocalizeMixin(PolymerElement)) {
margin-top: 8px; margin-top: 8px;
} }
.code-editor {
margin-right: 16px;
}
.header { .header {
@apply --paper-font-title; @apply --paper-font-title;
} }
event-subscribe-card { event-subscribe-card {
display: block; display: block;
max-width: 800px; margin: 16px 16px 0 0;
margin: 16px auto;
} }
a { a {
@ -70,7 +77,7 @@ class HaPanelDevEvent extends EventsMixin(LocalizeMixin(PolymerElement)) {
)]] )]]
</a> </a>
</p> </p>
<div class="ha-form"> <div class="inputs">
<paper-input <paper-input
label="[[localize( label="[[localize(
'ui.panel.developer-tools.tabs.events.type' 'ui.panel.developer-tools.tabs.events.type'
@ -82,17 +89,20 @@ class HaPanelDevEvent extends EventsMixin(LocalizeMixin(PolymerElement)) {
<p> <p>
[[localize( 'ui.panel.developer-tools.tabs.events.data' )]] [[localize( 'ui.panel.developer-tools.tabs.events.data' )]]
</p> </p>
</div>
<div class="code-editor">
<ha-code-editor <ha-code-editor
mode="yaml" mode="yaml"
value="[[eventData]]" value="[[eventData]]"
error="[[!validJSON]]" error="[[!validJSON]]"
on-value-changed="_yamlChanged" on-value-changed="_yamlChanged"
></ha-code-editor> ></ha-code-editor>
</div>
<mwc-button on-click="fireEvent" raised disabled="[[!validJSON]]" <mwc-button on-click="fireEvent" raised disabled="[[!validJSON]]"
>[[localize( 'ui.panel.developer-tools.tabs.events.fire_event' >[[localize( 'ui.panel.developer-tools.tabs.events.fire_event'
)]]</mwc-button )]]</mwc-button
> >
</div> <event-subscribe-card hass="[[hass]]"></event-subscribe-card>
</div> </div>
<div> <div>
@ -106,7 +116,6 @@ class HaPanelDevEvent extends EventsMixin(LocalizeMixin(PolymerElement)) {
></events-list> ></events-list>
</div> </div>
</div> </div>
<event-subscribe-card hass="[[hass]]"></event-subscribe-card>
`; `;
} }
@ -185,7 +194,7 @@ class HaPanelDevEvent extends EventsMixin(LocalizeMixin(PolymerElement)) {
} }
computeFormClasses(narrow) { computeFormClasses(narrow) {
return narrow ? "" : "layout horizontal"; return narrow ? "content" : "content layout horizontal";
} }
} }

View File

@ -122,19 +122,23 @@ class EventSubscribeCard extends LitElement {
return css` return css`
form { form {
display: block; display: block;
padding: 16px; padding: 0 0 16px 16px;
} }
paper-input { paper-input {
display: inline-block; display: inline-block;
width: 200px; width: 200px;
} }
mwc-button {
vertical-align: middle;
}
.events { .events {
margin: -16px 0; margin: -16px 0;
padding: 0 16px; padding: 0 16px;
} }
.event { .event {
border-bottom: 1px solid var(--divider-color); border-top: 1px solid var(--divider-color);
padding-bottom: 16px; padding-top: 8px;
padding-bottom: 8px;
margin: 16px 0; margin: 16px 0;
} }
.event:last-child { .event:last-child {

View File

@ -129,7 +129,8 @@ class HuiGenericEntityRow extends LitElement {
stateObj.attributes.brightness stateObj.attributes.brightness
? html`${Math.round( ? html`${Math.round(
(stateObj.attributes.brightness / 255) * 100 (stateObj.attributes.brightness / 255) * 100
)} %` )}
%`
: "")} : "")}
</div> </div>
` `

View File

@ -374,7 +374,7 @@
"clear": "Clear", "clear": "Clear",
"show_areas": "Show areas", "show_areas": "Show areas",
"area": "Area", "area": "Area",
"add_new": "Add new area", "add_new": "Add new area...",
"no_areas": "You don't have any areas", "no_areas": "You don't have any areas",
"no_match": "No matching areas found", "no_match": "No matching areas found",
"add_dialog": { "add_dialog": {
@ -847,7 +847,7 @@
}, },
"notification_toast": { "notification_toast": {
"service_call_failed": "Failed to call service {service}.", "service_call_failed": "Failed to call service {service}.",
"connection_lost": "Connection lost. Reconnecting", "connection_lost": "Connection lost. Reconnecting...",
"started": "Home Assistant has started!", "started": "Home Assistant has started!",
"starting": "Home Assistant is starting, not everything will be available until it is finished.", "starting": "Home Assistant is starting, not everything will be available until it is finished.",
"wrapping_up_startup": "Wrapping up startup, not everything will be available until it is finished.", "wrapping_up_startup": "Wrapping up startup, not everything will be available until it is finished.",
@ -1055,7 +1055,7 @@
"description": "View the Home Assistant logs", "description": "View the Home Assistant logs",
"details": "Log Details ({level})", "details": "Log Details ({level})",
"load_full_log": "Load Full Home Assistant Log", "load_full_log": "Load Full Home Assistant Log",
"loading_log": "Loading error log", "loading_log": "Loading error log...",
"no_errors": "No errors have been reported", "no_errors": "No errors have been reported",
"no_issues": "There are no new issues!", "no_issues": "There are no new issues!",
"clear": "Clear", "clear": "Clear",
@ -1196,7 +1196,7 @@
}, },
"server_management": { "server_management": {
"heading": "Server management", "heading": "Server management",
"introduction": "Control your Home Assistant server from Home Assistant.", "introduction": "Control your Home Assistant server... from Home Assistant.",
"restart": "Restart", "restart": "Restart",
"confirm_restart": "Are you sure you want to restart Home Assistant?", "confirm_restart": "Are you sure you want to restart Home Assistant?",
"stop": "Stop", "stop": "Stop",
@ -1781,7 +1781,7 @@
"integrations_link_all_features": " all available features", "integrations_link_all_features": " all available features",
"connected": "Connected", "connected": "Connected",
"not_connected": "Not Connected", "not_connected": "Not Connected",
"fetching_subscription": "Fetching subscription", "fetching_subscription": "Fetching subscription...",
"tts": { "tts": {
"title": "Text to Speech", "title": "Text to Speech",
"info": "Bring personality to your home by having it speak to you by using our Text-to-Speech services. You can use this in automations and scripts by using the {service} service.", "info": "Bring personality to your home by having it speak to you by using our Text-to-Speech services. You can use this in automations and scripts by using the {service} service.",
@ -2799,7 +2799,7 @@
"clear": "Clear", "clear": "Clear",
"delete": "Delete card", "delete": "Delete card",
"duplicate": "Duplicate card", "duplicate": "Duplicate card",
"move": "Move to View", "move": "Move to view",
"move_before": "Move card before", "move_before": "Move card before",
"move_after": "Move card after", "move_after": "Move card after",
"options": "More options", "options": "More options",
@ -3410,7 +3410,7 @@
"events": { "events": {
"title": "Events", "title": "Events",
"description": "Fire an event on the event bus.", "description": "Fire an event on the event bus.",
"documentation": "Events Documentation.", "documentation": "Events documentation",
"type": "Event Type", "type": "Event Type",
"data": "Event Data (YAML, optional)", "data": "Event Data (YAML, optional)",
"fire_event": "Fire Event", "fire_event": "Fire Event",
@ -3423,7 +3423,7 @@
"start_listening": "Start listening", "start_listening": "Start listening",
"stop_listening": "Stop listening", "stop_listening": "Stop listening",
"alert_event_type": "Event type is a mandatory field", "alert_event_type": "Event type is a mandatory field",
"notification_event_fired": "Event {type} successful fired!" "notification_event_fired": "Event {type} successfully fired!"
}, },
"services": { "services": {
"title": "Services", "title": "Services",
@ -3442,8 +3442,8 @@
}, },
"states": { "states": {
"title": "States", "title": "States",
"description1": "Set the representation of a device within Home Assistant.", "description1": "Set the current state representation of an entity within Home Assistant.",
"description2": "This will not communicate with the actual device.", "description2": "If the entity belongs to a device, there will be no actual communication with that device.",
"entity": "Entity", "entity": "Entity",
"state": "State", "state": "State",
"attributes": "Attributes", "attributes": "Attributes",