Skip to content

Commit

Permalink
fix(access-log): 查询语句输入空字符串后不写入搜索历史
Browse files Browse the repository at this point in the history
# Reviewed, transaction id: 21714
  • Loading branch information
Carlmac committed Oct 24, 2024
1 parent 1919903 commit 638b825
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
</div>
</template>
</bk-popover>
<bk-dropdown :popover-options="popoverOptions" style="width: 100%;">
<bk-dropdown :popover-options="popoverOptions" :disabled="queryHistory.length === 0" style="width: 100%;">
<bk-input
class="search-input"
v-model="localValue"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ import 'echarts/lib/component/tooltip';
import { ref, computed, nextTick, onMounted, onBeforeUnmount, markRaw } from 'vue';
import {
merge,
trim,
uniq,
} from 'lodash';
import { copy } from '@/common/util';
Expand Down Expand Up @@ -717,9 +718,11 @@ const handleSearch = (value: string) => {
keyword.value = value;
searchParams.value.query = keyword.value;
pagination.value.current = 1;
// 写入搜索历史
queryHistory.value.unshift(value);
queryHistory.value = uniq(queryHistory.value).slice(0, 10);
// 若是非空字符串则写入搜索历史
if (trim(value) !== '') {
queryHistory.value.unshift(value);
queryHistory.value = uniq(queryHistory.value).slice(0, 10);
}
getSearchData();
};
Expand Down
11 changes: 8 additions & 3 deletions src/dashboard-front/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3043,9 +3043,9 @@ caniuse-api@^3.0.0:
lodash.uniq "^4.5.0"

caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001578, caniuse-lite@^1.0.30001587:
version "1.0.30001651"
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001651.tgz"
integrity sha512-9Cf+Xv1jJNe1xPZLGuUXLNkE1BoDkqRqYyFJ9TDYSqhduqA4hu4oR9HluGoWYQC/aj8WHjsGVV+bwkh0+tegRg==
version "1.0.30001669"
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001669.tgz"
integrity sha512-DlWzFDJqstqtIVx1zeSpIMLjunf5SmwOw0N2Ck/QSQdS8PLS4+9HrLaYei4w8BIAL7IB/UEDu889d8vhCTPA0w==

case-sensitive-paths-webpack-plugin@^2.4.0:
version "2.4.0"
Expand Down Expand Up @@ -3562,6 +3562,11 @@ cuint@^0.2.2:
resolved "https://registry.npmjs.org/cuint/-/cuint-0.2.2.tgz"
integrity sha512-d4ZVpCW31eWwCMe1YT3ur7mUDnTXbgwyzaL320DrcRT45rfjYxkt5QWLrmOJ+/UEAI2+fQgKe/fCjR8l4TpRgw==

cz-git@^1.10.1:
version "1.10.1"
resolved "https://registry.yarnpkg.com/cz-git/-/cz-git-1.10.1.tgz#762a70488155f9ea4f2080508e99cb995ec7eaae"
integrity sha512-pBudDYUEqSOgt5cAlAk6BDs/h99lxfiii+1KCxfuVNOgcpn+yz7AejDjdBEJ+XDt7MOeAvcpYW3gi7C7il+IFA==

dashdash@^1.12.0:
version "1.14.1"
resolved "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz"
Expand Down

0 comments on commit 638b825

Please sign in to comment.