mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Move error outside ha form for assist pipeline form (#16258)
This commit is contained in:
parent
be1867900e
commit
49b0c7c3d1
@ -5,10 +5,10 @@ import type { SpeechMetadata } from "./stt";
|
|||||||
|
|
||||||
export interface AssistPipeline {
|
export interface AssistPipeline {
|
||||||
id: string;
|
id: string;
|
||||||
|
name: string;
|
||||||
|
language: string;
|
||||||
conversation_engine: string;
|
conversation_engine: string;
|
||||||
conversation_language: string | null;
|
conversation_language: string | null;
|
||||||
language: string;
|
|
||||||
name: string;
|
|
||||||
stt_engine: string | null;
|
stt_engine: string | null;
|
||||||
stt_language: string | null;
|
stt_language: string | null;
|
||||||
tts_engine: string | null;
|
tts_engine: string | null;
|
||||||
@ -17,15 +17,15 @@ export interface AssistPipeline {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface AssistPipelineMutableParams {
|
export interface AssistPipelineMutableParams {
|
||||||
conversation_engine: string;
|
|
||||||
conversation_language?: string | null;
|
|
||||||
language: string;
|
|
||||||
name: string;
|
name: string;
|
||||||
stt_engine?: string | null;
|
language: string;
|
||||||
stt_language?: string | null;
|
conversation_engine: string;
|
||||||
tts_engine?: string | null;
|
conversation_language: string | null;
|
||||||
tts_language?: string | null;
|
stt_engine: string | null;
|
||||||
tts_voice?: string | null;
|
stt_language: string | null;
|
||||||
|
tts_engine: string | null;
|
||||||
|
tts_language: string | null;
|
||||||
|
tts_voice: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface assistRunListing {
|
export interface assistRunListing {
|
||||||
|
@ -11,8 +11,6 @@ export class AssistPipelineDetailConfig extends LitElement {
|
|||||||
|
|
||||||
@property() public data?: Partial<AssistPipeline>;
|
@property() public data?: Partial<AssistPipeline>;
|
||||||
|
|
||||||
@property() public error?: Record<string, string>;
|
|
||||||
|
|
||||||
@property() public supportedLanguages?: string[];
|
@property() public supportedLanguages?: string[];
|
||||||
|
|
||||||
private _schema = memoizeOne(
|
private _schema = memoizeOne(
|
||||||
@ -60,7 +58,6 @@ export class AssistPipelineDetailConfig extends LitElement {
|
|||||||
<ha-form
|
<ha-form
|
||||||
.schema=${this._schema(this.supportedLanguages)}
|
.schema=${this._schema(this.supportedLanguages)}
|
||||||
.data=${this.data}
|
.data=${this.data}
|
||||||
.error=${this.error}
|
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.computeLabel=${this._computeLabel}
|
.computeLabel=${this._computeLabel}
|
||||||
></ha-form>
|
></ha-form>
|
||||||
|
@ -11,8 +11,6 @@ export class AssistPipelineDetailConversation extends LitElement {
|
|||||||
|
|
||||||
@property() public data?: Partial<AssistPipeline>;
|
@property() public data?: Partial<AssistPipeline>;
|
||||||
|
|
||||||
@property() public error?: Record<string, string>;
|
|
||||||
|
|
||||||
private _schema = memoizeOne(
|
private _schema = memoizeOne(
|
||||||
(language?: string) =>
|
(language?: string) =>
|
||||||
[
|
[
|
||||||
@ -60,7 +58,6 @@ export class AssistPipelineDetailConversation extends LitElement {
|
|||||||
<ha-form
|
<ha-form
|
||||||
.schema=${this._schema(this.data?.language)}
|
.schema=${this._schema(this.data?.language)}
|
||||||
.data=${this.data}
|
.data=${this.data}
|
||||||
.error=${this.error}
|
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.computeLabel=${this._computeLabel}
|
.computeLabel=${this._computeLabel}
|
||||||
></ha-form>
|
></ha-form>
|
||||||
|
@ -11,8 +11,6 @@ export class AssistPipelineDetailSTT extends LitElement {
|
|||||||
|
|
||||||
@property() public data?: Partial<AssistPipeline>;
|
@property() public data?: Partial<AssistPipeline>;
|
||||||
|
|
||||||
@property() public error?: Record<string, string>;
|
|
||||||
|
|
||||||
private _schema = memoizeOne(
|
private _schema = memoizeOne(
|
||||||
(language?: string) =>
|
(language?: string) =>
|
||||||
[
|
[
|
||||||
@ -59,7 +57,6 @@ export class AssistPipelineDetailSTT extends LitElement {
|
|||||||
<ha-form
|
<ha-form
|
||||||
.schema=${this._schema(this.data?.language)}
|
.schema=${this._schema(this.data?.language)}
|
||||||
.data=${this.data}
|
.data=${this.data}
|
||||||
.error=${this.error}
|
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.computeLabel=${this._computeLabel}
|
.computeLabel=${this._computeLabel}
|
||||||
></ha-form>
|
></ha-form>
|
||||||
|
@ -11,8 +11,6 @@ export class AssistPipelineDetailTTS extends LitElement {
|
|||||||
|
|
||||||
@property() public data?: Partial<AssistPipeline>;
|
@property() public data?: Partial<AssistPipeline>;
|
||||||
|
|
||||||
@property() public error?: Record<string, string>;
|
|
||||||
|
|
||||||
private _schema = memoizeOne(
|
private _schema = memoizeOne(
|
||||||
(language?: string) =>
|
(language?: string) =>
|
||||||
[
|
[
|
||||||
@ -67,7 +65,6 @@ export class AssistPipelineDetailTTS extends LitElement {
|
|||||||
<ha-form
|
<ha-form
|
||||||
.schema=${this._schema(this.data?.language)}
|
.schema=${this._schema(this.data?.language)}
|
||||||
.data=${this.data}
|
.data=${this.data}
|
||||||
.error=${this.error}
|
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.computeLabel=${this._computeLabel}
|
.computeLabel=${this._computeLabel}
|
||||||
></ha-form>
|
></ha-form>
|
||||||
|
@ -80,30 +80,29 @@ export class DialogVoiceAssistantPipelineDetail extends LitElement {
|
|||||||
)
|
)
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<div>
|
<div class="content">
|
||||||
|
${this._error
|
||||||
|
? html`<ha-alert alert-type="error"> ${this._error} </ha-alert>`
|
||||||
|
: nothing}
|
||||||
<assist-pipeline-detail-config
|
<assist-pipeline-detail-config
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.data=${this._data}
|
.data=${this._data}
|
||||||
.error=${this._error}
|
|
||||||
.supportedLanguages=${this._supportedLanguages}
|
.supportedLanguages=${this._supportedLanguages}
|
||||||
@value-changed=${this._valueChanged}
|
@value-changed=${this._valueChanged}
|
||||||
></assist-pipeline-detail-config>
|
></assist-pipeline-detail-config>
|
||||||
<assist-pipeline-detail-conversation
|
<assist-pipeline-detail-conversation
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.data=${this._data}
|
.data=${this._data}
|
||||||
.error=${this._error}
|
|
||||||
@value-changed=${this._valueChanged}
|
@value-changed=${this._valueChanged}
|
||||||
></assist-pipeline-detail-conversation>
|
></assist-pipeline-detail-conversation>
|
||||||
<assist-pipeline-detail-stt
|
<assist-pipeline-detail-stt
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.data=${this._data}
|
.data=${this._data}
|
||||||
.error=${this._error}
|
|
||||||
@value-changed=${this._valueChanged}
|
@value-changed=${this._valueChanged}
|
||||||
></assist-pipeline-detail-stt>
|
></assist-pipeline-detail-stt>
|
||||||
<assist-pipeline-detail-tts
|
<assist-pipeline-detail-tts
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.data=${this._data}
|
.data=${this._data}
|
||||||
.error=${this._error}
|
|
||||||
@value-changed=${this._valueChanged}
|
@value-changed=${this._valueChanged}
|
||||||
></assist-pipeline-detail-tts>
|
></assist-pipeline-detail-tts>
|
||||||
</div>
|
</div>
|
||||||
@ -165,12 +164,12 @@ export class DialogVoiceAssistantPipelineDetail extends LitElement {
|
|||||||
name: data.name!,
|
name: data.name!,
|
||||||
language: data.language!,
|
language: data.language!,
|
||||||
conversation_engine: data.conversation_engine!,
|
conversation_engine: data.conversation_engine!,
|
||||||
conversation_language: data.conversation_language,
|
conversation_language: data.conversation_language ?? null,
|
||||||
stt_engine: data.stt_engine,
|
stt_engine: data.stt_engine ?? null,
|
||||||
stt_language: data.stt_language,
|
stt_language: data.stt_language ?? null,
|
||||||
tts_engine: data.tts_engine,
|
tts_engine: data.tts_engine ?? null,
|
||||||
tts_language: data.tts_language,
|
tts_language: data.tts_language ?? null,
|
||||||
tts_voice: data.tts_voice,
|
tts_voice: data.tts_voice ?? null,
|
||||||
};
|
};
|
||||||
await this._params!.updatePipeline(values);
|
await this._params!.updatePipeline(values);
|
||||||
} else {
|
} else {
|
||||||
@ -180,7 +179,7 @@ export class DialogVoiceAssistantPipelineDetail extends LitElement {
|
|||||||
}
|
}
|
||||||
this.closeDialog();
|
this.closeDialog();
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
this._error = { base: err?.message || "Unknown error" };
|
this._error = err?.message || "Unknown error";
|
||||||
} finally {
|
} finally {
|
||||||
this._submitting = false;
|
this._submitting = false;
|
||||||
}
|
}
|
||||||
@ -192,7 +191,7 @@ export class DialogVoiceAssistantPipelineDetail extends LitElement {
|
|||||||
await this._params!.setPipelinePreferred();
|
await this._params!.setPipelinePreferred();
|
||||||
this._preferred = true;
|
this._preferred = true;
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
this._error = { base: err?.message || "Unknown error" };
|
this._error = err?.message || "Unknown error";
|
||||||
} finally {
|
} finally {
|
||||||
this._submitting = false;
|
this._submitting = false;
|
||||||
}
|
}
|
||||||
@ -205,7 +204,7 @@ export class DialogVoiceAssistantPipelineDetail extends LitElement {
|
|||||||
this.closeDialog();
|
this.closeDialog();
|
||||||
}
|
}
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
this._error = { base: err?.message || "Unknown error" };
|
this._error = err?.message || "Unknown error";
|
||||||
} finally {
|
} finally {
|
||||||
this._submitting = false;
|
this._submitting = false;
|
||||||
}
|
}
|
||||||
@ -217,11 +216,14 @@ export class DialogVoiceAssistantPipelineDetail extends LitElement {
|
|||||||
css`
|
css`
|
||||||
assist-pipeline-detail-config,
|
assist-pipeline-detail-config,
|
||||||
assist-pipeline-detail-conversation,
|
assist-pipeline-detail-conversation,
|
||||||
assist-pipeline-detail-stt,
|
assist-pipeline-detail-stt {
|
||||||
assist-pipeline-detail-tts {
|
|
||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
ha-alert {
|
||||||
|
margin-bottom: 8px;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
`,
|
`,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user