diff --git a/src/editor.ts b/src/editor.ts index 1d8158d8..46b1d683 100644 --- a/src/editor.ts +++ b/src/editor.ts @@ -155,6 +155,12 @@ const options: EditorOptions = { secondary: localize('editor.dimensions_secondary'), show: false, }, + overrides: { + icon: 'file-replace', + name: localize('editor.overrides'), + secondary: localize('editor.overrides_secondary'), + show: false, + }, }; @customElement('frigate-card-editor') @@ -302,7 +308,7 @@ export class FrigateCardEditor extends LitElement implements LovelaceCardEditor return html`
@@ -364,6 +370,15 @@ export class FrigateCardEditor extends LitElement implements LovelaceCardEditor `; } + /** + * Render a number slider. + * @param configPath Configuration path of the variable. + * @param valueDefault The default value. + * @param icon The icon to use on the slider. + * @param min The minimum value. + * @param max The maximum value. + * @returns A rendered template. + */ protected _renderSlider( configPath: string, valueDefault: number, @@ -388,6 +403,15 @@ export class FrigateCardEditor extends LitElement implements LovelaceCardEditor `; } + /** + * Render a simple text info box. + * @param info The string to display. + * @returns A rendered template. + */ + protected _renderInfo(info: string): TemplateResult { + return html` ${info}`; + } + /** * Render a camera header. * @param cameraIndex The index of the camera to edit/add. @@ -856,6 +880,14 @@ export class FrigateCardEditor extends LitElement implements LovelaceCardEditor ${this._renderStringInput(CONF_DIMENSIONS_ASPECT_RATIO)}
` : ''} + ${this._config['overrides'] !== undefined + ? html` ${this._renderOptionSetHeader('overrides')} + ${options.overrides.show + ? html`
+ ${this._renderInfo(localize('config.overrides.info'))} +
` + : ''}` + : html``} `; } diff --git a/src/localize/languages/en.json b/src/localize/languages/en.json index c5e21a08..4fc9c5e6 100644 --- a/src/localize/languages/en.json +++ b/src/localize/languages/en.json @@ -160,6 +160,9 @@ "dynamic": "Aspect ratio adjusts to media", "static": "Static aspect ratio" } + }, + "overrides": { + "info": "This card configuration has manually specified overrides configured which may override values shown in the visual editor, please consult the code editor to view/modify these overrides" } }, "editor": { @@ -186,7 +189,9 @@ "move_up": "Move up", "move_down": "Move down", "add_new_camera": "Add new camera", - "camera": "Camera" + "camera": "Camera", + "overrides": "Overrides are active", + "overrides_secondary": "Dynamic configuration overrides detected" }, "error": { "empty_response": "Received empty response from Home Assistant for request", diff --git a/src/scss/editor.scss b/src/scss/editor.scss index 0e7ff52d..30d59b2d 100644 --- a/src/scss/editor.scss +++ b/src/scss/editor.scss @@ -1,9 +1,12 @@ @use './button.scss'; .option { - padding: 4px 0px; + padding: 4px 4px; cursor: pointer; } +.option.option-overrides .title { + color: var(--warning-color); +} .row { display: flex; margin-bottom: -14px; @@ -70,4 +73,7 @@ div.upgrade span { .cameras .controls ha-icon-button.button { --mdc-icon-button-size: 32px; --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2); +} +span.info { + padding: 4px; } \ No newline at end of file