committed by
Henning Jacobs
parent
b3952a2d73
commit
d257337a5a
@@ -74,11 +74,22 @@ export default class App {
|
||||
return labels && labels[name] === value
|
||||
}
|
||||
|
||||
namespaceMatches(pod, value) {
|
||||
return pod.namespace === value
|
||||
}
|
||||
|
||||
createMatchesFunctionForQuery(query) {
|
||||
if (query.includes('=')) {
|
||||
const labelAndValue = query.split('=', 2)
|
||||
return pod => this.labelMatches(pod, labelAndValue[0], labelAndValue[1])
|
||||
} else {
|
||||
if (query.startsWith('namespace=')) {
|
||||
// filter by namespace
|
||||
const value = query.split('namespace=', 2)[1]
|
||||
return pod => this.namespaceMatches(pod, value)
|
||||
} else if (query.includes('=')) {
|
||||
// filter by label
|
||||
const [label, value] = query.split('=', 2)
|
||||
return pod => this.labelMatches(pod, label, value)
|
||||
}
|
||||
else {
|
||||
// filter by name
|
||||
return pod => this.nameMatches(pod, query)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ You can filter by:
|
||||
|
||||
* name
|
||||
* labels - when query includes ``=``, e.g. ``env=prod``
|
||||
* namespace - when query starts with ``namespace``, e.g. ``namespace=default``
|
||||
|
||||
The pod filter is persisted in the location bar (``#q=..`` query parameter) which allows to conveniently send the filtered view to other users (e.g. for troubleshooting).
|
||||
|
||||
|
||||
Reference in New Issue
Block a user