mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-12-16 21:59:00 +08:00
Small fixes for global search [SCI-10737][SCI-10713][SCI-10720]
This commit is contained in:
parent
f4003f9962
commit
c7cb5875d3
5 changed files with 30 additions and 11 deletions
|
|
@ -57,7 +57,7 @@
|
|||
</button>
|
||||
</div>
|
||||
<button class="btn btn-light btn-sm" @click="filterModalOpened = true">
|
||||
<i class="sn-icon sn-icon-search-options"></i>
|
||||
<i class="sn-icon sn-icon-search-options" :title="i18n.t('search.index.more_search_options')"></i>
|
||||
<span class="tw-hidden xl:inline">{{ i18n.t('search.index.more_search_options') }}</span>
|
||||
<span
|
||||
v-if="activeFilters.length > 0"
|
||||
|
|
@ -69,12 +69,12 @@
|
|||
<template v-if="activeFilters.length > 0">
|
||||
<div class="h-4 w-[1px] bg-sn-grey"></div>
|
||||
<button class="btn btn-light btn-sm" @click="resetFilters">
|
||||
<i class="sn-icon sn-icon-close"></i>
|
||||
<i class="sn-icon sn-icon-close" :title="i18n.t('search.index.clear_filters')"></i>
|
||||
<span class="tw-hidden xl:inline">{{ i18n.t('search.index.clear_filters') }}</span>
|
||||
</button>
|
||||
</template>
|
||||
<button v-if="activeGroup" class="btn btn-light btn-sm" @click="resetGroup">
|
||||
<i class="sn-icon sn-icon-undo"></i>
|
||||
<i class="sn-icon sn-icon-undo" :title="i18n.t('search.index.all_results')"></i>
|
||||
<span class="tw-hidden xl:inline">{{ i18n.t('search.index.all_results') }}</span>
|
||||
</button>
|
||||
</div>
|
||||
|
|
@ -151,6 +151,10 @@ export default {
|
|||
currentTeam: {
|
||||
type: Number || String,
|
||||
required: true
|
||||
},
|
||||
singleTeam: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
|
|
@ -227,7 +231,7 @@ export default {
|
|||
to: null
|
||||
},
|
||||
include_archived: urlParams.get('include_archived') === 'true',
|
||||
teams: urlParams.getAll('teams[]').map((team) => parseInt(team, 10)),
|
||||
teams: (this.singleTeam ? [] : urlParams.getAll('teams[]').map((team) => parseInt(team, 10))),
|
||||
users: urlParams.getAll('users[]').map((user) => parseInt(user, 10)),
|
||||
group: urlParams.get('group')
|
||||
};
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
:multiple="true"
|
||||
:value="selectedTeams"
|
||||
:placeholder="i18n.t('search.filters.by_team_placeholder')"
|
||||
@change="(v) => {selectedTeams = v}" />
|
||||
@change="selectTeams" />
|
||||
</template>
|
||||
<div class="sci-label mb-2 flex items-center gap-2">
|
||||
{{ i18n.t('search.filters.by_user') }}
|
||||
|
|
@ -52,7 +52,7 @@
|
|||
:with-checkboxes="true"
|
||||
:multiple="true"
|
||||
:placeholder="i18n.t('search.filters.by_user_placeholder')"
|
||||
@change="(v) => {selectedUsers = v}" />
|
||||
@change="selectUsers" />
|
||||
<div class="flex items-center gap-2">
|
||||
<div class="sci-checkbox-container">
|
||||
<input type="checkbox" v-model="includeArchived" class="sci-checkbox" />
|
||||
|
|
@ -178,6 +178,16 @@ export default {
|
|||
this.users = response.data.data.map((user) => ([parseInt(user.id, 10), user.attributes.name, { avatar_url: user.attributes.avatar_url }]));
|
||||
});
|
||||
},
|
||||
selectTeams(teams) {
|
||||
if (Array.isArray(teams)) {
|
||||
this.selectedTeams = teams;
|
||||
}
|
||||
},
|
||||
selectUsers(users) {
|
||||
if (Array.isArray(users)) {
|
||||
this.selectedUsers = users;
|
||||
}
|
||||
},
|
||||
clearFilters() {
|
||||
this.createdAt = {
|
||||
on: null,
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
ref="search"
|
||||
v-else
|
||||
v-model="query"
|
||||
:placeholder="label || placeholder || this.i18n.t('general.select_dropdown.placeholder')"
|
||||
:placeholder="placeholderRender"
|
||||
class="w-full border-0 outline-none pl-0 placeholder:text-sn-grey" />
|
||||
</template>
|
||||
<div v-else class="flex items-center gap-1 flex-wrap">
|
||||
|
|
@ -142,6 +142,13 @@ export default {
|
|||
},
|
||||
mixins: [FixedFlyoutMixin],
|
||||
computed: {
|
||||
placeholderRender() {
|
||||
if (this.searchable && this.labelRenderer && this.label) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return this.label || this.placeholder || this.i18n.t('general.select_dropdown.placeholder');
|
||||
},
|
||||
sizeClass() {
|
||||
switch (this.size) {
|
||||
case 'xs':
|
||||
|
|
@ -301,8 +308,6 @@ export default {
|
|||
});
|
||||
},
|
||||
setValue(value) {
|
||||
this.query = '';
|
||||
|
||||
if (this.multiple) {
|
||||
if (this.newValue.includes(value)) {
|
||||
this.newValue = this.newValue.filter((v) => v !== value);
|
||||
|
|
@ -310,7 +315,6 @@ export default {
|
|||
this.newValue = [...this.newValue, value];
|
||||
}
|
||||
} else {
|
||||
this.newValue = value;
|
||||
this.$nextTick(() => {
|
||||
this.close();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
:search-url="'<%= search_path(format: :json) %>'"
|
||||
teams-url="<%= visible_teams_teams_path %>"
|
||||
users-url="<%= visible_users_teams_path %>"
|
||||
:single-team="<%= current_user.teams.count == 1 %>"
|
||||
current-team="<%= current_team.id %>"
|
||||
/>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -479,7 +479,7 @@ en:
|
|||
by_user_placeholder: "Filter by user"
|
||||
by_user_info: "The 'Filter by user' option will refine search results based on records where the selected user is the creator, modifier, or is assigned to the entry."
|
||||
include_archived: "Include Archived objects"
|
||||
clear: "Clear filters"
|
||||
clear: "Clear"
|
||||
date:
|
||||
today: "Today"
|
||||
yesterday: "Yesterday"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue