mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +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 { haStyle } from "../../../../resources/styles";
|
||||||
import { HomeAssistant } from "../../../../types";
|
import { HomeAssistant } from "../../../../types";
|
||||||
import { loadPolyfillIfNeeded } from "../../../../resources/resize-observer.polyfill";
|
import { loadPolyfillIfNeeded } from "../../../../resources/resize-observer.polyfill";
|
||||||
|
import { showConfirmationDialog } from "../../../../dialogs/generic/show-dialog-box";
|
||||||
|
|
||||||
const defaultFullCalendarConfig: CalendarOptions = {
|
const defaultFullCalendarConfig: CalendarOptions = {
|
||||||
plugins: [timeGridPlugin, interactionPlugin],
|
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 [day, index] = info.event.id.split("-");
|
||||||
const value = [...this[`_${day}`]];
|
const value = [...this[`_${day}`]];
|
||||||
|
|
||||||
|
@ -1223,6 +1223,10 @@
|
|||||||
"timer": {
|
"timer": {
|
||||||
"duration": "Duration",
|
"duration": "Duration",
|
||||||
"restore": "Restore?"
|
"restore": "Restore?"
|
||||||
|
},
|
||||||
|
"schedule": {
|
||||||
|
"delete": "Delete item?",
|
||||||
|
"confirm_delete": "Do you want to delete this item?"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"options_flow": {
|
"options_flow": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user