Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 3 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,9 @@ const flatReact = [
},
{
...reactRefresh.configs.recommended,
rules: {
"react-refresh/only-export-components": "off",
}
},
{
// https://github.com/vitest-dev/eslint-plugin-vitest
Expand Down
4 changes: 4 additions & 0 deletions src/components/ControlPlane/MCPHealthPopoverButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ export default function MCPHealthPopoverButton({

const { t } = useTranslation();

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const handleOpenerClick = (e: any) => {
if (popoverRef.current) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const ref = popoverRef.current as any;
ref.opener = e.target;
setOpen((prev) => !prev);
Expand All @@ -34,6 +36,7 @@ export default function MCPHealthPopoverButton({
Header: t('MCPHealthPopoverButton.statusHeader'),
accessor: 'status',
width: 50,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Cell: (instance: any) => {
const isReady = instance.cell.value === 'True';
return (
Expand All @@ -59,6 +62,7 @@ export default function MCPHealthPopoverButton({
{
Header: t('MCPHealthPopoverButton.transitionHeader'),
accessor: 'lastTransitionTime',
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Cell: (instance: any) => {
return <ReactTimeAgo date={new Date(instance.cell.value)} />;
},
Expand Down
5 changes: 5 additions & 0 deletions src/components/ControlPlanes/ConnectButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ export default function ConnectButton(props: Props) {
const navigate = useLuigiNavigate();
const popoverRef = useRef(null);
const [open, setOpen] = useState(false);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const handleOpenerClick = (e: any) => {
if (popoverRef.current) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const ref = popoverRef.current as any;
ref.opener = e.target;
setOpen((prev) => !prev);
Expand All @@ -40,8 +42,10 @@ export default function ConnectButton(props: Props) {
if (res.isLoading) {
return <></>;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const kubeconfig = yaml.load(res.data as string) as any;

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const contexts = kubeconfig.contexts as any[];
const currentContext = kubeconfig['current-context'];
if (!currentContext) {
Expand Down Expand Up @@ -89,6 +93,7 @@ export default function ConnectButton(props: Props) {
}
}}
>
{/* eslint-disable-next-line @typescript-eslint/no-explicit-any */}
{contexts.map((context: any) => (
<MenuItem
key={context.name}
Expand Down
4 changes: 3 additions & 1 deletion src/components/ControlPlanes/CopyKubeconfigButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ export default function CopyKubeconfigButton() {
const { show } = useToast();
const { t } = useTranslation();

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const handleOpenerClick = (e: any) => {
if (popoverRef.current) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const ref = popoverRef.current as any;
ref.opener = e.target;
setOpen((prev) => !prev);
Expand Down Expand Up @@ -65,6 +67,7 @@ export default function CopyKubeconfigButton() {
);
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function DownloadKubeconfig(config: any, displayName: string) {
const filename = 'kubeconfig-' + displayName + '.yaml';

Expand All @@ -84,7 +87,6 @@ export function DownloadKubeconfig(config: any, displayName: string) {
document.body.removeChild(link);
window.URL.revokeObjectURL(url);
} catch (error) {
debugger;
console.error(error);
}
// dynaLeaveAction(id);
Expand Down
44 changes: 22 additions & 22 deletions src/components/Core/DarkModeSystemSwitcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,29 @@ import { useEffect } from 'react';
import { setTheme } from '@ui5/webcomponents-base/dist/config/Theme.js';

export function DarkModeSystemSwitcher() {
if (window.matchMedia) {
useEffect(() => {
window
.matchMedia('(prefers-color-scheme: dark)')
.addEventListener('change', (e) =>
setTheme(e.matches ? 'sap_horizon_dark' : 'sap_horizon'),
);
useEffect(() => {
if (!window.matchMedia) {
console.warn(
'Dark mode system switcher is not supported in this browser',
);
return;
}

const initialMode = window.matchMedia('(prefers-color-scheme: dark)')
.matches
? 'sap_horizon_dark'
: 'sap_horizon';
setTheme(initialMode);
const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');

return () => {
window
.matchMedia('(prefers-color-scheme: dark)')
.removeEventListener('change', () => {});
};
}, []);
} else {
console.warn('Dark mode system switcher is not supported in this browser');
}
const handleChange = (e: MediaQueryListEvent) => {
setTheme(e.matches ? 'sap_horizon_dark' : 'sap_horizon');
};

return <></>;
mediaQuery.addEventListener('change', handleChange);

const initialMode = mediaQuery.matches ? 'sap_horizon_dark' : 'sap_horizon';
setTheme(initialMode);

return () => {
mediaQuery.removeEventListener('change', handleChange);
};
}, []);

return null; // albo <></>
}
1 change: 1 addition & 0 deletions src/components/Core/IntelligentBreadcrumbs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const PREFIX = '/mcp';
function navigateFromBreadcrumbs(
navigate: (to: string, options?: NavigateOptions) => void,
) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return (event: Ui5CustomEvent<BreadcrumbsDomRef, any>) => {
event.preventDefault();
// @ts-ignore
Expand Down
3 changes: 2 additions & 1 deletion src/components/Dialogs/CreateProjectDialog.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import { validationSchemaProjectWorkspace } from '../../lib/api/validations/sche
import { CreateDialogProps } from './CreateWorkspaceDialogContainer.tsx';

export const CreateProjectWorkspaceDialogWrapper: React.FC<{
spyFormBody?: (data: any) => {};
// eslint-disable-next-line @typescript-eslint/no-explicit-any
spyFormBody?: (data: any) => object;
}> = ({ spyFormBody }) => {
const [isOpen, setIsOpen] = useState(true);

Expand Down
1 change: 1 addition & 0 deletions src/components/Dialogs/DeleteConfirmationDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export function DeleteConfirmationDialog({
};
}, [isOpen]);

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const onConfirmationInputChange = (event: any) => {
if (event.target.value === resourceName) {
setConfirmed(true);
Expand Down
1 change: 1 addition & 0 deletions src/components/Helper/AnimatedHoverTextButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export function AnimatedHoverTextButton({
}: {
text: string;
icon: JSX.Element;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
onClick: (e: any) => void;
}) {
const [hover, setHover] = useState(false);
Expand Down
1 change: 1 addition & 0 deletions src/components/Members/MemberTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const MemberTable: FC<MemberTableProps> = ({
Header: '',
accessor: '.',
width: 50,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Cell: (instance: any) => (
<Button
icon="delete"
Expand Down
3 changes: 3 additions & 0 deletions src/components/Projects/ProjectsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export default function ProjectsList() {
{
Header: t('ProjectsListView.title'),
accessor: 'projectName',
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Cell: (instance: any) => (
<div
style={{
Expand All @@ -43,6 +44,7 @@ export default function ProjectsList() {
{
Header: 'Namespace',
accessor: 'nameSpace',
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Cell: (instance: any) => (
<div
style={{
Expand All @@ -67,6 +69,7 @@ export default function ProjectsList() {
};
}) ?? []
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
onRowClick={(e: any) => {
navigate(
`/mcp/projects/${data ? [e.detail.row.values.projectName] : ''}`,
Expand Down
1 change: 1 addition & 0 deletions src/components/Shared/IllustratedError.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { useTranslation } from 'react-i18next';
interface Props {
title?: string;
subtitleText?: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
error?: any;
}

Expand Down
1 change: 1 addition & 0 deletions src/lib/api/error.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export class APIError extends Error {
status: number;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
info: any;

constructor(message: string, status: number) {
Expand Down
2 changes: 2 additions & 0 deletions src/lib/api/types/crate/createProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ export interface CreateProjectType {
metadata: {
name: string;
annotations: {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[annotation: string]: any;
};
labels: {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[label: string]: any;
};
};
Expand Down
2 changes: 2 additions & 0 deletions src/lib/api/types/crate/createWorkspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ export interface CreateWorkspaceType {
name: string;
namespace: string;
annotations: {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[annotation: string]: any;
};
labels: {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[label: string]: any;
};
};
Expand Down
1 change: 1 addition & 0 deletions src/lib/api/types/k8s/listCustomResourceDefinition.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Resource } from '../resource';

//TODO: typing and jq query
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const CustomResourceDefinitions: Resource<any> = {
path: '/apis/apiextensions.k8s.io/v1/customresourcedefinitions',
jq: '[.items[]]',
Expand Down
2 changes: 2 additions & 0 deletions src/lib/api/useApiResource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ export const useProvidersConfigResource = (config?: SWRConfiguration) => {

export const useApiResourceMutation = <T>(
resource: Resource<T>,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
config?: SWRMutationConfiguration<T, any, any, any>,
) => {
const apiConfig = useContext(ApiConfigContext);
Expand All @@ -177,6 +178,7 @@ export const useApiResourceMutation = <T>(
resource.path === null
? null //TODO: is null a valid key?
: [resource.path, apiConfig],
// eslint-disable-next-line @typescript-eslint/no-explicit-any
([path, apiConfig]: [path: string, config: ApiConfig], arg: any) =>
fetchApiServerJson<T>(
path,
Expand Down
6 changes: 6 additions & 0 deletions src/lib/oidc/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import yaml from 'js-yaml';

// Extract the oidc configuration from the kubeconfig for the current context
export function GetAuthPropsForCurrentContext(data: string): AuthProviderProps {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const kubeconfig = yaml.load(data as string) as any;

const currentContext = kubeconfig['current-context'];
Expand All @@ -19,6 +20,7 @@ export function GetAuthPropsForContextName(
contextName: string,
data: string,
): AuthProviderProps {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const kubeconfig = yaml.load(data as string) as any;
const context = LookupContextByName(contextName, kubeconfig);
return GetAuthPropsForContext(context, kubeconfig);
Expand All @@ -27,6 +29,7 @@ export function GetAuthPropsForContextName(
// Extract the oidc configuration from the kubeconfig for the given context from the users section
export function GetAuthPropsForContext(
context: Context,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
kubeconfig: any,
): AuthProviderProps {
if (!kubeconfig.users) {
Expand Down Expand Up @@ -79,6 +82,7 @@ export function GetAuthPropsForContext(
return props;
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
function LookupContextByName(contextName: string, kubeconfig: any) {
const contexts = kubeconfig.contexts as Context[];
for (let i = 0; i < contexts.length; i++) {
Expand Down Expand Up @@ -109,6 +113,7 @@ function findArguments(args: string[], key: string): string[] {
}
return values;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function lookupUserByName(username: string, kubeconfig: any) {
const users = kubeconfig.users;
for (let i = 0; i < users.length; i++) {
Expand All @@ -128,6 +133,7 @@ type Context = {
user: string;
namespace: string;
cluster: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
extensions: any;
};
};
Loading