mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-21 08:16:36 +00:00
Fix create write tag (#6679)
This commit is contained in:
parent
5fd8b5c5b9
commit
e8f6a79c8f
@ -3,23 +3,23 @@ import "@polymer/paper-input/paper-input";
|
|||||||
import {
|
import {
|
||||||
css,
|
css,
|
||||||
CSSResult,
|
CSSResult,
|
||||||
|
customElement,
|
||||||
html,
|
html,
|
||||||
|
internalProperty,
|
||||||
LitElement,
|
LitElement,
|
||||||
property,
|
property,
|
||||||
internalProperty,
|
|
||||||
TemplateResult,
|
TemplateResult,
|
||||||
customElement,
|
|
||||||
} from "lit-element";
|
} from "lit-element";
|
||||||
import { fireEvent } from "../../../common/dom/fire_event";
|
import { fireEvent } from "../../../common/dom/fire_event";
|
||||||
import { createCloseHeading } from "../../../components/ha-dialog";
|
import { createCloseHeading } from "../../../components/ha-dialog";
|
||||||
import "../../../components/ha-switch";
|
|
||||||
import "../../../components/ha-formfield";
|
import "../../../components/ha-formfield";
|
||||||
|
import "../../../components/ha-switch";
|
||||||
import "../../../components/map/ha-location-editor";
|
import "../../../components/map/ha-location-editor";
|
||||||
|
import { Tag, UpdateTagParams } from "../../../data/tag";
|
||||||
|
import { HassDialog } from "../../../dialogs/make-dialog-manager";
|
||||||
import { haStyleDialog } from "../../../resources/styles";
|
import { haStyleDialog } from "../../../resources/styles";
|
||||||
import { HomeAssistant } from "../../../types";
|
import { HomeAssistant } from "../../../types";
|
||||||
import { HassDialog } from "../../../dialogs/make-dialog-manager";
|
|
||||||
import { TagDetailDialogParams } from "./show-dialog-tag-detail";
|
import { TagDetailDialogParams } from "./show-dialog-tag-detail";
|
||||||
import { UpdateTagParams, Tag } from "../../../data/tag";
|
|
||||||
|
|
||||||
@customElement("dialog-tag-detail")
|
@customElement("dialog-tag-detail")
|
||||||
class DialogTagDetail extends LitElement implements HassDialog {
|
class DialogTagDetail extends LitElement implements HassDialog {
|
||||||
@ -162,7 +162,7 @@ class DialogTagDetail extends LitElement implements HassDialog {
|
|||||||
} else {
|
} else {
|
||||||
newValue = await this._params!.createEntry(values, this._id);
|
newValue = await this._params!.createEntry(values, this._id);
|
||||||
}
|
}
|
||||||
this._params = undefined;
|
this.closeDialog();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this._error = err ? err.message : "Unknown error";
|
this._error = err ? err.message : "Unknown error";
|
||||||
} finally {
|
} finally {
|
||||||
@ -172,11 +172,12 @@ class DialogTagDetail extends LitElement implements HassDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async _updateWriteEntry() {
|
private async _updateWriteEntry() {
|
||||||
|
const openWrite = this._params?.openWrite;
|
||||||
const tag = await this._updateEntry();
|
const tag = await this._updateEntry();
|
||||||
if (!tag) {
|
if (!tag || !openWrite) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this._params?.openWrite!(tag);
|
openWrite(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _deleteEntry() {
|
private async _deleteEntry() {
|
||||||
|
@ -12,6 +12,7 @@ import memoizeOne from "memoize-one";
|
|||||||
import { DataTableColumnContainer } from "../../../components/data-table/ha-data-table";
|
import { DataTableColumnContainer } from "../../../components/data-table/ha-data-table";
|
||||||
import "../../../components/ha-card";
|
import "../../../components/ha-card";
|
||||||
import "../../../components/ha-relative-time";
|
import "../../../components/ha-relative-time";
|
||||||
|
import { showAutomationEditor, TagTrigger } from "../../../data/automation";
|
||||||
import {
|
import {
|
||||||
createTag,
|
createTag,
|
||||||
deleteTag,
|
deleteTag,
|
||||||
@ -23,14 +24,13 @@ import {
|
|||||||
UpdateTagParams,
|
UpdateTagParams,
|
||||||
} from "../../../data/tag";
|
} from "../../../data/tag";
|
||||||
import { showConfirmationDialog } from "../../../dialogs/generic/show-dialog-box";
|
import { showConfirmationDialog } from "../../../dialogs/generic/show-dialog-box";
|
||||||
|
import { getExternalConfig } from "../../../external_app/external_config";
|
||||||
import "../../../layouts/hass-tabs-subpage-data-table";
|
import "../../../layouts/hass-tabs-subpage-data-table";
|
||||||
import { SubscribeMixin } from "../../../mixins/subscribe-mixin";
|
import { SubscribeMixin } from "../../../mixins/subscribe-mixin";
|
||||||
import { HomeAssistant, Route } from "../../../types";
|
import { HomeAssistant, Route } from "../../../types";
|
||||||
import { configSections } from "../ha-panel-config";
|
import { configSections } from "../ha-panel-config";
|
||||||
import { showTagDetailDialog } from "./show-dialog-tag-detail";
|
import { showTagDetailDialog } from "./show-dialog-tag-detail";
|
||||||
import "./tag-image";
|
import "./tag-image";
|
||||||
import { getExternalConfig } from "../../../external_app/external_config";
|
|
||||||
import { showAutomationEditor, TagTrigger } from "../../../data/automation";
|
|
||||||
|
|
||||||
export interface TagRowData extends Tag {
|
export interface TagRowData extends Tag {
|
||||||
last_scanned_datetime: Date | null;
|
last_scanned_datetime: Date | null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user