Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ FEAT: Search for feedbacktask #3138

Merged
merged 75 commits into from
Jun 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
26b8504
feat(Client): remove on mouseleave event
Jan 30, 2023
a5b48d9
Merge branch 'develop' of https://github.com/recognai/rubrix into dev…
Jan 31, 2023
bdc3cb9
Merge branch 'develop' of https://github.com/recognai/rubrix into dev…
Jan 31, 2023
e79eb6e
Merge branch 'develop' of https://github.com/recognai/rubrix into dev…
Feb 1, 2023
6905376
Merge branch 'develop' of https://github.com/recognai/rubrix into dev…
Feb 7, 2023
6a102ae
Merge branch 'develop' of https://github.com/recognai/rubrix into dev…
Feb 14, 2023
e1b844c
Merge branch 'develop' of https://github.com/recognai/rubrix into dev…
Feb 15, 2023
792fa5e
Merge branch 'develop' of https://github.com/recognai/rubrix into dev…
Feb 21, 2023
1513d63
Merge branch 'develop' of https://github.com/recognai/rubrix into dev…
Feb 21, 2023
90e98e0
Merge branch 'develop' of https://github.com/recognai/rubrix into dev…
Feb 23, 2023
75366b6
Merge branch 'develop' of https://github.com/recognai/rubrix into dev…
Feb 24, 2023
c117b3d
Merge branch 'develop' of https://github.com/recognai/rubrix into dev…
Mar 1, 2023
da4026c
Merge branch 'develop' of https://github.com/recognai/rubrix into dev…
Mar 14, 2023
0c5eef9
Merge branch 'develop' of https://github.com/recognai/rubrix into dev…
Mar 16, 2023
2a0ff8e
Merge branch 'develop' of https://github.com/recognai/rubrix into dev…
Mar 21, 2023
b2e20bb
Merge branch 'develop' of https://github.com/recognai/rubrix into dev…
Mar 21, 2023
b47793e
Merge branch 'develop' of https://github.com/recognai/rubrix into dev…
Mar 21, 2023
ca314e2
Merge branch 'develop' of https://github.com/recognai/rubrix into dev…
Mar 22, 2023
5e905f6
Merge branch 'develop' of https://github.com/recognai/rubrix into dev…
Mar 27, 2023
dc0f4d0
Merge branch 'develop' of https://github.com/recognai/rubrix into dev…
Mar 28, 2023
b062d10
Merge branch 'develop' of https://github.com/recognai/rubrix into dev…
Mar 29, 2023
84b383e
Merge branch 'develop' of https://github.com/recognai/rubrix into dev…
Mar 29, 2023
f7ab48e
Merge branch 'develop' of https://github.com/recognai/rubrix into dev…
Mar 30, 2023
100ec1a
Merge branch 'develop' of https://github.com/recognai/rubrix into dev…
Apr 10, 2023
3803181
Merge branch 'develop' of https://github.com/recognai/rubrix into dev…
May 19, 2023
a3111fb
Merge branch 'develop' of https://github.com/recognai/rubrix into dev…
May 25, 2023
e51119b
Merge branch 'develop' of https://github.com/recognai/rubrix into dev…
May 25, 2023
9abd52f
Merge branch 'develop' of https://github.com/recognai/rubrix into dev…
May 25, 2023
e75147c
Merge branch 'develop' of https://github.com/recognai/rubrix into dev…
May 29, 2023
c38f950
Merge branch 'develop' of https://github.com/recognai/rubrix into dev…
May 29, 2023
e638433
Merge branch 'develop' of https://github.com/recognai/rubrix into dev…
May 31, 2023
71df09f
Merge branch 'develop' of https://github.com/recognai/rubrix into dev…
May 31, 2023
70b87f0
Merge branch 'develop' of https://github.com/recognai/rubrix into dev…
Jun 1, 2023
703ab6a
Merge branch 'develop' of https://github.com/recognai/rubrix into dev…
Jun 2, 2023
76874ee
Merge branch 'develop' of https://github.com/recognai/rubrix into dev…
Jun 5, 2023
b128f05
Merge branch 'develop' of https://github.com/recognai/rubrix into dev…
Jun 5, 2023
7811187
Merge branch 'develop' of https://github.com/recognai/rubrix into dev…
Jun 6, 2023
c65d714
:sparkles: `SearchBar` component
Jun 6, 2023
9cbc2cb
:sparkles: add default value to route `search params`
Jun 6, 2023
668e0fb
:sparkles: add `SearchBar.component` to `DatasetFilter.component`
Jun 6, 2023
4717b46
:construction: WIP : use search value in `RecordFeedbackTaskAndQuesti…
Jun 6, 2023
28b9e91
Merge branch 'develop' of https://github.com/recognai/rubrix into dev…
Jun 6, 2023
e7ce157
Merge branch 'develop' into feat/front-search-for-feedbacktask
Jun 6, 2023
3cfc2cb
Merge branch 'develop' of https://github.com/recognai/rubrix into dev…
Jun 7, 2023
ab4c6ed
Merge branch 'develop' of https://github.com/recognai/rubrix into dev…
Jun 7, 2023
aa3ebcc
Merge branch 'develop' into feat/front-search-for-feedbacktask
Jun 7, 2023
d014257
:sparkles: emit search on "enter"
Jun 7, 2023
994f2c1
:sparkles: `search` logic to fetch record
Jun 8, 2023
bbee04f
:zap: avoid memory leak by destroying bus event
Jun 8, 2023
bef22b4
Merge branch 'develop' of https://github.com/recognai/rubrix into dev…
Jun 8, 2023
e283e8c
Merge branch 'develop' of https://github.com/recognai/rubrix into dev…
Jun 8, 2023
93468a0
Merge branch 'develop' into feat/front-search-for-feedbacktask
Jun 8, 2023
91e67b7
Merge branch 'develop' into feat/front-search-for-feedbacktask
Jun 8, 2023
e7b941d
Merge branch 'feat/front-search-for-feedbacktask' of https://github.c…
Jun 8, 2023
838b8ab
Merge branch 'develop' of https://github.com/recognai/rubrix into dev…
Jun 8, 2023
104afc4
Merge branch 'develop' of https://github.com/recognai/rubrix into dev…
Jun 8, 2023
afd12af
:sparkles: update condition to show toast
Jun 9, 2023
1f5d651
:sparkles: update localvariable when props change
Jun 9, 2023
5bcf71c
:speech_balloon: update messagewhen no result after search
Jun 9, 2023
558d91e
Merge branch 'develop' into feat/front-search-for-feedbacktask
Jun 9, 2023
4864556
:recycle: clean code => destructure object
Jun 9, 2023
580882b
:bug: fix unknown token which breaks test
Jun 9, 2023
d339a3d
:bug: missing data `searchValue` && unknown token which break test
Jun 9, 2023
0729ec4
➕ add missing dependency
Jun 9, 2023
a787252
:speech_balloon: update placeholder
Jun 9, 2023
a8a4f4e
:lipstick: reverse position : search then status filter
Jun 9, 2023
8202e89
:bug: missing icon after deployment
Jun 9, 2023
b2ede8c
Merge branch 'develop' of https://github.com/recognai/rubrix into dev…
Jun 13, 2023
c051a25
Merge branch 'develop' into feat/front-search-for-feedbacktask
Jun 13, 2023
286b293
fix: import the right name of the icon
Jun 13, 2023
1e238ef
:recycle: homogenized default `data` && data
Jun 13, 2023
e475e02
Merge branch 'feat/front-search-for-feedbacktask' of https://github.c…
Jun 13, 2023
d953cc5
:coffin: remove unused `async` keyword
Jun 13, 2023
ebaa074
:mute: remove console.log
Jun 13, 2023
b412d81
:recycle: simplified url params
Jun 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
</template>

<script>
import "assets/icons/external";
import "assets/icons/external-link";
import { isEqual, cloneDeep } from "lodash";
import { Notification } from "@/models/Notifications";
import { COMPONENT_TYPE } from "@/components/feedback-task/feedbackTask.properties";
Expand Down
57 changes: 34 additions & 23 deletions frontend/components/feedback-task/DatasetFilters.component.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
<div class="filters">
<span
class="filters__component"
v-for="{ id } in sortedFiltersValue"
v-for="{ id, componentType, placeholder, options } in sortedFiltersValue"
:key="id"
>
<SearchBarBase
v-if="getFilterById(id).component_type === 'searchBar'"
:current-search-text="getFilterById(id).value"
@on-search-text="onSearch(id, $event)"
:placeholder="getFilterById(id).placeholder"
v-if="componentType === 'searchBar'"
:placeholder="placeholder"
v-model="searchInput"
/>

<StatusFilter
v-if="getFilterById(id).component_type === 'statusSelector'"
:options="getFilterById(id).options"
v-if="componentType === 'statusSelector'"
:options="options"
v-model="selectedStatus"
/>
</span>
Expand Down Expand Up @@ -44,16 +44,25 @@ export default {
data: () => {
return {
selectedStatus: null,
searchInput: null,
sortedFiltersValue: [],
};
},
mounted() {
beforeMount() {
this.selectedStatus = this.selectedStatus || this.statusFromRoute;
this.searchInput = this.searchInput ?? this.searchFromRoute;

this.$root.$on("reset-status-filter", () => {
this.selectedStatus = this.statusFromRoute;
});
},
this.$root.$on("reset-search-filter", () => {
this.searchInput = this.searchFromRoute;
});

this.sortedFiltersValue = Object.values(this.filters).sort((a, b) =>
a.order > b.order ? -1 : 1
);
},
computed: {
filtersFromVuex() {
return getFiltersByDatasetId(
Expand All @@ -62,35 +71,35 @@ export default {
this.orderBy?.ascendent
);
},
sortedFiltersValue() {
return Object.values(this.filters).sort((a, b) =>
a.order > b.order ? -1 : 1
);
},
statusFromRoute() {
return this.$route.query?._status;
},
searchFromRoute() {
return this.$route.query?._search;
},
},
watch: {
selectedStatus(newValue) {
this.$root.$emit("status-filter-changed", newValue);
},
searchInput(searchInput) {
this.$root.$emit("search-filter-changed", searchInput);
},
},
created() {
this.filters = {
// NOTE: HIDE SEARCHBAR FOR MVP
// searchText: {
// id: "searchText",
// name: "Search",
// componentType: "searchBar",
// order: 0,
// placeholder: "Introduce your query",
// },
searchText: {
id: "searchText",
name: "Search",
componentType: "searchBar",
order: 1,
placeholder: "Introduce a query",
},
statusSelector: {
id: "statusSelector",
name: "Status Selector",
componentType: "statusSelector",
order: 1,
order: 0,
options: [
{
id: "pending",
Expand Down Expand Up @@ -153,13 +162,15 @@ export default {
},
beforeDestroy() {
this.$root.$off("reset-status-filter");
this.$root.$off("reset-search-filter");
},
};
</script>

<style lang="scss" scoped>
.filters {
display: flex;
flex-wrap: wrap;
gap: $base-space * 2;
align-items: center;
padding: $base-space * 2 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
</template>

<script>
import "assets/icons/chevron-down";
export default {
props: {
options: {
Expand Down
135 changes: 71 additions & 64 deletions frontend/components/feedback-task/SearchBar.base.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,87 +16,99 @@
-->

<template>
<form @submit.prevent="searchText(query)">
<div class="searchbar" :class="{ active: query }" :style="searchBarStyles">
<BaseIcon
v-if="!query"
icon-name="search"
icon-width="20"
icon-height="20"
/>
<BaseButton
v-else
class="searchbar__button"
@click="removeCurrentSearchText()"
>
<BaseIcon
class="searchbar__button__icon"
icon-name="close"
icon-width="20"
icon-height="20"
/>
</BaseButton>
<label class="searchbar__label" for="query" v-text="description" />
<input
ref="input"
class="searchbar__input"
type="text"
name="query"
id="query"
v-model.lazy="query"
:placeholder="placeholder"
autocomplete="off"
/>
</div>
</form>
<div
class="search-area"
:class="{ active: isSearchActive }"
@click="focusInSearch"
>
<BaseIconWithBadge
class="searchbar__icon"
:icon="iconType"
:show-badge="false"
iconColor="#acacac"
badge-vertical-position="top"
badge-horizontal-position="right"
badge-border-color="white"
@click-icon="resetValue"
/>
<input
ref="searchRef"
class="searchbar__input"
type="text"
v-model.trim="searchValue"
:placeholder="placeholder"
:aria-description="description"
autocomplete="off"
@keydown.enter.exact="applySearch"
@keydown.arrow-right.stop=""
@keydown.arrow-left.stop=""
@keydown.delete.exact.stop=""
@keydown.enter.exact.stop=""
/>
</div>
</template>

<script>
export default {
name: "SearchBarComponent",
props: {
currentSearchText: {
value: {
type: String,
default: "",
},
placeholder: {
type: String,
default: "Introduce your text:",
default: "",
},
description: {
type: String,
default: "Introduce your text",
},
bgColor: {
type: String,
default: "#ffffff",
default: "Introduce a text",
},
},
data: () => ({
query: "",
}),
data() {
return {
searchValue: "",
};
},
computed: {
searchBarStyles() {
return { backgroundColor: this.bgColor };
isSearchActive() {
return this.value?.length;
},
iconType() {
return this.searchValue?.length ? "close" : "search";
},
},
watch: {
value: {
immediate: true,
handler(newValue) {
this.searchValue = newValue ?? "";
},
},
},
methods: {
searchText(query) {
this.$refs.input.blur();
this.$emit("on-search-text", query);
applySearch() {
this.$emit("input", this.searchValue);
this.looseFocus();
},
removeCurrentSearchText() {
this.query = "";
this.$emit("on-search-text", "");
looseFocus() {
this.$refs.searchRef.blur();
},
focusInSearch() {
this.$refs.searchRef.focus();
},
resetValue() {
if (this.searchValue?.length) {
this.searchValue = "";
this.$emit("input", "");
}
},
},
created() {
this.query = this.currentSearchText;
},
};
</script>

<style lang="scss" scoped>
.searchbar {
.search-area {
display: flex;
flex: 1;
align-items: center;
Expand All @@ -111,22 +123,17 @@ export default {
box-shadow: 0 6px 10px 0 rgba(0, 0, 0, 0.1);
transition: all 0.2s ease;
}
&__button.button {
button {
display: flex;
padding: 0;
&:hover {
background: $black-4;
}
}
&__button {
&__icon {
padding: calc($base-space / 2);
}
}
&__label {
@extend %visuallyhidden;
&__icon {
padding: calc($base-space / 2);
}
&__input {
input {
width: 100%;
height: 1rem;
padding: 0;
Expand Down
Loading