Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/components/DownloadImageDialog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ import { DropDownButton } from '../DropDownButton';

import pickBy from 'lodash/pickBy';
import debounce from 'lodash/debounce';
import isEmpty from 'lodash/isEmpty';
import type { DeviceType, Dictionary, OsVersionsByDeviceType } from './models';
import { OsTypesEnum } from './models';
import uniq from 'lodash/uniq';
import { uniq } from '../../utils/arrays';
import { enqueueSnackbar } from 'notistack';
import { DialogWithCloseButton } from '../DialogWithCloseButton';
import type { CalloutProps } from '../Callout';
Expand All @@ -36,6 +35,7 @@ import { Spinner } from '../Spinner';
import { faDownload } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import * as semver from 'balena-semver';
import { isObjectEmpty } from '../../utils/objects';

const etcherLogoBase64 =
'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODAwIiBoZWlnaHQ9IjYwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KIDxnPgogIDx0aXRsZT5FdGNoZXI8L3RpdGxlPgogIDxnIGlkPSJzdmdfMSIgc3Ryb2tlPSJudWxsIj4KICAgPHBhdGggaWQ9InN2Z18yIiBjbGFzcz0ic3QxIiBkPSJtNDEyLjkwMzgzLDM1OC4wNjcxM2wwLDE3MS40OTU4M2M3LjQ5MjU0LC0xLjY2NTAxIDE0LjE1MjU3LC0zLjMzMDAyIDIwLjgxMjYsLTcuNDkyNTRsMTQyLjM1ODE5LC04MS41ODUzOWMyMC44MTI2LC0xMS42NTUwNiAzMy4zMDAxNiwtMzQuMTMyNjYgMzMuMzAwMTYsLTU4LjI3NTI4bDAsLTE2Mi4zMzgyOGMwLC02LjY2MDAzIC0wLjgzMjUs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TMuMzIwMDYsNS44Mjc1MyAyMC44MTI2LDcuNDkyNTRsMCwtMTcxLjQ5NTgzYy0wLjgzMjUsLTI0Ljk3NTEyIC03LjQ5MjU0LC00NS43ODc3MiAtMzkuOTYwMTksLTY5LjA5NzgzbDAsLTAuMDAwMDF6IiBmaWxsPSIjQTVERTM3IiBzdHJva2U9Im51bGwiLz4KICA8L2c+CiA8L2c+Cgo8L3N2Zz4=';
Expand Down Expand Up @@ -68,9 +68,9 @@ const getUniqueOsTypes = (
deviceTypeSlug: string | undefined,
) => {
if (
isEmpty(osVersions) ||
isObjectEmpty(osVersions) ||
!deviceTypeSlug ||
isEmpty(osVersions[deviceTypeSlug])
osVersions[deviceTypeSlug]?.length === 0
) {
return [];
}
Expand Down Expand Up @@ -237,7 +237,7 @@ export const DownloadImageDialog = ({
}
: {},
);
const [isFetching, setIsFetching] = useState(isEmpty(osVersions));
const [isFetching, setIsFetching] = useState(isObjectEmpty(osVersions));
const [downloadSize, setDownloadSize] = useState<string | null>(null);
const [isValidatingUrl, setIsValidatingUrl] = useState(false);

Expand Down Expand Up @@ -488,7 +488,7 @@ export const DownloadImageDialog = ({
<Spinner />
) : (
<>
{isEmpty(osVersions) && (
{isObjectEmpty(osVersions) && (
<Callout severity="warning">
No OS versions available for download
</Callout>
Expand Down
2 changes: 1 addition & 1 deletion src/components/DownloadImageDialog/version.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import uniq from 'lodash/uniq';
import { uniq } from '../../utils/arrays';
import partition from 'lodash/partition';
import type { Dictionary, OsVersion } from './models';

Expand Down
21 changes: 11 additions & 10 deletions src/components/DropDownButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { Button, ButtonGroup, MenuItem, Menu } from '@mui/material';
import { ButtonWithTracking } from '../ButtonWithTracking';
import { useAnalyticsContext } from '../../contexts/AnalyticsContext';
import groupBy from 'lodash/groupBy';
import flatMap from 'lodash/flatMap';
import { Tooltip } from '../Tooltip';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import {
Expand Down Expand Up @@ -59,16 +58,18 @@ export const DropDownButton = <T extends unknown>({
return items;
}
const grouped = groupBy(items, (item) => item[groupByProp]);
const keys = Object.keys(grouped);
const lastKey = keys[keys.length - 1];
const entries = Object.entries(grouped);
const lastKey = entries.at(-1)?.[0];

return flatMap(grouped, (value, key) => [
...value.map((v, index) =>
key !== lastKey && index === value.length - 1
? { ...v, divider: true }
: v,
),
]).filter((item) => item);
return entries
.flatMap(([key, value]) =>
value.map((v, index) =>
key !== lastKey && index === value.length - 1
? { ...v, divider: true }
: v,
),
)
.filter(Boolean);
}, [items, groupByProp]);

const handleClick = (
Expand Down
2 changes: 1 addition & 1 deletion src/components/Form/Widgets/FileWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
faUpload,
} from '@fortawesome/free-solid-svg-icons';
import { useRandomUUID } from '../../../hooks/useRandomUUID';
import uniq from 'lodash/uniq';
import { uniq } from '../../../utils/arrays';
import { token } from '../../../utils/token';

const restingStyle: SxProps = {
Expand Down
7 changes: 4 additions & 3 deletions src/components/RJST/DataTypes/array.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import type { CreateFilter } from './utils';
import { getDataTypeSchema } from './utils';
import { getDataModel } from '.';
import { getRefSchema, isJSONSchema } from '../schemaOps';
import { isObjectEmpty } from '../../../utils/objects';

export const operators = () => ({
contains: 'contains',
Expand Down Expand Up @@ -42,7 +43,7 @@ const buildFilterForPropertySchema = (
): JSONSchema => {
const filter = getFilter(field, schema, value, operator);

if (!Object.keys(filter).length) {
if (isObjectEmpty(filter)) {
return {};
}
return {
Expand Down Expand Up @@ -93,7 +94,7 @@ const getFilter = (
operator: effectiveOperator,
value,
});
if (!filter || typeof filter !== 'object' || !Object.keys(filter).length) {
if (!filter || typeof filter !== 'object' || isObjectEmpty(filter)) {
return {};
}

Expand All @@ -103,7 +104,7 @@ const getFilter = (

return recursiveFilter &&
isJSONSchema(recursiveFilter) &&
Object.keys(recursiveFilter).length
!isObjectEmpty(recursiveFilter)
? wrapFilter(recursiveFilter)
: {};
};
Expand Down
37 changes: 28 additions & 9 deletions src/components/RJST/DataTypes/object.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { JSONSchema7 as JSONSchema } from 'json-schema';
import find from 'lodash/find';
import type { CreateFilter, KeysOfUnion } from './utils';
import { getDataTypeSchema, regexEscape } from './utils';
import type { FormData } from '../components/Filters/SchemaSieve';
Expand All @@ -8,23 +7,43 @@ import {
createModelFilter,
} from '../components/Filters/SchemaSieve';
import { isJSONSchema, getRefSchema } from '../schemaOps';
import findKey from 'lodash/findKey';
import pick from 'lodash/pick';
import mapValues from 'lodash/mapValues';

const findValueByDescription = (
obj: object | undefined,
description: string,
) => {
return Object.values(obj ?? {}).find(
(property) =>
typeof property === 'object' &&
'description' in property &&
property.description === description,
) as JSONSchema | undefined;
};

const findKeyByDescription = (obj: object | undefined, description: string) => {
return Object.entries(obj ?? {}).find(
([, value]) =>
typeof value === 'object' &&
'description' in value &&
value.description === description,
)?.[0];
};

const getKeyLabel = (schema: JSONSchema) => {
const s = find(schema.properties, { description: 'key' }) as JSONSchema;
const s = findValueByDescription(schema.properties, 'key');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can remove these 2 find methods and reuse

export const findInObject = (obj: Record<string, any>, key: string): any => {

Copy link
Contributor Author

@myarmolinsky myarmolinsky Sep 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please explain why you think so? They do not appear alike to me

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nvm sorry my bad 🙏
we can probably replace one of them but I'm also thinking that the fact that these 2 methods are only checking the first level was intentional for filters logic

return s?.title ?? 'key';
};

const getValueLabel = (schema: JSONSchema) => {
const s = find(schema.properties, { description: 'value' }) as JSONSchema;
const s = findValueByDescription(schema.properties, 'value');
return s?.title ?? 'value';
};

export const isKeyValueObj = (schema: JSONSchema) =>
!!find(schema.properties, { description: 'key' }) ||
!!find(schema.properties, { description: 'value' });
!!findValueByDescription(schema.properties, 'key') ||
!!findValueByDescription(schema.properties, 'value');

export const operators = (s: JSONSchema) => {
return {
Expand Down Expand Up @@ -94,7 +113,7 @@ const getValueForOperation = (
? 'value'
: null;
const schemaProperty = schemaField
? findKey(schema.properties, { description: schemaField })
? findKeyByDescription(schema.properties, schemaField)
: null;

// Return the appropriate value format based on the operation type
Expand Down Expand Up @@ -191,8 +210,8 @@ export const createFilter: CreateFilter<OperatorSlug> = (

// TODO: this case does not cover complex objects for FULL_TEXT_SLUG
if (operator === FULL_TEXT_SLUG && schema.properties) {
const schemaKey = findKey(schema.properties, { description: 'key' });
const schemaValue = findKey(schema.properties, { description: 'value' });
const schemaKey = findKeyByDescription(schema.properties, 'key');
const schemaValue = findKeyByDescription(schema.properties, 'value');
const properties = [schemaKey, schemaValue]
.map((key) =>
key
Expand Down
6 changes: 3 additions & 3 deletions src/components/RJST/Filters/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import {
parseDescription,
parseDescriptionProperty,
} from '../schemaOps';
import isEmpty from 'lodash/isEmpty';
import get from 'lodash/get';
import { isObjectEmpty } from '../../../utils/objects';

const X_FOREIGN_KEY_SCHEMA_SEPARATOR = '___ref_scheme_separator_';

Expand Down Expand Up @@ -69,12 +69,12 @@ export const removeFieldsWithNoFilter = (schema: JSONSchema): JSONSchema => {
}

const hasEmptyProperties =
newValue.properties && isEmpty(newValue.properties);
newValue.properties && isObjectEmpty(newValue.properties);

const hasEmptyItemsProperties =
isJSONSchema(newValue.items) &&
'properties' in newValue.items &&
isEmpty(newValue.items.properties);
isObjectEmpty(newValue.items.properties ?? {});

if (hasEmptyProperties || hasEmptyItemsProperties) {
continue;
Expand Down
3 changes: 1 addition & 2 deletions src/components/RJST/Lenses/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as types from './types';
import type { IconProp } from '@fortawesome/fontawesome-svg-core';
import uniq from 'lodash/uniq';

export interface LensTemplate<T extends { id: number } = any> {
slug: string;
Expand Down Expand Up @@ -32,7 +31,7 @@ export const getLenses = <T extends { id: number }>(
);

const slugs = concatenatedLenses.map((lens) => lens.slug);
if (slugs.length > uniq(slugs).length) {
if (slugs.length > new Set(slugs).size) {
throw new Error('Lenses must have unique slugs');
}

Expand Down
7 changes: 2 additions & 5 deletions src/components/RJST/components/Filters/SchemaSieve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import addFormats from 'ajv-formats';
import pickBy from 'lodash/pickBy';
import Ajv from 'ajv';
import { enqueueSnackbar } from 'notistack';
import { isObjectEmpty } from '../../../../utils/objects';

const ajv = new Ajv();
ajvKeywords(ajv, ['regexp']);
Expand Down Expand Up @@ -130,11 +131,7 @@ export const createFilter = (
operator,
value,
});
if (
!filter ||
typeof filter !== 'object' ||
!Object.keys(filter).length
) {
if (!filter || typeof filter !== 'object' || isObjectEmpty(filter)) {
return {};
}
return {
Expand Down
2 changes: 1 addition & 1 deletion src/components/RJST/components/Table/useTagActions.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useMemo, useState } from 'react';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faPlus } from '@fortawesome/free-solid-svg-icons/faPlus';
import uniq from 'lodash/uniq';
import { uniq } from '../../../../utils/arrays';
import type { RJSTContext } from '../../schemaOps';
import { useQuery } from '@tanstack/react-query';
import { Stack } from '@mui/material';
Expand Down
3 changes: 1 addition & 2 deletions src/components/RJST/components/Widget/Formats/TxtWidget.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import get from 'lodash/get';
import invokeMap from 'lodash/invokeMap';
import isArray from 'lodash/isArray';
import type { UiSchema, Value } from '../utils';
import { UiOption, JsonTypes, widgetFactory, formatTimestamp } from '../utils';
import { Truncate } from '../../../../Truncate';
Expand Down Expand Up @@ -45,7 +44,7 @@ const TxtWidget = widgetFactory(
variant: UiOption.string,
},
)(({ value, schema, uiSchema }) => {
let displayValue = isArray(value)
let displayValue = Array.isArray(value)
? getArrayValue(value as Array<Exclude<typeof value, any[]>>, uiSchema)
: value?.toString();
if (DATE_TIME_FORMATS.includes(schema?.format ?? '')) {
Expand Down
4 changes: 2 additions & 2 deletions src/components/RJST/components/Widget/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import castArray from 'lodash/castArray';
import { toArray } from '../../../../utils/arrays';
import type { Format, UiSchema, Value, WidgetProps } from './utils';
import { JsonTypes } from './utils';
import { typeWidgets } from './Formats';
Expand Down Expand Up @@ -56,7 +56,7 @@ export const Widget = ({

const processedValue = getValue(value, schema, uiSchema);
const subSchema = getSubSchemaFromRefScheme(schema);
const types = subSchema?.type != null ? castArray(subSchema.type) : [];
const types = subSchema?.type != null ? toArray(subSchema.type) : [];

if (processedValue == null && !types.includes(JsonTypes.null)) {
return null;
Expand Down
4 changes: 2 additions & 2 deletions src/components/RJST/models/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import isEmpty from 'lodash/isEmpty';
import { isObjectEmpty } from '../../../utils/objects';
import type { Permissions, RJSTModel, RJSTRawModel } from '../schemaOps';
import { rjstJsonSchemaPick } from '../schemaOps';

Expand Down Expand Up @@ -33,7 +33,7 @@ export const rjstRunTransformers = <
return data;
}

if (!transformers || isEmpty(transformers)) {
if (!transformers || isObjectEmpty(transformers)) {
return data as TResult;
}

Expand Down
3 changes: 2 additions & 1 deletion src/components/RJST/schemaOps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { findInObject } from './utils';
import type { ResourceTagModelService } from '../TagManagementDialog/tag-management-service';
import type { CheckedState } from './components/Table/utils';
import type { PineFilterObject } from './oData/jsonToOData';
import { isObjectEmpty } from '../../utils/objects';

export interface RJSTBaseResource<T> {
id: number;
Expand Down Expand Up @@ -222,7 +223,7 @@ export const isJSONSchema = (
typeof value === 'object' &&
value !== null &&
typeof value !== 'boolean' &&
!!Object.keys(value).length
!isObjectEmpty(value)
);
};

Expand Down
4 changes: 2 additions & 2 deletions src/components/RJST/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { RJSTBaseResource, Permissions, RJSTTagsSdk } from './schemaOps';
import { getPropertyScheme } from './schemaOps';
import castArray from 'lodash/castArray';
import { toArray } from '../../utils/arrays';
import get from 'lodash/get';
import type { JSONSchema7 as JSONSchema } from 'json-schema';
import type { CheckedState } from './components/Table/utils';
Expand Down Expand Up @@ -163,7 +163,7 @@ export const getSortingFunction = <T>(
schemaKey: keyof T,
schemaValue: JSONSchema,
) => {
const types = castArray(schemaValue.type);
const types = toArray(schemaValue.type);
const refScheme = getPropertyScheme(schemaValue);
const splitRefScheme = refScheme?.[0] ? splitPath(refScheme[0]) : null;
if (types.includes(JsonTypes.string)) {
Expand Down
Loading
Loading