This repository has been archived by the owner on Apr 28, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CreateVmDialog: V2V VMware report deployment status and all errors
- Loading branch information
Showing
45 changed files
with
1,454 additions
and
93 deletions.
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
30 changes: 30 additions & 0 deletions
30
...components/Wizard/CreateVmWizard/providers/VMwareImportProvider/VMWareControllerErrors.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,30 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
import { ResultTabRow } from '../../ResultTabRow'; | ||
|
||
const VMWareControllerErrors = ({ id, errors }) => { | ||
if (!errors) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<div id={id}> | ||
{errors.map((result, index) => ( | ||
<ResultTabRow key={index} {...result} /> | ||
))} | ||
</div> | ||
); | ||
}; | ||
|
||
VMWareControllerErrors.defaultProps = { | ||
id: null, | ||
errors: null, | ||
}; | ||
|
||
VMWareControllerErrors.propTypes = { | ||
id: PropTypes.string, | ||
errors: PropTypes.array, | ||
}; | ||
|
||
export default VMWareControllerErrors; |
137 changes: 137 additions & 0 deletions
137
...ponents/Wizard/CreateVmWizard/providers/VMwareImportProvider/VMWareControllerStatusRow.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,137 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
import { Alert, Col, FormGroup, Spinner } from 'patternfly-react'; | ||
|
||
import { Link } from 'react-router-dom'; | ||
|
||
import { | ||
getV2vVMwareDeploymentStatus, | ||
V2V_WMWARE_DEPLOYMENT_STATUS_FAILED, | ||
V2V_WMWARE_DEPLOYMENT_STATUS_POD_FAILED, | ||
V2V_WMWARE_DEPLOYMENT_STATUS_PROGRESSING, | ||
V2V_WMWARE_DEPLOYMENT_STATUS_ROLLOUT_COMPLETE, | ||
V2V_WMWARE_DEPLOYMENT_STATUS_UNKNOWN, | ||
} from '../../../../../utils/status/v2vVMwareDeployment'; | ||
|
||
import VMwareStatusField from './VMwareStatusField'; | ||
import { FormRow } from '../../../../Form/FormRow'; | ||
import { getName } from '../../../../../selectors'; | ||
|
||
import { getSubPagePath } from '../../../../../utils'; | ||
import { DeploymentModel, PodModel } from '../../../../../models'; | ||
|
||
const DeploymentLink = ({ deployment }) => ( | ||
<Link to={getSubPagePath(deployment, DeploymentModel, 'events')}>{getName(deployment)}</Link> | ||
); | ||
|
||
DeploymentLink.defaultProps = { | ||
deployment: null, | ||
}; | ||
|
||
DeploymentLink.propTypes = { | ||
deployment: PropTypes.object, | ||
}; | ||
|
||
const NoDeployment = () => ( | ||
<VMwareStatusField> | ||
Starting VMware controller... <Spinner loading size="sm" /> | ||
</VMwareStatusField> | ||
); | ||
|
||
const DeploymentProgressing = ({ id, deployment }) => ( | ||
<VMwareStatusField id={id}> | ||
Deploying VMware controller (<DeploymentLink deployment={deployment} /> | ||
)... <Spinner loading size="sm" /> | ||
</VMwareStatusField> | ||
); | ||
|
||
DeploymentProgressing.defaultProps = { | ||
deployment: null, | ||
id: null, | ||
}; | ||
|
||
DeploymentProgressing.propTypes = { | ||
deployment: PropTypes.object, | ||
id: PropTypes.string, | ||
}; | ||
|
||
const DeploymentFailed = ({ deployment, pod, message }) => { | ||
let podMessage; | ||
if (pod) { | ||
podMessage = ( | ||
<React.Fragment> | ||
{' '} | ||
Please inspect a failing pod <Link to={getSubPagePath(pod, PodModel, 'events')}>{getName(pod)}</Link> | ||
</React.Fragment> | ||
); | ||
} | ||
return ( | ||
<VMwareStatusField> | ||
<Alert type="warning"> | ||
Deployment of VMware controller <DeploymentLink deployment={deployment} /> failed: {message}.{podMessage} | ||
</Alert> | ||
</VMwareStatusField> | ||
); | ||
}; | ||
|
||
DeploymentFailed.defaultProps = { | ||
...DeploymentProgressing.defaultProps, | ||
pod: null, | ||
message: null, | ||
}; | ||
|
||
DeploymentFailed.propTypes = { | ||
...DeploymentProgressing.propTypes, | ||
pod: PropTypes.object, | ||
message: PropTypes.string, | ||
}; | ||
|
||
const vmwareStatusComponentResolver = { | ||
[V2V_WMWARE_DEPLOYMENT_STATUS_PROGRESSING]: DeploymentProgressing, | ||
[V2V_WMWARE_DEPLOYMENT_STATUS_POD_FAILED]: DeploymentFailed, | ||
[V2V_WMWARE_DEPLOYMENT_STATUS_FAILED]: DeploymentFailed, | ||
}; | ||
|
||
const VMWareControllerStatusRow = props => { | ||
const { id, hasErrors, deployment, deploymentPods, controlSize, labelSize } = props; | ||
|
||
const status = getV2vVMwareDeploymentStatus(deployment, deploymentPods); | ||
if ( | ||
status.status === V2V_WMWARE_DEPLOYMENT_STATUS_ROLLOUT_COMPLETE || | ||
(status.status === V2V_WMWARE_DEPLOYMENT_STATUS_UNKNOWN && hasErrors) // deployment failed | ||
) { | ||
return null; | ||
} | ||
|
||
const StatusComponent = vmwareStatusComponentResolver[status.status] || NoDeployment; | ||
|
||
return ( | ||
<FormGroup> | ||
<Col sm={labelSize} /> | ||
<Col sm={controlSize}> | ||
<StatusComponent id={id} {...status} /> | ||
</Col> | ||
</FormGroup> | ||
); | ||
}; | ||
|
||
VMWareControllerStatusRow.defaultProps = { | ||
id: null, | ||
hasErrors: false, | ||
deployment: null, | ||
deploymentPods: null, | ||
controlSize: FormRow.defaultProps.controlSize, | ||
labelSize: FormRow.defaultProps.labelSize, | ||
}; | ||
|
||
VMWareControllerStatusRow.propTypes = { | ||
id: PropTypes.string, | ||
hasErrors: PropTypes.bool, | ||
deployment: PropTypes.object, | ||
deploymentPods: PropTypes.array, | ||
controlSize: FormRow.propTypes.controlSize, | ||
labelSize: FormRow.propTypes.labelSize, | ||
}; | ||
|
||
export default VMWareControllerStatusRow; |
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.