mirror of https://github.com/portainer/portainer
fix(UI): some minor fixes [EE-6667] (#11061)
* minor tweeks for kubernetes settings * address review commentspull/11077/head
parent
a93344386c
commit
01cd64037f
|
@ -21,7 +21,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="w-full">
|
<div class="w-full">
|
||||||
<div class="mb-2 small text-muted"
|
<div class="mb-2 small text-muted"
|
||||||
>Select the Helm chart to use. Bring further Helm charts into your selection list via <a ui-sref="portainer.account">User settings - Helm repositories</a>.</div
|
>Select the Helm chart to use. Bring further Helm charts into your selection list via
|
||||||
|
<a ui-sref="portainer.account({'#': 'helm-repositories'})">User settings - Helm repositories</a>.</div
|
||||||
>
|
>
|
||||||
<beta-alert
|
<beta-alert
|
||||||
is-html="true"
|
is-html="true"
|
||||||
|
|
|
@ -2,19 +2,23 @@ import { createContext, PropsWithChildren, useContext } from 'react';
|
||||||
|
|
||||||
const Context = createContext<null | boolean>(null);
|
const Context = createContext<null | boolean>(null);
|
||||||
Context.displayName = 'WidgetContext';
|
Context.displayName = 'WidgetContext';
|
||||||
|
|
||||||
export function useWidgetContext() {
|
export function useWidgetContext() {
|
||||||
const context = useContext(Context);
|
const context = useContext(Context);
|
||||||
|
|
||||||
if (context == null) {
|
if (context == null) {
|
||||||
throw new Error('Should be inside a Widget component');
|
throw new Error('Should be inside a Widget component');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
export function Widget({
|
||||||
export function Widget({ children }: PropsWithChildren<unknown>) {
|
children,
|
||||||
|
id,
|
||||||
|
}: PropsWithChildren<{
|
||||||
|
id?: string;
|
||||||
|
}>) {
|
||||||
return (
|
return (
|
||||||
<Context.Provider value>
|
<Context.Provider value>
|
||||||
<div className="widget">{children}</div>
|
<div id={id} className="widget">
|
||||||
|
{children}
|
||||||
|
</div>
|
||||||
</Context.Provider>
|
</Context.Provider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,6 +58,7 @@ export interface Props<D extends DefaultType> extends AutomationTestingProps {
|
||||||
emptyContentLabel?: string;
|
emptyContentLabel?: string;
|
||||||
title?: string;
|
title?: string;
|
||||||
titleIcon?: IconProps['icon'];
|
titleIcon?: IconProps['icon'];
|
||||||
|
titleId?: string;
|
||||||
initialTableState?: Partial<TableState>;
|
initialTableState?: Partial<TableState>;
|
||||||
isLoading?: boolean;
|
isLoading?: boolean;
|
||||||
description?: ReactNode;
|
description?: ReactNode;
|
||||||
|
@ -78,6 +79,7 @@ export function Datatable<D extends DefaultType>({
|
||||||
getRowId = defaultGetRowId,
|
getRowId = defaultGetRowId,
|
||||||
isRowSelectable = () => true,
|
isRowSelectable = () => true,
|
||||||
title,
|
title,
|
||||||
|
titleId,
|
||||||
titleIcon,
|
titleIcon,
|
||||||
emptyContentLabel,
|
emptyContentLabel,
|
||||||
initialTableState = {},
|
initialTableState = {},
|
||||||
|
@ -172,6 +174,7 @@ export function Datatable<D extends DefaultType>({
|
||||||
onSearchChange={handleSearchBarChange}
|
onSearchChange={handleSearchBarChange}
|
||||||
searchValue={settings.search}
|
searchValue={settings.search}
|
||||||
title={title}
|
title={title}
|
||||||
|
titleId={titleId}
|
||||||
titleIcon={titleIcon}
|
titleIcon={titleIcon}
|
||||||
description={description}
|
description={description}
|
||||||
renderTableActions={() => renderTableActions(selectedItems)}
|
renderTableActions={() => renderTableActions(selectedItems)}
|
||||||
|
|
|
@ -13,6 +13,7 @@ type Props = {
|
||||||
renderTableSettings?(): ReactNode;
|
renderTableSettings?(): ReactNode;
|
||||||
renderTableActions?(): ReactNode;
|
renderTableActions?(): ReactNode;
|
||||||
description?: ReactNode;
|
description?: ReactNode;
|
||||||
|
titleId?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export function DatatableHeader({
|
export function DatatableHeader({
|
||||||
|
@ -23,6 +24,7 @@ export function DatatableHeader({
|
||||||
title,
|
title,
|
||||||
titleIcon,
|
titleIcon,
|
||||||
description,
|
description,
|
||||||
|
titleId,
|
||||||
}: Props) {
|
}: Props) {
|
||||||
if (!title) {
|
if (!title) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -37,7 +39,12 @@ export function DatatableHeader({
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Table.Title label={title} icon={titleIcon} description={description}>
|
<Table.Title
|
||||||
|
id={titleId}
|
||||||
|
label={title}
|
||||||
|
icon={titleIcon}
|
||||||
|
description={description}
|
||||||
|
>
|
||||||
{searchBar}
|
{searchBar}
|
||||||
{tableActions}
|
{tableActions}
|
||||||
{tableTitleSettings}
|
{tableTitleSettings}
|
||||||
|
|
|
@ -8,6 +8,7 @@ interface Props {
|
||||||
label: string;
|
label: string;
|
||||||
description?: ReactNode;
|
description?: ReactNode;
|
||||||
className?: string;
|
className?: string;
|
||||||
|
id?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function TableTitle({
|
export function TableTitle({
|
||||||
|
@ -16,10 +17,11 @@ export function TableTitle({
|
||||||
children,
|
children,
|
||||||
description,
|
description,
|
||||||
className,
|
className,
|
||||||
|
id,
|
||||||
}: PropsWithChildren<Props>) {
|
}: PropsWithChildren<Props>) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className={clsx('toolBar flex-col', className)}>
|
<div className={clsx('toolBar flex-col', className)} id={id}>
|
||||||
<div className="flex w-full items-center gap-1 p-0">
|
<div className="flex w-full items-center gap-1 p-0">
|
||||||
<div className="toolBarTitle">
|
<div className="toolBarTitle">
|
||||||
{icon && (
|
{icon && (
|
||||||
|
|
|
@ -3,6 +3,7 @@ import { useMemo } from 'react';
|
||||||
import { useCurrentUser } from '@/react/hooks/useUser';
|
import { useCurrentUser } from '@/react/hooks/useUser';
|
||||||
import helm from '@/assets/ico/vendor/helm.svg?c';
|
import helm from '@/assets/ico/vendor/helm.svg?c';
|
||||||
|
|
||||||
|
import { Link } from '@@/Link';
|
||||||
import { Datatable } from '@@/datatables';
|
import { Datatable } from '@@/datatables';
|
||||||
import { createPersistedStore } from '@@/datatables/types';
|
import { createPersistedStore } from '@@/datatables/types';
|
||||||
import { useTableState } from '@@/datatables/useTableState';
|
import { useTableState } from '@@/datatables/useTableState';
|
||||||
|
@ -64,8 +65,11 @@ function HelmDatatableDescription() {
|
||||||
<TextTip color="blue" className="mb-3">
|
<TextTip color="blue" className="mb-3">
|
||||||
Adding a Helm repo here only makes it available in your own user
|
Adding a Helm repo here only makes it available in your own user
|
||||||
account's Portainer UI. Helm charts are pulled down from these repos
|
account's Portainer UI. Helm charts are pulled down from these repos
|
||||||
(plus the globally-set Helm repo) and shown in the Create from Manifest
|
(plus the{' '}
|
||||||
screen's Helm charts list.
|
<Link to="portainer.settings" params={{ '#': 'kubernetes-settings' }}>
|
||||||
|
<span>globally-set Helm repo</span>
|
||||||
|
</Link>
|
||||||
|
) and shown in the Create from Manifest screen's Helm charts list.
|
||||||
</TextTip>
|
</TextTip>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ export function DeploymentOptionsSection() {
|
||||||
|
|
||||||
const limitedFeature = isLimitedToBE(FeatureId.ENFORCE_DEPLOYMENT_OPTIONS);
|
const limitedFeature = isLimitedToBE(FeatureId.ENFORCE_DEPLOYMENT_OPTIONS);
|
||||||
return (
|
return (
|
||||||
<FormSection title="Deployment Options">
|
<FormSection title="Deployment options">
|
||||||
<div className="form-group">
|
<div className="form-group">
|
||||||
<div className="col-sm-12">
|
<div className="col-sm-12">
|
||||||
<SwitchField
|
<SwitchField
|
||||||
|
|
|
@ -9,7 +9,7 @@ export function HelmSection() {
|
||||||
const [{ name }, { error }] = useField<string>('helmRepositoryUrl');
|
const [{ name }, { error }] = useField<string>('helmRepositoryUrl');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FormSection title="Helm Repository">
|
<FormSection title="Helm repository">
|
||||||
<div className="mb-2">
|
<div className="mb-2">
|
||||||
<TextTip color="blue">
|
<TextTip color="blue">
|
||||||
You can specify the URL to your own Helm repository here. See the{' '}
|
You can specify the URL to your own Helm repository here. See the{' '}
|
||||||
|
|
|
@ -44,7 +44,7 @@ export function KubeSettingsPanel() {
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Widget>
|
<Widget id="kubernetes-settings">
|
||||||
<Widget.Title icon={kubeIcon} title="Kubernetes settings" />
|
<Widget.Title icon={kubeIcon} title="Kubernetes settings" />
|
||||||
<Widget.Body>
|
<Widget.Body>
|
||||||
<Formik
|
<Formik
|
||||||
|
@ -66,7 +66,7 @@ export function KubeSettingsPanel() {
|
||||||
loadingText="Saving"
|
loadingText="Saving"
|
||||||
className="!ml-0"
|
className="!ml-0"
|
||||||
>
|
>
|
||||||
Save Kubernetes Settings
|
Save Kubernetes settings
|
||||||
</LoadingButton>
|
</LoadingButton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -121,7 +121,7 @@ function SSLSettingsPanel() {
|
||||||
loadingText={reloadingPage ? 'Reloading' : 'Saving'}
|
loadingText={reloadingPage ? 'Reloading' : 'Saving'}
|
||||||
className="!ml-0"
|
className="!ml-0"
|
||||||
>
|
>
|
||||||
Save SSL Settings
|
Save SSL settings
|
||||||
</LoadingButton>
|
</LoadingButton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue