Show if helper can be edited (#5174)

Fixes #5173
Fixes #5171
This commit is contained in:
Bram Kragten 2020-03-12 20:37:33 +01:00 committed by GitHub
parent e0a6d2efe5
commit f5653d0da5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 4 deletions

View File

@ -534,6 +534,10 @@ export class HaDataTable extends LitElement {
flex-shrink: 0;
}
.mdc-data-table__cell.mdc-data-table__cell--icon {
overflow: initial;
}
.mdc-data-table__header-cell--checkbox,
.mdc-data-table__cell--checkbox {
/* @noflip */

View File

@ -29,6 +29,7 @@ import { configSections } from "../ha-panel-config";
import { showEntityEditorDialog } from "../entities/show-dialog-entity-editor";
import { showHelperDetailDialog } from "./show-dialog-helper-detail";
import { HELPER_DOMAINS } from "./const";
import { domainIcon } from "../../../common/entity/domain_icon";
@customElement("ha-config-helpers")
export class HaConfigHelpers extends LitElement {
@ -44,8 +45,8 @@ export class HaConfigHelpers extends LitElement {
icon: {
title: "",
type: "icon",
template: (icon) => html`
<ha-icon slot="item-icon" .icon=${icon}></ha-icon>
template: (icon, helper: any) => html`
<ha-icon .icon=${icon || domainIcon(helper.type)}></ha-icon>
`,
},
name: {
@ -76,7 +77,7 @@ export class HaConfigHelpers extends LitElement {
),
sortable: true,
filterable: true,
width: "30%",
width: "25%",
};
}
columns.type = {
@ -84,7 +85,7 @@ export class HaConfigHelpers extends LitElement {
"ui.panel.config.helpers.picker.headers.type"
),
sortable: true,
width: "30%",
width: "25%",
filterable: true,
template: (type) =>
html`
@ -92,6 +93,27 @@ export class HaConfigHelpers extends LitElement {
type}
`,
};
columns.editable = {
title: "",
type: "icon",
template: (editable) => html`
${!editable
? html`
<div
tabindex="0"
style="display:inline-block; position: relative;"
>
<ha-icon icon="hass:pencil-off"></ha-icon>
<paper-tooltip position="left">
${this.hass.localize(
"ui.panel.config.entities.picker.status.readonly"
)}
</paper-tooltip>
</div>
`
: ""}
`,
};
return columns;
}
);