Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
edc3b578
Commit
edc3b578
authored
Jul 26, 2024
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: implement search multi tags
parent
c6a09d93
Changes
14
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
61 additions
and
35 deletions
+61
-35
memo_service.go
server/router/api/v1/memo_service.go
+13
-9
memo.go
store/db/mysql/memo.go
+4
-2
memo.go
store/db/postgres/memo.go
+4
-2
memo.go
store/db/sqlite/memo.go
+4
-2
memo.go
store/memo.go
+1
-1
TagsSection.tsx
web/src/components/HomeSidebar/TagsSection.tsx
+3
-3
Tag.tsx
web/src/components/MemoContent/Tag.tsx
+3
-3
MemoFilters.tsx
web/src/components/MemoFilters.tsx
+1
-1
TagTree.tsx
web/src/components/TagTree.tsx
+3
-3
Archived.tsx
web/src/pages/Archived.tsx
+6
-2
Explore.tsx
web/src/pages/Explore.tsx
+6
-2
Home.tsx
web/src/pages/Home.tsx
+6
-2
UserProfile.tsx
web/src/pages/UserProfile.tsx
+6
-2
memoFilter.ts
web/src/store/v1/memoFilter.ts
+1
-1
No files found.
server/router/api/v1/memo_service.go
View file @
edc3b578
...
@@ -711,7 +711,7 @@ func (s *APIV1Service) RenameMemoTag(ctx context.Context, request *v1pb.RenameMe
...
@@ -711,7 +711,7 @@ func (s *APIV1Service) RenameMemoTag(ctx context.Context, request *v1pb.RenameMe
memoFind
:=
&
store
.
FindMemo
{
memoFind
:=
&
store
.
FindMemo
{
CreatorID
:
&
user
.
ID
,
CreatorID
:
&
user
.
ID
,
PayloadFind
:
&
store
.
FindMemoPayload
{
Tag
:
&
request
.
OldTag
},
PayloadFind
:
&
store
.
FindMemoPayload
{
Tag
Search
:
[]
string
{
request
.
OldTag
}
},
ExcludeComments
:
true
,
ExcludeComments
:
true
,
}
}
if
(
request
.
Parent
)
!=
"memos/-"
{
if
(
request
.
Parent
)
!=
"memos/-"
{
...
@@ -765,7 +765,7 @@ func (s *APIV1Service) DeleteMemoTag(ctx context.Context, request *v1pb.DeleteMe
...
@@ -765,7 +765,7 @@ func (s *APIV1Service) DeleteMemoTag(ctx context.Context, request *v1pb.DeleteMe
memoFind
:=
&
store
.
FindMemo
{
memoFind
:=
&
store
.
FindMemo
{
CreatorID
:
&
user
.
ID
,
CreatorID
:
&
user
.
ID
,
PayloadFind
:
&
store
.
FindMemoPayload
{
Tag
:
&
request
.
Tag
},
PayloadFind
:
&
store
.
FindMemoPayload
{
Tag
Search
:
[]
string
{
request
.
Tag
}
},
ExcludeContent
:
true
,
ExcludeContent
:
true
,
ExcludeComments
:
true
,
ExcludeComments
:
true
,
}
}
...
@@ -928,11 +928,11 @@ func (s *APIV1Service) buildMemoFindWithFilter(ctx context.Context, find *store.
...
@@ -928,11 +928,11 @@ func (s *APIV1Service) buildMemoFindWithFilter(ctx context.Context, find *store.
if
len
(
filter
.
Visibilities
)
>
0
{
if
len
(
filter
.
Visibilities
)
>
0
{
find
.
VisibilityList
=
filter
.
Visibilities
find
.
VisibilityList
=
filter
.
Visibilities
}
}
if
filter
.
Tag
!=
nil
{
if
filter
.
Tag
Search
!=
nil
{
if
find
.
PayloadFind
==
nil
{
if
find
.
PayloadFind
==
nil
{
find
.
PayloadFind
=
&
store
.
FindMemoPayload
{}
find
.
PayloadFind
=
&
store
.
FindMemoPayload
{}
}
}
find
.
PayloadFind
.
Tag
=
filter
.
Tag
find
.
PayloadFind
.
Tag
Search
=
filter
.
TagSearch
}
}
if
filter
.
OrderByPinned
{
if
filter
.
OrderByPinned
{
find
.
OrderByPinned
=
filter
.
OrderByPinned
find
.
OrderByPinned
=
filter
.
OrderByPinned
...
@@ -1039,7 +1039,7 @@ func (s *APIV1Service) getContentLengthLimit(ctx context.Context) (int, error) {
...
@@ -1039,7 +1039,7 @@ func (s *APIV1Service) getContentLengthLimit(ctx context.Context) (int, error) {
var
MemoFilterCELAttributes
=
[]
cel
.
EnvOption
{
var
MemoFilterCELAttributes
=
[]
cel
.
EnvOption
{
cel
.
Variable
(
"content_search"
,
cel
.
ListType
(
cel
.
StringType
)),
cel
.
Variable
(
"content_search"
,
cel
.
ListType
(
cel
.
StringType
)),
cel
.
Variable
(
"visibilities"
,
cel
.
ListType
(
cel
.
StringType
)),
cel
.
Variable
(
"visibilities"
,
cel
.
ListType
(
cel
.
StringType
)),
cel
.
Variable
(
"tag
"
,
cel
.
StringType
),
cel
.
Variable
(
"tag
_search"
,
cel
.
ListType
(
cel
.
StringType
)
),
cel
.
Variable
(
"order_by_pinned"
,
cel
.
BoolType
),
cel
.
Variable
(
"order_by_pinned"
,
cel
.
BoolType
),
cel
.
Variable
(
"display_time_before"
,
cel
.
IntType
),
cel
.
Variable
(
"display_time_before"
,
cel
.
IntType
),
cel
.
Variable
(
"display_time_after"
,
cel
.
IntType
),
cel
.
Variable
(
"display_time_after"
,
cel
.
IntType
),
...
@@ -1058,7 +1058,7 @@ var MemoFilterCELAttributes = []cel.EnvOption{
...
@@ -1058,7 +1058,7 @@ var MemoFilterCELAttributes = []cel.EnvOption{
type
MemoFilter
struct
{
type
MemoFilter
struct
{
ContentSearch
[]
string
ContentSearch
[]
string
Visibilities
[]
store
.
Visibility
Visibilities
[]
store
.
Visibility
Tag
*
string
Tag
Search
[]
string
OrderByPinned
bool
OrderByPinned
bool
DisplayTimeBefore
*
int64
DisplayTimeBefore
*
int64
DisplayTimeAfter
*
int64
DisplayTimeAfter
*
int64
...
@@ -1110,9 +1110,13 @@ func findMemoField(callExpr *expr.Expr_Call, filter *MemoFilter) {
...
@@ -1110,9 +1110,13 @@ func findMemoField(callExpr *expr.Expr_Call, filter *MemoFilter) {
visibilities
=
append
(
visibilities
,
store
.
Visibility
(
value
))
visibilities
=
append
(
visibilities
,
store
.
Visibility
(
value
))
}
}
filter
.
Visibilities
=
visibilities
filter
.
Visibilities
=
visibilities
}
else
if
idExpr
.
Name
==
"tag"
{
}
else
if
idExpr
.
Name
==
"tag_search"
{
tag
:=
callExpr
.
Args
[
1
]
.
GetConstExpr
()
.
GetStringValue
()
tagSearch
:=
[]
string
{}
filter
.
Tag
=
&
tag
for
_
,
expr
:=
range
callExpr
.
Args
[
1
]
.
GetListExpr
()
.
GetElements
()
{
value
:=
expr
.
GetConstExpr
()
.
GetStringValue
()
tagSearch
=
append
(
tagSearch
,
value
)
}
filter
.
TagSearch
=
tagSearch
}
else
if
idExpr
.
Name
==
"order_by_pinned"
{
}
else
if
idExpr
.
Name
==
"order_by_pinned"
{
value
:=
callExpr
.
Args
[
1
]
.
GetConstExpr
()
.
GetBoolValue
()
value
:=
callExpr
.
Args
[
1
]
.
GetConstExpr
()
.
GetBoolValue
()
filter
.
OrderByPinned
=
value
filter
.
OrderByPinned
=
value
...
...
store/db/mysql/memo.go
View file @
edc3b578
...
@@ -90,8 +90,10 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo
...
@@ -90,8 +90,10 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo
if
v
.
Raw
!=
nil
{
if
v
.
Raw
!=
nil
{
where
,
args
=
append
(
where
,
"`memo`.`payload` = ?"
),
append
(
args
,
*
v
.
Raw
)
where
,
args
=
append
(
where
,
"`memo`.`payload` = ?"
),
append
(
args
,
*
v
.
Raw
)
}
}
if
v
.
Tag
!=
nil
{
if
len
(
v
.
TagSearch
)
!=
0
{
where
,
args
=
append
(
where
,
"JSON_CONTAINS(JSON_EXTRACT(`memo`.`payload`, '$.property.tags'), ?)"
),
append
(
args
,
fmt
.
Sprintf
(
`["%s"]`
,
*
v
.
Tag
))
for
_
,
tag
:=
range
v
.
TagSearch
{
where
,
args
=
append
(
where
,
"JSON_CONTAINS(JSON_EXTRACT(`memo`.`payload`, '$.property.tags'), ?)"
),
append
(
args
,
fmt
.
Sprintf
(
`%%"%s"%%`
,
tag
))
}
}
}
if
v
.
HasLink
{
if
v
.
HasLink
{
where
=
append
(
where
,
"JSON_EXTRACT(`memo`.`payload`, '$.property.hasLink') IS TRUE"
)
where
=
append
(
where
,
"JSON_EXTRACT(`memo`.`payload`, '$.property.hasLink') IS TRUE"
)
...
...
store/db/postgres/memo.go
View file @
edc3b578
...
@@ -81,8 +81,10 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo
...
@@ -81,8 +81,10 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo
if
v
.
Raw
!=
nil
{
if
v
.
Raw
!=
nil
{
where
,
args
=
append
(
where
,
"memo.payload = "
+
placeholder
(
len
(
args
)
+
1
)),
append
(
args
,
*
v
.
Raw
)
where
,
args
=
append
(
where
,
"memo.payload = "
+
placeholder
(
len
(
args
)
+
1
)),
append
(
args
,
*
v
.
Raw
)
}
}
if
v
.
Tag
!=
nil
{
if
len
(
v
.
TagSearch
)
!=
0
{
where
,
args
=
append
(
where
,
"memo.payload->'property'->'tags' @> "
+
placeholder
(
len
(
args
)
+
1
)),
append
(
args
,
fmt
.
Sprintf
(
`["%s"]`
,
*
v
.
Tag
))
for
_
,
tag
:=
range
v
.
TagSearch
{
where
,
args
=
append
(
where
,
"memo.payload->'property'->'tags' @> "
+
placeholder
(
len
(
args
)
+
1
)),
append
(
args
,
fmt
.
Sprintf
(
`["%s"]`
,
tag
))
}
}
}
if
v
.
HasLink
{
if
v
.
HasLink
{
where
=
append
(
where
,
"(memo.payload->'property'->>'hasLink')::BOOLEAN IS TRUE"
)
where
=
append
(
where
,
"(memo.payload->'property'->>'hasLink')::BOOLEAN IS TRUE"
)
...
...
store/db/sqlite/memo.go
View file @
edc3b578
...
@@ -82,8 +82,10 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo
...
@@ -82,8 +82,10 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo
if
v
.
Raw
!=
nil
{
if
v
.
Raw
!=
nil
{
where
,
args
=
append
(
where
,
"`memo`.`payload` = ?"
),
append
(
args
,
*
v
.
Raw
)
where
,
args
=
append
(
where
,
"`memo`.`payload` = ?"
),
append
(
args
,
*
v
.
Raw
)
}
}
if
v
.
Tag
!=
nil
{
if
len
(
v
.
TagSearch
)
!=
0
{
where
,
args
=
append
(
where
,
"JSON_EXTRACT(`memo`.`payload`, '$.property.tags') LIKE ?"
),
append
(
args
,
fmt
.
Sprintf
(
`%%"%s"%%`
,
*
v
.
Tag
))
for
_
,
tag
:=
range
v
.
TagSearch
{
where
,
args
=
append
(
where
,
"JSON_EXTRACT(`memo`.`payload`, '$.property.tags') LIKE ?"
),
append
(
args
,
fmt
.
Sprintf
(
`%%"%s"%%`
,
tag
))
}
}
}
if
v
.
HasLink
{
if
v
.
HasLink
{
where
=
append
(
where
,
"JSON_EXTRACT(`memo`.`payload`, '$.property.hasLink') IS TRUE"
)
where
=
append
(
where
,
"JSON_EXTRACT(`memo`.`payload`, '$.property.hasLink') IS TRUE"
)
...
...
store/memo.go
View file @
edc3b578
...
@@ -84,7 +84,7 @@ type FindMemo struct {
...
@@ -84,7 +84,7 @@ type FindMemo struct {
type
FindMemoPayload
struct
{
type
FindMemoPayload
struct
{
Raw
*
string
Raw
*
string
Tag
*
string
Tag
Search
[]
string
HasLink
bool
HasLink
bool
HasTaskList
bool
HasTaskList
bool
HasCode
bool
HasCode
bool
...
...
web/src/components/HomeSidebar/TagsSection.tsx
View file @
edc3b578
...
@@ -36,12 +36,12 @@ const TagsSection = (props: Props) => {
...
@@ -36,12 +36,12 @@ const TagsSection = (props: Props) => {
};
};
const
handleTagClick
=
(
tag
:
string
)
=>
{
const
handleTagClick
=
(
tag
:
string
)
=>
{
const
isActive
=
memoFilterStore
.
getFiltersByFactor
(
"tag"
).
some
((
filter
)
=>
filter
.
value
===
tag
);
const
isActive
=
memoFilterStore
.
getFiltersByFactor
(
"tag
Search
"
).
some
((
filter
)
=>
filter
.
value
===
tag
);
if
(
isActive
)
{
if
(
isActive
)
{
memoFilterStore
.
removeFilter
((
f
)
=>
f
.
factor
===
"tag"
&&
f
.
value
===
tag
);
memoFilterStore
.
removeFilter
((
f
)
=>
f
.
factor
===
"tag
Search
"
&&
f
.
value
===
tag
);
}
else
{
}
else
{
memoFilterStore
.
addFilter
({
memoFilterStore
.
addFilter
({
factor
:
"tag"
,
factor
:
"tag
Search
"
,
value
:
tag
,
value
:
tag
,
});
});
}
}
...
...
web/src/components/MemoContent/Tag.tsx
View file @
edc3b578
...
@@ -16,12 +16,12 @@ const Tag: React.FC<Props> = ({ content }: Props) => {
...
@@ -16,12 +16,12 @@ const Tag: React.FC<Props> = ({ content }: Props) => {
return
;
return
;
}
}
const
isActive
=
memoFilterStore
.
getFiltersByFactor
(
"tag"
).
some
((
filter
)
=>
filter
.
value
===
content
);
const
isActive
=
memoFilterStore
.
getFiltersByFactor
(
"tag
Search
"
).
some
((
filter
)
=>
filter
.
value
===
content
);
if
(
isActive
)
{
if
(
isActive
)
{
memoFilterStore
.
removeFilter
((
f
)
=>
f
.
factor
===
"tag"
&&
f
.
value
===
content
);
memoFilterStore
.
removeFilter
((
f
)
=>
f
.
factor
===
"tag
Search
"
&&
f
.
value
===
content
);
}
else
{
}
else
{
memoFilterStore
.
addFilter
({
memoFilterStore
.
addFilter
({
factor
:
"tag"
,
factor
:
"tag
Search
"
,
value
:
content
,
value
:
content
,
});
});
}
}
...
...
web/src/components/MemoFilters.tsx
View file @
edc3b578
...
@@ -47,7 +47,7 @@ const MemoFilters = () => {
...
@@ -47,7 +47,7 @@ const MemoFilters = () => {
const
FactorIcon
=
({
factor
,
className
}:
{
factor
:
FilterFactor
;
className
?:
string
})
=>
{
const
FactorIcon
=
({
factor
,
className
}:
{
factor
:
FilterFactor
;
className
?:
string
})
=>
{
const
iconMap
=
{
const
iconMap
=
{
tag
:
<
Icon
.
Tag
className=
{
className
}
/>,
tag
Search
:
<
Icon
.
Tag
className=
{
className
}
/>,
visibility
:
<
Icon
.
Eye
className=
{
className
}
/>,
visibility
:
<
Icon
.
Eye
className=
{
className
}
/>,
contentSearch
:
<
Icon
.
Search
className=
{
className
}
/>,
contentSearch
:
<
Icon
.
Search
className=
{
className
}
/>,
displayTime
:
<
Icon
.
Calendar
className=
{
className
}
/>,
displayTime
:
<
Icon
.
Calendar
className=
{
className
}
/>,
...
...
web/src/components/TagTree.tsx
View file @
edc3b578
...
@@ -78,17 +78,17 @@ interface TagItemContainerProps {
...
@@ -78,17 +78,17 @@ interface TagItemContainerProps {
const
TagItemContainer
:
React
.
FC
<
TagItemContainerProps
>
=
(
props
:
TagItemContainerProps
)
=>
{
const
TagItemContainer
:
React
.
FC
<
TagItemContainerProps
>
=
(
props
:
TagItemContainerProps
)
=>
{
const
{
tag
}
=
props
;
const
{
tag
}
=
props
;
const
memoFilterStore
=
useMemoFilterStore
();
const
memoFilterStore
=
useMemoFilterStore
();
const
tagFilters
=
memoFilterStore
.
getFiltersByFactor
(
"tag"
);
const
tagFilters
=
memoFilterStore
.
getFiltersByFactor
(
"tag
Search
"
);
const
isActive
=
tagFilters
.
some
((
f
)
=>
f
.
value
===
tag
.
text
);
const
isActive
=
tagFilters
.
some
((
f
)
=>
f
.
value
===
tag
.
text
);
const
hasSubTags
=
tag
.
subTags
.
length
>
0
;
const
hasSubTags
=
tag
.
subTags
.
length
>
0
;
const
[
showSubTags
,
toggleSubTags
]
=
useToggle
(
false
);
const
[
showSubTags
,
toggleSubTags
]
=
useToggle
(
false
);
const
handleTagClick
=
()
=>
{
const
handleTagClick
=
()
=>
{
if
(
isActive
)
{
if
(
isActive
)
{
memoFilterStore
.
removeFilter
((
f
)
=>
f
.
factor
===
"tag"
&&
f
.
value
===
tag
.
text
);
memoFilterStore
.
removeFilter
((
f
)
=>
f
.
factor
===
"tag
Search
"
&&
f
.
value
===
tag
.
text
);
}
else
{
}
else
{
memoFilterStore
.
addFilter
({
memoFilterStore
.
addFilter
({
factor
:
"tag"
,
factor
:
"tag
Search
"
,
value
:
tag
.
text
,
value
:
tag
.
text
,
});
});
}
}
...
...
web/src/pages/Archived.tsx
View file @
edc3b578
...
@@ -37,16 +37,20 @@ const Archived = () => {
...
@@ -37,16 +37,20 @@ const Archived = () => {
setIsRequesting
(
true
);
setIsRequesting
(
true
);
const
filters
=
[
`creator == "
${
user
.
name
}
"`
,
`row_status == "ARCHIVED"`
];
const
filters
=
[
`creator == "
${
user
.
name
}
"`
,
`row_status == "ARCHIVED"`
];
const
contentSearch
:
string
[]
=
[];
const
contentSearch
:
string
[]
=
[];
const
tagSearch
:
string
[]
=
[];
for
(
const
filter
of
memoFilterStore
.
filters
)
{
for
(
const
filter
of
memoFilterStore
.
filters
)
{
if
(
filter
.
factor
===
"contentSearch"
)
{
if
(
filter
.
factor
===
"contentSearch"
)
{
contentSearch
.
push
(
`"
${
filter
.
value
}
"`
);
contentSearch
.
push
(
`"
${
filter
.
value
}
"`
);
}
else
if
(
filter
.
factor
===
"tag"
)
{
}
else
if
(
filter
.
factor
===
"tag
Search
"
)
{
filters
.
push
(
`tag ==
"
${
filter
.
value
}
"`
);
tagSearch
.
push
(
`
"
${
filter
.
value
}
"`
);
}
}
}
}
if
(
contentSearch
.
length
>
0
)
{
if
(
contentSearch
.
length
>
0
)
{
filters
.
push
(
`content_search == [
${
contentSearch
.
join
(
", "
)}
]`
);
filters
.
push
(
`content_search == [
${
contentSearch
.
join
(
", "
)}
]`
);
}
}
if
(
tagSearch
.
length
>
0
)
{
filters
.
push
(
`tag_search == [
${
tagSearch
.
join
(
", "
)}
]`
);
}
const
response
=
await
memoStore
.
fetchMemos
({
const
response
=
await
memoStore
.
fetchMemos
({
pageSize
:
DEFAULT_LIST_MEMOS_PAGE_SIZE
,
pageSize
:
DEFAULT_LIST_MEMOS_PAGE_SIZE
,
filter
:
filters
.
join
(
" && "
),
filter
:
filters
.
join
(
" && "
),
...
...
web/src/pages/Explore.tsx
View file @
edc3b578
...
@@ -34,16 +34,20 @@ const Explore = () => {
...
@@ -34,16 +34,20 @@ const Explore = () => {
setIsRequesting
(
true
);
setIsRequesting
(
true
);
const
filters
=
[
`row_status == "NORMAL"`
,
`visibilities == [
${
user
?
"'PUBLIC', 'PROTECTED'"
:
"'PUBLIC'"
}
]`
];
const
filters
=
[
`row_status == "NORMAL"`
,
`visibilities == [
${
user
?
"'PUBLIC', 'PROTECTED'"
:
"'PUBLIC'"
}
]`
];
const
contentSearch
:
string
[]
=
[];
const
contentSearch
:
string
[]
=
[];
const
tagSearch
:
string
[]
=
[];
for
(
const
filter
of
memoFilterStore
.
filters
)
{
for
(
const
filter
of
memoFilterStore
.
filters
)
{
if
(
filter
.
factor
===
"contentSearch"
)
{
if
(
filter
.
factor
===
"contentSearch"
)
{
contentSearch
.
push
(
`"
${
filter
.
value
}
"`
);
contentSearch
.
push
(
`"
${
filter
.
value
}
"`
);
}
else
if
(
filter
.
factor
===
"tag"
)
{
}
else
if
(
filter
.
factor
===
"tag
Search
"
)
{
filters
.
push
(
`tag ==
"
${
filter
.
value
}
"`
);
tagSearch
.
push
(
`
"
${
filter
.
value
}
"`
);
}
}
}
}
if
(
contentSearch
.
length
>
0
)
{
if
(
contentSearch
.
length
>
0
)
{
filters
.
push
(
`content_search == [
${
contentSearch
.
join
(
", "
)}
]`
);
filters
.
push
(
`content_search == [
${
contentSearch
.
join
(
", "
)}
]`
);
}
}
if
(
tagSearch
.
length
>
0
)
{
filters
.
push
(
`tag_search == [
${
tagSearch
.
join
(
", "
)}
]`
);
}
const
response
=
await
memoStore
.
fetchMemos
({
const
response
=
await
memoStore
.
fetchMemos
({
pageSize
:
DEFAULT_LIST_MEMOS_PAGE_SIZE
,
pageSize
:
DEFAULT_LIST_MEMOS_PAGE_SIZE
,
filter
:
filters
.
join
(
" && "
),
filter
:
filters
.
join
(
" && "
),
...
...
web/src/pages/Home.tsx
View file @
edc3b578
...
@@ -39,11 +39,12 @@ const Home = () => {
...
@@ -39,11 +39,12 @@ const Home = () => {
setIsRequesting
(
true
);
setIsRequesting
(
true
);
const
filters
=
[
`creator == "
${
user
.
name
}
"`
,
`row_status == "NORMAL"`
,
`order_by_pinned == true`
];
const
filters
=
[
`creator == "
${
user
.
name
}
"`
,
`row_status == "NORMAL"`
,
`order_by_pinned == true`
];
const
contentSearch
:
string
[]
=
[];
const
contentSearch
:
string
[]
=
[];
const
tagSearch
:
string
[]
=
[];
for
(
const
filter
of
memoFilterStore
.
filters
)
{
for
(
const
filter
of
memoFilterStore
.
filters
)
{
if
(
filter
.
factor
===
"contentSearch"
)
{
if
(
filter
.
factor
===
"contentSearch"
)
{
contentSearch
.
push
(
`"
${
filter
.
value
}
"`
);
contentSearch
.
push
(
`"
${
filter
.
value
}
"`
);
}
else
if
(
filter
.
factor
===
"tag"
)
{
}
else
if
(
filter
.
factor
===
"tag
Search
"
)
{
filters
.
push
(
`tag ==
"
${
filter
.
value
}
"`
);
tagSearch
.
push
(
`
"
${
filter
.
value
}
"`
);
}
else
if
(
filter
.
factor
===
"property.hasLink"
)
{
}
else
if
(
filter
.
factor
===
"property.hasLink"
)
{
filters
.
push
(
`has_link == true`
);
filters
.
push
(
`has_link == true`
);
}
else
if
(
filter
.
factor
===
"property.hasTaskList"
)
{
}
else
if
(
filter
.
factor
===
"property.hasTaskList"
)
{
...
@@ -55,6 +56,9 @@ const Home = () => {
...
@@ -55,6 +56,9 @@ const Home = () => {
if
(
contentSearch
.
length
>
0
)
{
if
(
contentSearch
.
length
>
0
)
{
filters
.
push
(
`content_search == [
${
contentSearch
.
join
(
", "
)}
]`
);
filters
.
push
(
`content_search == [
${
contentSearch
.
join
(
", "
)}
]`
);
}
}
if
(
tagSearch
.
length
>
0
)
{
filters
.
push
(
`tag_search == [
${
tagSearch
.
join
(
", "
)}
]`
);
}
const
response
=
await
memoStore
.
fetchMemos
({
const
response
=
await
memoStore
.
fetchMemos
({
pageSize
:
DEFAULT_LIST_MEMOS_PAGE_SIZE
,
pageSize
:
DEFAULT_LIST_MEMOS_PAGE_SIZE
,
filter
:
filters
.
join
(
" && "
),
filter
:
filters
.
join
(
" && "
),
...
...
web/src/pages/UserProfile.tsx
View file @
edc3b578
...
@@ -70,16 +70,20 @@ const UserProfile = () => {
...
@@ -70,16 +70,20 @@ const UserProfile = () => {
setIsRequesting
(
true
);
setIsRequesting
(
true
);
const
filters
=
[
`creator == "
${
user
.
name
}
"`
,
`row_status == "NORMAL"`
,
`order_by_pinned == true`
];
const
filters
=
[
`creator == "
${
user
.
name
}
"`
,
`row_status == "NORMAL"`
,
`order_by_pinned == true`
];
const
contentSearch
:
string
[]
=
[];
const
contentSearch
:
string
[]
=
[];
const
tagSearch
:
string
[]
=
[];
for
(
const
filter
of
memoFilterStore
.
filters
)
{
for
(
const
filter
of
memoFilterStore
.
filters
)
{
if
(
filter
.
factor
===
"contentSearch"
)
{
if
(
filter
.
factor
===
"contentSearch"
)
{
contentSearch
.
push
(
`"
${
filter
.
value
}
"`
);
contentSearch
.
push
(
`"
${
filter
.
value
}
"`
);
}
else
if
(
filter
.
factor
===
"tag"
)
{
}
else
if
(
filter
.
factor
===
"tag
Search
"
)
{
filters
.
push
(
`tag ==
"
${
filter
.
value
}
"`
);
tagSearch
.
push
(
`
"
${
filter
.
value
}
"`
);
}
}
}
}
if
(
contentSearch
.
length
>
0
)
{
if
(
contentSearch
.
length
>
0
)
{
filters
.
push
(
`content_search == [
${
contentSearch
.
join
(
", "
)}
]`
);
filters
.
push
(
`content_search == [
${
contentSearch
.
join
(
", "
)}
]`
);
}
}
if
(
tagSearch
.
length
>
0
)
{
filters
.
push
(
`tag_search == [
${
tagSearch
.
join
(
", "
)}
]`
);
}
const
response
=
await
memoStore
.
fetchMemos
({
const
response
=
await
memoStore
.
fetchMemos
({
pageSize
:
DEFAULT_LIST_MEMOS_PAGE_SIZE
,
pageSize
:
DEFAULT_LIST_MEMOS_PAGE_SIZE
,
filter
:
filters
.
join
(
" && "
),
filter
:
filters
.
join
(
" && "
),
...
...
web/src/store/v1/memoFilter.ts
View file @
edc3b578
...
@@ -3,7 +3,7 @@ import { create } from "zustand";
...
@@ -3,7 +3,7 @@ import { create } from "zustand";
import
{
combine
}
from
"zustand/middleware"
;
import
{
combine
}
from
"zustand/middleware"
;
export
type
FilterFactor
=
export
type
FilterFactor
=
|
"tag"
|
"tag
Search
"
|
"visibility"
|
"visibility"
|
"contentSearch"
|
"contentSearch"
|
"displayTime"
|
"displayTime"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment