mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-08 18:06:36 +00:00
Fix duplicate agents ids during onboarding (#23357)
Fix duplicate agents ids during onboardind
This commit is contained in:
parent
907299b139
commit
ecc704e6ac
@ -116,10 +116,11 @@ class HaBackupConfigAgents extends LitElement {
|
|||||||
this.value = this._value.filter((agent) => agent !== agentId);
|
this.value = this._value.filter((agent) => agent !== agentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure agents exist in the list
|
// Ensure we don't have duplicates, agents exist in the list and cloud is logged in
|
||||||
this.value = this.value
|
this.value = [...new Set(this.value)]
|
||||||
.filter((agent) => this._agentIds.some((id) => id === agent))
|
.filter((agent) => this._agentIds.some((id) => id === agent))
|
||||||
.filter((id) => id !== CLOUD_AGENT || this.cloudStatus);
|
.filter((id) => id !== CLOUD_AGENT || this.cloudStatus.logged_in);
|
||||||
|
|
||||||
fireEvent(this, "value-changed", { value: this.value });
|
fireEvent(this, "value-changed", { value: this.value });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,18 +96,26 @@ class DialogBackupOnboarding extends LitElement implements HassDialog {
|
|||||||
this._step = this._steps[0];
|
this._step = this._steps[0];
|
||||||
this._config = RECOMMENDED_CONFIG;
|
this._config = RECOMMENDED_CONFIG;
|
||||||
|
|
||||||
|
const agents: string[] = [];
|
||||||
// Enable local location by default
|
// Enable local location by default
|
||||||
if (isComponentLoaded(this.hass, "hassio")) {
|
if (isComponentLoaded(this.hass, "hassio")) {
|
||||||
this._config.create_backup.agent_ids.push(HASSIO_LOCAL_AGENT);
|
agents.push(HASSIO_LOCAL_AGENT);
|
||||||
} else {
|
} else {
|
||||||
this._config.create_backup.agent_ids.push(CORE_LOCAL_AGENT);
|
agents.push(CORE_LOCAL_AGENT);
|
||||||
}
|
}
|
||||||
// Enable cloud location if logged in
|
// Enable cloud location if logged in
|
||||||
if (this._params.cloudStatus.logged_in) {
|
if (this._params.cloudStatus.logged_in) {
|
||||||
this._config.create_backup.agent_ids.push(CLOUD_AGENT);
|
agents.push(CLOUD_AGENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
this._config.create_backup.password = generateEncryptionKey();
|
this._config = {
|
||||||
|
...this._config,
|
||||||
|
create_backup: {
|
||||||
|
...this._config.create_backup,
|
||||||
|
agent_ids: agents,
|
||||||
|
password: generateEncryptionKey(),
|
||||||
|
},
|
||||||
|
};
|
||||||
this._opened = true;
|
this._opened = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user