mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 15:59:41 +02:00
feat(config): separate configmaps and secrets [EE-5078] (#9029)
This commit is contained in:
parent
4a331b71e1
commit
d7fc2046d7
102 changed files with 2845 additions and 665 deletions
|
@ -22,7 +22,7 @@ export function Badge({ type, className, children }: PropsWithChildren<Props>) {
|
|||
);
|
||||
}
|
||||
|
||||
// classes in full to prevent a dev server bug, where tailwind doesn't render the interpolated classes
|
||||
// the classes are typed in full to prevent a dev server bug, where tailwind doesn't render the interpolated classes
|
||||
function getClasses(type: BadgeType | undefined) {
|
||||
switch (type) {
|
||||
case 'success':
|
||||
|
|
|
@ -14,6 +14,7 @@ interface Props extends IconProps {
|
|||
isRefetching?: boolean;
|
||||
value?: number;
|
||||
to?: string;
|
||||
params?: object;
|
||||
children?: ReactNode;
|
||||
dataCy?: string;
|
||||
}
|
||||
|
@ -26,6 +27,7 @@ export function DashboardItem({
|
|||
isRefetching,
|
||||
value,
|
||||
to,
|
||||
params,
|
||||
children,
|
||||
dataCy,
|
||||
}: Props) {
|
||||
|
@ -41,7 +43,7 @@ export function DashboardItem({
|
|||
>
|
||||
<div
|
||||
className={clsx(
|
||||
'text-muted absolute top-2 right-2 flex items-center transition-opacity',
|
||||
'text-muted absolute top-2 right-2 flex items-center text-xs transition-opacity',
|
||||
isRefetching ? 'opacity-100' : 'opacity-0'
|
||||
)}
|
||||
>
|
||||
|
@ -50,7 +52,7 @@ export function DashboardItem({
|
|||
</div>
|
||||
<div
|
||||
className={clsx(
|
||||
'text-muted absolute top-2 right-2 flex items-center transition-opacity',
|
||||
'text-muted absolute top-2 right-2 flex items-center text-xs transition-opacity',
|
||||
isLoading ? 'opacity-100' : 'opacity-0'
|
||||
)}
|
||||
>
|
||||
|
@ -101,7 +103,7 @@ export function DashboardItem({
|
|||
|
||||
if (to) {
|
||||
return (
|
||||
<Link to={to} className="!no-underline">
|
||||
<Link to={to} className="!no-underline" params={params}>
|
||||
{Item}
|
||||
</Link>
|
||||
);
|
||||
|
|
66
app/react/components/Widget/WidgetTabs.tsx
Normal file
66
app/react/components/Widget/WidgetTabs.tsx
Normal file
|
@ -0,0 +1,66 @@
|
|||
import { RawParams } from '@uirouter/react';
|
||||
import clsx from 'clsx';
|
||||
import { ReactNode } from 'react';
|
||||
|
||||
import { Icon } from '@@/Icon';
|
||||
import { Link } from '@@/Link';
|
||||
|
||||
export interface Tab {
|
||||
name: string;
|
||||
icon: ReactNode;
|
||||
widget: ReactNode;
|
||||
selectedTabParam: string;
|
||||
}
|
||||
|
||||
interface Props {
|
||||
currentTabIndex: number;
|
||||
tabs: Tab[];
|
||||
}
|
||||
|
||||
export function WidgetTabs({ currentTabIndex, tabs }: Props) {
|
||||
// ensure that the selectedTab param is always valid
|
||||
const invalidQueryParamValue = tabs.every(
|
||||
(tab) => encodeURIComponent(tab.selectedTabParam) !== tab.selectedTabParam
|
||||
);
|
||||
|
||||
if (invalidQueryParamValue) {
|
||||
throw new Error('Invalid query param value for tab');
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="row">
|
||||
<div className="col-sm-12 !mb-0">
|
||||
<div className="pl-2">
|
||||
{tabs.map(({ name, icon }, index) => (
|
||||
<Link
|
||||
to="."
|
||||
params={{ tab: tabs[index].selectedTabParam }}
|
||||
key={index}
|
||||
className={clsx(
|
||||
'inline-flex items-center gap-2 border-0 border-b-2 border-solid bg-transparent px-4 py-2',
|
||||
currentTabIndex === index
|
||||
? 'border-blue-8 text-blue-8 th-highcontrast:border-blue-6 th-highcontrast:text-blue-6 th-dark:border-blue-6 th-dark:text-blue-6'
|
||||
: 'border-transparent'
|
||||
)}
|
||||
>
|
||||
<Icon icon={icon} />
|
||||
{name}
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// findSelectedTabIndex returns the index of the tab, or 0 if none is selected
|
||||
export function findSelectedTabIndex(
|
||||
{ params }: { params: RawParams },
|
||||
tabs: Tab[]
|
||||
) {
|
||||
const selectedTabParam = params.tab || tabs[0].selectedTabParam;
|
||||
const currentTabIndex = tabs.findIndex(
|
||||
(tab) => tab.selectedTabParam === selectedTabParam
|
||||
);
|
||||
return currentTabIndex || 0;
|
||||
}
|
|
@ -13,6 +13,7 @@ export function createSelectColumn<T>(): ColumnDef<T> {
|
|||
checked={table.getIsAllRowsSelected()}
|
||||
indeterminate={table.getIsSomeRowsSelected()}
|
||||
onChange={table.getToggleAllRowsSelectedHandler()}
|
||||
disabled={table.getRowModel().rows.every((row) => !row.getCanSelect())}
|
||||
/>
|
||||
),
|
||||
cell: ({ row, table }) => (
|
||||
|
@ -21,6 +22,7 @@ export function createSelectColumn<T>(): ColumnDef<T> {
|
|||
checked={row.getIsSelected()}
|
||||
indeterminate={row.getIsSomeSelected()}
|
||||
onChange={row.getToggleSelectedHandler()}
|
||||
disabled={!row.getCanSelect()}
|
||||
onClick={(e) => {
|
||||
if (e.shiftKey) {
|
||||
const { rows, rowsById } = table.getRowModel();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue