-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
🌊 Streams routing UI #201427
Merged
flash1293
merged 115 commits into
elastic:main
from
flash1293:flash1293/streams-routing-ui
Dec 4, 2024
Merged
🌊 Streams routing UI #201427
Changes from 108 commits
Commits
Show all changes
115 commits
Select commit
Hold shift + click to select a range
5fe1078
Initial setup for streams plugin
simianhacker 6f940eb
migrating to the streams naming schema; adding an abstraction for the…
simianhacker 9b33808
ensure forked streams are marked root:false
simianhacker c8cd0f7
Commit entities plugins
dgieselaar 7e8f2d7
Move files into streams_*
dgieselaar 999dfef
Rename stuff & remove stuff
dgieselaar d99a3ff
stream management
flash1293 0e89345
add delete and listing endpoint
flash1293 9dd5fde
cleanup
flash1293 7400a3b
add resync endpoint
flash1293 5140687
Remove cruft, handle package relocation
dgieselaar 797c93d
Streams table
dgieselaar fcce628
Only fetch histogram when DS exists
dgieselaar 9d37219
more fixes
flash1293 d622fa1
more adjustments
flash1293 fbc6c2a
some more fixes
flash1293 45787d0
Merge remote-tracking branch 'upstream/main' into init-streams-plugin
flash1293 e810f53
[CI] Auto-commit changed files from 'node scripts/build_plugin_list_d…
kibanamachine e93ac17
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine cf9f349
add limits
flash1293 0d676ed
Merge branch 'init-streams-plugin' of github.com:simianhacker/kibana …
flash1293 7b0a4e5
Add streams to left nav
dgieselaar 34f3c44
fix permissions
flash1293 0b7de24
remove feature completely
flash1293 76ed81d
cleanup
flash1293 2427d2e
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine 2ad08f4
Merge branch 'main' into init-streams-plugin
flash1293 c8d99ed
Merge branch 'main' into init-streams-plugin
flash1293 8c707d1
Merge commit '0d676edfc0681f18d3804e079bad09053bf32247' into init-str…
dgieselaar e6bb640
[Observability] Split up observability-utils package
dgieselaar 421ea5b
Merge branch 'main' of github.com:elastic/kibana into observability-u…
dgieselaar 7992539
Fix references
dgieselaar 95ae9f8
[CI] Auto-commit changed files from 'node scripts/generate codeowners'
kibanamachine 7a88cc5
Fix issues in APM plugin
dgieselaar 74f0678
Merge branch 'observability-utils-pkg-split' of github.com:dgieselaar…
dgieselaar dab77c1
[CI] Auto-commit changed files from 'node scripts/yarn_deduplicate'
kibanamachine a60a165
Updating the owners and CODEOWNERS to @simianhacker @flash1293 @dgies…
simianhacker fc031f8
Merge branch 'main' of github.com:elastic/kibana into init-streams-pl…
simianhacker e9189e0
Merge branch 'main' of github.com:elastic/kibana into observability-u…
dgieselaar 08aef83
Merge branch 'observability-utils-pkg-split' of github.com:dgieselaar…
dgieselaar 2bef512
Fix references
dgieselaar 5c10198
Option to unset value on error
dgieselaar 5d40445
Merge branch 'observability-utils-pkg-split' into init-streams-app-pl…
dgieselaar 9ca2da2
Fix lingering import
dgieselaar 8b0b51c
Merge branch 'observability-utils-pkg-split' into init-streams-app-pl…
dgieselaar d655c0a
Clean up esql signature
dgieselaar 8e0eba8
Handle sync callbacks in withSpan
dgieselaar eb61e23
Merge branch 'observability-utils-pkg-split' into init-streams-app-pl…
dgieselaar 5e90008
Make APIs internal
dgieselaar dd55c3a
Merge branch 'init-streams-plugin' into init-streams-app-plugin
dgieselaar b9896ab
Merge remote-tracking branch 'upstream/main' into init-streams-app-pl…
dgieselaar 377b365
Merge branch 'main' of github.com:elastic/kibana into init-streams-ap…
dgieselaar b556194
Move to x-pack/plugins/streams_app
dgieselaar aa4a2e0
Improve types
dgieselaar f0276dc
Improve type strictness
dgieselaar adcd660
Update .i18nrc.json
dgieselaar 224ffeb
Merge branch 'main' of github.com:elastic/kibana into init-streams-ap…
dgieselaar 2edc694
Merge branch 'init-streams-app-plugin' of github.com:dgieselaar/kiban…
dgieselaar bb4dc6e
Conditionally register items in side nav
dgieselaar 2b74f6c
Clean up
dgieselaar 46ffca7
[CI] Auto-commit changed files from 'node scripts/build_plugin_list_d…
kibanamachine 6e87efd
place nice with ES
flash1293 d0c05f3
[CI] Auto-commit changed files from 'make api-docs'
kibanamachine f663b43
Merge branch 'main' into flash1293/streams-improvements
flash1293 6373996
Merge branch 'main' into flash1293/streams-improvements
flash1293 18ca51e
streams data generation
flash1293 a8eefbe
leave comment
flash1293 ef8a4c1
fix
flash1293 be2712b
Merge remote-tracking branch 'upstream/main' into flash1293/streams-d…
flash1293 7fd7cb8
add missing things
flash1293 105ef6e
Merge branch 'init-streams-app-plugin' into flash1293/streams-routing-ui
flash1293 3fdc9cb
wip
flash1293 a1279c7
Merge branch 'flash1293/streams-improvements' into flash1293/streams-…
flash1293 9c0dfbd
Merge branch 'main' into flash1293/streams-improvements
flash1293 9865d73
add more stuff
flash1293 e71a5a9
Merge branch 'main' into flash1293/streams-improvements
flash1293 d1066c2
Merge branch 'main' into flash1293/streams-capabilities
flash1293 64bb157
add more stuff
flash1293 4741073
some smaller fixes
flash1293 d7ac8cd
make it pretty
flash1293 609f66e
better condition editor
flash1293 43b9aaa
Merge branch 'main' into flash1293/streams-improvements
flash1293 ef1c23f
Merge remote-tracking branch 'upstream/main' into flash1293/streams-i…
flash1293 90e7708
Merge branch 'flash1293/streams-improvements' of github.com:flash1293…
flash1293 4ad40a6
Merge remote-tracking branch 'upstream/main' into flash1293/streams-c…
flash1293 f00e883
Merge remote-tracking branch 'upstream/main' into flash1293/streams-r…
flash1293 b78a139
fix some stuff
flash1293 5d8ffbf
Merge remote-tracking branch 'upstream/main' into flash1293/streams-i…
flash1293 a55fe17
fix
flash1293 3bd3a9a
fix
flash1293 d92d0e8
Merge branch 'flash1293/streams-capabilities' into flash1293/streams-…
flash1293 20568a6
Merge branch 'flash1293/streams-improvements' into flash1293/streams-…
flash1293 7e2fc11
remove unintended changes
flash1293 72eb0cc
management base page
flash1293 417f68f
Merge branch 'flash1293/streams-management-ui' into flash1293/streams…
flash1293 b34dc28
fix link
flash1293 be3695f
Merge branch 'main' into flash1293/streams-routing-ui
flash1293 28e5d14
make layout work
flash1293 510aa65
add delete modal
flash1293 23eeda9
add move up button
flash1293 3ec9857
cleanuops
flash1293 8d91298
more cleanups
flash1293 8ad507b
Merge remote-tracking branch 'upstream/main' into flash1293/streams-r…
flash1293 0b843c2
fix page height in different nav modes
flash1293 909e62b
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine 91d0921
Merge remote-tracking branch 'upstream/main' into flash1293/streams-r…
flash1293 29b1a21
fix types
flash1293 cec06fa
Merge branch 'flash1293/streams-routing-ui' of github.com:flash1293/k…
flash1293 f01e4f2
Merge remote-tracking branch 'upstream/main' into flash1293/streams-r…
flash1293 22baed7
fix
flash1293 a6730af
use debounce
flash1293 09f30a2
Merge branch 'main' into flash1293/streams-routing-ui
flash1293 e4a89cf
Merge remote-tracking branch 'upstream/main' into flash1293/streams-r…
flash1293 a49933e
Merge branch 'flash1293/streams-routing-ui' of github.com:flash1293/k…
flash1293 9f5b0f6
add comment
flash1293 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
x-pack/plugins/streams/server/lib/streams/helpers/condition_fields.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { Condition, FilterCondition } from '../../../../common/types'; | ||
import { isAndCondition, isFilterCondition, isOrCondition } from './condition_guards'; | ||
|
||
export function isComplete(condition: Condition): boolean { | ||
if (isFilterCondition(condition)) { | ||
return condition.field !== undefined && condition.field !== ''; | ||
} | ||
if (isAndCondition(condition)) { | ||
return condition.and.every(isComplete); | ||
} | ||
if (isOrCondition(condition)) { | ||
return condition.or.every(isComplete); | ||
} | ||
return false; | ||
} | ||
|
||
export function getFields( | ||
condition: Condition | ||
): Array<{ name: string; type: 'number' | 'string' }> { | ||
const fields = collectFields(condition); | ||
// deduplicate fields, if mapped as string and number, keep as number | ||
const uniqueFields = new Map<string, 'number' | 'string'>(); | ||
fields.forEach((field) => { | ||
const existing = uniqueFields.get(field.name); | ||
if (existing === 'number') { | ||
return; | ||
} | ||
if (existing === 'string' && field.type === 'number') { | ||
uniqueFields.set(field.name, 'number'); | ||
return; | ||
} | ||
uniqueFields.set(field.name, field.type); | ||
}); | ||
|
||
return Array.from(uniqueFields).map(([name, type]) => ({ name, type })); | ||
} | ||
|
||
function collectFields(condition: Condition): Array<{ name: string; type: 'number' | 'string' }> { | ||
if (isFilterCondition(condition)) { | ||
return [{ name: condition.field, type: getFieldTypeForFilterCondition(condition) }]; | ||
} | ||
if (isAndCondition(condition)) { | ||
return condition.and.flatMap(collectFields); | ||
} | ||
if (isOrCondition(condition)) { | ||
return condition.or.flatMap(collectFields); | ||
} | ||
return []; | ||
} | ||
|
||
function getFieldTypeForFilterCondition(condition: FilterCondition): 'number' | 'string' { | ||
switch (condition.operator) { | ||
case 'gt': | ||
case 'gte': | ||
case 'lt': | ||
case 'lte': | ||
return 'number'; | ||
case 'neq': | ||
case 'eq': | ||
case 'exists': | ||
case 'contains': | ||
case 'startsWith': | ||
case 'endsWith': | ||
case 'notExists': | ||
return 'string'; | ||
default: | ||
return 'string'; | ||
} | ||
} | ||
|
||
export function validateCondition(condition: Condition) { | ||
if (isFilterCondition(condition)) { | ||
// check whether a field is specified | ||
if (!condition.field.trim()) { | ||
throw new Error('Field is required in conditions'); | ||
} | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
x-pack/plugins/streams/server/lib/streams/helpers/condition_guards.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { | ||
AndCondition, | ||
conditionSchema, | ||
FilterCondition, | ||
filterConditionSchema, | ||
OrCondition, | ||
} from '../../../../common/types'; | ||
|
||
export function isFilterCondition(subject: any): subject is FilterCondition { | ||
const result = filterConditionSchema.safeParse(subject); | ||
return result.success; | ||
} | ||
|
||
export function isAndCondition(subject: any): subject is AndCondition { | ||
const result = conditionSchema.safeParse(subject); | ||
return result.success && subject.and != null; | ||
} | ||
|
||
export function isOrCondition(subject: any): subject is OrCondition { | ||
const result = conditionSchema.safeParse(subject); | ||
return result.success && subject.or != null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
x-pack/plugins/streams/server/lib/streams/helpers/condition_to_query_dsl.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { Condition, FilterCondition } from '../../../../common/types'; | ||
import { isAndCondition, isFilterCondition, isOrCondition } from './condition_guards'; | ||
|
||
function conditionToClause(condition: FilterCondition) { | ||
switch (condition.operator) { | ||
case 'neq': | ||
return { bool: { must_not: { match: { [condition.field]: condition.value } } } }; | ||
case 'eq': | ||
return { match: { [condition.field]: condition.value } }; | ||
case 'exists': | ||
return { exists: { field: condition.field } }; | ||
case 'gt': | ||
return { range: { [condition.field]: { gt: condition.value } } }; | ||
case 'gte': | ||
return { range: { [condition.field]: { gte: condition.value } } }; | ||
case 'lt': | ||
return { range: { [condition.field]: { lt: condition.value } } }; | ||
case 'lte': | ||
return { range: { [condition.field]: { lte: condition.value } } }; | ||
case 'contains': | ||
return { wildcard: { [condition.field]: `*${condition.value}*` } }; | ||
case 'startsWith': | ||
return { prefix: { [condition.field]: condition.value } }; | ||
case 'endsWith': | ||
return { wildcard: { [condition.field]: `*${condition.value}` } }; | ||
case 'notExists': | ||
return { bool: { must_not: { exists: { field: condition.field } } } }; | ||
default: | ||
return { match_none: {} }; | ||
} | ||
} | ||
|
||
export function conditionToQueryDsl(condition: Condition): any { | ||
if (isFilterCondition(condition)) { | ||
return conditionToClause(condition); | ||
} | ||
if (isAndCondition(condition)) { | ||
const and = condition.and.map((filter) => conditionToQueryDsl(filter)); | ||
return { | ||
bool: { | ||
must: and, | ||
}, | ||
}; | ||
} | ||
if (isOrCondition(condition)) { | ||
const or = condition.or.map((filter) => conditionToQueryDsl(filter)); | ||
return { | ||
bool: { | ||
should: or, | ||
}, | ||
}; | ||
} | ||
return { | ||
match_none: {}, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should
total
reflect the overall total or the total the userhasAccess
to?If the former (as implemented here) is there any risk avenue in "leaking" that there are potentially more entries?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point - there isn't really a point of sending total at the moment as we don't have pagination anyway. I just removed it