From 7f6cb505acc4dc0bc755c1002b86a90dc0cb2cc5 Mon Sep 17 00:00:00 2001 From: Sai Nikhil Date: Fri, 3 Jan 2025 11:49:49 +0530 Subject: [PATCH] fix: function image in search bar (#5565) This PR solves #5551 ## Summary by CodeRabbit - **New Features** - Enhanced theme-based icon management in the search bar - Dynamically updated icons based on application theme - **Improvements** - Improved maintainability of icon path handling - Centralized icon selection logic for better code readability --- .../assets/images/common/function_dark.svg | 8 ++++++ web/src/plugins/logs/SearchBar.vue | 26 +++++++++++++++++-- 2 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 web/src/assets/images/common/function_dark.svg diff --git a/web/src/assets/images/common/function_dark.svg b/web/src/assets/images/common/function_dark.svg new file mode 100644 index 0000000000..52f2fcbd5a --- /dev/null +++ b/web/src/assets/images/common/function_dark.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/web/src/plugins/logs/SearchBar.vue b/web/src/plugins/logs/SearchBar.vue index 1dffb6afdd..69edcaad13 100644 --- a/web/src/plugins/logs/SearchBar.vue +++ b/web/src/plugins/logs/SearchBar.vue @@ -302,7 +302,7 @@ along with this program. If not, see . . auto-close size="12px" icon="save" - :icon-right="'img:' + getImageURL('images/common/function.svg')" + :icon-right="iconRight" :title="t('search.functionPlaceholder')" split class="no-outline saved-views-dropdown no-border btn-function" @@ -2714,6 +2714,26 @@ export default defineComponent({ ); disable.value = panelsValues.some((item: any) => item === true); }); + const iconRight = computed(() => { + return ( + "img:" + + getImageURL( + store.state.theme === "dark" + ? "images/common/function_dark.svg" + : "images/common/function.svg", + ) + ); + }); + const functionToggleIcon = computed(() => { + return ( + "img:" + + getImageURL( + searchObj.meta.toggleFunction + ? "images/common/function_dark.svg" + : "images/common/function.svg", + ) + ); + }); // [END] cancel running queries @@ -2803,6 +2823,8 @@ export default defineComponent({ backgroundColorStyle, editorWidthToggleFunction, fnParsedSQL, + iconRight, + functionToggleIcon, }; }, computed: {