Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
SigNoz
Commits
32e8e489
Unverified
Commit
32e8e489
authored
3 years ago
by
Palash gupta
Browse files
Options
Download
Email Patches
Plain Diff
chore: behaviour for dropdown is updated
parent
5556d1d6
develop
1244-edit-alert
1725-expection
24-may-2022-testing
414-uri
ankit01-oss-patch-1
bump-json-iterator
bump-prometheus
chore/analytics
chore/change-validation-message
chore/improve-metrics-perf
chore/migration-0.8.0
chore/remove-query-service-codeowners
dashboarad-vars
dashboard-bug-fix
effgo
feat-doc-contribute
feat/amol-ee
feat/clickhouse-db-optimizations
feat/custom-func-getSubTreeSpans
feat/dynamic-tooltip
feat/ee
feat/featureFlagging
feat/fields-compression
feat/gRPC-code-method
feat/gh-bot
feat/searchTraceId
feat/trace-resource-attributes
feat/udf-function-getSubTreeSpans
feat/usage
feat/usage-reporting
filter-set
fix-double-client
fix/aggregate
fix/error-exception-page-typo
fix/error-exception-sql-issue
fix/errorDetailURL
fix/exceptionPageOptimization
fix/null-values
fix/serviceMapDependencies
fix/setTTLapis
issue-1228
issue-1252
issue-1293
issue-1294
issue-1442
issue-1485-develop
issue-1511
issue-1583
issue-618
issue-pod-687
labels_object
main
metric-suggest-apis-chv2
metrics-builder-all
metrics-table
new-metrics
new-metrics-enums
palashgdev-patch-1
palashgdev-patch-2
perf/trace-detail-page
playwright
prashant/frontend-docker
prashant/nginx-cache-improvement
release/v0.10
release/v0.10.0
release/v0.10.1
release/v0.10.2
release/v0.11
release/v0.11.0
release/v0.11.1
release/v0.11.2
release/v0.11.3
release/v0.7
release/v0.7.5
release/v0.8
release/v0.8.0
release/v0.8.1
release/v0.8.2
release/v0.9
release/v0.9.0
release/v0.9.1
release/v0.9.2
snyk-fix-3d7b28e56a36018c4b5cf8438365ff27
snyk-fix-4ef12a6988dec7696867e0b2accb8289
snyk-fix-7ee2560cd9d67a9821899135c05c1175
snyk-fix-8f3a2f55a70c214b57d1a3b3bce7d0cf
trace-search
ttl-plus
wip-release-0.11.1
v0.11.3
v0.11.3-rc.1
v0.11.2
v0.11.2-rc.3
v0.11.2-rc.2
v0.11.2-rc.1
v0.11.1
v0.11.1-rc.1
v0.11.0
v0.11.0-rc.1
v0.11
v0.10.2
v0.10.1
v0.10.1-rc.1
v0.10.0
v0.10.0-rc2
v0.10.0-rc1
v0.10
v0.9.2
v0.9.2-rc1
v0.9.1
v0.9.0
v0.9.0-rc2
v0.9.0-rc1
v0.9
v0.8.2
v0.8.1
v0.8.1-rc5
v0.8.1-rc4
v0.8.1-rc3
v0.8.1-rc2
v0.8.1-rc1
v0.8.0
v0.8.0-rc6
v0.8.0-rc5
v0.8.0-rc4
v0.8.0-rc3
v0.8.0-rc2
v0.8.0-rc1
v0.8
v0.7.5
v0.7.5-rc2
v0.7.5-rc1
v0.7
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
frontend/src/container/Trace/Search/AllTags/Tag/DebounceSelect/index.tsx
+0
-63
...ntainer/Trace/Search/AllTags/Tag/DebounceSelect/index.tsx
frontend/src/container/Trace/Search/AllTags/Tag/TagValue.tsx
+69
-0
frontend/src/container/Trace/Search/AllTags/Tag/TagValue.tsx
frontend/src/container/Trace/Search/AllTags/Tag/config.ts
+0
-28
frontend/src/container/Trace/Search/AllTags/Tag/config.ts
frontend/src/container/Trace/Search/AllTags/Tag/index.tsx
+12
-26
frontend/src/container/Trace/Search/AllTags/Tag/index.tsx
with
81 additions
and
117 deletions
+81
-117
frontend/src/container/Trace/Search/AllTags/Tag/DebounceSelect/index.tsx
deleted
100644 → 0
+
0
-
63
View file @
5556d1d6
import
{
Select
,
Spin
}
from
'
antd
'
;
import
{
SelectProps
}
from
'
antd/es/select
'
;
import
debounce
from
'
lodash-es/debounce
'
;
import
React
,
{
useRef
,
useState
}
from
'
react
'
;
export
interface
DebounceSelectProps
<
ValueType
=
any
>
extends
Omit
<
SelectProps
<
ValueType
>
,
'
options
'
|
'
children
'
>
{
fetchOptions
:
(
search
:
string
)
=>
Promise
<
ValueType
[]
>
;
debounceTimeout
:
number
;
}
function
DebounceSelect
<
ValueType
extends
{
key
?:
string
;
label
:
React
.
ReactNode
;
value
:
string
|
number
;
}
=
never
>
({
fetchOptions
,
debounceTimeout
=
800
,
...
props
}:
DebounceSelectProps
):
JSX
.
Element
{
const
[
fetching
,
setFetching
]
=
useState
(
false
);
const
[
options
,
setOptions
]
=
useState
<
ValueType
[]
>
([]);
const
fetchRef
=
useRef
(
0
);
const
debounceFetcher
=
React
.
useMemo
(()
=>
{
const
loadOptions
=
(
value
:
string
):
void
=>
{
fetchRef
.
current
+=
1
;
const
fetchId
=
fetchRef
.
current
;
setOptions
([]);
setFetching
(
true
);
fetchOptions
(
value
).
then
((
newOptions
)
=>
{
if
(
fetchId
!==
fetchRef
.
current
)
{
// for fetch callback order
return
;
}
setOptions
(
newOptions
);
setFetching
(
false
);
});
};
return
debounce
(
loadOptions
,
debounceTimeout
);
},
[
fetchOptions
,
debounceTimeout
]);
return
(
<
Select
<
ValueType
>
labelInValue
filterOption=
{
false
}
onSearch=
{
debounceFetcher
}
notFoundContent=
{
fetching
?
<
Spin
size
=
"small"
/>
:
null
}
style=
{
{
width
:
'
170px
'
}
}
// as all other props are from SelectProps only
// eslint-disable-next-line react/jsx-props-no-spreading
{
...
props
}
options=
{
options
}
/>
);
}
export default DebounceSelect;
This diff is collapsed.
Click to expand it.
frontend/src/container/Trace/Search/AllTags/Tag/TagValue.tsx
0 → 100644
+
69
-
0
View file @
32e8e489
import
{
Select
}
from
'
antd
'
;
import
{
DefaultOptionType
}
from
'
antd/lib/select
'
;
import
getTagValue
from
'
api/trace/getTagValue
'
;
import
useFetch
from
'
hooks/useFetch
'
;
import
React
from
'
react
'
;
import
{
useSelector
}
from
'
react-redux
'
;
import
{
AppState
}
from
'
store/reducers
'
;
import
{
PayloadProps
,
Props
}
from
'
types/api/trace/getTagValue
'
;
import
{
GlobalReducer
}
from
'
types/reducer/globalTime
'
;
import
{
TraceReducer
}
from
'
types/reducer/trace
'
;
import
{
Value
}
from
'
.
'
;
import
{
SelectComponent
}
from
'
./styles
'
;
function
TagValue
(
props
:
TagValueProps
):
JSX
.
Element
{
const
{
tag
,
setLocalSelectedTags
,
index
,
tagKey
}
=
props
;
const
{
Key
:
selectedKey
,
Operator
:
selectedOperator
,
Values
:
selectedValues
,
}
=
tag
;
const
globalReducer
=
useSelector
<
AppState
,
GlobalReducer
>
(
(
state
)
=>
state
.
globalTime
,
);
const
valueSuggestion
=
useFetch
<
PayloadProps
,
Props
>
(
getTagValue
,
{
end
:
globalReducer
.
maxTime
,
start
:
globalReducer
.
minTime
,
tagKey
,
});
return
(
<
SelectComponent
onSelect
=
{
(
value
:
unknown
):
void
=>
{
if
(
typeof
value
===
'
string
'
)
{
setLocalSelectedTags
((
tags
)
=>
[
...
tags
.
slice
(
0
,
index
),
{
Key
:
selectedKey
,
Operator
:
selectedOperator
,
Values
:
[...
selectedValues
,
value
],
},
...
tags
.
slice
(
index
+
1
,
tags
.
length
),
]);
}
}
}
loading
=
{
valueSuggestion
.
loading
||
false
}
>
{
valueSuggestion
.
payload
&&
valueSuggestion
.
payload
.
map
((
suggestion
)
=>
(
<
Select
.
Option
key
=
{
suggestion
.
tagValues
}
value
=
{
suggestion
.
tagValues
}
>
{
suggestion
.
tagValues
}
</
Select
.
Option
>
))
}
</
SelectComponent
>
);
}
interface
TagValueProps
{
index
:
number
;
tag
:
FlatArray
<
TraceReducer
[
'
selectedTags
'
],
1
>
;
setLocalSelectedTags
:
React
.
Dispatch
<
React
.
SetStateAction
<
TraceReducer
[
'
selectedTags
'
]
>
>
;
tagKey
:
string
;
}
export
default
TagValue
;
This diff is collapsed.
Click to expand it.
frontend/src/container/Trace/Search/AllTags/Tag/config.ts
deleted
100644 → 0
+
0
-
28
View file @
5556d1d6
import
getTagValue
from
'
api/trace/getTagValue
'
;
// Usage of DebounceSelect
export
interface
TagValue
{
label
:
string
;
value
:
string
;
}
export
async
function
fetchTag
(
globalStart
:
number
,
globalEnd
:
number
,
tagKey
:
string
,
):
Promise
<
TagValue
[]
>
{
const
response
=
await
getTagValue
({
end
:
globalEnd
,
start
:
globalStart
,
tagKey
,
});
if
(
response
.
statusCode
!==
200
||
!
response
.
payload
)
{
return
[];
}
return
response
.
payload
.
map
((
e
)
=>
({
label
:
e
.
tagValues
,
value
:
e
.
tagValues
,
}));
}
This diff is collapsed.
Click to expand it.
frontend/src/container/Trace/Search/AllTags/Tag/index.tsx
+
12
-
26
View file @
32e8e489
...
...
@@ -3,13 +3,11 @@ import { Select } from 'antd';
import
React
from
'
react
'
;
import
{
useSelector
}
from
'
react-redux
'
;
import
{
AppState
}
from
'
store/reducers
'
;
import
{
GlobalReducer
}
from
'
types/reducer/globalTime
'
;
import
{
TraceReducer
}
from
'
types/reducer/trace
'
;
import
{
fetchTag
,
TagValue
}
from
'
./config
'
;
import
DebounceSelect
from
'
./DebounceSelect
'
;
import
{
Container
,
IconContainer
,
SelectComponent
}
from
'
./styles
'
;
import
TagsKey
from
'
./TagKey
'
;
import
TagValue
from
'
./TagValue
'
;
const
{
Option
}
=
Select
;
...
...
@@ -33,9 +31,6 @@ const AllMenu: AllMenuProps[] = [
function
SingleTags
(
props
:
AllTagsProps
):
JSX
.
Element
{
const
traces
=
useSelector
<
AppState
,
TraceReducer
>
((
state
)
=>
state
.
traces
);
const
globalReducer
=
useSelector
<
AppState
,
GlobalReducer
>
(
(
state
)
=>
state
.
globalTime
,
);
const
{
tag
,
onCloseHandler
,
setLocalSelectedTags
,
index
}
=
props
;
const
{
...
...
@@ -69,7 +64,6 @@ function SingleTags(props: AllTagsProps): JSX.Element {
tag
=
{
tag
}
setLocalSelectedTags
=
{
setLocalSelectedTags
}
/>
<
SelectComponent
onChange
=
{
onChangeOperatorHandler
}
value
=
{
AllMenu
.
find
((
e
)
=>
e
.
key
===
selectedOperator
)?.
value
||
''
}
...
...
@@ -81,24 +75,16 @@ function SingleTags(props: AllTagsProps): JSX.Element {
))
}
</
SelectComponent
>
<
DebounceSelect
fetchOptions
=
{
():
Promise
<
TagValue
[]
>
=>
fetchTag
(
globalReducer
.
minTime
,
globalReducer
.
maxTime
,
selectedKey
[
index
])
}
debounceTimeout
=
{
300
}
onSelect
=
{
(
value
:
Value
):
void
=>
{
setLocalSelectedTags
((
tags
)
=>
[
...
tags
.
slice
(
0
,
index
),
{
Key
:
selectedKey
,
Operator
:
selectedOperator
,
Values
:
[...
selectedValues
,
value
.
value
],
},
...
tags
.
slice
(
index
+
1
,
tags
.
length
),
]);
}
}
mode
=
"multiple"
{
selectedKey
[
0
]
?
(
<
TagValue
index
=
{
index
}
tag
=
{
tag
}
setLocalSelectedTags
=
{
setLocalSelectedTags
}
tagKey
=
{
selectedKey
[
0
]
}
/>
)
:
(
<
SelectComponent
/>
)
}
<
IconContainer
role
=
"button"
onClick
=
{
():
void
=>
onDeleteTagHandler
(
index
)
}
>
<
CloseOutlined
/>
...
...
@@ -116,7 +102,7 @@ interface AllTagsProps {
>
;
}
interface
Value
{
export
interface
Value
{
key
:
string
;
label
:
string
;
value
:
string
;
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
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
Menu
Projects
Groups
Snippets
Help