Skip to content

Commit 488d486

Browse files
committed
refactor
1 parent c99e6c7 commit 488d486

File tree

5 files changed

+77
-42
lines changed

5 files changed

+77
-42
lines changed

public/locales/en.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"ControlPlaneCard": {
6161
"deleteConfirmationDialog": "MCP deletion triggered. The list will refresh automatically once completed.",
6262
"editMCP": "Edit Managed Control Plane",
63-
"duplicateMCP": "Duplicate MCP config",
63+
"duplicateMCP": "Duplicate ManagedControlPlane",
6464
"deleteMCP": "Delete Managed Control Plane"
6565

6666
},
@@ -391,13 +391,16 @@
391391
"dialogTitle": "Edit Managed Control Plane",
392392
"titleText": "Managed Control Plane Updated Successfully!",
393393
"subtitleText": "Your Managed Control Plane is being updated. It will be ready to use in just a few minutes. You can safely close this window.",
394-
"editComponents": "Edit components"
394+
"editComponents": "Edit components",
395+
"duplicatingMCPInfo1": "Duplicating a <span>ManagedControlPlane</span> will only create a <span>ManagedControlPlane</span> with the same configuration. ",
396+
"duplicatingMCPInfo2": "<b>It will NOT copy the managed resources inside</b>"
395397
},
396398
"componentsSelection": {
397399
"selectComponents": "Select Components",
398400
"selectedComponents": "Selected Components",
399401
"pleaseSelectComponents": "Choose the components you want to add to your Managed Control Plane.",
400-
"cannotLoad": "Cannot load components list"
402+
"cannotLoad": "Cannot load components list",
403+
"noComponentsFound": "No components found matching your search."
401404
},
402405
"Hints": {
403406
"CrossplaneHint": {

src/components/ComponentsSelection/ComponentsSelection.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ export const ComponentsSelection: React.FC<ComponentsSelectionProps> = ({
167167
);
168168
})
169169
) : (
170-
<Infobox fullWidth variant="success">
171-
<Text>{t('componentsSelection.pleaseSelectComponents')}</Text>
170+
<Infobox fullWidth variant="normal" icon="search">
171+
<Text>{t('componentsSelection.noComponentsFound')}</Text>
172172
</Infobox>
173173
)}
174174
</div>
@@ -191,7 +191,7 @@ export const ComponentsSelection: React.FC<ComponentsSelectionProps> = ({
191191
))}
192192
</List>
193193
) : (
194-
<Infobox fullWidth variant="success">
194+
<Infobox fullWidth variant="success" icon="add">
195195
<Text>{t('componentsSelection.pleaseSelectComponents')}</Text>
196196
</Infobox>
197197
)}
Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,32 @@
11
.infobox {
2-
display: inline-block;
3-
border: 1px solid;
2+
display: flex;
3+
align-items: center;
4+
border-radius: 12px;
5+
padding: 1rem;
46
margin: 1rem 0;
7+
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
8+
transform: translateY(-2px);
9+
color: #fff;
10+
font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
11+
}
12+
13+
.icon {
14+
margin-right: 1rem;
15+
font-size: 1.5rem;
16+
flex-shrink: 0;
17+
}
18+
19+
.content {
20+
flex-grow: 1;
521
}
622

723
.full-width {
8-
display: block;
9-
margin: 0;
24+
width: 100%;
25+
margin: 1rem 0;
1026
}
1127

1228
.size-sm {
13-
padding: 0.5rem 0.75rem;
29+
padding: 0.75rem 1rem;
1430
font-size: 0.875rem;
1531
}
1632

@@ -21,29 +37,21 @@
2137

2238
.size-lg {
2339
padding: 1.5rem 2rem;
24-
font-size: 1.25rem;
40+
font-size: 1.125rem;
2541
}
2642

