From ff19dda71cc502586f064b3666b620dae7508239 Mon Sep 17 00:00:00 2001 From: Aman Agrawal Date: Thu, 23 Nov 2023 07:06:12 +0000 Subject: [PATCH] dropdown_widget: Style cannot view stream similar to disabled state. --- web/src/dropdown_widget.js | 7 ++++++- web/styles/app_components.css | 1 + web/templates/dropdown_current_value_not_in_options.hbs | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 web/templates/dropdown_current_value_not_in_options.hbs diff --git a/web/src/dropdown_widget.js b/web/src/dropdown_widget.js index 39e565916b..d100b767a9 100644 --- a/web/src/dropdown_widget.js +++ b/web/src/dropdown_widget.js @@ -1,6 +1,7 @@ import $ from "jquery"; import * as tippy from "tippy.js"; +import render_dropdown_current_value_not_in_options from "../templates/dropdown_current_value_not_in_options.hbs"; import render_dropdown_disabled_state from "../templates/dropdown_disabled_state.hbs"; import render_dropdown_list from "../templates/dropdown_list.hbs"; import render_dropdown_list_container from "../templates/dropdown_list_container.hbs"; @@ -311,7 +312,11 @@ export class DropdownWidget { // If provided, show custom text if cannot find current option. if (!option && this.text_if_current_value_not_in_options) { - $(this.widget_value_selector).text(this.text_if_current_value_not_in_options); + $(this.widget_value_selector).html( + render_dropdown_current_value_not_in_options({ + name: this.text_if_current_value_not_in_options, + }), + ); return; } diff --git a/web/styles/app_components.css b/web/styles/app_components.css index f79932c616..b30016ee3d 100644 --- a/web/styles/app_components.css +++ b/web/styles/app_components.css @@ -1123,6 +1123,7 @@ div.overlay { } } +.dropdown-current-value-not-in-options, .setting-disabled-option { color: hsl(38deg 46% 54%); diff --git a/web/templates/dropdown_current_value_not_in_options.hbs b/web/templates/dropdown_current_value_not_in_options.hbs new file mode 100644 index 0000000000..3fb4ab6957 --- /dev/null +++ b/web/templates/dropdown_current_value_not_in_options.hbs @@ -0,0 +1 @@ +{{name}}