Move all destructive device actions to the bottom of the overflow menu (#13490)

This commit is contained in:
Franck Nijhof 2022-08-25 18:33:09 +02:00 committed by GitHub
parent 8db1881a93
commit 88decba851
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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) {