2743
.variant-normal {
28-
border-color: var(--sapNeutralTextColor);
29-
background-color: var(--sapNeutralBackground);
30-
color: var(--sapNeutralTextColor);
44+
background: linear-gradient(135deg, #6e8efb, #a777e3);
3145
}
3246

3347
.variant-success {
34-
border-color: var(--sapPositiveTextColor);
35-
background-color: var(--sapPositiveBackground);
36-
color: var(--sapPositiveTextColor);
48+
background: linear-gradient(135deg, #56ab2f, #a8e063);
3749
}
3850

3951
.variant-warning {
40-
border-color: var(--sapCriticalTextColor);
41-
background-color: var(--sapCriticalBackground);
42-
color: var(--sapCriticalTextColor);
52+
background: linear-gradient(135deg, #ffc837, #ff8008);
4353
}
4454

4555
.variant-danger {
46-
border-color: var(--sapNegativeTextColor);
47-
background-color: var(--sapErrorBackground);
48-
color: var(--sapNegativeTextColor);
56+
background: linear-gradient(135deg, #e53935, #e35d5b);
4957
}

src/components/Ui/Infobox/Infobox.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, { ReactNode } from 'react';
22
import cx from 'clsx';
3+
import { Icon } from '@ui5/webcomponents-react';
34

45
import styles from './Infobox.module.css';
56

@@ -10,6 +11,7 @@ interface LabelProps {
1011
children: ReactNode;
1112
fullWidth?: boolean;
1213
className?: string;
14+
icon?: string;
1315
}
1416

1517
export const Infobox: React.FC<LabelProps> = ({
@@ -19,6 +21,7 @@ export const Infobox: React.FC<LabelProps> = ({
1921
children,
2022
fullWidth = false,
2123
className,
24+
icon,
2225
}) => {
2326
const infoboxClasses = cx(
2427
styles.infobox,
@@ -36,10 +39,9 @@ export const Infobox: React.FC<LabelProps> = ({
3639
);
3740

3841
return (
39-
<div>
40-
<span className={infoboxClasses} id={id}>
41-
{children}
42-
</span>
42+
<div className={infoboxClasses} id={id}>
43+
{icon && <Icon name={icon} className={styles.icon} />}
44+
<div className={styles.content}>{children}</div>
4345
</div>
4446
);
4547
};

src/components/Wizards/CreateManagedControlPlane/CreateManagedControlPlaneWizardContainer.tsx

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,18 @@ import {
1010
Bar,
1111
Button,
1212
Dialog,
13+
FlexBox,
1314
Form,
1415
FormGroup,
1516
Ui5CustomEvent,
1617
Wizard,
1718
WizardDomRef,
1819
WizardStep,
20+
Text,
1921
} from '@ui5/webcomponents-react';
2022

2123
import { SummarizeStep } from './SummarizeStep.tsx';
22-
import { useTranslation } from 'react-i18next';
24+
import { Trans, useTranslation } from 'react-i18next';
2325
import { useAuthOnboarding } from '../../../spaces/onboarding/auth/AuthContextOnboarding.tsx';
2426
import { ErrorDialog, ErrorDialogHandle } from '../../Shared/ErrorMessageBox.tsx';
2527
import { CreateDialogProps } from '../../Dialogs/CreateWorkspaceDialogContainer.tsx';
@@ -57,6 +59,7 @@ import {
5759
} from '../../../lib/api/types/mcpResource.ts';
5860
import { stringify } from 'yaml';
5961
import { useComponentsSelectionData } from './useComponentsSelectionData.ts';
62+
import { Infobox } from '../../Ui/Infobox/Infobox.tsx';
6063

6164
type CreateManagedControlPlaneWizardContainerProps = {
6265
isOpen: boolean;
@@ -538,19 +541,38 @@ export const CreateManagedControlPlaneWizardContainer: FC<CreateManagedControlPl
538541
selected={selectedStep === 'metadata'}
539542
data-step="metadata"
540543
>
541-
<MetadataForm
542-
key={metadataFormKey}
543-
watch={watch}
544-
setValue={setValue}
545-
register={register}
546-
errors={errors}
547-
isEditMode={isEditMode}
548-
disableChargingFields={!!selectedTemplate}
549-
namePrefix={templateAffixes.namePrefix}
550-
displayNamePrefix={templateAffixes.displayNamePrefix}
551-
nameSuffix={templateAffixes.nameSuffix}
552-
displayNameSuffix={templateAffixes.displayNameSuffix}
553-
/>
544+
<FlexBox direction={'Row'} justifyContent={'SpaceBetween'} gap={16}>
545+
<div style={{ border: '1px solid red', width: '50%' }}>
546+
<MetadataForm
547+
key={metadataFormKey}
548+
watch={watch}
549+
setValue={setValue}
550+
register={register}
551+
errors={errors}
552+
isEditMode={isEditMode}
553+
disableChargingFields={!!selectedTemplate}
554+
namePrefix={templateAffixes.namePrefix}
555+
displayNamePrefix={templateAffixes.displayNamePrefix}
556+
nameSuffix={templateAffixes.nameSuffix}
557+
displayNameSuffix={templateAffixes.displayNameSuffix}
558+
/>
559+
</div>
560+
{isDuplicateMode && (
561+
<div style={{ border: '1px solid red', width: '50%' }}>
562+
<Infobox size={'sm'} variant={'warning'}>
563+
<Text>
564+
<Trans
565+
i18nKey="editMCP.duplicatingMCPInfo1"
566+
components={{ span: <span className="mono-font" /> }}
567+
/>
568+
</Text>
569+
<Text>
570+
<Trans i18nKey="editMCP.duplicatingMCPInfo2" components={{ b: <b /> }} />
571+
</Text>
572+
</Infobox>
573+
</div>
574+
)}
575+
</FlexBox>
554576
</WizardStep>
555577
<WizardStep
556578
icon="user-edit"

0 commit comments

Comments
 (0)