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