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