Allow for custom submit button text in data flows (#15383)

This commit is contained in:
Bram Kragten 2023-02-20 19:56:06 +01:00 committed by GitHub
parent 658ce80801
commit 48dcd98634
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 49 additions and 4 deletions

View File

@ -101,6 +101,19 @@ export const showConfigFlowDialog = (
return hass.localize(`component.${step.handler}.selector.${key}`);
},
renderShowFormStepSubmitButton(hass, step) {
return (
hass.localize(
`component.${step.handler}.config.step.${step.step_id}.submit`
) ||
hass.localize(
`ui.panel.config.integrations.config_flow.${
step.last_step === false ? "next" : "submit"
}`
)
);
},
renderExternalStepHeader(hass, step) {
return (
hass.localize(

View File

@ -67,6 +67,11 @@ export interface FlowConfig {
key: string
): string;
renderShowFormStepSubmitButton(
hass: HomeAssistant,
step: DataEntryFlowStepForm
): string;
renderExternalStepHeader(
hass: HomeAssistant,
step: DataEntryFlowStepExternal

View File

@ -115,6 +115,19 @@ export const showOptionsFlowDialog = (
return hass.localize(`component.${configEntry.domain}.selector.${key}`);
},
renderShowFormStepSubmitButton(hass, step) {
return (
hass.localize(
`component.${configEntry.domain}.options.step.${step.step_id}.submit`
) ||
hass.localize(
`ui.panel.config.integrations.config_flow.${
step.last_step === false ? "next" : "submit"
}`
)
);
},
renderExternalStepHeader(_hass, _step) {
return "";
},

View File

@ -70,10 +70,9 @@ class StepFlowForm extends LitElement {
: html`
<div>
<mwc-button @click=${this._submitStep}>
${this.hass.localize(
`ui.panel.config.integrations.config_flow.${
this.step.last_step === false ? "next" : "submit"
}`
${this.flowConfig.renderShowFormStepSubmitButton(
this.hass,
this.step
)}
</mwc-button>
</div>

View File

@ -128,6 +128,21 @@ export const showRepairsFlowDialog = (
return hass.localize(`component.${issue.domain}.selector.${key}`);
},
renderShowFormStepSubmitButton(hass, step) {
return (
hass.localize(
`component.${issue.domain}.issues.${
issue.translation_key || issue.issue_id
}.fix_flow.step.${step.step_id}.submit`
) ||
hass.localize(
`ui.panel.config.integrations.config_flow.${
step.last_step === false ? "next" : "submit"
}`
)
);
},
renderExternalStepHeader(_hass, _step) {
return "";
},