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
6 changes: 3 additions & 3 deletions apps/ocp-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@
"svg-url-loader": "^8.0.0",
"terser-webpack-plugin": "^5.3.9",
"tsconfig-paths-webpack-plugin": "^4.1.0",
"ts-loader": "^9.4.4",
"ts-loader": "^9.6.2",
"url-loader": "^4.1.1",
"webpack": "^5.105.4",
"webpack-dev-server": "^6.0.0"
"webpack-dev-server": "^6.1.0"
},
"dependencies": {
"@openshift-console/dynamic-plugin-sdk": "4.19.1",
Expand All @@ -93,7 +93,7 @@
"react-i18next": "^11.7.3",
"react-redux": "7.2.2",
"react-router-dom": "^5.3.x",
"react-router-dom-v5-compat": "6.30.3",
"react-router-dom-v5-compat": "6.30.6",
"yup": "^1.3.3"
}
}
1 change: 0 additions & 1 deletion apps/ocp-plugin/src/components/AppContext/AppContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {
useParams,
useSearchParams,
} from 'react-router-dom-v5-compat';
// @ts-expect-error Provided by the OCP console in the runtime environment.
import { Prompt } from 'react-router-dom';
import { getUser } from '@openshift-console/dynamic-plugin-sdk/lib/app/core/reducers';
import { useSelector } from 'react-redux';
Expand Down
8 changes: 4 additions & 4 deletions apps/standalone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
"style-loader": "^3.3.3",
"svg-url-loader": "^8.0.0",
"terser-webpack-plugin": "^5.3.9",
"ts-loader": "^9.4.4",
"ts-loader": "^9.6.2",
"tsconfig-paths-webpack-plugin": "^4.1.0",
"url-loader": "^4.1.1",
"webpack": "^5.105.4",
"webpack-dev-server": "^6.0.0"
"webpack-dev-server": "^6.1.0"
},
"dependencies": {
"@patternfly/patternfly": "^6.4.0",
Expand All @@ -51,13 +51,13 @@
"formik": "^2.4.5",
"i18next": "^21.8.14",
"i18next-browser-languagedetector": "^7.2.1",
"i18next-http-backend": "^2.5.0",
"i18next-http-backend": "4.0.10",
"js-yaml": "^4.3.0",
"monaco-editor": "^0.51.0",
"react": "17.0.1",
"react-dom": "17.0.1",
"react-i18next": "^11.7.3",
"react-router-dom": "^6.30.3",
"react-router-dom": "^6.30.6",
"yup": "^1.3.3"
}
}
6 changes: 3 additions & 3 deletions libs/ui-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
"@types/file-saver": "^2.0.5",
"@types/react-dom": "^18.2.17",
"@types/semver": "^7.5.2",
"react-router": "6.30.3",
"react-router-dom": "6.30.3"
"react-router": "6.30.6",
"react-router-dom": "6.30.6"
},
"dependencies": {
"@rjsf/core": "5.24.13",
Expand Down Expand Up @@ -61,7 +61,7 @@
"react": "17.0.1 - 18.x",
"react-dom": "17.0.1 - 18.x",
"react-i18next": "11.7.3 - 15.x",
"react-router-dom": "^5.3 || ^6.30.3",
"react-router-dom": "^5.3 || ^6.30.6",
"victory": "^37.3.6"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -196,14 +196,14 @@ const getRoleAssignment = (values: AuthProviderFormValues): AuthRoleAssignment =
type: RoleAssignmentType.Static,
roles: values.staticRoles || [],
};
return staticAssignment as AuthRoleAssignment;
return staticAssignment;
} else {
const dynamicAssignment: AuthDynamicRoleAssignment = {
type: RoleAssignmentType.Dynamic,
claimPath: values.roleClaimPath || [],
separator: values.roleSeparator || DEFAULT_ROLE_SEPARATOR,
};
return dynamicAssignment as AuthRoleAssignment;
return dynamicAssignment;
}
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as Yup from 'yup';
import * as semver from 'semver';
import validator from '@rjsf/validator-ajv8';
import { type RJSFSchema } from '@rjsf/utils';
import { dump, load } from 'js-yaml';
import { type TFunction } from 'i18next';
import isEqual from 'lodash/isEqual';
Expand Down Expand Up @@ -342,7 +341,7 @@ const jsonSchemaFieldSchema = (t: TFunction) =>
if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {
return false;
}
validator.validateFormData({}, parsed as RJSFSchema);
validator.validateFormData({}, parsed);
return true;
} catch {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ const CatalogItemDetailsModal = ({
const { t } = useTranslation();
const { patch, remove } = useFetch();

const displayName = item.spec.displayName || (item.metadata.name as string);
const displayName = item.spec.displayName || item.metadata.name || '';
const itemEndpoint = `catalogs/${item.metadata.catalog}/items/${item.metadata.name}`;

switch (itemModalOpen) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { load } from 'js-yaml';
import { type RJSFSchema, type RJSFValidationError } from '@rjsf/utils';
import { type RJSFValidationError } from '@rjsf/utils';
import validator from '@rjsf/validator-ajv8';

import { useTranslation } from '../../hooks/useTranslation';
Expand Down Expand Up @@ -35,7 +35,7 @@ export const useSubmitCatalogForm = <
return false;
}
if (values.configSchema) {
const validationData = validator.validateFormData(yamlContent, values.configSchema as RJSFSchema);
const validationData = validator.validateFormData(yamlContent, values.configSchema);
if (validationData.errors.length) {
setSchemaErrors(validationData.errors);
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as Yup from 'yup';
import semver from 'semver';
import { load } from 'js-yaml';
import validator from '@rjsf/validator-ajv8';
import type { RJSFSchema, RJSFValidationError } from '@rjsf/utils';
import type { RJSFValidationError } from '@rjsf/utils';
import type { TFunction } from 'i18next';

import { type ApplicationProviderSpec, type CatalogItemRefSpec, OsModeType } from '@flightctl/types';
Expand Down Expand Up @@ -76,7 +76,7 @@ export const validateCatalogAdvancedConfig = (
try {
const yamlContent = load(values.editorContent || '');
if (values.configSchema) {
const validationData = validator.validateFormData(yamlContent, values.configSchema as RJSFSchema);
const validationData = validator.validateFormData(yamlContent, values.configSchema);
if (validationData.errors.length) {
return {
errors: { editorContent: t('Configuration is not valid') },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,11 +426,9 @@ const DeviceToolbarFilter = ({
ref={toggleRef}
onClick={onToggle}
isExpanded={isSearchTypeExpanded}
style={
{
width: '250px',
} as React.CSSProperties
}
style={{
width: '250px',
}}
>
{getDeviceFilterLabel(t, selectedSearchType)}
</MenuToggle>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,10 @@ import {
type ComposeAppForm,
type ConfigSourceProvider,
ConfigType,
type GitConfigTemplate,
type HelmAppForm,
type HttpConfigTemplate,
type InlineConfigTemplate,
type InlineFileForm,
type KubeSecretTemplate,
type ManualAppForm,
type PortMapping,
type QuadletAppForm,
Expand Down Expand Up @@ -429,9 +427,9 @@ const hasApplicationChanged = (current: ApplicationProviderSpec, updated: Applic
case AppType.AppTypeHelm:
return hasHelmAppChanged(current as HelmApplication, updated as HelmApplication);
case AppType.AppTypeQuadlet:
return hasQuadletAppChanged(current as QuadletApplication, updated as QuadletApplication, currentSpectType);
return hasQuadletAppChanged(current, updated, currentSpectType);
case AppType.AppTypeCompose:
return hasComposeAppChanged(current as ComposeApplication, updated as ComposeApplication, currentSpectType);
return hasComposeAppChanged(current, updated, currentSpectType);
case AppType.AppTypeVm:
return hasVmAppChanged(current as VmApplication, updated as VmApplication);
}
Expand Down Expand Up @@ -940,9 +938,9 @@ const toFormApps = (app: ApplicationProviderSpec): ManualAppForm => {
case AppType.AppTypeHelm:
return toHelmAppForm(app as HelmApplication);
case AppType.AppTypeQuadlet:
return toQuadletAppForm(app as QuadletApplication);
return toQuadletAppForm(app);
case AppType.AppTypeCompose:
return toComposeAppForm(app as ComposeApplication);
return toComposeAppForm(app);
case AppType.AppTypeVm:
return toVmAppForm(app as VmApplication);
default:
Expand Down Expand Up @@ -1030,7 +1028,7 @@ export const getConfigTemplatesValues = (deviceSpec?: DeviceSpec, registerMicroS
path: c.gitRef.path,
repository: c.gitRef.repository,
targetRevision: c.gitRef.targetRevision,
} as GitConfigTemplate;
};
}
if (isK8sSecretProviderSpec(c)) {
return {
Expand All @@ -1039,7 +1037,7 @@ export const getConfigTemplatesValues = (deviceSpec?: DeviceSpec, registerMicroS
mountPath: c.secretRef.mountPath,
secretName: c.secretRef.name,
secretNs: c.secretRef.namespace,
} as KubeSecretTemplate;
};
}
if (isHttpProviderSpec(c)) {
return {
Expand All @@ -1062,7 +1060,7 @@ export const getConfigTemplatesValues = (deviceSpec?: DeviceSpec, registerMicroS
permissions: inline.mode !== undefined ? formatFileMode(inline.mode) : undefined,
content: inline.content,
base64: inline.contentEncoding === EncodingType.EncodingBase64,
} as InlineConfigTemplate['files'][0];
};
}),
} as InlineConfigTemplate;
}) || []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ const EnrollmentRequestList = ({ refetchDevices, isStandalone }: EnrollmentReque
isRowSelected={isRowSelected}
rowIndex={index}
onApprove={() => {
setApprovingErId(er.metadata.name as string);
setApprovingErId(er.metadata.name);
}}
canApprove={canApprove}
canDelete={canDelete}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const getImagePromotion = (values: ImagePromotionFormValues, buildName: s
version: values.newItem.version,
readme: optionalTrimmed(values.newItem.readme),
displayName: optionalTrimmed(values.newItem.displayName),
} as NewCatalogItemTarget;
};
} else {
const skips = (values.existingItem.skips || '')
.split(',')
Expand All @@ -48,7 +48,7 @@ export const getImagePromotion = (values: ImagePromotionFormValues, buildName: s
replaces: optionalTrimmed(values.existingItem.replaces),
skipRange: optionalTrimmed(values.existingItem.skipRange),
skips: skips.length ? skips : undefined,
} as ExistingCatalogItemTarget;
};
}

const newImagePromotion: ImagePromotion = {
Expand Down
2 changes: 1 addition & 1 deletion libs/ui-components/src/components/ImagePromotion/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const getEditInitialValues = (imagePromotion: ImagePromotion): ImagePromo
const newTarget = target as NewCatalogItemTarget;

return {
name: (imagePromotion.metadata.name || '') as '',
name: imagePromotion.metadata.name || '',
catalog: (isExisting ? existingTarget.catalogName : newTarget.catalogName) || '',
type: isExisting ? 'existing' : 'new',
exportFormats: imagePromotion.spec.source.exportFormats || [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ const CreateResourceSyncsForm = ({
path: '',
targetRevision: '',
type: defaultSyncType,
} as ResourceSyncFormValue)
})
}
>
{t('Add resource sync')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,14 @@ const ResourceSyncImport = ({ type }: { type: 'fleet' | 'catalog' }) => {
<Stack hasGutter>
{pendingRs.map((rs) => {
return (
<StackItem key={rs.metadata.name as string}>
<StackItem key={rs.metadata.name}>
<ResourceSyncInfoAlert rs={rs} type={type} />
</StackItem>
);
})}
{errorRs.map((rs) => {
return (
<StackItem key={rs.metadata.name as string}>
<StackItem key={rs.metadata.name}>
<ResourceSyncErrorAlert rs={rs} refetch={rsRefetch} type={type} />
</StackItem>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ const EntitySecurityOverviewCard = ({
<VulnerabilitiesTable
isSingleDevice
isUpdating={isUpdating}
vulnerabilities={vulnerabilities as Vulnerability[]}
vulnerabilities={vulnerabilities}
selectedSeverities={selectedSeverities}
setSelectedSeverities={setSelectedSeverities}
search={search}
Expand Down
12 changes: 7 additions & 5 deletions libs/ui-components/src/components/charts/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import percentRound from 'percent-round';

import { type StatusItem, getDefaultStatusColor } from '../../utils/status/common';
import { type FilterSearchParams } from '../../utils/status/devices';
import { ROUTE, type Route } from '../../hooks/useNavigate';
import { type LinkProps, ROUTE } from '../../hooks/useNavigate';

export type StatusMap = Record<string, number>;

Expand All @@ -24,14 +24,16 @@ export const toChartData = <T extends string>(
const query = new URLSearchParams(baseQuery);
query.append(filterName, statusId);

const link: LinkProps = {
to: ROUTE.DEVICES,
query: query.toString(),
};

return {
x: `${statusItem.label}`,
y: entryIndex === -1 ? 0 : percentages[entryIndex],
color: statusItem.customColor || getDefaultStatusColor(statusItem.level),
link: {
to: ROUTE.DEVICES as Route,
query: query.toString(),
},
link,
tooltip: `${map[statusId]} ${statusItem.label}`,
};
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const buildAllDropdownActions = (actions: IAction[], dangerActions: IActi
if (dangerActions.length === 0) {
return actions;
}
return [...actions, { isSeparator: true } as IAction, ...dangerActions];
return [...actions, { isSeparator: true }, ...dangerActions];
};

export default ActionsDropdownList;
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const getFilename = (obj: FlightCtlYamlResource) => {
if (obj.kind === ResourceKind.DEVICE) {
filename = obj.metadata.labels?.alias;
}
return filename || (obj.metadata.name as string);
return filename || obj.metadata.name;
};

const createPatchList = (original: FlightCtlYamlResource, updated: FlightCtlYamlResource): PatchRequest => {
Expand Down
2 changes: 1 addition & 1 deletion libs/ui-components/src/components/form/UploadField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const UploadField = ({ ariaLabel, maxFileBytes, isRequired, name }: UploadFieldP
allowEditingUploadedText
style={{ resize: 'vertical' }}
validated={isValid || isFileUploading ? 'default' : 'error'}
value={field.value as string}
value={field.value}
filename={filename ? t('Content loaded from: {{ filename }}', { filename }) : ''}
onDataChange={handleFileChange}
onTextChange={handleFileChange}
Expand Down
2 changes: 1 addition & 1 deletion libs/ui-components/src/hooks/useDeviceLogs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ export const useDeviceLogs = ({ deviceId }: UseDeviceLogsArgs) => {
}
if (isMountedRef.current) {
if (err.message === 'TIMEOUT' || err.message === 'CONNECTION_ERROR') {
setErrorTypeOrMsg(err.message as DeviceLogErrorType);
setErrorTypeOrMsg(err.message);
} else {
setErrorTypeOrMsg(getErrorMessage(e) as DeviceLogErrorType);
}
Expand Down
Loading
Loading