Skip to content

Commit

Permalink
Merge pull request #966 from sgratch/add-mapping-tab-to-plans-details…
Browse files Browse the repository at this point in the history
…-page

🐾 Enrich the mappings tab for the plans details page
  • Loading branch information
yaacov authored Mar 12, 2024
2 parents f020093 + 9f3995a commit 0675907
Show file tree
Hide file tree
Showing 20 changed files with 1,516 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"Certificate change detected": "Certificate change detected",
"Clear all filters": "Clear all filters",
"Click the update credentials button to save your changes, button is disabled until a change is detected.": "Click the update credentials button to save your changes, button is disabled until a change is detected.",
"Click the update mappings button to save your changes, button is disabled until a change is detected.": "Click the update mappings button to save your changes, button is disabled until a change is detected.",
"Cluster": "Cluster",
"Clusters": "Clusters",
"Completed at": "Completed at",
Expand Down Expand Up @@ -81,6 +82,7 @@
"Critical": "Critical",
"Critical concerns": "Critical concerns",
"Data centers": "Data centers",
"Data is loading, please wait.": "Data is loading, please wait.",
"Data stores": "Data stores",
"Dates are compared in UTC. End of the interval is included.": "Dates are compared in UTC. End of the interval is included.",
"Dedicated CPU": "Dedicated CPU",
Expand All @@ -107,6 +109,7 @@
"Edit Controller Memory limit": "Edit Controller Memory limit",
"Edit credentials": "Edit credentials",
"Edit Default Transfer Network": "Edit Default Transfer Network",
"Edit mappings": "Edit mappings",
"Edit Maximum concurrent VM migrations": "Edit Maximum concurrent VM migrations",
"Edit migration plan target namespace": "Edit migration plan target namespace",
"Edit migration plan transfer network": "Edit migration plan transfer network",
Expand Down Expand Up @@ -234,6 +237,7 @@
"NICs with empty NIC profile": "NICs with empty NIC profile",
"No credentials found.": "No credentials found.",
"No inventory data available.": "No inventory data available.",
"No Mapping found.": "No Mapping found.",
"No NetworkMaps found.": "No NetworkMaps found.",
"No networks in this category": "No networks in this category",
"No owner": "No owner",
Expand Down Expand Up @@ -355,6 +359,7 @@
"Show the welcome card": "Show the welcome card",
"Skip certificate validation": "Skip certificate validation",
"Snapshot polling interval (seconds)": "Snapshot polling interval (seconds)",
"Something is wrong, the data was not loaded due to an error, please try to reload the page.": "Something is wrong, the data was not loaded due to an error, please try to reload the page.",
"Something is wrong, the secret was not loaded, please try to reload the page.": "Something is wrong, the secret was not loaded, please try to reload the page.",
"source": "source",
"Source Only": "Source Only",
Expand Down Expand Up @@ -388,6 +393,7 @@
"The certificate is not a valid PEM-encoded X.509 certificate": "The certificate is not a valid PEM-encoded X.509 certificate",
"The chosen provider is no longer available.": "The chosen provider is no longer available.",
"The current certificate does not match the certificate fetched from URL. Manually validate the fingerprint before proceeding.": "The current certificate does not match the certificate fetched from URL. Manually validate the fingerprint before proceeding.",
"The edit mappings button is disabled if the plan started running and at least one virtual machine was migrated successfully.": "The edit mappings button is disabled if the plan started running and at least one virtual machine was migrated successfully.",
"The interval in minutes for precopy. Default value is 60.": "The interval in minutes for precopy. Default value is 60.",
"The interval in seconds for snapshot pooling. Default value is 10.": "The interval in seconds for snapshot pooling. Default value is 10.",
"The limit for CPU usage by the controller, specified in milliCPU. Default value is 500m.": "The limit for CPU usage by the controller, specified in milliCPU. Default value is 500m.",
Expand Down Expand Up @@ -420,6 +426,7 @@
"Unknown power state": "Unknown power state",
"Unsupported provider type": "Unsupported provider type",
"Update credentials": "Update credentials",
"Update mappings": "Update mappings",
"Update providers": "Update providers",
"Updated": "Updated",
"Upload": "Upload",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,75 +1,93 @@
.forklift-page-plan-details-section {
padding-top: 0;
padding-bottom: 30px;
}

.forklift-page-headings-alerts {
padding-left: 0;
padding-top: 0;
padding-left: 0;
padding-top: 0;
}

.forklift-page-section {
border-top: 1px solid var(--pf-global--BorderColor--100);
border-top: 1px solid var(--pf-global--BorderColor--100);
}

.forklift-page-section--info {
border-bottom: 0;
padding-bottom: 0;
border-bottom: 0;
padding-bottom: 0;
}

.forklift-page-section--details {
border-top: 0;
border-top: 0;
}

.forklift-page-plan-networks-button {
padding-bottom: var(--pf-global--spacer--lg);
padding-bottom: var(--pf-global--spacer--lg);
}

.forklift-page-plan-vm_concern-button {
padding: var(--pf-global--spacer--xs);
padding: var(--pf-global--spacer--xs);
}

.forklift-page-plan-field-error-validation {
color: var(--pf-c-form__helper-text--m-error--Color);
font-size: small;
padding-top: var(--pf-c-form__helper-text--MarginTop);
color: var(--pf-c-form__helper-text--m-error--Color);
font-size: small;
padding-top: var(--pf-c-form__helper-text--MarginTop);
}

