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}`); 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) { renderExternalStepHeader(hass, step) {
return ( return (
hass.localize( hass.localize(

View File

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

View File

@ -115,6 +115,19 @@ export const showOptionsFlowDialog = (
return hass.localize(`component.${configEntry.domain}.selector.${key}`); 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) { renderExternalStepHeader(_hass, _step) {
return ""; return "";
}, },

View File

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

View File

@ -128,6 +128,21 @@ export const showRepairsFlowDialog = (
return hass.localize(`component.${issue.domain}.selector.${key}`); 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) { renderExternalStepHeader(_hass, _step) {
return ""; return "";
}, },