From 6d17d8bc6462a22a3401467da3bc66c6becfb381 Mon Sep 17 00:00:00 2001 From: Ali <83188384+testA113@users.noreply.github.com> Date: Tue, 7 May 2024 16:16:49 +1200 Subject: [PATCH] fix(be-overlay): consistency overlay with variants [EE-6742] (#11774) Co-authored-by: testa113 --- .../auth-logs-view/auth-logs-view.html | 8 ++-- .../BEFeatureIndicator/BEOverlay.tsx | 44 ++++++++++++++++-- .../ActivityLogsView/ActivityLogsView.tsx | 45 ++++++++++--------- .../logs/ActivityLogsView/FilterBar.tsx | 3 -- .../logs/components/DateRangePicker.tsx | 2 +- .../BackupSettingsView/BackupS3Form.tsx | 7 ++- .../BackupSettingsPanel.tsx | 2 + .../settings/SettingsView/HelmCertPanel.tsx | 2 +- 8 files changed, 76 insertions(+), 37 deletions(-) diff --git a/app/portainer/user-activity/auth-logs-view/auth-logs-view.html b/app/portainer/user-activity/auth-logs-view/auth-logs-view.html index f59f27584..020ff76f7 100644 --- a/app/portainer/user-activity/auth-logs-view/auth-logs-view.html +++ b/app/portainer/user-activity/auth-logs-view/auth-logs-view.html @@ -1,8 +1,8 @@ -
-
- +
+
+
@@ -11,7 +11,7 @@
- +
diff --git a/app/react/components/BEFeatureIndicator/BEOverlay.tsx b/app/react/components/BEFeatureIndicator/BEOverlay.tsx index 41765930c..fcdddd980 100644 --- a/app/react/components/BEFeatureIndicator/BEOverlay.tsx +++ b/app/react/components/BEFeatureIndicator/BEOverlay.tsx @@ -5,14 +5,38 @@ import { isLimitedToBE } from '@/react/portainer/feature-flags/feature-flags.ser import { BEFeatureIndicator } from './BEFeatureIndicator'; +type Variants = 'form-section' | 'widget' | 'multi-widget'; + +type OverlayClasses = { + beLinkContainerClassName: string; + contentClassName: string; +}; + +const variantClassNames: Record = { + 'form-section': { + beLinkContainerClassName: '', + contentClassName: '', + }, + widget: { + beLinkContainerClassName: '', + // no padding so that the border overlaps the widget border + contentClassName: '!p-0', + }, + 'multi-widget': { + beLinkContainerClassName: 'm-4', + // widgets have a mx of 15px and mb of 15px - match this at the top with padding + contentClassName: '!p-0 !pt-[15px]', + }, +}; + export function BEOverlay({ featureId, children, - className, + variant = 'form-section', }: { featureId: FeatureId; children: React.ReactNode; - className?: string; + variant?: 'form-section' | 'widget' | 'multi-widget'; }) { const isLimited = isLimitedToBE(featureId); if (!isLimited) { @@ -21,10 +45,22 @@ export function BEOverlay({ return (
-
+
-
{children}
+
+ {children} +
); } diff --git a/app/react/portainer/logs/ActivityLogsView/ActivityLogsView.tsx b/app/react/portainer/logs/ActivityLogsView/ActivityLogsView.tsx index 9d3ff502e..24eef5b19 100644 --- a/app/react/portainer/logs/ActivityLogsView/ActivityLogsView.tsx +++ b/app/react/portainer/logs/ActivityLogsView/ActivityLogsView.tsx @@ -45,29 +45,30 @@ export function ActivityLogsView() { />
- - - -
- - tableState.setSortBy(value?.id, value?.desc || false) - } - limit={tableState.pageSize} - onChangeLimit={tableState.setPageSize} - keyword={tableState.search} - onChangeKeyword={tableState.setSearch} - currentPage={page} - onChangePage={setPage} - totalItems={logsQuery.data?.totalCount || 0} - dataset={logsQuery.data?.logs} - /> + +
+
+ +
+ + tableState.setSortBy(value?.id, value?.desc || false) + } + limit={tableState.pageSize} + onChangeLimit={tableState.setPageSize} + keyword={tableState.search} + onChangeKeyword={tableState.setSearch} + currentPage={page} + onChangePage={setPage} + totalItems={logsQuery.data?.totalCount || 0} + dataset={logsQuery.data?.logs} + />
diff --git a/app/react/portainer/logs/ActivityLogsView/FilterBar.tsx b/app/react/portainer/logs/ActivityLogsView/FilterBar.tsx index 272198c9d..007db6ce6 100644 --- a/app/react/portainer/logs/ActivityLogsView/FilterBar.tsx +++ b/app/react/portainer/logs/ActivityLogsView/FilterBar.tsx @@ -3,9 +3,7 @@ import { DownloadIcon } from 'lucide-react'; import { Widget } from '@@/Widget'; import { TextTip } from '@@/Tip/TextTip'; import { Button } from '@@/buttons'; -import { BEFeatureIndicator } from '@@/BEFeatureIndicator'; -import { FeatureId } from '../../feature-flags/enums'; import { DateRangePicker } from '../components/DateRangePicker'; export function FilterBar({ @@ -37,7 +35,6 @@ export function FilterBar({ > Export as CSV -
diff --git a/app/react/portainer/logs/components/DateRangePicker.tsx b/app/react/portainer/logs/components/DateRangePicker.tsx index 4ad27e6f6..1bb50c19d 100644 --- a/app/react/portainer/logs/components/DateRangePicker.tsx +++ b/app/react/portainer/logs/components/DateRangePicker.tsx @@ -24,7 +24,7 @@ export function DateRangePicker({ error?: FormikErrors; }) { return ( - +
{({ values, errors, isSubmitting, setFieldValue, isValid }) => ( - +
diff --git a/app/react/portainer/settings/SettingsView/BackupSettingsView/BackupSettingsPanel.tsx b/app/react/portainer/settings/SettingsView/BackupSettingsView/BackupSettingsPanel.tsx index 107e6b6e6..b1cd423a5 100644 --- a/app/react/portainer/settings/SettingsView/BackupSettingsView/BackupSettingsPanel.tsx +++ b/app/react/portainer/settings/SettingsView/BackupSettingsView/BackupSettingsPanel.tsx @@ -12,6 +12,8 @@ import { BackupS3Form } from './BackupS3Form'; export function BackupSettingsPanel() { const [backupType, setBackupType] = useState(options[0].value); + console.log(backupType); + return ( diff --git a/app/react/portainer/settings/SettingsView/HelmCertPanel.tsx b/app/react/portainer/settings/SettingsView/HelmCertPanel.tsx index 03384415f..855a6f537 100644 --- a/app/react/portainer/settings/SettingsView/HelmCertPanel.tsx +++ b/app/react/portainer/settings/SettingsView/HelmCertPanel.tsx @@ -30,7 +30,7 @@ export function HelmCertPanel() { }; return ( - +