.forklift-page-plan-field-warning-validation {
color: var(--pf-c-form__helper-text--m-warning--Color);
font-size: small;
padding-top: var(--pf-c-form__helper-text--MarginTop);
color: var(--pf-c-form__helper-text--m-warning--Color);
font-size: small;
padding-top: var(--pf-c-form__helper-text--MarginTop);
}

.forklift-page-plan-field-success-validation {
color: var(--pf-c-form__helper-text--m-success--Color);
font-size: small;
padding-top: var(--pf-c-form__helper-text--MarginTop);
}

.forklift-page-plan-field-default-validation {
font-size: small;
padding-top: var(--pf-c-form__helper-text--MarginTop);
color: var(--pf-c-form__helper-text--m-success--Color);
font-size: small;
padding-top: var(--pf-c-form__helper-text--MarginTop);
}

.forklift-network-map__details-tab--update-button {
margin-bottom: var(--pf-global--spacer--md);
margin-bottom: var(--pf-global--spacer--md);
}

.forklift-overview__controller-card__status-icon {
padding-right: var(--pf-global--spacer--sm);
padding-right: var(--pf-global--spacer--sm);
}

.forklift-table__status-cell-progress {
padding-right: var(--pf-global--spacer--xl);;
padding-right: var(--pf-global--spacer--xl);;
}

.forklift-table__status-cell-progress div {
grid-gap: var(--pf-global--spacer--xs);
grid-gap: var(--pf-global--spacer--xs);
}

.forklift-page-section--details-status {
width: 50%;
width: 50%;
}


.forklift-page-section--details-start-button {
padding-bottom: var(--pf-global--spacer--lg);
padding-bottom: var(--pf-global--spacer--lg);
}

.forklift-page-plan-mapping-list {
max-width: 55rem;
}

.forklift-page-plan-mapping {
display: flex;
padding-top: 30px;
font-size: 16px;
}

.forklift-page-plan-resource-link-in-description-item {
padding-left: 8px;
}

.forklift-alert--margin-top {
margin-top: var(--pf-global--spacer--md);
}

.forklift-page-details-edit-pencil{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
import { PlanActionsDropdown } from '../../actions';

import { Suspend } from './components';
import { PlanDetails, PlanYAML } from './tabs';
import { PlanDetails, PlanMappings, PlanYAML } from './tabs';

import './PlanDetailsPage.style.css';

Expand Down Expand Up @@ -57,6 +57,13 @@ const PlanDetailsPage_: React.FC<{
<PlanYAML plan={obj} loaded={loaded} loadError={loadError} permissions={permissions} />
),
},
{
href: 'mappings',
name: t('Mappings'),
component: () => (
<PlanMappings plan={obj} loaded={loaded} loadError={loadError} permissions={permissions} />
),
},
/*
{
href: 'vms',
Expand All @@ -70,13 +77,6 @@ const PlanDetailsPage_: React.FC<{
/>
),
},
{
href: 'mappings',
name: t('Mappings'),
component: () => (
<PlanMappings plan={obj} loaded={loaded} loadError={loadError} permissions={permissions} />
),
},
{
href: 'hooks',
name: t('Hooks'),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import React, { FC } from 'react';
import { useForkliftTranslation } from 'src/utils/i18n';

import { Button, DataList } from '@patternfly/react-core';
import { PlusCircleIcon } from '@patternfly/react-icons';

import { Mapping, MappingListItem } from './MappingListItem';

interface MappingListProps {
/**
* List of existed mappings
*/
mappings: Mapping[];
/**
* List of available source provider's mappings
*/
availableSources?: string[];
/**
* List of available target provider's mappings
*/
availableDestinations?: string[];
replaceMapping?: (val: { current: Mapping; next: Mapping }) => void;
deleteMapping?: (mapping: Mapping) => void;
addMapping?: () => void;
generalSourcesLabel: string;
noSourcesLabel: string;
/**
* Is the 'mappings adding' buttons disabled
*/
isDisabled?: boolean;
/**
* Is in edit/view mode? In case of view mode, the DataListCells are disabled and buttons are hidden
*/
isEditable?: boolean;
}

export const MappingList: FC<MappingListProps> = ({
mappings,
availableSources,
availableDestinations,
replaceMapping,
deleteMapping,
addMapping,
generalSourcesLabel,
noSourcesLabel,
isDisabled = false,
isEditable = true,
}) => {
const { t } = useForkliftTranslation();

return (
<>
<DataList isCompact aria-label="">
{mappings?.map(({ source, destination }, index) => (
<MappingListItem
source={source}
destination={destination}
sources={availableSources}
destinations={availableDestinations}
replaceMapping={replaceMapping}
deleteMapping={deleteMapping}
index={index}
key={`${source}-${destination}`}
generalSourcesLabel={generalSourcesLabel}
noSourcesLabel={noSourcesLabel}
isEditable={isEditable}
/>
))}
</DataList>
{isEditable ? (
<Button
onClick={addMapping}
type="button"
variant="link"
isDisabled={isDisabled}
icon={<PlusCircleIcon />}
>
{t('Add mapping')}
</Button>
) : (
''
)}
</>
);
};
Loading

0 comments on commit 0675907

Please sign in to comment.