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

[data views] cache field caps requests #168910

Merged
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
258 commits
Select commit Hold shift + click to select a range
5dc9eee
Merge branch 'fields_for_wildcard_stale_while_revalidate' of github.c…
mattkime Nov 1, 2023
797263d
Merge branch 'main' into fields_for_wildcard_stale_while_revalidate
mattkime Nov 1, 2023
691df4f
caching fields requests mostly working
mattkime Nov 2, 2023
609a962
implement advanced setting for cache length AND etag headers
mattkime Nov 2, 2023
2aec419
add mock
mattkime Nov 2, 2023
2abf10e
attempt to fix discover alerting functional test
mattkime Nov 2, 2023
4de45b5
304 sohuldn't accept body
mattkime Nov 2, 2023
8d8fbb4
try setting cache to zero to see if fewer tests fail
mattkime Nov 3, 2023
146ba0b
remove some comments
mattkime Nov 4, 2023
567e250
Merge branch 'main' into fields_for_wildcard_stale_while_revalidate
mattkime Nov 4, 2023
830b959
fix tests
mattkime Nov 5, 2023
9638c36
restore default cache max-age
mattkime Nov 5, 2023
442c048
fix 304 responses, implement refresh button, hopefully fix a test
mattkime Nov 7, 2023
c0e4e26
Merge branch 'main' into fields_for_wildcard_stale_while_revalidate
mattkime Nov 7, 2023
3f533ab
fix tests
mattkime Nov 7, 2023
ffde29e
revert fields_for_wildcard changes
mattkime Nov 7, 2023
40704e7
revert fields_for_wildcard changes
mattkime Nov 7, 2023
4b02f2d
functional test fixes
mattkime Nov 7, 2023
f294f75
Merge branch 'main' into fields_for_wildcard_stale_while_revalidate
mattkime Nov 7, 2023
78bd537
disable cache for sanity check
mattkime Nov 7, 2023
86681be
cleanup
mattkime Nov 7, 2023
4099571
fix test
mattkime Nov 7, 2023
97e7689
restore default cache time length
mattkime Nov 7, 2023
7b7189d
functional test fix
mattkime Nov 8, 2023
7d93e2b
Merge branch 'main' into fields_for_wildcard_stale_while_revalidate
mattkime Nov 9, 2023
5de584f
Merge branch 'main' of github.com:elastic/kibana into fields_for_wild…
mattkime Nov 9, 2023
5313afb
Merge branch 'main' of github.com:elastic/kibana into fields_for_wild…
mattkime Nov 10, 2023
521e028
hopefully fix some functional tests
mattkime Nov 10, 2023
d93f86b
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Nov 10, 2023
4845511
add vary header which should clear cache on user change
mattkime Nov 10, 2023
9dd5d15
Merge branch 'fields_for_wildcard_stale_while_revalidate' of github.c…
mattkime Nov 10, 2023
7f52130
test fixes
mattkime Nov 10, 2023
1566350
Merge branch 'main' of github.com:elastic/kibana into fields_for_wild…
mattkime Nov 10, 2023
abcf7d6
I think I implemented the Vary header
mattkime Nov 11, 2023
5f123ae
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Nov 11, 2023
ebc5c67
remove unused type
mattkime Nov 11, 2023
62e3d79
t Merge branch 'fields_for_wildcard_stale_while_revalidate' of github…
mattkime Nov 11, 2023
efdc60a
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Nov 11, 2023
0b90af3
remove unused type
mattkime Nov 11, 2023
6cc3ba4
Merge branch 'fields_for_wildcard_stale_while_revalidate' of github.c…
mattkime Nov 11, 2023
cbfc4de
fix jest test
mattkime Nov 11, 2023
cde6207
add console.log debugging for functional tests
mattkime Nov 12, 2023
2c0e5d5
add console.log debugging for functional tests
mattkime Nov 12, 2023
e2b2ba7
add refresh button in data view picker, attempt to fix field formatte…
mattkime Nov 12, 2023
c929e5f
functional test fixes
mattkime Nov 12, 2023
8f59cf5
fix transform functional test
mattkime Nov 12, 2023
7e7da4a
fix data view mgmt type filter on refresh
mattkime Nov 12, 2023
fd083a1
try to fix another test
mattkime Nov 12, 2023
b1e3357
Merge branch 'main' into fields_for_wildcard_stale_while_revalidate
mattkime Nov 12, 2023
4e5d94d
script field functional test fixes
mattkime Nov 13, 2023
651a792
I hope I fixed the maps functional test
mattkime Nov 13, 2023
8685243
fix some functional tests
mattkime Nov 13, 2023
7319b18
cleanup and functional test fix
mattkime Nov 13, 2023
45b3dca
don't cache empty responses
mattkime Nov 13, 2023
4b4266f
fix functional tests by removing unneeded code
mattkime Nov 13, 2023
2f11c36
cleanup
mattkime Nov 13, 2023
5e94706
Merge branch 'main' of github.com:elastic/kibana into fields_for_wild…
mattkime Nov 13, 2023
b0f930e
remove console.log statements
mattkime Nov 13, 2023
208f643
use hash instead of userid
mattkime Nov 14, 2023
e101dba
fix browser bundle size
mattkime Nov 14, 2023
6e9e871
Merge branch 'main' of github.com:elastic/kibana into fields_for_wild…
mattkime Nov 14, 2023
eb2e989
add integration tests
mattkime Nov 14, 2023
121c2e8
update refresh button text
mattkime Nov 14, 2023
aa3503b
increase bundle limit
mattkime Nov 14, 2023
7734118
skip flakey test
mattkime Nov 14, 2023
b12cade
Merge branch 'main' of github.com:elastic/kibana into fields_for_wild…
mattkime Nov 14, 2023
247bcaa
skip flakey test
mattkime Nov 14, 2023
66836bd
skip flaky test
mattkime Nov 14, 2023
294dfd1
Merge branch 'main' into fields_for_wildcard_stale_while_revalidate
mattkime Nov 14, 2023
c2d5595
Merge branch 'main' of github.com:elastic/kibana into fields_for_wild…
mattkime Nov 14, 2023
8736f54
Merge branch 'fields_for_wildcard_stale_while_revalidate' of github.c…
mattkime Nov 14, 2023
387b203
update snapshot
mattkime Nov 14, 2023
99b03af
skip scripted field test, its being flaky
mattkime Nov 15, 2023
4246c60
skip scripted field test, its being flaky
mattkime Nov 15, 2023
42bd2f4
refactor security / data view plugin dependency
mattkime Nov 15, 2023
fef8a55
Merge branch 'main' of github.com:elastic/kibana into fields_for_wild…
mattkime Nov 15, 2023
6693cf6
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Nov 15, 2023
7b384d4
Revert "refactor security / data view plugin dependency"
mattkime Nov 15, 2023
486308a
Merge branch 'fields_for_wildcard_stale_while_revalidate' of github.c…
mattkime Nov 15, 2023
b009721
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Nov 15, 2023
5c58232
remove circ dependency
mattkime Nov 15, 2023
7445428
Merge branch 'fields_for_wildcard_stale_while_revalidate' of github.c…
mattkime Nov 15, 2023
6ea9098
disable flaky test
mattkime Nov 15, 2023
864d9ef
remove discover refresh button and turn off cache
mattkime Nov 15, 2023
2d7ab2f
fix api integration test
mattkime Nov 15, 2023
dbee901
cleanup
mattkime Nov 15, 2023
80249e5
remove skips
mattkime Nov 16, 2023
f26a084
Merge branch 'main' into fields_for_wildcard_stale_while_revalidate
mattkime Nov 16, 2023
cd4049b
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Nov 17, 2023
544aa05
Merge branch 'main' into fields_for_wildcard_stale_while_revalidate
mattkime Nov 19, 2023
df2307e
Merge branch 'main' into fields_for_wildcard_stale_while_revalidate
mattkime Nov 21, 2023
0fc9422
Merge branch 'fields_for_wildcard_stale_while_revalidate' of github.c…
mattkime Nov 21, 2023
efa3195
Merge branch 'main' into fields_for_wildcard_stale_while_revalidate
mattkime Nov 21, 2023
e03a3ec
reenable cache but only for classic environment
mattkime Nov 21, 2023
7bae56d
Merge branch 'main' into fields_for_wildcard_stale_while_revalidate
mattkime Nov 22, 2023
5c69712
type cleanup
mattkime Nov 22, 2023
377a5a6
remove user hash from server response
mattkime Nov 22, 2023
7dc380f
Merge branch 'fields_for_wildcard_stale_while_revalidate' of github.c…
mattkime Nov 22, 2023
1a9a450
remove server side user hash header
mattkime Nov 22, 2023
5971b41
typefix
mattkime Nov 22, 2023
fd7adb2
remove unneeded functional test changes
mattkime Nov 22, 2023
278d005
Merge branch 'main' into fields_for_wildcard_stale_while_revalidate
mattkime Nov 23, 2023
55b8191
implement versioned router on fields endpoint
mattkime Nov 27, 2023
1b8704d
Merge branch 'fields_for_wildcard_stale_while_revalidate' of github.c…
mattkime Nov 27, 2023
89c4ff2
fix fields route
mattkime Nov 27, 2023
c0fb816
Merge branch 'main' into fields_for_wildcard_stale_while_revalidate
mattkime Nov 27, 2023
6efa5f1
fix test
mattkime Nov 27, 2023
9723dc3
Merge branch 'fields_for_wildcard_stale_while_revalidate' of github.c…
mattkime Nov 27, 2023
c5c993e
add performance journey
mattkime Nov 27, 2023
6d7212a
remove one serialization
mattkime Nov 27, 2023
ed73b7b
fix api integration test
mattkime Nov 27, 2023
cdeec68
add performance journeys
mattkime Nov 30, 2023
72bbeb7
Merge branch 'main' into fields_for_wildcard_stale_while_revalidate
mattkime Nov 30, 2023
26d3d6d
Add new fields to list with correct types
kertal Nov 30, 2023
7b999db
Improve code
kertal Dec 1, 2023
3a6c239
Remove redundant newFieldsByFieldNameMap
kertal Dec 1, 2023
179105b
Merge branch 'main' into fields_for_wildcard_stale_while_revalidate
mattkime Dec 2, 2023
3fa1369
update setting text
mattkime Dec 2, 2023
f40eb1d
use new method for security dependency
mattkime Dec 2, 2023
cf7c893
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Dec 2, 2023
781a580
Merge branch 'main' into fields_for_wildcard_stale_while_revalidate
mattkime Dec 2, 2023
9b719cc
Revert "use new method for security dependency"
mattkime Dec 2, 2023
780fc78
Merge branch 'fields_for_wildcard_stale_while_revalidate' of github.c…
mattkime Dec 2, 2023
ccd243a
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Dec 2, 2023
9ec2773
Revert "Revert "use new method for security dependency""
mattkime Dec 2, 2023
e412172
Merge branch 'fields_for_wildcard_stale_while_revalidate' of github.c…
mattkime Dec 2, 2023
c51b7d2
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Dec 2, 2023
6d5df9d
add loading text for button, better button push test logic
mattkime Dec 2, 2023
7f7be97
Merge branch 'fields_for_wildcard_stale_while_revalidate' of github.c…
mattkime Dec 2, 2023
3f7fb79
fix i18n name
mattkime Dec 2, 2023
3c1ab44
wait on field list refresh
mattkime Dec 3, 2023
fdcd16c
add refresh button push to serverless index filter test
mattkime Dec 3, 2023
53f1f19
fix ml alert test
mattkime Dec 3, 2023
ebd04c7
fix discover security functional test
mattkime Dec 3, 2023
46c9ee7
functional test fix attempts
mattkime Dec 3, 2023
60b0675
another attempt at fixing the discover security test
mattkime Dec 3, 2023
b563acd
add some debugging to hopefully help with remaining errors
mattkime Dec 3, 2023
b145375
a little more debugging
mattkime Dec 3, 2023
eb0604d
a little more debugging
mattkime Dec 4, 2023
6216b37
attempt to fix lens functional test with additional data view refresh
mattkime Dec 4, 2023
c386791
Merge branch 'main' of github.com:elastic/kibana into fields_for_wild…
mattkime Dec 4, 2023
307a16d
Add multi field support
kertal Dec 4, 2023
54daa2f
Merge branch 'main' into unified-field-list-add-new-fields
kibanamachine Dec 4, 2023
2bce926
Merge branch 'main' of github.com:elastic/kibana into fields_for_wild…
mattkime Dec 5, 2023
af83362
fix discover alert functional test
mattkime Dec 5, 2023
1d0dcd5
get fresh field list vith data view swapping.
mattkime Dec 6, 2023
797f6ce
fix discover alert functional test
mattkime Dec 6, 2023
913bedb
fix discover alert functional test
mattkime Dec 6, 2023
e6e1e3e
Merge branch 'main' into fields_for_wildcard_stale_while_revalidate
kibanamachine Dec 6, 2023
b3349b1
Merge branch 'main' of github.com:elastic/kibana into fields_for_wild…
mattkime Dec 6, 2023
3f58ecd
fix functional test
mattkime Dec 6, 2023
152d016
Merge branch 'fields_for_wildcard_stale_while_revalidate' of github.c…
mattkime Dec 6, 2023
08a3ea8
cleanup
mattkime Dec 6, 2023
836452a
Merge branch 'main' into fields_for_wildcard_stale_while_revalidate
mattkime Dec 7, 2023
ca50f4d
Merge branch 'main' into unified-field-list-add-new-fields
kibanamachine Dec 7, 2023
b73f727
Update docs/concepts/data-views.asciidoc
mattkime Dec 7, 2023
c7fbf1e
Merge branch 'main' into fields_for_wildcard_stale_while_revalidate
mattkime Dec 7, 2023
9c4e416
better rendering of refresh button
mattkime Dec 8, 2023
17d4b59
Merge branch 'fields_for_wildcard_stale_while_revalidate' of github.c…
mattkime Dec 8, 2023
44dded0
Merge branch 'main' into fields_for_wildcard_stale_while_revalidate
mattkime Dec 8, 2023
999a6a9
Add support for Lens
kertal Dec 9, 2023
1a30c70
Merge remote-tracking branch 'origin/unified-field-list-add-new-field…
kertal Dec 9, 2023
dc9fa0e
cleanup
mattkime Dec 11, 2023
4b17356
Merge branch 'main' of github.com:elastic/kibana into fields_for_wild…
mattkime Dec 11, 2023
082430d
Merge branch 'fields_for_wildcard_stale_while_revalidate' of github.c…
mattkime Dec 11, 2023
985ed11
better caching, add tests
mattkime Dec 11, 2023
d7701c7
Merge branch 'main' into fields_for_wildcard_stale_while_revalidate
mattkime Dec 11, 2023
fa237a4
Merge remote-tracking branch 'upstream/main' into unified-field-list-…
kertal Dec 12, 2023
15cc582
Add functional test
kertal Dec 13, 2023
3cea884
Merge branch 'main' into unified-field-list-add-new-fields
kibanamachine Dec 13, 2023
065a50c
Add documentation
kertal Dec 14, 2023
e9fd00e
Improve code
kertal Dec 14, 2023
63907e4
Merge branch 'unified-field-list-add-new-fields' of github.com:kertal…
kertal Dec 14, 2023
454592c
Add Lens test
kertal Dec 15, 2023
75cc235
Improve Lens code preventing an endless loop of update
kertal Dec 15, 2023
12616b4
Merge branch 'main' into unified-field-list-add-new-fields
kibanamachine Dec 18, 2023
27dd198
Merge branch 'main' into fields_for_wildcard_stale_while_revalidate
jughosta Dec 18, 2023
e0792e6
Merge branch 'main' into fields_for_wildcard_stale_while_revalidate
mattkime Dec 18, 2023
3a74600
Update packages/kbn-unified-field-list/src/hooks/use_existing_fields.ts
kertal Dec 19, 2023
15e5168
Update packages/kbn-unified-field-list/src/hooks/use_grouped_fields.ts
kertal Dec 19, 2023
139b651
Update packages/kbn-unified-field-list/src/services/field_existing/fi…
kertal Dec 19, 2023
ab514e4
Update packages/kbn-unified-field-list/src/services/field_existing/fi…
kertal Dec 19, 2023
e25dcf9
Merge branch 'main' into fields_for_wildcard_stale_while_revalidate
jughosta Dec 19, 2023
5cd087f
Merge remote-tracking branch 'upstream/main' into unified-field-list-…
kertal Dec 19, 2023
b424159
Improve code
kertal Dec 20, 2023
9b70dec
Merge branch 'main' into unified-field-list-add-new-fields
kibanamachine Dec 20, 2023
30dfec6
Add isFieldLensCompatible for new fields in Lens
kertal Dec 20, 2023
f747c2e
Improve multi field code
kertal Dec 21, 2023
9ed0c49
Improve code
kertal Dec 21, 2023
5420c77
Remove redundant field list refreshing
kertal Dec 21, 2023
f340fae
Undo multi field changes
kertal Dec 22, 2023
26c4d72
Address feedback
kertal Dec 22, 2023
ab2c743
Merge remote-tracking branch 'upstream/main' into unified-field-list-…
kertal Dec 22, 2023
921a598
Address review feedback
kertal Dec 22, 2023
ec55f89
Fix error
kertal Dec 22, 2023
c76c87e
Add useMemo for new fields
kertal Dec 22, 2023
165c3cd
Address review feedback
kertal Dec 22, 2023
cbf3cc9
Merge branch 'main' into fields_for_wildcard_stale_while_revalidate
mattkime Dec 25, 2023
e4fdc38
Merge branch 'main' into fields_for_wildcard_stale_while_revalidate
mattkime Jan 2, 2024
07f5058
[CI] Auto-commit changed files from 'node scripts/notice'
kibanamachine Jan 2, 2024
cbee199
Merge branch 'main' into unified-field-list-add-new-fields
jughosta Jan 2, 2024
9170300
[CI] Auto-commit changed files from 'node scripts/notice'
kibanamachine Jan 2, 2024
d62dba7
Merge branch 'main' into unified-field-list-add-new-fields
jughosta Jan 3, 2024
02a4537
[Discover] Small fixes for types and memo deps. Add tests.
jughosta Jan 3, 2024
449565e
Merge branch 'main' into fields_for_wildcard_stale_while_revalidate
mattkime Jan 4, 2024
87d63fe
Merge branch 'main' of github.com:elastic/kibana into fields_for_wild…
mattkime Jan 4, 2024
04e40be
cleanup
mattkime Jan 5, 2024
786ce63
Merge branch 'fields_for_wildcard_stale_while_revalidate' of github.c…
mattkime Jan 5, 2024
a01dd65
fix display of advanced setting
mattkime Jan 5, 2024
f67dc85
add functional test to check for presence and absense of advanced set…
mattkime Jan 6, 2024
603708e
fix tests, improve buttons?
mattkime Jan 6, 2024
937366b
fix functional tests
mattkime Jan 6, 2024
a6bbc40
fix functional tests
mattkime Jan 6, 2024
15f8771
fix functional tests
mattkime Jan 6, 2024
290a3ca
fix functional tests
mattkime Jan 6, 2024
dda0d98
fix functional tests
mattkime Jan 7, 2024
621a1df
Merge pull request #16 from jughosta/unified-field-list-add-new-field…
kertal Jan 8, 2024
8617b3d
Merge branch 'main' into unified-field-list-add-new-fields
kibanamachine Jan 8, 2024
223f546
Merge branch 'main' into unified-field-list-add-new-fields
kibanamachine Jan 8, 2024
8549c3f
Merge remote-tracking branch 'upstream/main' into unified-field-list-…
kertal Jan 9, 2024
f751a4e
Address review feedback
kertal Jan 9, 2024
d024027
Apply useLatest feedback
kertal Jan 9, 2024
e628af7
better buttons, better software
mattkime Jan 9, 2024
66fd722
fix functional test
mattkime Jan 9, 2024
465d993
Merge branch 'main' into fields_for_wildcard_stale_while_revalidate
mattkime Jan 9, 2024
d18c90a
Merge branch 'unified-field-list-add-new-fields' into fields_for_wild…
mattkime Jan 9, 2024
3a7b331
Merge branch 'main' into fields_for_wildcard_stale_while_revalidate
mattkime Jan 9, 2024
48d28c9
fix functional test
mattkime Jan 9, 2024
0a34ba8
Merge branch 'fields_for_wildcard_stale_while_revalidate' of github.c…
mattkime Jan 9, 2024
a40cc37
partial progress on fixing fields
mattkime Jan 9, 2024
c1ab8ff
Merge branch 'main' into fields_for_wildcard_stale_while_revalidate
mattkime Jan 9, 2024
6342b89
cleanup and hopefully fix tests related to auto refresh
mattkime Jan 9, 2024
8e5ba7e
remove some comments
mattkime Jan 10, 2024
b56cb26
remve unneeded change
mattkime Jan 10, 2024
19c06b2
functional test fix
mattkime Jan 10, 2024
3bf8c03
Update src/plugins/data_view_management/public/components/edit_index_…
mattkime Jan 10, 2024
36fc2a6
translate some text, remove unneeded comma
mattkime Jan 10, 2024
ff11592
Merge branch 'fields_for_wildcard_stale_while_revalidate' of github.c…
mattkime Jan 10, 2024
d1d1c0c
Merge branch 'main' into fields_for_wildcard_stale_while_revalidate
kibanamachine Jan 11, 2024
14a2fd8
Merge branch 'fields_for_wildcard_stale_while_revalidate' of github.c…
mattkime Jan 12, 2024
67dbffe
fix refresh button in mobile view
mattkime Jan 12, 2024
765152d
restore doc change
mattkime Jan 12, 2024
416a785
better caching, with test
mattkime Jan 14, 2024
9f2700d
Merge branch 'main' into fields_for_wildcard_stale_while_revalidate
mattkime Jan 14, 2024
194527e
Merge branch 'main' into fields_for_wildcard_stale_while_revalidate
mattkime Jan 14, 2024
b12b865
Merge branch 'main' into fields_for_wildcard_stale_while_revalidate
mattkime Jan 14, 2024
99356b3
undo removal of version header for hasUserDataView
mattkime Jan 14, 2024
244896e
Merge branch 'fields_for_wildcard_stale_while_revalidate' of github.c…
mattkime Jan 14, 2024
a9315ac
fix test
mattkime Jan 14, 2024
0493689
Merge branch 'main' into fields_for_wildcard_stale_while_revalidate
mattkime Jan 15, 2024
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 @@ -17,6 +17,7 @@ import type {
ErrorHttpResponseOptions,
KibanaErrorResponseFactory,
KibanaRedirectionResponseFactory,
KibanaNotModifiedResponseFactory,
KibanaSuccessResponseFactory,
KibanaResponseFactory,
LifecycleResponseFactory,
Expand Down Expand Up @@ -51,6 +52,10 @@ const redirectionResponseFactory: KibanaRedirectionResponseFactory = {
redirected: (options: RedirectResponseOptions) => new KibanaResponse(302, options.body, options),
};

const notModifiedResponseFactory: KibanaNotModifiedResponseFactory = {
notModified: (options: HttpResponseOptions = {}) => new KibanaResponse(304, undefined, options),
};

const errorResponseFactory: KibanaErrorResponseFactory = {
badRequest: (options: ErrorHttpResponseOptions = {}) =>
new KibanaResponse(400, options.body || 'Bad Request', options),
Expand Down Expand Up @@ -120,6 +125,7 @@ export const fileResponseFactory = {
export const kibanaResponseFactory: KibanaResponseFactory = {
...successResponseFactory,
...redirectionResponseFactory,
...notModifiedResponseFactory,
...errorResponseFactory,
...fileResponseFactory,
custom: <T extends HttpResponsePayload | ResponseError>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ function setHeaders(response: HapiResponseObject, headers: Record<string, string

const statusHelpers = {
isSuccess: (code: number) => code >= 100 && code < 300,
isRedirect: (code: number) => code >= 300 && code < 400,
isNotModified: (code: number) => code === 304,
isRedirect: (code: number) => code >= 300 && code < 400 && code !== 304,
isError: (code: number) => code >= 400 && code < 600,
};

Expand Down Expand Up @@ -76,7 +77,10 @@ export class HapiResponseAdapter {
if (statusHelpers.isError(kibanaResponse.status)) {
return this.toError(kibanaResponse);
}
if (statusHelpers.isSuccess(kibanaResponse.status)) {
if (
statusHelpers.isSuccess(kibanaResponse.status) ||
statusHelpers.isNotModified(kibanaResponse.status)
) {
return this.toSuccess(kibanaResponse);
}
if (statusHelpers.isRedirect(kibanaResponse.status)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ const createResponseFactoryMock = (): jest.Mocked<KibanaResponseFactory> => ({
ok: jest.fn(),
accepted: jest.fn(),
noContent: jest.fn(),
notModified: jest.fn(),
custom: jest.fn(),
redirected: jest.fn(),
badRequest: jest.fn(),
Expand Down
1 change: 1 addition & 0 deletions packages/core/http/core-http-server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export type {
IKibanaSocket,
KibanaErrorResponseFactory,
KibanaRedirectionResponseFactory,
KibanaNotModifiedResponseFactory,
KibanaSuccessResponseFactory,
KibanaResponseFactory,
LifecycleResponseFactory,
Expand Down
1 change: 1 addition & 0 deletions packages/core/http/core-http-server/src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export type { IKibanaSocket } from './socket';
export type {
KibanaErrorResponseFactory,
KibanaRedirectionResponseFactory,
KibanaNotModifiedResponseFactory,
KibanaSuccessResponseFactory,
KibanaResponseFactory,
LifecycleResponseFactory,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,7 @@ export interface FileHttpResponseOptions<T extends HttpResponsePayload | Respons
* @public
*/
export type RedirectResponseOptions = HttpResponseOptions & {
headers: {
location: string;
};
headers?: ResponseHeaders;
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,18 @@ export interface KibanaRedirectionResponseFactory {
redirected(options: RedirectResponseOptions): IKibanaResponse;
}

/**
* @public
*/
export interface KibanaNotModifiedResponseFactory {
/**
* Content not modified.
* Status code: `304`.
* @param options - {@link HttpResponseOptions} configures HTTP response body & headers.
*/
notModified(options: HttpResponseOptions): IKibanaResponse;
}

/**
* @public
*/
Expand Down Expand Up @@ -200,6 +212,7 @@ export interface KibanaErrorResponseFactory {
*/
export type KibanaResponseFactory = KibanaSuccessResponseFactory &
KibanaRedirectionResponseFactory &
KibanaNotModifiedResponseFactory &
KibanaErrorResponseFactory & {
/**
* Creates a response with defined status code and payload.
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-optimizer/limits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pageLoadAssetSize:
dataViewEditor: 28082
dataViewFieldEditor: 27000
dataViewManagement: 5100
dataViews: 48300
dataViews: 48800
dataVisualizer: 27530
devTools: 38637
discover: 99999
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ export const EditIndexPattern = withRouter(
const [showEditDialog, setShowEditDialog] = useState<boolean>(false);
const [relationships, setRelationships] = useState<SavedObjectRelationWithTitle[]>([]);
const [allowedTypes, setAllowedTypes] = useState<SavedObjectManagementTypeInfo[]>([]);
const [refreshCount, setRefreshCount] = useState<number>(0);
const [isRefreshing, setIsRefreshing] = React.useState(false);

const conflictFieldsUrl = useMemo(() => {
return setStateToKbnUrl(
APP_STATE_STORAGE_KEY,
Expand Down Expand Up @@ -142,7 +145,7 @@ export const EditIndexPattern = withRouter(
setConflictedFields(
indexPattern.fields.getAll().filter((field) => field.type === 'conflict')
);
}, [indexPattern]);
}, [indexPattern, refreshCount]);

useEffect(() => {
setTags(
Expand Down Expand Up @@ -244,8 +247,15 @@ export const EditIndexPattern = withRouter(
deleteIndexPatternClick={() =>
removeHandler([indexPattern as RemoveDataViewProps], <div>{warning}</div>)
}
refreshIndexPatternClick={async () => {
setIsRefreshing(true);
await dataViews.refreshFields(indexPattern, false, true);
setRefreshCount(refreshCount + 1);
setIsRefreshing(false);
}}
defaultIndex={defaultIndex}
canSave={userEditPermission}
isRefreshing={isRefreshing}
>
<EuiHorizontalRule margin="none" />
<EuiSpacer size="l" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import React from 'react';
import { i18n } from '@kbn/i18n';
import { EuiButton, EuiButtonEmpty, EuiPageHeader } from '@elastic/eui';
import { EuiButton, EuiButtonEmpty, EuiPageHeader, EuiToolTip } from '@elastic/eui';
import { DataView } from '@kbn/data-views-plugin/public';

interface IndexHeaderProps {
Expand All @@ -17,7 +17,9 @@ interface IndexHeaderProps {
setDefault?: () => void;
editIndexPatternClick?: () => void;
deleteIndexPatternClick?: () => void;
refreshIndexPatternClick?: () => void;
canSave: boolean;
isRefreshing?: boolean;
}

const setDefaultAriaLabel = i18n.translate('indexPatternManagement.editDataView.setDefaultAria', {
Expand All @@ -44,19 +46,44 @@ const removeTooltip = i18n.translate('indexPatternManagement.editDataView.remove
defaultMessage: 'Delete',
});

const refreshAriaLabel = i18n.translate('indexPatternManagement.editDataView.refreshAria', {
defaultMessage: 'Refresh',
});

const refreshTooltip = i18n.translate('indexPatternManagement.editDataView.refreshTooltip', {
defaultMessage: 'Refresh local copy of data view field list',
mattkime marked this conversation as resolved.
Show resolved Hide resolved
});

const refreshLabel = i18n.translate('indexPatternManagement.editDataView.refreshLabel', {
defaultMessage: 'Refresh',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we already had "Refresh" button in the earlier Kibana versions and it had a different purpose, using a label other than "Refresh" might work better here. For example, "Clear fields cache".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think my concern with Clear fields cache is that its unclear where the cache lives. The tooltip explains in detail.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amyjtechwriter I'm curious about your thoughts on this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be great to make it clear that it's about Kibana and browser cache rather than something to do with how elasticsearch itself manages fields.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will using two words for this 'refresh' label be too long? I was thinking:
1 Clear cache
2 Empty cache

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amyjtechwriter My concern with those phrases, and you're free to overrule me - in the context of a web browser they mean everything is cleared. The button reloads only this specific data view field set.

Past that, I don't think we should worry about button length.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just echoing what I said in the meeting earlier today - I think it would be worthwhile to move this "Refresh" button to next to the field list text input.

});

export const IndexHeader: React.FC<IndexHeaderProps> = ({
defaultIndex,
indexPattern,
setDefault,
editIndexPatternClick,
deleteIndexPatternClick,
refreshIndexPatternClick,
children,
canSave,
isRefreshing,
}) => {
return (
<EuiPageHeader
pageTitle={<span data-test-subj="indexPatternTitle">{indexPattern.getName()}</span>}
rightSideItems={[
<EuiToolTip content={<p>{refreshTooltip}</p>}>
<EuiButton
onClick={refreshIndexPatternClick}
iconType="refresh"
aria-label={refreshAriaLabel}
data-test-subj="refreshDataViewButton"
disabled={isRefreshing}
>
{refreshLabel}
</EuiButton>
</EuiToolTip>,
canSave && (
<EuiButton
onClick={editIndexPatternClick}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ export const IndexPatternTable = ({
<div>
<EuiLink
{...reactRouterNavigate(history, `patterns/${dataView.id}`)}
data-test-subj={`detail-link-${dataView.name}`}
data-test-subj={`detail-link-${dataView.getName()}`}
>
{dataView.getName()}
{dataView.name ? (
Expand Down
6 changes: 6 additions & 0 deletions src/plugins/data_views/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ export const PLUGIN_NAME = 'DataViews';
*/
export const FIELDS_FOR_WILDCARD_PATH = '/internal/data_views/_fields_for_wildcard';

/**
* Fields path. Like fields for wildcard but GET only
* @public
*/
export const FIELDS_PATH = '/internal/data_views/fields';

/**
* Existing indices path
* @public
Expand Down
6 changes: 6 additions & 0 deletions src/plugins/data_views/common/data_views/data_view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ export class DataView extends AbstractDataView implements DataViewBase {
*/
public flattenHit: (hit: Record<string, unknown[]>, deep?: boolean) => Record<string, unknown>;

private etag: string | undefined;

/**
* constructor
* @param config - config data and dependencies
Expand All @@ -77,6 +79,10 @@ export class DataView extends AbstractDataView implements DataViewBase {
this.fields.replaceAll(Object.values(spec.fields || {}));
}

getEtag = () => this.etag;

setEtag = (etag: string) => (this.etag = etag);
davismcphee marked this conversation as resolved.
Show resolved Hide resolved

/**
* Returns scripted fields
*/
Expand Down
Loading