mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Rename iter.pipeline as iter.chain
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
1841907eb8
commit
9f4941f4a8
@ -15,12 +15,12 @@ interface Iterator<T> extends Iterable<T> {
|
||||
join(sep?: string): string;
|
||||
}
|
||||
|
||||
export function pipeline<T>(src: IterableIterator<T>): Iterator<T> {
|
||||
export function chain<T>(src: IterableIterator<T>): Iterator<T> {
|
||||
return {
|
||||
filter: (fn) => pipeline(filter(src, fn)),
|
||||
filterMap: (fn) => pipeline(filterMap(src, fn)),
|
||||
map: (fn) => pipeline(map(src, fn)),
|
||||
flatMap: (fn) => pipeline(flatMap(src, fn)),
|
||||
filter: (fn) => chain(filter(src, fn)),
|
||||
filterMap: (fn) => chain(filterMap(src, fn)),
|
||||
map: (fn) => chain(map(src, fn)),
|
||||
flatMap: (fn) => chain(flatMap(src, fn)),
|
||||
find: (fn) => find(src, fn),
|
||||
join: (sep) => join(src, sep),
|
||||
collect: (fn) => fn(src),
|
||||
|
||||
@ -34,7 +34,7 @@ export class KubeconfigSyncManager {
|
||||
const seenIds = new Set<string>();
|
||||
|
||||
return (
|
||||
iter.pipeline(this.sources.values())
|
||||
iter.chain(this.sources.values())
|
||||
.flatMap(([entities]) => entities.get())
|
||||
.filter(entity => {
|
||||
const alreadySeen = seenIds.has(entity.getId());
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
*/
|
||||
import type { V1APIGroupList } from "@kubernetes/client-node";
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { pipeline } from "../../common/utils/iter";
|
||||
import { chain } from "../../common/utils/iter";
|
||||
import k8sRequestInjectable from "../k8s-request.injectable";
|
||||
import { requestApiVersionsInjectionToken } from "./request-api-versions";
|
||||
|
||||
@ -16,7 +16,7 @@ const requestNonCoreApiVersionsInjectable = getInjectable({
|
||||
return async (cluster) => {
|
||||
const { groups } = await k8sRequest(cluster, "/apis") as V1APIGroupList;
|
||||
|
||||
return pipeline(groups.values())
|
||||
return chain(groups.values())
|
||||
.filterMap(group => group.preferredVersion?.groupVersion && ({
|
||||
group: group.name,
|
||||
path: `/apis/${group.preferredVersion.groupVersion}`,
|
||||
|
||||
@ -86,7 +86,7 @@ export class AddSecretDialog extends React.Component<AddSecretDialogProps> {
|
||||
};
|
||||
|
||||
private getDataFromFields = (fields: SecretTemplateField[] = [], processValue: (val: string) => string = (val => val)) => {
|
||||
return iter.pipeline(fields.values())
|
||||
return iter.chain(fields.values())
|
||||
.filterMap(({ key, value }) => (
|
||||
value
|
||||
? [key, processValue(value)] as const
|
||||
|
||||
@ -67,7 +67,7 @@ const NonInjectedCommandDialog = observer(({
|
||||
}
|
||||
};
|
||||
|
||||
const activeCommands = iter.pipeline(commands.get().values())
|
||||
const activeCommands = iter.chain(commands.get().values())
|
||||
.filter(command => {
|
||||
try {
|
||||
return command.isActive(context);
|
||||
|
||||
@ -27,7 +27,7 @@ export function cssNames(...classNames: IClassName[]): string {
|
||||
}
|
||||
}
|
||||
|
||||
return iter.pipeline(classNamesEnabled.entries())
|
||||
return iter.chain(classNamesEnabled.entries())
|
||||
.filter(([, isActive]) => !!isActive)
|
||||
.filterMap(([className]) => className.trim())
|
||||
.join(" ");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user