mirror of https://github.com/portainer/portainer
chore(deps): upgrade react-query to v4 [EE-6638] (#11041)
parent
104307b2b2
commit
1032b462b4
|
@ -3,7 +3,7 @@ import React from 'react';
|
|||
import { pushStateLocationPlugin, UIRouter } from '@uirouter/react';
|
||||
import { initialize as initMSW, mswLoader } from 'msw-storybook-addon';
|
||||
import { handlers } from '../app/setup-tests/server-handlers';
|
||||
import { QueryClient, QueryClientProvider } from 'react-query';
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||
|
||||
initMSW(
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useMutation, useQuery, useQueryClient } from 'react-query';
|
||||
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
||||
|
||||
import {
|
||||
mutationOptions,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
import { TeamRole, TeamMembership } from '@/react/portainer/users/teams/types';
|
||||
import { useCurrentUser, useIsEdgeAdmin } from '@/react/hooks/useUser';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
import { withError } from '@/react-tools/react-query';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
import { withError } from '@/react-tools/react-query';
|
||||
|
|
|
@ -5,7 +5,7 @@ import {
|
|||
QueryClient,
|
||||
QueryKey,
|
||||
QueryOptions,
|
||||
} from 'react-query';
|
||||
} from '@tanstack/react-query';
|
||||
|
||||
import { notifyError } from '@/portainer/services/notifications';
|
||||
|
||||
|
|
|
@ -99,7 +99,11 @@ export function withControlledInput<T>(
|
|||
(value: T[keyof T]) => {
|
||||
// update the state with the value coming from WrappedComponent
|
||||
setControlledValues(
|
||||
(c) => ({ ...c, [valueKey]: value }) as KeyRecord<T>
|
||||
(c) =>
|
||||
({
|
||||
...c,
|
||||
[valueKey]: value,
|
||||
}) as KeyRecord<T>
|
||||
);
|
||||
|
||||
// call the bound handler func to update the value outside of React
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { ComponentType } from 'react';
|
||||
import { QueryClientProvider } from 'react-query';
|
||||
import { QueryClientProvider } from '@tanstack/react-query';
|
||||
|
||||
import { queryClient as defaultQueryClient } from './react-query';
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useMutation, useQueryClient } from 'react-query';
|
||||
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
|
||||
import { createContainerGroup } from '@/react/azure/services/container-groups.service';
|
||||
import { queryKeys } from '@/react/azure/queries/query-keys';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { useCurrentStateAndParams } from '@uirouter/react';
|
||||
import { useQueryClient } from 'react-query';
|
||||
import { useQueryClient } from '@tanstack/react-query';
|
||||
|
||||
import { useEnvironmentId } from '@/react/hooks/useEnvironmentId';
|
||||
import { AccessControlPanel } from '@/react/portainer/access-control/AccessControlPanel/AccessControlPanel';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useMutation, useQueryClient } from 'react-query';
|
||||
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
|
||||
import { deleteContainerGroup } from '@/react/azure/services/container-groups.service';
|
||||
import { useEnvironmentId } from '@/react/hooks/useEnvironmentId';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
import { EnvironmentId } from '@/react/portainer/environments/types';
|
||||
import { withError } from '@/react-tools/react-query';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import _ from 'lodash';
|
||||
import { useMemo } from 'react';
|
||||
import { useQueries } from 'react-query';
|
||||
import { useQueries } from '@tanstack/react-query';
|
||||
|
||||
import { withError } from '@/react-tools/react-query';
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
|
@ -16,8 +16,8 @@ export function useContainerGroups(
|
|||
subscriptions: Subscription[] = [],
|
||||
enabled?: boolean
|
||||
) {
|
||||
const queries = useQueries(
|
||||
useMemo(
|
||||
const queries = useQueries({
|
||||
queries: useMemo(
|
||||
() =>
|
||||
subscriptions.map((subscription) => ({
|
||||
queryKey: queryKeys.containerGroups(
|
||||
|
@ -30,8 +30,8 @@ export function useContainerGroups(
|
|||
enabled,
|
||||
})),
|
||||
[subscriptions, enabled, environmentId]
|
||||
)
|
||||
);
|
||||
),
|
||||
});
|
||||
|
||||
return useMemo(
|
||||
() => ({
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import _ from 'lodash';
|
||||
import { useQueries } from 'react-query';
|
||||
import { useQueries } from '@tanstack/react-query';
|
||||
|
||||
import { EnvironmentId } from '@/react/portainer/environments/types';
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
|
@ -14,9 +14,10 @@ export function useProvider(
|
|||
environmentId: EnvironmentId,
|
||||
subscriptions: Subscription[] = []
|
||||
) {
|
||||
const queries = useQueries(
|
||||
subscriptions.map((subscription) => ({
|
||||
const queries = useQueries({
|
||||
queries: subscriptions.map((subscription) => ({
|
||||
queryKey: queryKeys.provider(environmentId, subscription.subscriptionId),
|
||||
|
||||
queryFn: async () => {
|
||||
const provider = await getContainerInstanceProvider(
|
||||
environmentId,
|
||||
|
@ -24,9 +25,10 @@ export function useProvider(
|
|||
);
|
||||
return [subscription.subscriptionId, provider] as const;
|
||||
},
|
||||
|
||||
...withError('Unable to retrieve Azure providers'),
|
||||
}))
|
||||
);
|
||||
})),
|
||||
});
|
||||
|
||||
return {
|
||||
providers: Object.fromEntries(
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
import { EnvironmentId } from '@/react/portainer/environments/types';
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import _ from 'lodash';
|
||||
import { useQueries } from 'react-query';
|
||||
import { useQueries } from '@tanstack/react-query';
|
||||
|
||||
import { EnvironmentId } from '@/react/portainer/environments/types';
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
|
@ -15,12 +15,13 @@ export function useResourceGroups(
|
|||
environmentId: EnvironmentId,
|
||||
subscriptions: Subscription[] = []
|
||||
) {
|
||||
const queries = useQueries(
|
||||
subscriptions.map((subscription) => ({
|
||||
const queries = useQueries({
|
||||
queries: subscriptions.map((subscription) => ({
|
||||
queryKey: queryKeys.resourceGroups(
|
||||
environmentId,
|
||||
subscription.subscriptionId
|
||||
),
|
||||
|
||||
queryFn: async () => {
|
||||
const groups = await getResourceGroups(
|
||||
environmentId,
|
||||
|
@ -28,9 +29,10 @@ export function useResourceGroups(
|
|||
);
|
||||
return [subscription.subscriptionId, groups] as const;
|
||||
},
|
||||
|
||||
...withError('Unable to retrieve Azure resource groups'),
|
||||
}))
|
||||
);
|
||||
})),
|
||||
});
|
||||
|
||||
return {
|
||||
resourceGroups: Object.fromEntries(
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
import { EnvironmentId } from '@/react/portainer/environments/types';
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
import { EnvironmentId } from '@/react/portainer/environments/types';
|
||||
|
|
|
@ -86,7 +86,7 @@ export function StackContainersDatatable({ environment, stackName }: Props) {
|
|||
</>
|
||||
)}
|
||||
dataset={containersQuery.data || []}
|
||||
isLoading={containersQuery.isLoading}
|
||||
isLoading={!containersQuery.data}
|
||||
emptyContentLabel="No containers found"
|
||||
/>
|
||||
</TableSettingsProvider>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useMutation, useQueryClient } from 'react-query';
|
||||
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
|
||||
import { EnvironmentId } from '@/react/portainer/environments/types';
|
||||
import { Pair } from '@/react/portainer/settings/types';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
import { withError } from '@/react-tools/react-query';
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
import axios from '@/portainer/services/axios';
|
||||
import { withError } from '@/react-tools/react-query';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { ReactNode, useRef } from 'react';
|
||||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
let globalId = 0;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { useEffect } from 'react';
|
||||
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { ReactQueryDevtools } from 'react-query/devtools';
|
||||
import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
|
||||
|
||||
export function ReactQueryDevtoolsWrapper() {
|
||||
const showReactQueryDevtools =
|
||||
|
|
|
@ -110,7 +110,7 @@ export function Datatable<D extends DefaultType>({
|
|||
const allColumns = useMemo(
|
||||
() =>
|
||||
_.compact([!disableSelect && createSelectColumn<D>(dataCy), ...columns]),
|
||||
[disableSelect, columns]
|
||||
[disableSelect, dataCy, columns]
|
||||
);
|
||||
|
||||
const tableInstance = useReactTable<D>(
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
import { EnvironmentId } from '@/react/portainer/environments/types';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
import axios, {
|
||||
isAxiosError,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
import { EnvironmentId } from '@/react/portainer/environments/types';
|
||||
import axios from '@/portainer/services/axios';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Formik } from 'formik';
|
||||
import { useMutation } from 'react-query';
|
||||
import { useMutation } from '@tanstack/react-query';
|
||||
import { useCurrentStateAndParams } from '@uirouter/react';
|
||||
import { useState } from 'react';
|
||||
import { FormikHelpers } from 'formik/dist/types';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useMutation, useQueryClient } from 'react-query';
|
||||
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
import { RawAxiosRequestHeaders } from 'axios';
|
||||
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import {
|
||||
ContainerConfig,
|
||||
ContainerState,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
import { EnvironmentId } from '@/react/portainer/environments/types';
|
||||
import axios, {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
import { EnvironmentId } from '@/react/portainer/environments/types';
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
import { EnvironmentId } from '@/react/portainer/environments/types';
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
import { EnvironmentId } from '@/react/portainer/environments/types';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { useRouter, useCurrentStateAndParams } from '@uirouter/react';
|
||||
import { useQueryClient } from 'react-query';
|
||||
import { useQueryClient } from '@tanstack/react-query';
|
||||
|
||||
import { useEnvironmentId } from '@/react/hooks/useEnvironmentId';
|
||||
import { AccessControlPanel } from '@/react/portainer/access-control/AccessControlPanel/AccessControlPanel';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { HttpResponse, http } from 'msw';
|
||||
import { render } from '@testing-library/react';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
|
||||
import { UserViewModel } from '@/portainer/models/user';
|
||||
import { server } from '@/setup-tests/server';
|
||||
|
@ -38,19 +38,17 @@ test('Network details values should be visible', async () => {
|
|||
|
||||
test(`System networks shouldn't show a delete button`, async () => {
|
||||
const systemNetwork = getNetwork('bridge');
|
||||
const { queryByText } = await renderComponent(true, systemNetwork);
|
||||
await renderComponent(true, systemNetwork);
|
||||
|
||||
const deleteButton = queryByText('Delete this network');
|
||||
expect(deleteButton).toBeNull();
|
||||
expect(screen.queryByText('Delete this network')).toBeNull();
|
||||
});
|
||||
|
||||
test('Non system networks should have a delete button', async () => {
|
||||
const nonSystemNetwork = getNetwork('non system network');
|
||||
|
||||
const { queryByText } = await renderComponent(true, nonSystemNetwork);
|
||||
await renderComponent(true, nonSystemNetwork);
|
||||
|
||||
const button = queryByText('Delete this network');
|
||||
expect(button).toBeVisible();
|
||||
await expect(screen.findByText('Delete this network')).resolves.toBeVisible();
|
||||
});
|
||||
|
||||
async function renderComponent(isAdmin: boolean, network: DockerNetwork) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useQuery, useMutation, useQueryClient } from 'react-query';
|
||||
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
|
||||
import { EnvironmentId } from '@/react/portainer/environments/types';
|
||||
import {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { EndpointSettings } from 'docker-types/generated/1.41';
|
||||
import { RawAxiosRequestHeaders } from 'axios';
|
||||
import { useMutation, useQueryClient } from 'react-query';
|
||||
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
import { EnvironmentId } from '@/react/portainer/environments/types';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
import { EnvironmentId } from '@/react/portainer/environments/types';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { ImageSummary } from 'docker-types/generated/1.41';
|
||||
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Node } from 'docker-types/generated/1.41';
|
||||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
import { EnvironmentId } from '@/react/portainer/environments/types';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { SystemInfo } from 'docker-types/generated/1.41';
|
||||
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import {
|
||||
Plugin,
|
||||
PluginInterfaceType,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { Swarm } from 'docker-types/generated/1.41';
|
||||
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { SystemVersion } from 'docker-types/generated/1.41';
|
||||
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useMutation } from 'react-query';
|
||||
import { useMutation } from '@tanstack/react-query';
|
||||
|
||||
import { promiseSequence } from '@/portainer/helpers/promise-utils';
|
||||
import { withError } from '@/react-tools/react-query';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useMutation } from 'react-query';
|
||||
import { useMutation } from '@tanstack/react-query';
|
||||
|
||||
import { EnvironmentId } from '@/react/portainer/environments/types';
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
|
|
|
@ -3,7 +3,7 @@ import {
|
|||
ServiceSpec,
|
||||
ServiceUpdateResponse,
|
||||
} from 'docker-types/generated/1.41';
|
||||
import { useMutation, useQueryClient } from 'react-query';
|
||||
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
import { EnvironmentId } from '@/react/portainer/environments/types';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { Loader2 } from 'lucide-react';
|
||||
|
||||
import { EnvironmentId } from '@/react/portainer/environments/types';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { Volume } from 'docker-types/generated/1.41';
|
||||
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useMutation, useQueryClient } from 'react-query';
|
||||
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
|
||||
import { EdgeTypes, EnvironmentId } from '@/react/portainer/environments/types';
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
import { EnvironmentId } from '@/react/portainer/environments/types';
|
||||
import { withError } from '@/react-tools/react-query';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useMutation } from 'react-query';
|
||||
import { useMutation } from '@tanstack/react-query';
|
||||
|
||||
import { promiseSequence } from '@/portainer/helpers/promise-utils';
|
||||
import { mutationOptions, withError } from '@/react-tools/react-query';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useMutation, useQueryClient } from 'react-query';
|
||||
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
import { withError } from '@/react-tools/react-query';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useMutation, useQueryClient } from 'react-query';
|
||||
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
|
||||
import { promiseSequence } from '@/portainer/helpers/promise-utils';
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useMutation, useQueryClient } from 'react-query';
|
||||
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
import { TagId } from '@/portainer/tags/types';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
import {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useMutation, useQueryClient } from 'react-query';
|
||||
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
|
||||
import { promiseSequence } from '@/portainer/helpers/promise-utils';
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useMutation } from 'react-query';
|
||||
import { useMutation } from '@tanstack/react-query';
|
||||
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
import { mutationOptions, withError } from '@/react-tools/react-query';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useMutation, useQueryClient } from 'react-query';
|
||||
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
|
||||
import { EnvironmentId } from '@/react/portainer/environments/types';
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useMutation, useQueryClient } from 'react-query';
|
||||
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
|
||||
import { EnvironmentId } from '@/react/portainer/environments/types';
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { saveAs } from 'file-saver';
|
||||
import { useMutation } from 'react-query';
|
||||
import { useMutation } from '@tanstack/react-query';
|
||||
|
||||
import { EnvironmentId } from '@/react/portainer/environments/types';
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
import { EnvironmentId } from '@/react/portainer/environments/types';
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useMutation, useQueryClient } from 'react-query';
|
||||
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
|
||||
import { promiseSequence } from '@/portainer/helpers/promise-utils';
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useQueryClient } from 'react-query';
|
||||
import { useQueryClient } from '@tanstack/react-query';
|
||||
|
||||
import { PageHeader } from '@@/PageHeader';
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useMutation } from 'react-query';
|
||||
import { useMutation } from '@tanstack/react-query';
|
||||
|
||||
import { EdgeGroup } from '@/react/edge/edge-groups/types';
|
||||
import { RegistryId } from '@/react/portainer/registries/types/registry';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
import { withError } from '@/react-tools/react-query';
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
import { withError } from '@/react-tools/react-query';
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useMutation } from 'react-query';
|
||||
import { useMutation } from '@tanstack/react-query';
|
||||
|
||||
import { withError } from '@/react-tools/react-query';
|
||||
import { RegistryId } from '@/react/portainer/registries/types/registry';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { RefreshCw, Trash2 } from 'lucide-react';
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
import { UseQueryResult } from 'react-query';
|
||||
import { UseQueryResult } from '@tanstack/react-query';
|
||||
import { FormikErrors } from 'formik';
|
||||
|
||||
import { Ingress } from '@/react/kubernetes/ingresses/types';
|
||||
|
|
|
@ -163,8 +163,10 @@ export function kubeServicesValidation(
|
|||
.flatMap((formService) => formService.Ports)
|
||||
.map((formServicePorts) => formServicePorts.nodePort);
|
||||
return (
|
||||
!clusterNodePortsWithoutFormServices.includes(nodePort) && // node port is not in the cluster services that aren't in the application form
|
||||
!formNodePortsWithoutCurrentService.includes(nodePort) // and the node port is not in the current form, excluding the current service
|
||||
// and the node port is not in the current form, excluding the current service
|
||||
// node port is not in the cluster services that aren't in the application form
|
||||
!clusterNodePortsWithoutFormServices.includes(nodePort) &&
|
||||
!formNodePortsWithoutCurrentService.includes(nodePort)
|
||||
);
|
||||
}
|
||||
)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { EventList } from 'kubernetes-types/core/v1';
|
||||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
import { EnvironmentId } from '@/react/portainer/environments/types';
|
||||
import axios from '@/portainer/services/axios';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { UseQueryResult, useMutation, useQuery } from 'react-query';
|
||||
import { UseQueryResult, useMutation, useQuery } from '@tanstack/react-query';
|
||||
import { Pod } from 'kubernetes-types/core/v1';
|
||||
|
||||
import { queryClient, withError } from '@/react-tools/react-query';
|
||||
|
@ -18,103 +18,105 @@ import { getNamespaceHorizontalPodAutoscalers } from './autoscaling.service';
|
|||
import { applicationIsKind, matchLabelsToLabelSelectorValue } from './utils';
|
||||
|
||||
const queryKeys = {
|
||||
applicationsForCluster: (environmentId: EnvironmentId) => [
|
||||
'environments',
|
||||
environmentId,
|
||||
'kubernetes',
|
||||
'applications',
|
||||
],
|
||||
applicationsForCluster: (environmentId: EnvironmentId) =>
|
||||
['environments', environmentId, 'kubernetes', 'applications'] as const,
|
||||
application: (
|
||||
environmentId: EnvironmentId,
|
||||
namespace: string,
|
||||
name: string,
|
||||
yaml?: boolean
|
||||
) => [
|
||||
'environments',
|
||||
environmentId,
|
||||
'kubernetes',
|
||||
'applications',
|
||||
namespace,
|
||||
name,
|
||||
yaml,
|
||||
],
|
||||
) =>
|
||||
[
|
||||
'environments',
|
||||
environmentId,
|
||||
'kubernetes',
|
||||
'applications',
|
||||
namespace,
|
||||
name,
|
||||
yaml,
|
||||
] as const,
|
||||
applicationRevisions: (
|
||||
environmentId: EnvironmentId,
|
||||
namespace: string,
|
||||
name: string,
|
||||
labelSelector?: string
|
||||
) => [
|
||||
'environments',
|
||||
environmentId,
|
||||
'kubernetes',
|
||||
'applications',
|
||||
namespace,
|
||||
name,
|
||||
'revisions',
|
||||
labelSelector,
|
||||
],
|
||||
) =>
|
||||
[
|
||||
'environments',
|
||||
environmentId,
|
||||
'kubernetes',
|
||||
'applications',
|
||||
namespace,
|
||||
name,
|
||||
'revisions',
|
||||
labelSelector,
|
||||
] as const,
|
||||
applicationServices: (
|
||||
environmentId: EnvironmentId,
|
||||
namespace: string,
|
||||
name: string
|
||||
) => [
|
||||
'environments',
|
||||
environmentId,
|
||||
'kubernetes',
|
||||
'applications',
|
||||
namespace,
|
||||
name,
|
||||
'services',
|
||||
],
|
||||
) =>
|
||||
[
|
||||
'environments',
|
||||
environmentId,
|
||||
'kubernetes',
|
||||
'applications',
|
||||
namespace,
|
||||
name,
|
||||
'services',
|
||||
] as const,
|
||||
ingressesForApplication: (
|
||||
environmentId: EnvironmentId,
|
||||
namespace: string,
|
||||
name: string
|
||||
) => [
|
||||
'environments',
|
||||
environmentId,
|
||||
'kubernetes',
|
||||
'applications',
|
||||
namespace,
|
||||
name,
|
||||
'ingresses',
|
||||
],
|
||||
) =>
|
||||
[
|
||||
'environments',
|
||||
environmentId,
|
||||
'kubernetes',
|
||||
'applications',
|
||||
namespace,
|
||||
name,
|
||||
'ingresses',
|
||||
] as const,
|
||||
applicationHorizontalPodAutoscalers: (
|
||||
environmentId: EnvironmentId,
|
||||
namespace: string,
|
||||
name: string
|
||||
) => [
|
||||
'environments',
|
||||
environmentId,
|
||||
'kubernetes',
|
||||
'applications',
|
||||
namespace,
|
||||
name,
|
||||
'horizontalpodautoscalers',
|
||||
],
|
||||
) =>
|
||||
[
|
||||
'environments',
|
||||
environmentId,
|
||||
'kubernetes',
|
||||
'applications',
|
||||
namespace,
|
||||
name,
|
||||
'horizontalpodautoscalers',
|
||||
] as const,
|
||||
applicationPods: (
|
||||
environmentId: EnvironmentId,
|
||||
namespace: string,
|
||||
name: string
|
||||
) => [
|
||||
'environments',
|
||||
environmentId,
|
||||
'kubernetes',
|
||||
'applications',
|
||||
namespace,
|
||||
name,
|
||||
'pods',
|
||||
],
|
||||
) =>
|
||||
[
|
||||
'environments',
|
||||
environmentId,
|
||||
'kubernetes',
|
||||
'applications',
|
||||
namespace,
|
||||
name,
|
||||
'pods',
|
||||
] as const,
|
||||
};
|
||||
|
||||
// useQuery to get a list of all applications from an array of namespaces
|
||||
export function useApplicationsQuery(
|
||||
environemtId: EnvironmentId,
|
||||
environmentId: EnvironmentId,
|
||||
namespaces?: string[]
|
||||
) {
|
||||
return useQuery(
|
||||
queryKeys.applicationsForCluster(environemtId),
|
||||
() => getApplicationsForCluster(environemtId, namespaces),
|
||||
queryKeys.applicationsForCluster(environmentId),
|
||||
() => getApplicationsForCluster(environmentId, namespaces),
|
||||
{
|
||||
...withError('Unable to retrieve applications'),
|
||||
enabled: !!namespaces?.length,
|
||||
|
|
|
@ -2,7 +2,7 @@ import {
|
|||
HorizontalPodAutoscaler,
|
||||
HorizontalPodAutoscalerList,
|
||||
} from 'kubernetes-types/autoscaling/v1';
|
||||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
import axios from '@/portainer/services/axios';
|
||||
import { EnvironmentId } from '@/react/portainer/environments/types';
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { FormikHelpers } from 'formik';
|
||||
import { StorageClass } from 'kubernetes-types/storage/v1';
|
||||
import { compare } from 'fast-json-patch';
|
||||
import { UseMutationResult } from 'react-query';
|
||||
import { UseMutationResult } from '@tanstack/react-query';
|
||||
|
||||
import { notifyError, notifySuccess } from '@/portainer/services/notifications';
|
||||
import { UpdateEnvironmentPayload } from '@/react/portainer/environments/queries/useUpdateEnvironmentMutation';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useMutation, useQueryClient } from 'react-query';
|
||||
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
import { Operation } from 'fast-json-patch';
|
||||
import _ from 'lodash';
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { StorageClass, StorageClassList } from 'kubernetes-types/storage/v1';
|
||||
|
||||
import axios from '@/portainer/services/axios';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { NodeList, Node } from 'kubernetes-types/core/v1';
|
||||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
import axios from '@/portainer/services/axios';
|
||||
import { EnvironmentId } from '@/react/portainer/environments/types';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
import { EnvironmentId } from '@/react/portainer/environments/types';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
import { EnvironmentId } from '@/react/portainer/environments/types';
|
||||
import PortainerError from '@/portainer/error';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
import { EnvironmentId } from '@/react/portainer/environments/types';
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { EndpointsList } from 'kubernetes-types/core/v1';
|
||||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
import axios from '@/portainer/services/axios';
|
||||
import { EnvironmentId } from '@/react/portainer/environments/types';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { ConfigMap, ConfigMapList } from 'kubernetes-types/core/v1';
|
||||
import { useMutation, useQuery } from 'react-query';
|
||||
import { useMutation, useQuery } from '@tanstack/react-query';
|
||||
|
||||
import { queryClient, withError } from '@/react-tools/react-query';
|
||||
import axios from '@/portainer/services/axios';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Secret, SecretList } from 'kubernetes-types/core/v1';
|
||||
import { useMutation, useQuery } from 'react-query';
|
||||
import { useMutation, useQuery } from '@tanstack/react-query';
|
||||
|
||||
import { queryClient, withError } from '@/react-tools/react-query';
|
||||
import axios from '@/portainer/services/axios';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Box, Database, FileCode, Layers, Lock, Shuffle } from 'lucide-react';
|
||||
import { useQueryClient } from 'react-query';
|
||||
import { useQueryClient } from '@tanstack/react-query';
|
||||
|
||||
import { useEnvironmentId } from '@/react/hooks/useEnvironmentId';
|
||||
import Route from '@/assets/ico/route.svg?c';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useQuery, useMutation, useQueryClient } from 'react-query';
|
||||
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
|
||||
import { EnvironmentId } from '@/react/portainer/environments/types';
|
||||
import {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useMutation } from 'react-query';
|
||||
import { useMutation } from '@tanstack/react-query';
|
||||
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
import { withError } from '@/react-tools/react-query';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
import { EnvironmentId } from '@/react/portainer/environments/types';
|
||||
import { notifyError } from '@/portainer/services/notifications';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
import { notifyError } from '@/portainer/services/notifications';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
import { EnvironmentId } from '@/react/portainer/environments/types';
|
||||
import { withError } from '@/react-tools/react-query';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
import { EnvironmentId } from '@/react/portainer/environments/types';
|
||||
import { error as notifyError } from '@/portainer/services/notifications';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useMutation } from 'react-query';
|
||||
import { useMutation } from '@tanstack/react-query';
|
||||
|
||||
import { getMetricsForAllNodes } from '../services/service';
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useMutation, useQuery, useQueryClient } from 'react-query';
|
||||
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
||||
import { compact } from 'lodash';
|
||||
import { ServiceList } from 'kubernetes-types/core/v1';
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { PersistentVolumeClaimList } from 'kubernetes-types/core/v1';
|
||||
|
||||
import { EnvironmentId } from '@/react/portainer/environments/types';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
import { error as notifyError } from '@/portainer/services/notifications';
|
||||
import { getBackupStatus } from '@/portainer/services/api/backup.service';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useQuery } from 'react-query';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import _ from 'lodash';
|
||||
|
||||
import { useUIState } from '@/react/hooks/useUIState';
|
||||
|
@ -43,7 +43,7 @@ export function MotdPanel() {
|
|||
}
|
||||
|
||||
function useMotd() {
|
||||
const { data } = useQuery('motd', () => getMotd());
|
||||
const { data } = useQuery(['motd'], () => getMotd());
|
||||
return data;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { Form, Formik } from 'formik';
|
||||
import clsx from 'clsx';
|
||||
import { useMutation } from 'react-query';
|
||||
import { useMutation } from '@tanstack/react-query';
|
||||
import { object } from 'yup';
|
||||
|
||||
import { useCurrentUser, useIsEdgeAdmin } from '@/react/hooks/useUser';
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue