mirror of
https://github.com/home-assistant/frontend.git
synced 2025-11-17 06:50:23 +00:00
Merge Confirmation Dialogs into Alert, Confirmation or Prompt (#4114)
* ✨ Add alert dialog 🔨 Add alert dialogs 🔨 add more 🔨 Add more 🔨 Enhance check Co-Authored-By: Bram Kragten <mail@bramkragten.nl> 🔥 Combine confirmation into alert dialog 🔨 Replace confirmation calls with alert dialog ✏️ Remove 3 🔨 Add prompt logic Rename to generic Rename and add new params for alert, confirmation and prompt Renames and prop changes Rename and props Cleanup Setup prompt Wording Use text for prompt Add prompts and confirmation on delete user Rename Rename Rename imports Fix parms change Only use default for confirmation Co-Authored-By: Bram Kragten <mail@bramkragten.nl> Update src/dialogs/generic/dialog-box.ts Co-Authored-By: Bram Kragten <mail@bramkragten.nl> Update change text Add autofocus Merge show dialogs into one generic Add automation delete confirmation Modal Remove deleted file Add delete donfirm to script Fix error with tslint Fix from rebase Fix from rebase Fix from rebase * 🔧 Split dialog functions * 🔧 Fix from rebase * 🔧 More fixes * 🔧 Fix * 🔧 Apply suggestions from code review Co-Authored-By: Bram Kragten <mail@bramkragten.nl> * 🔧 Update from suggestion * 🔧 Renames and cleanup * 🔧 Camelcase Co-Authored-By: Bram Kragten <mail@bramkragten.nl> * 🔧 camel case Co-Authored-By: Bram Kragten <mail@bramkragten.nl> Co-authored-by: Bram Kragten <mail@bramkragten.nl>
This commit is contained in:
@@ -22,7 +22,7 @@ import {
|
||||
ScriptConfig,
|
||||
deleteScript,
|
||||
} from "../../../data/script";
|
||||
import { showConfirmationDialog } from "../../../dialogs/confirmation/show-dialog-confirmation";
|
||||
import { showConfirmationDialog } from "../../../dialogs/generic/show-dialog-box";
|
||||
import "../../../layouts/ha-app-layout";
|
||||
import { haStyle } from "../../../resources/styles";
|
||||
import { HomeAssistant } from "../../../types";
|
||||
@@ -61,7 +61,7 @@ export class HaScriptEditor extends LitElement {
|
||||
"ui.panel.config.script.editor.delete_script"
|
||||
)}"
|
||||
icon="hass:delete"
|
||||
@click=${this._delete}
|
||||
@click=${this._deleteConfirm}
|
||||
></paper-icon-button>
|
||||
`}
|
||||
</app-toolbar>
|
||||
@@ -228,8 +228,8 @@ export class HaScriptEditor extends LitElement {
|
||||
text: this.hass!.localize(
|
||||
"ui.panel.config.common.editor.confirm_unsaved"
|
||||
),
|
||||
confirmBtnText: this.hass!.localize("ui.common.yes"),
|
||||
cancelBtnText: this.hass!.localize("ui.common.no"),
|
||||
confirmText: this.hass!.localize("ui.common.yes"),
|
||||
dismissText: this.hass!.localize("ui.common.no"),
|
||||
confirm: () => history.back(),
|
||||
});
|
||||
} else {
|
||||
@@ -237,14 +237,16 @@ export class HaScriptEditor extends LitElement {
|
||||
}
|
||||
}
|
||||
|
||||
private async _deleteConfirm() {
|
||||
showConfirmationDialog(this, {
|
||||
text: this.hass.localize("ui.panel.config.script.editor.delete_confirm"),
|
||||
confirmText: this.hass!.localize("ui.common.yes"),
|
||||
dismissText: this.hass!.localize("ui.common.no"),
|
||||
confirm: () => this._delete(),
|
||||
});
|
||||
}
|
||||
|
||||
private async _delete() {
|
||||
if (
|
||||
!confirm(
|
||||
this.hass.localize("ui.panel.config.script.editor.delete_confirm")
|
||||
)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
await deleteScript(this.hass, computeObjectId(this.script.entity_id));
|
||||
history.back();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user