mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-28 03:36:44 +00:00
Require hyphen in lovelace dashboard url path (#5214)
* Require hyphen in url path * Update dialog-lovelace-dashboard-detail.ts
This commit is contained in:
parent
5a84e34f93
commit
447d4604c6
@ -57,7 +57,7 @@ export class DialogLovelaceDashboardDetail extends LitElement {
|
|||||||
if (!this._params) {
|
if (!this._params) {
|
||||||
return html``;
|
return html``;
|
||||||
}
|
}
|
||||||
const urlInvalid = !/^[a-zA-Z0-9_-]+$/.test(this._urlPath);
|
const urlInvalid = !/^[a-zA-Z0-9_-]+-[a-zA-Z0-9_-]+$/.test(this._urlPath);
|
||||||
const titleInvalid = !this._urlPath.trim();
|
const titleInvalid = !this._urlPath.trim();
|
||||||
return html`
|
return html`
|
||||||
<ha-dialog
|
<ha-dialog
|
||||||
@ -215,14 +215,13 @@ export class DialogLovelaceDashboardDetail extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _fillUrlPath() {
|
private _fillUrlPath() {
|
||||||
if (this._urlPath) {
|
if (this._urlPath || !this._title) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const parts = this._title.split(" ");
|
const parts = this._title.toLowerCase().split(" ");
|
||||||
|
|
||||||
if (parts.length) {
|
this._urlPath =
|
||||||
this._urlPath = parts.join("_").toLowerCase();
|
parts.length === 1 ? `lovelace-${parts[0]}` : parts.join("_");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private _showSidebarChanged(ev: Event) {
|
private _showSidebarChanged(ev: Event) {
|
||||||
|
@ -887,7 +887,7 @@
|
|||||||
"title": "Title",
|
"title": "Title",
|
||||||
"title_required": "Title is required.",
|
"title_required": "Title is required.",
|
||||||
"url": "Url",
|
"url": "Url",
|
||||||
"url_error_msg": "The url can not contain spaces or special characters, except for _ and -",
|
"url_error_msg": "The url should contain a - and can not contain spaces or special characters, except for _ and -",
|
||||||
"require_admin": "Admin only",
|
"require_admin": "Admin only",
|
||||||
"delete": "Delete",
|
"delete": "Delete",
|
||||||
"update": "Update",
|
"update": "Update",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user