Skip to content
Merged

Dev #1086

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ui/src/components/Common/Card/card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ const Card = <T extends ICardType = ICardType>({
}}
>
{isHovered || selectedCard?.[idField] === data?.[idField] ? (
<Radio checked={selectedCard?.id === data?.id} disabled={!isHovered} />
<Radio checked={selectedCard?.[idField] === data?.[idField]} disabled={!isHovered} />
) : (
<></>
)}
Expand Down
14 changes: 7 additions & 7 deletions ui/src/components/Common/SaveChangesModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ interface Props {
closeModal: () => void;
isopen?: (flag: boolean) => void;
otherCmsTitle?: string;
saveContentType?: () => void | Promise<void>;
saveContentType?: () => void;
openContentType?: () => void;
changeStep?: () => void | Promise<void>;
changeStep?: () => void;
dropdownStateChange: () => void;
}

Expand Down Expand Up @@ -47,24 +47,24 @@ const SaveChangesModal = (props: Props) => {
<Button
buttonType="secondary"
version={'v2'}
onClick={async () => {
onClick={ () => {
props.closeModal();
props?.dropdownStateChange();
props.openContentType?.();
props?.isopen?.(false);
await props?.changeStep?.();
props?.changeStep?.();
}}
>
Don&apos;t Save
</Button>
<Button
version={'v2'}
onClick={async () => {
onClick={ () => {
props?.dropdownStateChange();
await props?.saveContentType?.();
props?.saveContentType?.();
props.closeModal();
props.openContentType?.();
await props?.changeStep?.();
props?.changeStep?.();
}}
>
Save
Expand Down
122 changes: 58 additions & 64 deletions ui/src/components/ContentMapper/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -67,35 +67,16 @@
justify-content: space-between;
min-height: 42px;
padding: $px-8 $px-10 $px-8 $px-12;

> .ct-options {
align-items: center;
display: flex;
flex-shrink: 0;
gap: $space-10;

.ct-schema-preview-wrap {
align-items: center;
display: inline-flex;
}
}

.ct-names {
align-items: center;
display: flex;
font-size: $size-font-xl;
line-height: normal;
min-height: 0;
min-width: 0;
text-align: left;
width: calc(100% - 50px);
.cms-title {
align-items: center;
display: flex;
max-height: 24px;
white-space: nowrap;
.tippy-wrapper {
align-items: center;
display: flex;
}
span {
Expand All @@ -105,6 +86,9 @@
text-overflow: ellipsis;
}
}
.ct-options {
justify-content: flex-end;
}
}
.schema-preview {
padding: 0;
Expand Down Expand Up @@ -156,58 +140,56 @@
.table-container {
flex: 1 0 auto;
}
.content-mapper-container {
.table-wrapper {
flex: 1;
.TablePanel {
border-left: 0 none;
.TablePanel__list-count {
display: none;
}
.table-wrapper {
flex: 1;
.TablePanel {
border-left: 0 none;
.TablePanel__list-count {
display: none;
}
.Table {
border-left: 0 none;
min-height: 24.25rem;
.Table__body__row {
}
.Table {
border-left: 0 none;
min-height: 24.25rem;
.Table__body__row {
.Table-select-body {
> .checkbox-wrapper {
align-items: flex-start;
}
>.checkbox-wrapper {
align-items: flex-start;
}
}
.Table__body__column {
padding: 0 1.25rem;
&:not(:last-of-type) {
display: block;
}
}
.Table-select-body {
width: 68px;
}
.Table__body__column {
padding: 0 1.25rem;
&:not(:last-of-type) {
display: block;
}
.cms-field {
// text-transform: capitalize;
// overflow: hidden;
// text-overflow: ellipsis;
// white-space: nowrap;
// width: 445px;
}
.Table-select-body {
width: 68px;
}
.cms-field {
// text-transform: capitalize;
// overflow: hidden;
// text-overflow: ellipsis;
// white-space: nowrap;
// width: 445px;

display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
overflow: hidden;
text-overflow: ellipsis;
}
.InstructionText {
font-size: $size-font-small;
margin: 0;
}
.EmptyStateWrapper {
margin-top: $px-20;
}
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
overflow: hidden;
text-overflow: ellipsis;
}
.import-cta {
.InstructionText {
font-size: $size-font-small;
margin: 0;
}
.EmptyStateWrapper {
margin-top: $px-20;
}
}
.import-cta {
margin: 0;
}
}
.disabled-field {
Expand Down Expand Up @@ -503,22 +485,34 @@ div .table-row {
}
}

.select {
.tippy-wrapper {
display: inline;
}
}

.entry-mapper-container {
.Table {

// Force row layout alignment
.Table__head,
.Table__body__row {
display: flex !important;
width: 100%;
}

// Keep the row-select (checkbox) cell at its fixed width and never shrink it
// Keep the row-select (checkbox) cell at its fixed width and never shrink it,
// and vertically center the checkbox so it lines up with the row text.
.Table-select-head,
.Table-select-body {
flex: 0 0 68px !important;
width: 68px !important;
min-width: 68px !important;
display: flex !important;
align-items: center !important;

.checkbox-wrapper {
align-items: center !important;
}
}

// Target actual column containers
Expand Down
23 changes: 20 additions & 3 deletions ui/src/components/LegacyCms/Actions/LoadSelectCms.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,21 @@ const LoadSelectCms = (props: LoadSelectCmsProps) => {
}


// Determine which CMS to set as selected
// Determine which CMS to set as selected.
// If a version is already selected (e.g. preserved across a restart / on revisit),
// keep it instead of wiping it back to DEFAULT_CMS_TYPE. Only auto-pick when there's
// a single matching version, and only fall back to default when nothing is selected.
let finalSelectedCard: ICMSType | undefined;
if (filteredCmsData?.length === 1) {
const existingSelectedCms = newMigrationData?.legacy_cms?.selectedCms;
const existingStillValid =
!isEmptyString(existingSelectedCms?.cms_id) &&
filteredCmsData?.some(
(cms: ICMSType) => cms?.cms_id === existingSelectedCms?.cms_id
);

if (existingStillValid) {
finalSelectedCard = existingSelectedCms;
} else if (filteredCmsData?.length === 1) {
finalSelectedCard = filteredCmsData[0];
} else {
finalSelectedCard = DEFAULT_CMS_TYPE;
Expand All @@ -144,7 +156,12 @@ const LoadSelectCms = (props: LoadSelectCmsProps) => {
legacy_cms: {
...newMigrationData?.legacy_cms,
selectedCms: finalSelectedCard, // Include selectedCms in this dispatch
selectedFileFormat: filteredCmsData[0]?.allowed_file_formats?.[0],
// Keep the file format in sync with the resolved CMS: only preserve the existing
// format when the existing version is being preserved; otherwise derive it from
// the resolved card so we never end up with DEFAULT_CMS_TYPE + a stale format.
selectedFileFormat: existingStillValid
? newMigrationData?.legacy_cms?.selectedFileFormat
: finalSelectedCard?.allowed_file_formats?.[0],
affix: newMigrationData?.legacy_cms?.affix || 'cs', // Preserve or set default affix
uploadedFile: {
...newMigrationData?.legacy_cms?.uploadedFile,
Expand Down
5 changes: 4 additions & 1 deletion ui/src/components/LegacyCms/Actions/LoadUploadFile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,14 @@ const FileComponent = ( { fileDetails, fileFormatId }: Props ) =>
{
const isSQL = fileFormatId?.toLowerCase() === 'sql';
const newMigrationData = useSelector((state: RootState) => state?.migration?.newMigrationData);
const isValidated = newMigrationData?.legacy_cms?.uploadedFile?.isValidated;
const [isEditing, setIsEditing] = useState((newMigrationData?.iteration > 1 && !newMigrationData?.legacy_cms?.uploadedFile?.isValidated) ? true : false);
const [localPath, setLocalPath] = useState(fileDetails?.localPath || '');
const dispatch = useDispatch();
const currentPath = newMigrationData?.legacy_cms?.uploadedFile?.file_details?.localPath || fileDetails?.localPath || '';
const handleEditFile = async () => {
// Once the file is validated, editing the path is disabled
if (isValidated) return;
setIsEditing(true);
setLocalPath(currentPath);
};
Expand Down Expand Up @@ -116,7 +119,7 @@ const FileComponent = ( { fileDetails, fileFormatId }: Props ) =>
<Paragraph tagName="p" variant="p1" text={`Local Path: ${currentPath}`} />
)}
</div>
<div className="edit-icon">
<div className={`edit-icon${isValidated ? ' edit-icon--disabled' : ''}`}>
<Icon icon="EditSmallActive" size="small" onClick={handleEditFile} />
</div>
</div>
Expand Down
12 changes: 9 additions & 3 deletions ui/src/components/LegacyCms/legacyCms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@
line-clamp: 2;
-webkit-box-orient: vertical;
width: 540px;
gap: 10px;
gap: 5px;

.file-path-text {
flex: 1;
Expand All @@ -184,11 +184,17 @@
display: flex;
align-items: center;
justify-content: center;
padding: 5px;
padding-right: 10px;

&:hover {
opacity: 0.7;
}

&--disabled {
cursor: not-allowed;
opacity: 0.4;
pointer-events: none;
}
}
}
.message-container {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@ const HorizontalStepper = forwardRef(
if (!Number.isNaN(stepIndex) && stepIndex >= 0 && stepIndex < steps?.length) {
!newMigrationDataRef?.current?.isprojectMapped && setShowStep(stepIndex);
setStepsCompleted((prev) => {
const updatedStepsCompleted = [...prev];
// Drop any completed steps at or beyond the current step so a restart
// (navigating back to an earlier step) un-fills the connectors ahead of it.
// Steps before the current one remain completed.
const updatedStepsCompleted = prev?.filter((i) => i < stepIndex);
if (
stepIndex === 4 &&
(props?.projectData?.isMigrationCompleted ||
Expand Down
1 change: 1 addition & 0 deletions ui/src/pages/Migration/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,7 @@ const Migration = () => {
isprojectMapped: false,
project_current_step: projectData?.current_step,
isContentMapperGenerated: projectData?.content_mapper?.length > 0,
iteration: projectData?.iteration ?? 1,
};

dispatch(updateNewMigrationData(projectMapper));
Expand Down
Loading