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
34af9697
Commit
34af9697
authored
Dec 22, 2023
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: fix list memos order by pinned
parent
fd9c3ccb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
memo_service.go
api/v2/memo_service.go
+9
-1
Home.tsx
web/src/pages/Home.tsx
+1
-1
No files found.
api/v2/memo_service.go
View file @
34af9697
...
@@ -62,6 +62,9 @@ func (s *APIV2Service) ListMemos(ctx context.Context, request *apiv2pb.ListMemos
...
@@ -62,6 +62,9 @@ func (s *APIV2Service) ListMemos(ctx context.Context, request *apiv2pb.ListMemos
if
len
(
filter
.
Visibilities
)
>
0
{
if
len
(
filter
.
Visibilities
)
>
0
{
memoFind
.
VisibilityList
=
filter
.
Visibilities
memoFind
.
VisibilityList
=
filter
.
Visibilities
}
}
if
filter
.
OrderByPinned
{
memoFind
.
OrderByPinned
=
filter
.
OrderByPinned
}
if
filter
.
CreatedTsBefore
!=
nil
{
if
filter
.
CreatedTsBefore
!=
nil
{
memoFind
.
CreatedTsBefore
=
filter
.
CreatedTsBefore
memoFind
.
CreatedTsBefore
=
filter
.
CreatedTsBefore
}
}
...
@@ -516,17 +519,19 @@ func convertVisibilityToStore(visibility apiv2pb.Visibility) store.Visibility {
...
@@ -516,17 +519,19 @@ func convertVisibilityToStore(visibility apiv2pb.Visibility) store.Visibility {
// ListMemosFilterCELAttributes are the CEL attributes for ListMemosFilter.
// ListMemosFilterCELAttributes are the CEL attributes for ListMemosFilter.
var
ListMemosFilterCELAttributes
=
[]
cel
.
EnvOption
{
var
ListMemosFilterCELAttributes
=
[]
cel
.
EnvOption
{
cel
.
Variable
(
"content_search"
,
cel
.
ListType
(
cel
.
StringType
)),
cel
.
Variable
(
"visibilities"
,
cel
.
ListType
(
cel
.
StringType
)),
cel
.
Variable
(
"visibilities"
,
cel
.
ListType
(
cel
.
StringType
)),
cel
.
Variable
(
"order_by_pinned"
,
cel
.
BoolType
),
cel
.
Variable
(
"created_ts_before"
,
cel
.
IntType
),
cel
.
Variable
(
"created_ts_before"
,
cel
.
IntType
),
cel
.
Variable
(
"created_ts_after"
,
cel
.
IntType
),
cel
.
Variable
(
"created_ts_after"
,
cel
.
IntType
),
cel
.
Variable
(
"creator"
,
cel
.
StringType
),
cel
.
Variable
(
"creator"
,
cel
.
StringType
),
cel
.
Variable
(
"content_search"
,
cel
.
ListType
(
cel
.
StringType
)),
cel
.
Variable
(
"row_status"
,
cel
.
StringType
),
cel
.
Variable
(
"row_status"
,
cel
.
StringType
),
}
}
type
ListMemosFilter
struct
{
type
ListMemosFilter
struct
{
ContentSearch
[]
string
ContentSearch
[]
string
Visibilities
[]
store
.
Visibility
Visibilities
[]
store
.
Visibility
OrderByPinned
bool
CreatedTsBefore
*
int64
CreatedTsBefore
*
int64
CreatedTsAfter
*
int64
CreatedTsAfter
*
int64
Creator
*
string
Creator
*
string
...
@@ -570,6 +575,9 @@ func findField(callExpr *expr.Expr_Call, filter *ListMemosFilter) {
...
@@ -570,6 +575,9 @@ func findField(callExpr *expr.Expr_Call, filter *ListMemosFilter) {
visibilities
=
append
(
visibilities
,
store
.
Visibility
(
value
))
visibilities
=
append
(
visibilities
,
store
.
Visibility
(
value
))
}
}
filter
.
Visibilities
=
visibilities
filter
.
Visibilities
=
visibilities
}
else
if
idExpr
.
Name
==
"order_by_pinned"
{
value
:=
callExpr
.
Args
[
1
]
.
GetConstExpr
()
.
GetBoolValue
()
filter
.
OrderByPinned
=
value
}
else
if
idExpr
.
Name
==
"created_ts_before"
{
}
else
if
idExpr
.
Name
==
"created_ts_before"
{
createdTsBefore
:=
callExpr
.
Args
[
1
]
.
GetConstExpr
()
.
GetInt64Value
()
createdTsBefore
:=
callExpr
.
Args
[
1
]
.
GetConstExpr
()
.
GetInt64Value
()
filter
.
CreatedTsBefore
=
&
createdTsBefore
filter
.
CreatedTsBefore
=
&
createdTsBefore
...
...
web/src/pages/Home.tsx
View file @
34af9697
...
@@ -34,7 +34,7 @@ const Home = () => {
...
@@ -34,7 +34,7 @@ const Home = () => {
},
[
tagQuery
,
textQuery
]);
},
[
tagQuery
,
textQuery
]);
const
fetchMemos
=
async
()
=>
{
const
fetchMemos
=
async
()
=>
{
const
filters
=
[
`creator == "
${
user
.
name
}
"`
,
`row_status == "NORMAL"`
];
const
filters
=
[
`creator == "
${
user
.
name
}
"`
,
`row_status == "NORMAL"`
,
`order_by_pinned == true`
];
const
contentSearch
:
string
[]
=
[];
const
contentSearch
:
string
[]
=
[];
if
(
tagQuery
)
{
if
(
tagQuery
)
{
contentSearch
.
push
(
`"#
${
tagQuery
}
"`
);
contentSearch
.
push
(
`"#
${
tagQuery
}
"`
);
...
...
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