Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
Merge pull request #476 from AparnaKarve/i18n_migration_status_constants
Browse files Browse the repository at this point in the history
Migration Status string constants for i18n
(cherry picked from commit 8646fc4)

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1608752
  • Loading branch information
AllenBW authored and simaishi committed Jul 31, 2018
1 parent 2172a24 commit f930061
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 17 deletions.
45 changes: 45 additions & 0 deletions app/javascript/react/screens/App/Plan/PlanConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,48 @@ export const RESET_PLAN_STATE = 'RESET_PLAN_STATE';
export const FETCH_V2V_MIGRATION_TASK_LOG = 'FETCH_V2V_MIGRATION_TASK_LOG';
export const DOWNLOAD_LOG_CLICKED = 'DOWNLOAD_LOG_CLICKED';
export const DOWNLOAD_LOG_COMPLETED = 'DOWNLOAD_LOG_COMPLETED';

export const STATUS_MESSAGE_KEYS = {
ACQUIRE_TRANSFORMATION_HOST: 'Acquire Transformation Host',
ASSESS_MIGRATION: 'Assess Migration',
AUTOMATION_STARTING: 'Automation Starting',
COLLAPSE_SNAPSHOTS: 'Collapse Snapshots',
CONVERT_DISKS: 'Convert disks',
SOURCE_MIGRATED: 'Mark source as migrated',
MIGRATING: 'Migrating',
MIGRATION_COMPLETE: 'Migration complete',
POWER_OFF: 'Power off',
POWER_ON: 'Power-on VM',
PRE_MIGRATION: 'Pre-migration',
REFRESH_INVENTORY: 'Refresh inventory',
RESTORE_VM_ATTRIBUTES: 'Restore VM Attributes',
MIGRATE_VM: 'Transform VM',
UPDATE_DESCRIPTION: 'Update description of VM',
VALIDATING: 'Validating',
VM_MIGRATIONS_COMPLETED: 'VM Transformations completed',
VM_MIGRATED: 'Virtual machine migrated',
VM_MIGRATIONS_FAILED: 'VM Transformations failed'
};

const STATUS_MESSAGES = {};
STATUS_MESSAGES[STATUS_MESSAGE_KEYS.ACQUIRE_TRANSFORMATION_HOST] = __('Acquire Transformation Host');
STATUS_MESSAGES[STATUS_MESSAGE_KEYS.ASSESS_MIGRATION] = __('Assess Migration');
STATUS_MESSAGES[STATUS_MESSAGE_KEYS.AUTOMATION_STARTING] = __('Automation Starting');
STATUS_MESSAGES[STATUS_MESSAGE_KEYS.COLLAPSE_SNAPSHOTS] = __('Collapse Snapshots');
STATUS_MESSAGES[STATUS_MESSAGE_KEYS.CONVERT_DISKS] = __('Convert disks');
STATUS_MESSAGES[STATUS_MESSAGE_KEYS.SOURCE_MIGRATED] = __('Mark source as migrated');
STATUS_MESSAGES[STATUS_MESSAGE_KEYS.MIGRATING] = __('Migrating');
STATUS_MESSAGES[STATUS_MESSAGE_KEYS.MIGRATION_COMPLETE] = __('Migration complete');
STATUS_MESSAGES[STATUS_MESSAGE_KEYS.POWER_OFF] = __('Power off');
STATUS_MESSAGES[STATUS_MESSAGE_KEYS.POWER_ON] = __('Power-on VM');
STATUS_MESSAGES[STATUS_MESSAGE_KEYS.PRE_MIGRATION] = __('Pre-migration');
STATUS_MESSAGES[STATUS_MESSAGE_KEYS.REFRESH_INVENTORY] = __('Refresh inventory');
STATUS_MESSAGES[STATUS_MESSAGE_KEYS.RESTORE_VM_ATTRIBUTES] = __('Restore VM Attributes');
STATUS_MESSAGES[STATUS_MESSAGE_KEYS.MIGRATE_VM] = __('Migrate VM');
STATUS_MESSAGES[STATUS_MESSAGE_KEYS.UPDATE_DESCRIPTION] = __('Update description of VM');
STATUS_MESSAGES[STATUS_MESSAGE_KEYS.VALIDATING] = __('Validating');
STATUS_MESSAGES[STATUS_MESSAGE_KEYS.VM_MIGRATIONS_COMPLETED] = __('VM migrations completed');
STATUS_MESSAGES[STATUS_MESSAGE_KEYS.VM_MIGRATED] = __('Virtual machine migrated');
STATUS_MESSAGES[STATUS_MESSAGE_KEYS.VM_MIGRATIONS_FAILED] = __('VM migrations failed');

export { STATUS_MESSAGES as V2V_MIGRATION_STATUS_MESSAGES };
13 changes: 10 additions & 3 deletions app/javascript/react/screens/App/Plan/PlanReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Immutable from 'seamless-immutable';
import numeral from 'numeral';
import commonUtilitiesHelper from '../common/commonUtilitiesHelper';
import getMostRecentVMTasksFromRequests from '../Overview/components/Migrations/helpers/getMostRecentVMTasksFromRequests';
import { IsoElapsedTime } from '../../../../components/dates/IsoElapsedTime';

