mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +00:00
Ask confirmation before deleting a schedule item (#17158)
This commit is contained in:
parent
94808b75b3
commit
75b6b9cfd9
@ -23,6 +23,7 @@ import { Schedule, ScheduleDay, weekdays } from "../../../../data/schedule";
|
||||
import { haStyle } from "../../../../resources/styles";
|
||||
import { HomeAssistant } from "../../../../types";
|
||||
import { loadPolyfillIfNeeded } from "../../../../resources/resize-observer.polyfill";
|
||||
import { showConfirmationDialog } from "../../../../dialogs/generic/show-dialog-box";
|
||||
|
||||
const defaultFullCalendarConfig: CalendarOptions = {
|
||||
plugins: [timeGridPlugin, interactionPlugin],
|
||||
@ -365,7 +366,19 @@ class HaScheduleForm extends LitElement {
|
||||
}
|
||||
}
|
||||
|
||||
private _handleEventClick(info: any) {
|
||||
private async _handleEventClick(info: any) {
|
||||
if (
|
||||
!(await showConfirmationDialog(this, {
|
||||
title: this.hass.localize("ui.dialogs.helper_settings.schedule.delete"),
|
||||
text: this.hass.localize(
|
||||
"ui.dialogs.helper_settings.schedule.confirm_delete"
|
||||
),
|
||||
destructive: true,
|
||||
confirmText: this.hass.localize("ui.common.delete"),
|
||||
}))
|
||||
) {
|
||||
return;
|
||||
}
|
||||
const [day, index] = info.event.id.split("-");
|
||||
const value = [...this[`_${day}`]];
|
||||
|
||||
|
@ -1223,6 +1223,10 @@
|
||||
"timer": {
|
||||
"duration": "Duration",
|
||||
"restore": "Restore?"
|
||||
},
|
||||
"schedule": {
|
||||
"delete": "Delete item?",
|
||||
"confirm_delete": "Do you want to delete this item?"
|
||||
}
|
||||
},
|
||||
"options_flow": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user