From 88decba85124cddb8bd4c53f2e58bcba0a8c7aa8 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Thu, 25 Aug 2022 18:33:09 +0200 Subject: [PATCH] Move all destructive device actions to the bottom of the overflow menu (#13490) --- src/panels/config/devices/ha-config-device-page.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/panels/config/devices/ha-config-device-page.ts b/src/panels/config/devices/ha-config-device-page.ts index 1838e6a411..be85cdad56 100644 --- a/src/panels/config/devices/ha-config-device-page.ts +++ b/src/panels/config/devices/ha-config-device-page.ts @@ -303,6 +303,17 @@ export class HaConfigDevicePage extends LitElement { actions.push(...this._deleteButtons); } + // Move all warning actions to the end + actions.sort((a, b) => { + if (a.classes === "warning" && b.classes !== "warning") { + return 1; + } + if (a.classes !== "warning" && b.classes === "warning") { + return -1; + } + return 0; + }); + const firstDeviceAction = actions.shift(); if (device.disabled_by) {