mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 11:16:35 +00:00
Allow 'Discovered' flows to have title placeholders (#3106)
* Allow 'Discovered' flows to have title placeholders * Feedback from review
This commit is contained in:
parent
f967b4940a
commit
b3c1bead39
@ -64,7 +64,7 @@ class HaConfigManagerDashboard extends LocalizeMixin(
|
||||
<template is="dom-repeat" items="[[progress]]">
|
||||
<div class="config-entry-row">
|
||||
<paper-item-body>
|
||||
[[_computeIntegrationTitle(localize, item.handler)]]
|
||||
[[_computeActiveFlowTitle(localize, item)]]
|
||||
</paper-item-body>
|
||||
<mwc-button on-click="_continueFlow"
|
||||
>[[localize('ui.panel.config.integrations.configure')]]</mwc-button
|
||||
@ -190,6 +190,23 @@ class HaConfigManagerDashboard extends LocalizeMixin(
|
||||
return localize(`component.${integration}.config.title`);
|
||||
}
|
||||
|
||||
_computeActiveFlowTitle(localize, integration) {
|
||||
const placeholders = integration.context.title_placeholders || {};
|
||||
const placeholderKeys = Object.keys(placeholders);
|
||||
if (placeholderKeys.length === 0) {
|
||||
return localize(`component.${integration.handler}.config.title`);
|
||||
}
|
||||
const args = [];
|
||||
placeholderKeys.forEach((key) => {
|
||||
args.push(key);
|
||||
args.push(placeholders[key]);
|
||||
});
|
||||
return localize(
|
||||
`component.${integration.handler}.config.flow_title`,
|
||||
...args
|
||||
);
|
||||
}
|
||||
|
||||
_computeConfigEntryEntities(hass, configEntry, entities) {
|
||||
if (!entities) {
|
||||
return [];
|
||||
|
Loading…
x
Reference in New Issue
Block a user