Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow 'Discovered' flows to have title placeholders #3106

Merged
merged 2 commits into from
Apr 21, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 18 additions & 1 deletion src/panels/config/integrations/ha-config-entries-dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 [];
Expand Down