@@ -255,14 +260,23 @@ const handleSearchClick = () => {
// Toggle the VM list
const toggleList = () => {
+ // If the list is already open, toggle filtering instead of closing
if (props.showList) {
- // If we're closing the list, save the search text
- if (props.modelValue) {
- searchText.value = props.modelValue;
- // Save to localStorage
- localStorage.setItem('vmSearchText', props.modelValue);
+ // Toggle filtering mode
+ isFilterActive.value = !isFilterActive.value;
+
+ // If we're turning filtering on, make sure the search text is applied
+ if (isFilterActive.value && searchText.value) {
+ inputValue.value = searchText.value;
+ emit('update:modelValue', searchText.value);
}
- } else {
+
+ // No need to emit toggle-list since we're not closing the list
+ return;
+ }
+
+ // If the list is closed, open it without filtering
+ if (!props.showList) {
// If we're opening the list, deactivate filtering
isFilterActive.value = false;
@@ -558,6 +572,12 @@ const scrollToSelectedVM = () => {
color: white;
}
+.list-toggle-btn.filtering {
+ background-color: #0d6efd;
+ color: white;
+ border-color: #0d6efd;
+}
+
.filter-dropdown {
position: relative;
}