import {
FETCH_V2V_PLAN,
Expand All @@ -10,7 +11,9 @@ import {
RESET_PLAN_STATE,
FETCH_V2V_MIGRATION_TASK_LOG,
DOWNLOAD_LOG_CLICKED,
DOWNLOAD_LOG_COMPLETED
DOWNLOAD_LOG_COMPLETED,
V2V_MIGRATION_STATUS_MESSAGES,
STATUS_MESSAGE_KEYS
} from './PlanConstants';

export const initialState = Immutable({
Expand Down Expand Up @@ -42,11 +45,13 @@ const processVMTasks = vmTasks => {
vmTasks.forEach(task => {
const taskDetails = {
id: task.id,
message: task.message,
message: V2V_MIGRATION_STATUS_MESSAGES[task.message],
transformation_host_name: task.options && task.options.transformation_host_name,
delivered_on: new Date(task.options.delivered_on),
updated_on: new Date(task.updated_on),
completed: task.message === 'VM Transformations completed' || task.message === 'VM Transformations failed',
completed:
task.message === STATUS_MESSAGE_KEYS.VM_MIGRATIONS_COMPLETED ||
task.message === STATUS_MESSAGE_KEYS.VM_MIGRATIONS_FAILED,
state: task.state,
status: task.status,
options: {}
Expand Down Expand Up @@ -78,6 +83,8 @@ const processVMTasks = vmTasks => {
taskDetails.startDateTime = startDateTime;
taskDetails.lastUpdateDateTime = lastUpdateDateTime;

taskDetails.elapsedTime = IsoElapsedTime(new Date(startDateTime), new Date(lastUpdateDateTime));

if (taskDetails.completed) {
taskDetails.completedSuccessfully =
task.options.progress.current_description === 'Virtual machine migrated' ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
ACTIVE_PLAN_SORT_FIELDS,
FINISHED_PLAN_SORT_FIELDS
} from './PlanRequestDetailListConstants';
import { V2V_MIGRATION_STATUS_MESSAGES } from '../../PlanConstants';
import TickingIsoElapsedTime from '../../../../../../components/dates/TickingIsoElapsedTime';

class PlanRequestDetailList extends React.Component {
Expand Down Expand Up @@ -338,15 +339,20 @@ class PlanRequestDetailList extends React.Component {
const label = sprintf(__('%s of %s Migrated'), task.diskSpaceCompletedGb, task.totalDiskSpaceGb);

const popoverContent = (
<Popover id={`popover${task.id}${n}`} title={task.message} className="task-info-popover">
<Popover
id={`popover${task.id}${n}`}
title={V2V_MIGRATION_STATUS_MESSAGES[task.message]}
className="task-info-popover"
>
<div>
<div>
<b>{__('Started')}: </b>
<b>{__('Elapsed Time')}: </b>
{formatDateTime(task.startDateTime)}
</div>
<div>
<b>{__('Description')}: </b>
{task.options.progress && task.options.progress.current_description}
{task.options.progress &&
V2V_MIGRATION_STATUS_MESSAGES[task.options.progress.current_description]}
</div>
<div>
<b>{__('Conversion Host')}: </b>
Expand Down Expand Up @@ -381,7 +387,7 @@ class PlanRequestDetailList extends React.Component {
}}
>
<div>
<span style={{ textTransform: 'capitalize' }}>{task.message}</span>
<span>{task.message}</span>
&nbsp;
{/* Todo: revisit FieldLevelHelp props in patternfly-react to support this */}
<OverlayTrigger rootClose trigger="click" placement="left" overlay={popoverContent}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { V2V_MIGRATION_STATUS_MESSAGES, STATUS_MESSAGE_KEYS } from '../../PlanConstants';

export const FINISHED_PLAN_FILTER_TYPES = [
{
id: 'vmName',
Expand Down Expand Up @@ -27,24 +29,26 @@ export const ACTIVE_PLAN_FILTER_TYPES = [
placeholder: __('Filter by Status'),
filterType: 'select',
filterValues: [
{ title: __('Pending'), id: 'Pending' },
{ title: __('Validating'), id: 'Validating' },
{ title: __('Pre-migration'), id: 'Pre-migration' },
{ title: __('Migrating'), id: 'Migrating' },
{ title: V2V_MIGRATION_STATUS_MESSAGES[STATUS_MESSAGE_KEYS.VALIDATING], id: STATUS_MESSAGE_KEYS.VALIDATING },
{
title: V2V_MIGRATION_STATUS_MESSAGES[STATUS_MESSAGE_KEYS.PRE_MIGRATION],
id: STATUS_MESSAGE_KEYS.PRE_MIGRATION
},
{ title: V2V_MIGRATION_STATUS_MESSAGES[STATUS_MESSAGE_KEYS.MIGRATING], id: STATUS_MESSAGE_KEYS.MIGRATING },
{
title: __('VM Transformations completed'),
id: 'VM Transformations completed'
title: V2V_MIGRATION_STATUS_MESSAGES[STATUS_MESSAGE_KEYS.VM_MIGRATIONS_COMPLETED],
id: STATUS_MESSAGE_KEYS.VM_MIGRATIONS_COMPLETED
},
{
title: __('VM Transformations failed'),
id: 'VM Transformations failed'
title: V2V_MIGRATION_STATUS_MESSAGES[STATUS_MESSAGE_KEYS.VM_MIGRATIONS_FAILED],
id: STATUS_MESSAGE_KEYS.VM_MIGRATIONS_FAILED
}
]
}
];

export const FINISHED_PLAN_SORT_FIELDS = [
{ id: 'elapsedTime', title: __('Started'), isNumeric: false },
{ id: 'elapsedTime', title: __('Elapsed Time'), isNumeric: false },
{
id: 'vmName',
title: __('VM Name'),
Expand All @@ -54,7 +58,7 @@ export const FINISHED_PLAN_SORT_FIELDS = [
];

export const ACTIVE_PLAN_SORT_FIELDS = [
{ id: 'elapsedTime', title: __('Started'), isNumeric: false },
{ id: 'elapsedTime', title: __('Elapsed Time'), isNumeric: false },
{
id: 'vmName',
title: __('VM Name'),
Expand Down

0 comments on commit f930061

Please sign in to comment.