forked from hawtio/hawtio-online
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change filtering to push down into the mgmt and k8 services (hawtio#496)
* namespace-client.ts * Change name of 2nd callback parameter to fullPodCount to make it clear this is the total jolokia pods after filtering but before page slicing * Adds filtering and sorting getters/setters to affect the pods returned by the pod watchers * If any change occurs from filtering or sorting then the callback should be called in order to notify the UI * filter.ts * Refactors the TypeFilter to be a single class containing both namespace and pod name values * kubernetes-service.ts * Add/remove the pod projects to/from the service depending on if there are pods returned after filtering * management-service.ts * Add/remove the mgmt pod projects to/from the service depending on if there are pods returned after filtering * Discover context * Use only 1 filter rather than an array * Breaks out the empty state into its own component for use in other parts of the Discover page * DiscoverProjectContent.ts * Needs refresh Effect to reset the pagination index if it is greater than the project count returned * DiscoverToolbar.ts * When the buttons are clicked call the management service functions for filtering and sorting so that all pod projects down to the k8 service are effected. * discover-service.ts * Only responsible for grouping pods rather as filtering is re-assigned to other services
- Loading branch information
1 parent
b48aeca
commit 4ec8d23
Showing
17 changed files
with
566 additions
and
294 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import { KubePod } from "./globals" | ||
|
||
export enum TypeFilterType { | ||
NAME = 'Name', | ||
NAMESPACE = 'Namespace', | ||
} | ||
|
||
export function typeFilterTypeValueOf(str: string): TypeFilterType | undefined { | ||
switch (str) { | ||
case TypeFilterType.NAME: | ||
return TypeFilterType.NAME | ||
case TypeFilterType.NAMESPACE: | ||
return TypeFilterType.NAMESPACE | ||
default: | ||
return undefined | ||
} | ||
} | ||
|
||
export class TypeFilter { | ||
private _nsValues: Set<string> | ||
private _nameValues: Set<string> | ||
|
||
constructor(nsValues?: string[], nameValues?: string[]) { | ||
this._nsValues = new Set(nsValues ?? []) | ||
this._nameValues = new Set(nameValues ?? []) | ||
} | ||
|
||
get nsValues(): string[] { | ||
return Array.from(this._nsValues) | ||
} | ||
|
||
addNSValue(ns: string) { | ||
this._nsValues.add(ns) | ||
} | ||
|
||
deleteNSValue(ns: string) { | ||
this._nsValues.delete(ns) | ||
} | ||
|
||
get nameValues(): string[] { | ||
return Array.from(this._nameValues) | ||
} | ||
|
||
addNameValue(name: string) { | ||
this._nameValues.add(name) | ||
} | ||
|
||
deleteNameValue(name: string) { | ||
this._nameValues.delete(name) | ||
} | ||
|
||
filterNS(ns: string): boolean { | ||
if (this._nsValues.size === 0) return true | ||
|
||
let resolved = false | ||
this._nsValues.forEach(v => { | ||
if (ns.includes(v)) | ||
resolved = true | ||
}) | ||
|
||
return resolved | ||
} | ||
|
||
filterPod(podName: string): boolean { | ||
if (this._nameValues.size === 0) return true | ||
|
||
let resolved = false | ||
this._nameValues.forEach(v => { | ||
if (podName.includes(v)) | ||
resolved = true | ||
}) | ||
|
||
return resolved | ||
} | ||
} |
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.