This repository has been archived by the owner on Jul 21, 2023. It is now read-only.
Schedule migration modal changes for warm migration #1070
Merged
mturley
merged 2 commits into
ManageIQ:master
from
mzazrivec:schedule_migration_modal_changes_for_warm_migration
Jan 23, 2020
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
app/javascript/react/screens/App/Overview/components/Migrations/CutoverTimeInfoItem.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { Icon } from 'patternfly-react'; | ||
import { formatDateTime } from '../../../../../../components/dates/MomentDate'; | ||
import ListViewTable from '../../../common/ListViewTable/ListViewTable'; | ||
|
||
const CutoverTimeInfoItem = ({ plan }) => { | ||
if ( | ||
!plan.options.config_info.warm_migration || | ||
(plan.options.config_info.warm_migration && !plan.options.config_info.warm_migration_cutover_datetime) | ||
) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<ListViewTable.InfoItem key={`${plan.id}-cutoverTime`} style={{ textAlign: 'left' }}> | ||
<Icon type="fa" name="clock-o" /> | ||
{__('Cutover scheduled')} | ||
<br /> | ||
{formatDateTime(plan.options.config_info.warm_migration_cutover_datetime)} | ||
</ListViewTable.InfoItem> | ||
); | ||
}; | ||
|
||
CutoverTimeInfoItem.propTypes = { | ||
plan: PropTypes.object | ||
}; | ||
|
||
export default CutoverTimeInfoItem; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { Spinner, Button, Icon, UtilizationBar } from 'patternfly-react'; | ||
import { Spinner, Button, Icon, UtilizationBar, DropdownKebab, MenuItem } from 'patternfly-react'; | ||
import EllipsisWithTooltip from 'react-ellipsis-with-tooltip'; | ||
|
||
import ListViewTable from '../../../common/ListViewTable/ListViewTable'; | ||
|
@@ -18,6 +18,9 @@ import { | |
} from './helpers/inProgressHelpers'; | ||
import InProgressRow from './InProgressRow'; | ||
import ProgressBarTooltip from './ProgressBarTooltip'; | ||
import ScheduleMigrationButton from './ScheduleMigrationButton'; | ||
import CutoverTimeInfoItem from './CutoverTimeInfoItem'; | ||
import StopPropagationOnClick from '../../../common/StopPropagationOnClick'; | ||
|
||
const MigrationInProgressListItem = ({ | ||
plan, | ||
|
@@ -34,13 +37,20 @@ const MigrationInProgressListItem = ({ | |
setMigrationsFilterAction, | ||
cancelPlanRequestAction, | ||
isCancellingPlanRequest, | ||
requestsProcessingCancellation | ||
requestsProcessingCancellation, | ||
loading, | ||
toggleScheduleMigrationModal | ||
}) => { | ||
const { requestsOfAssociatedPlan, mostRecentRequest } = getRequestsOfPlan({ plan, allRequestsWithTasks }); | ||
const waitingForConversionHost = isWaitingForConversionHost(mostRecentRequest); | ||
|
||
const isInitiating = reloadCard || !mostRecentRequest || mostRecentRequest.request_state === 'pending'; | ||
|
||
const showScheduleMigrationButton = | ||
plan.options.config_info.warm_migration && !plan.options.config_info.warm_migration_cutover_datetime; | ||
const showWarmMigrationKebab = | ||
plan.options.config_info.warm_migration && plan.options.config_info.warm_migration_cutover_datetime; | ||
|
||
// Plan request state: initiating | ||
if (isInitiating) { | ||
return ( | ||
|
@@ -50,7 +60,8 @@ const MigrationInProgressListItem = ({ | |
<ListViewTable.InfoItem key="initiating"> | ||
<Spinner size="sm" inline loading /> | ||
{__('Initiating migration. This might take a few minutes.')} | ||
</ListViewTable.InfoItem> | ||
</ListViewTable.InfoItem>, | ||
<CutoverTimeInfoItem plan={plan} /> | ||
]} | ||
/> | ||
); | ||
|
@@ -81,7 +92,8 @@ const MigrationInProgressListItem = ({ | |
<EllipsisWithTooltip style={{ maxWidth: 300 }}> | ||
{__('Waiting for an available conversion host. You can continue waiting or go to the Migration Settings page to increase the number of migrations per host.') /* prettier-ignore */} | ||
</EllipsisWithTooltip> | ||
</ListViewTable.InfoItem> | ||
</ListViewTable.InfoItem>, | ||
<CutoverTimeInfoItem plan={plan} /> | ||
]} | ||
actions={ | ||
<Button disabled={cancelButtonDisabled} onClick={onCancelClick}> | ||
|
@@ -110,7 +122,8 @@ const MigrationInProgressListItem = ({ | |
{__('Unable to migrate VMs because no conversion host was configured at the time of the attempted migration.') /* prettier-ignore */}{' '} | ||
{__('See the product documentation for information on configuring conversion hosts.')} | ||
</EllipsisWithTooltip> | ||
</ListViewTable.InfoItem> | ||
</ListViewTable.InfoItem>, | ||
<CutoverTimeInfoItem plan={plan} /> | ||
]} | ||
actions={ | ||
<Button disabled={isEditingPlanRequest} onClick={onCancelClick}> | ||
|
@@ -160,8 +173,36 @@ const MigrationInProgressListItem = ({ | |
<ListViewTable.InfoItem key="running-playbook"> | ||
<Spinner size="sm" inline loading /> | ||
{sprintf(__('Running playbook service %s. This might take a few minutes.'), playbookName)} | ||
</ListViewTable.InfoItem> | ||
</ListViewTable.InfoItem>, | ||
<CutoverTimeInfoItem plan={plan} /> | ||
]} | ||
actions={ | ||
<div> | ||
{showScheduleMigrationButton && ( | ||
<ScheduleMigrationButton | ||
loading={loading} | ||
toggleScheduleMigrationModal={toggleScheduleMigrationModal} | ||
plan={plan} | ||
isMissingMapping={!plan.infraMappingName} | ||
/> | ||
)} | ||
{showWarmMigrationKebab && ( | ||
<StopPropagationOnClick> | ||
<DropdownKebab id={`${plan.id}-kebab`} pullRight> | ||
<MenuItem | ||
id={`edit_cutover_${plan.id}`} | ||
onClick={e => { | ||
e.stopPropagation(); | ||
toggleScheduleMigrationModal({ plan }); | ||
}} | ||
> | ||
{__('Edit Cutover')} | ||
</MenuItem> | ||
</DropdownKebab> | ||
</StopPropagationOnClick> | ||
)} | ||
</div> | ||
} | ||
/> | ||
); | ||
} | ||
|
@@ -195,8 +236,36 @@ const MigrationInProgressListItem = ({ | |
<TickingIsoElapsedTime startTime={mostRecentRequest.created_on} /> | ||
</div> | ||
</div> | ||
</ListViewTable.InfoItem> | ||
</ListViewTable.InfoItem>, | ||
<CutoverTimeInfoItem plan={plan} /> | ||
]} | ||
actions={ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar blocks of code found in 2 locations. Consider refactoring. |
||
<div> | ||
{showScheduleMigrationButton && ( | ||
<ScheduleMigrationButton | ||
loading={loading} | ||
toggleScheduleMigrationModal={toggleScheduleMigrationModal} | ||
plan={plan} | ||
isMissingMapping={!plan.infraMappingName} | ||
/> | ||
)} | ||
{showWarmMigrationKebab && ( | ||
<StopPropagationOnClick> | ||
<DropdownKebab id={`${plan.id}-kebab`} pullRight> | ||
<MenuItem | ||
id={`edit_cutover_${plan.id}`} | ||
onClick={e => { | ||
e.stopPropagation(); | ||
toggleScheduleMigrationModal({ plan }); | ||
}} | ||
> | ||
{__('Edit Cutover')} | ||
</MenuItem> | ||
</DropdownKebab> | ||
</StopPropagationOnClick> | ||
)} | ||
</div> | ||
} | ||
/> | ||
); | ||
}; | ||
|
@@ -216,7 +285,9 @@ MigrationInProgressListItem.propTypes = { | |
setMigrationsFilterAction: PropTypes.func, | ||
cancelPlanRequestAction: PropTypes.func, | ||
isCancellingPlanRequest: PropTypes.bool, | ||
requestsProcessingCancellation: PropTypes.array | ||
requestsProcessingCancellation: PropTypes.array, | ||
loading: PropTypes.bool, | ||
toggleScheduleMigrationModal: PropTypes.func | ||
}; | ||
|
||
export default MigrationInProgressListItem; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 2 locations. Consider refactoring.