Add several more util functions and tests (#4106)

This commit is contained in:
Sebastian Malton authored and GitHub committed 2021-10-26 09:36:34 -04:00
1 parent 0aabc9a5de
commit 5abc1c618c
9 files changed
+132 -31

No files matched your search

@@ -49,7 +49,7 @@ export class ServiceAccountsSecret extends React.Component<Props, State> {
<>
{!showToken && (
<>
<span className="asterisks">{Array(16).fill("•").join("")}</span>
<span className="asterisks">{"•".repeat(16)}</span>
<Icon
small material="lock_open"
tooltip="Show value"
+2 -2
View File
@@ -32,7 +32,7 @@ import type { Align, ListOnScrollProps } from "react-window";
import { SearchStore, searchStore } from "../../../common/search-store";
import { UserStore } from "../../../common/user-store";
import { boundMethod, cssNames } from "../../utils";
import { array, boundMethod, cssNames } from "../../utils";
import { Spinner } from "../spinner";
import { VirtualList } from "../virtual-list";
import { logStore } from "./log.store";
@@ -234,7 +234,7 @@ export class LogList extends React.Component<Props> {
render() {
const { isLoading } = this.props;
const isInitLoading = isLoading && !this.logs.length;
const rowHeights = new Array(this.logs.length).fill(this.lineHeight);
const rowHeights = array.filled(this.logs.length, this.lineHeight);
if (isInitLoading) {
return (
+2 -2
View File
@@ -20,7 +20,7 @@
*/
import type { TableSortCallback } from "./table";
import { array, Ordering, rectifyOrdering, sortCompare } from "../../utils";
import { Ordering, rectifyOrdering, sortCompare, tuple } from "../../utils";
export function getSorted<T>(rawItems: T[], sortingCallback: TableSortCallback<T> | undefined, orderByRaw: string): T[] {
if (typeof sortingCallback !== "function") {
@@ -40,7 +40,7 @@ export function getSorted<T>(rawItems: T[], sortingCallback: TableSortCallback<T
const leftSortBy = [left.sortBy].flat();
const rightSortBy = [right.sortBy].flat();
const zipIter = array.zipStrict(leftSortBy, rightSortBy);
const zipIter = tuple.zip(leftSortBy, rightSortBy);
let r = zipIter.next();
for (; r.done === false; r = zipIter.next()) {