mirror of
https://github.com/portainer/portainer.git
synced 2025-08-02 20:35:25 +02:00
This reverts commit 2c032f1739
.
This commit is contained in:
parent
2c032f1739
commit
ecce501cf3
70 changed files with 45 additions and 418 deletions
|
@ -27,7 +27,7 @@ export function DashboardView() {
|
|||
|
||||
return (
|
||||
<>
|
||||
<PageHeader title="Home" breadcrumbs={[{ label: 'Dashboard' }]} reload />
|
||||
<PageHeader title="Home" breadcrumbs={[{ label: 'Dashboard' }]} />
|
||||
|
||||
<div className="mx-4">
|
||||
{subscriptionsQuery.data && (
|
||||
|
|
|
@ -12,7 +12,6 @@ export function CreateView() {
|
|||
{ link: 'azure.containerinstances', label: 'Container instances' },
|
||||
{ label: 'Add container' },
|
||||
]}
|
||||
reload
|
||||
/>
|
||||
|
||||
<div className="row">
|
||||
|
|
|
@ -68,7 +68,6 @@ export function ItemView() {
|
|||
{ link: 'azure.containerinstances', label: 'Container instances' },
|
||||
{ label: container.name },
|
||||
]}
|
||||
reload
|
||||
/>
|
||||
|
||||
<div className="row">
|
||||
|
|
|
@ -32,9 +32,9 @@ export function ListView() {
|
|||
return (
|
||||
<>
|
||||
<PageHeader
|
||||
title="Container list"
|
||||
breadcrumbs="Container instances"
|
||||
reload
|
||||
title="Container list"
|
||||
/>
|
||||
|
||||
<ContainersDatatable
|
||||
|
|
|
@ -31,7 +31,6 @@ function Template({ title }: StoryProps) {
|
|||
{ label: 'bread3' },
|
||||
{ label: 'bread4' },
|
||||
]}
|
||||
reload
|
||||
/>
|
||||
</UserContext.Provider>
|
||||
);
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
import { useRouter } from '@uirouter/react';
|
||||
import { PropsWithChildren } from 'react';
|
||||
import { RefreshCw } from 'lucide-react';
|
||||
|
||||
import { dispatchCacheRefreshEvent } from '@/portainer/services/http-request.helper';
|
||||
import { PropsWithChildren } from 'react';
|
||||
|
||||
import { Button } from '../buttons';
|
||||
|
||||
|
@ -53,7 +51,6 @@ export function PageHeader({
|
|||
);
|
||||
|
||||
function onClickedRefresh() {
|
||||
dispatchCacheRefreshEvent();
|
||||
return onReload ? onReload() : router.stateService.reload();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ export function createMockUser(id: number, username: string): UserViewModel {
|
|||
Username: username,
|
||||
Role: 2,
|
||||
EndpointAuthorizations: {},
|
||||
UseCache: false,
|
||||
PortainerAuthorizations: {
|
||||
PortainerDockerHubInspect: true,
|
||||
PortainerEndpointGroupInspect: true,
|
||||
|
|
|
@ -36,7 +36,6 @@ export function CreateView() {
|
|||
{ label: 'Containers', link: 'docker.containers' },
|
||||
'Add container',
|
||||
]}
|
||||
reload
|
||||
/>
|
||||
|
||||
<CreateForm />
|
||||
|
|
|
@ -61,7 +61,6 @@ export function ItemView() {
|
|||
label: networkQuery.data.Name,
|
||||
},
|
||||
]}
|
||||
reload
|
||||
/>
|
||||
<NetworkDetailsTable
|
||||
network={networkQuery.data}
|
||||
|
|
|
@ -19,7 +19,6 @@ function WaitingRoomView() {
|
|||
<PageHeader
|
||||
title="Waiting Room"
|
||||
breadcrumbs={[{ label: 'Waiting Room' }]}
|
||||
reload
|
||||
/>
|
||||
|
||||
<InformationPanel>
|
||||
|
|
|
@ -27,6 +27,7 @@ export function ConfigureView() {
|
|||
<>
|
||||
<PageHeader
|
||||
title="Kubernetes features configuration"
|
||||
reload
|
||||
breadcrumbs={[
|
||||
{ label: 'Environments', link: 'portainer.endpoints' },
|
||||
{
|
||||
|
@ -36,7 +37,6 @@ export function ConfigureView() {
|
|||
},
|
||||
'Kubernetes configuration',
|
||||
]}
|
||||
reload
|
||||
/>
|
||||
<div className="row">
|
||||
<div className="col-sm-12">
|
||||
|
|
|
@ -573,7 +573,6 @@ export function CreateIngressView() {
|
|||
label: isEdit ? 'Edit ingress' : 'Create ingress',
|
||||
},
|
||||
]}
|
||||
reload
|
||||
/>
|
||||
<div className="row ingress-rules">
|
||||
<div className="col-sm-12">
|
||||
|
|
|
@ -1,86 +0,0 @@
|
|||
import { Form, Formik } from 'formik';
|
||||
|
||||
import { useCurrentUser } from '@/react/hooks/useUser';
|
||||
import { notifySuccess } from '@/portainer/services/notifications';
|
||||
import { updateAxiosAdapter } from '@/portainer/services/axios';
|
||||
import { withError } from '@/react-tools/react-query';
|
||||
|
||||
import { TextTip } from '@@/Tip/TextTip';
|
||||
import { LoadingButton } from '@@/buttons';
|
||||
import { SwitchField } from '@@/form-components/SwitchField';
|
||||
|
||||
import { useUpdateUserMutation } from '../../useUpdateUserMutation';
|
||||
|
||||
type FormValues = {
|
||||
useCache: boolean;
|
||||
};
|
||||
|
||||
export function ApplicationSettingsForm() {
|
||||
const { user } = useCurrentUser();
|
||||
const updateSettingsMutation = useUpdateUserMutation();
|
||||
|
||||
const initialValues = {
|
||||
useCache: user.UseCache,
|
||||
};
|
||||
|
||||
return (
|
||||
<Formik<FormValues>
|
||||
initialValues={initialValues}
|
||||
onSubmit={handleSubmit}
|
||||
validateOnMount
|
||||
enableReinitialize
|
||||
>
|
||||
{({ isValid, dirty, values, setFieldValue }) => (
|
||||
<Form className="form-horizontal">
|
||||
<TextTip color="orange" className="mb-3">
|
||||
Enabling front-end data caching can mean that changes to Kubernetes
|
||||
clusters made by other users or outside of Portainer may take up to
|
||||
five minutes to show in your session. This caching only applies to
|
||||
Kubernetes environments.
|
||||
</TextTip>
|
||||
<SwitchField
|
||||
label="Enable front-end data caching for Kubernetes environments"
|
||||
checked={values.useCache}
|
||||
onChange={(value) => setFieldValue('useCache', value)}
|
||||
labelClass="col-lg-2 col-sm-3" // match the label width of the other fields in the page
|
||||
fieldClass="!mb-4"
|
||||
/>
|
||||
<div className="form-group">
|
||||
<div className="col-sm-12">
|
||||
<LoadingButton
|
||||
loadingText="Saving..."
|
||||
isLoading={updateSettingsMutation.isLoading}
|
||||
disabled={!isValid || !dirty}
|
||||
className="!ml-0"
|
||||
data-cy="account-applicationSettingsSaveButton"
|
||||
>
|
||||
Save
|
||||
</LoadingButton>
|
||||
</div>
|
||||
</div>
|
||||
</Form>
|
||||
)}
|
||||
</Formik>
|
||||
);
|
||||
|
||||
function handleSubmit(values: FormValues) {
|
||||
updateSettingsMutation.mutate(
|
||||
{
|
||||
Id: user.Id,
|
||||
UseCache: values.useCache,
|
||||
},
|
||||
{
|
||||
onSuccess() {
|
||||
updateAxiosAdapter(values.useCache);
|
||||
notifySuccess(
|
||||
'Success',
|
||||
'Successfully updated application settings.'
|
||||
);
|
||||
// a full reload is required to update the angular $http cache setting
|
||||
setTimeout(() => window.location.reload(), 2000); // allow 2s to show the success notification
|
||||
},
|
||||
...withError('Unable to update application settings'),
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
import { Settings } from 'lucide-react';
|
||||
|
||||
import { Widget, WidgetBody, WidgetTitle } from '@@/Widget';
|
||||
|
||||
import { ApplicationSettingsForm } from './ApplicationSettingsForm';
|
||||
|
||||
export function ApplicationSettingsWidget() {
|
||||
return (
|
||||
<div className="row">
|
||||
<div className="col-sm-12">
|
||||
<Widget>
|
||||
<WidgetTitle icon={Settings} title="Application settings" />
|
||||
<WidgetBody>
|
||||
<ApplicationSettingsForm />
|
||||
</WidgetBody>
|
||||
</Widget>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
export { ApplicationSettingsWidget } from './ApplicationSettingsWidget';
|
|
@ -12,7 +12,6 @@ export function CreateHelmRepositoriesView() {
|
|||
{ label: 'My account', link: 'portainer.account' },
|
||||
{ label: 'Create Helm repository' },
|
||||
]}
|
||||
reload
|
||||
/>
|
||||
|
||||
<div className="row">
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
import { useMutation } from 'react-query';
|
||||
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
import { User } from '@/portainer/users/types';
|
||||
import {
|
||||
mutationOptions,
|
||||
withInvalidate,
|
||||
queryClient,
|
||||
} from '@/react-tools/react-query';
|
||||
import { userQueryKeys } from '@/portainer/users/queries/queryKeys';
|
||||
import { useCurrentUser } from '@/react/hooks/useUser';
|
||||
|
||||
export function useUpdateUserMutation() {
|
||||
const {
|
||||
user: { Id: userId },
|
||||
} = useCurrentUser();
|
||||
|
||||
return useMutation(
|
||||
(user: Partial<User>) => updateUser(user, userId),
|
||||
mutationOptions(withInvalidate(queryClient, [userQueryKeys.base()]))
|
||||
// error notification should be handled by the caller
|
||||
);
|
||||
}
|
||||
|
||||
async function updateUser(user: Partial<User>, userId: number) {
|
||||
try {
|
||||
const { data } = await axios.put(`/users/${userId}`, user);
|
||||
return data;
|
||||
} catch (error) {
|
||||
throw parseAxiosError(error);
|
||||
}
|
||||
}
|
|
@ -17,7 +17,6 @@ function EdgeAutoCreateScriptView() {
|
|||
{ label: 'Environments', link: 'portainer.endpoints' },
|
||||
'Automatic Edge Environment Creation',
|
||||
]}
|
||||
reload
|
||||
/>
|
||||
|
||||
<div className="mx-3">
|
||||
|
|
|
@ -54,7 +54,6 @@ function CreateView() {
|
|||
<PageHeader
|
||||
title="Update & Rollback"
|
||||
breadcrumbs="Edge agent update and rollback"
|
||||
reload
|
||||
/>
|
||||
|
||||
<BetaAlert
|
||||
|
|
|
@ -78,7 +78,6 @@ function ItemView() {
|
|||
{ label: 'Edge agent update and rollback', link: '^' },
|
||||
item.name,
|
||||
]}
|
||||
reload
|
||||
/>
|
||||
|
||||
<BetaAlert
|
||||
|
|
|
@ -56,8 +56,8 @@ export function ListView() {
|
|||
<>
|
||||
<PageHeader
|
||||
title="Update & Rollback"
|
||||
breadcrumbs="Update and rollback"
|
||||
reload
|
||||
breadcrumbs="Update and rollback"
|
||||
/>
|
||||
|
||||
<BetaAlert
|
||||
|
|
|
@ -27,7 +27,6 @@ export function EnvironmentTypeSelectView() {
|
|||
<PageHeader
|
||||
title="Quick Setup"
|
||||
breadcrumbs={[{ label: 'Environment Wizard' }]}
|
||||
reload
|
||||
/>
|
||||
|
||||
<div className="row">
|
||||
|
|
|
@ -71,7 +71,6 @@ export function EnvironmentCreationView() {
|
|||
<PageHeader
|
||||
title="Quick Setup"
|
||||
breadcrumbs={[{ label: 'Environment Wizard' }]}
|
||||
reload
|
||||
/>
|
||||
|
||||
<div className={styles.wizardWrapper}>
|
||||
|
|
|
@ -22,7 +22,6 @@ export function HomeView() {
|
|||
<PageHeader
|
||||
title="Quick Setup"
|
||||
breadcrumbs={[{ label: 'Environment Wizard' }]}
|
||||
reload
|
||||
/>
|
||||
|
||||
<div className="row">
|
||||
|
|
|
@ -18,7 +18,7 @@ import { ExperimentalFeatures } from './ExperimentalFeatures';
|
|||
export function SettingsView() {
|
||||
return (
|
||||
<>
|
||||
<PageHeader title="Settings" breadcrumbs="Settings" reload />
|
||||
<PageHeader title="Settings" breadcrumbs="Settings" />
|
||||
|
||||
<div className="mx-4 space-y-4">
|
||||
<ApplicationSettingsPanel onSuccess={handleSuccess} />
|
||||
|
|
|
@ -38,7 +38,6 @@ export function ItemView() {
|
|||
<PageHeader
|
||||
title="Team details"
|
||||
breadcrumbs={[{ label: 'Teams' }, { label: team.Name }]}
|
||||
reload
|
||||
/>
|
||||
|
||||
{membershipsQuery.data && (
|
||||
|
|
|
@ -42,7 +42,6 @@ export function mockExampleData() {
|
|||
RoleName: 'user',
|
||||
Checked: false,
|
||||
AuthenticationMethod: '',
|
||||
UseCache: false,
|
||||
},
|
||||
{
|
||||
Id: 13,
|
||||
|
@ -70,7 +69,6 @@ export function mockExampleData() {
|
|||
RoleName: 'user',
|
||||
Checked: false,
|
||||
AuthenticationMethod: '',
|
||||
UseCache: false,
|
||||
},
|
||||
];
|
||||
|
||||
|
|
|
@ -16,11 +16,7 @@ export function ListView() {
|
|||
|
||||
return (
|
||||
<>
|
||||
<PageHeader
|
||||
title="Teams"
|
||||
breadcrumbs={[{ label: 'Teams management' }]}
|
||||
reload
|
||||
/>
|
||||
<PageHeader title="Teams" breadcrumbs={[{ label: 'Teams management' }]} />
|
||||
|
||||
{isAdmin && usersQuery.data && teamsQuery.data && (
|
||||
<CreateTeamForm users={usersQuery.data} teams={teamsQuery.data} />
|
||||
|
|
|
@ -8,7 +8,6 @@ const mockUser: User = {
|
|||
Id: 1,
|
||||
Role: 1,
|
||||
Username: 'mock',
|
||||
UseCache: false,
|
||||
ThemeSettings: {
|
||||
color: 'auto',
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue