Show toast on successfull save (#3576)

* Show toast on successfull save

We need to make a list of places where this could benefit the user experience.

* Helper method

* Rename
This commit is contained in:
Bram Kragten 2019-09-03 20:33:10 +02:00 committed by GitHub
parent f00ad84c16
commit a9c9d4ca51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 1 deletions

View File

@ -23,6 +23,7 @@ import {
SYSTEM_GROUP_ID_USER,
SYSTEM_GROUP_ID_ADMIN,
} from "../../../data/user";
import { showSaveSuccessToast } from "../../../util/toast-saved-success";
declare global {
interface HASSDomEvents {
@ -150,6 +151,7 @@ class HaUserEditor extends LitElement {
await updateUser(this.hass!, this.user!.id, {
group_ids: [newGroup],
});
showSaveSuccessToast(this, this.hass!);
fireEvent(this, "reload-users");
} catch (err) {
alert(`Group update failed: ${err.message}`);

View File

@ -493,7 +493,8 @@
"common": {
"loading": "Loading",
"cancel": "Cancel",
"save": "Save"
"save": "Save",
"successfully_saved": "Successfully saved"
},
"components": {
"entity": {

View File

@ -0,0 +1,7 @@
import { showToast } from "./toast";
import { HomeAssistant } from "../types";
export const showSaveSuccessToast = (el: HTMLElement, hass: HomeAssistant) =>
showToast(el, {
message: hass!.localize("ui.common.successfully_saved"),
});