forked from kubev2v/forklift-console-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
If a migration task isn't completed but the migration is successful, …
…mark task as successful, Reference: kubev2v#1305 In case a migraiton task is not marked as finished (i.e. task.phase is undefined), but its pipeline step is marked as completed succesfully then mark the task as completed succesfully as well. Signed-off-by: Sharon Gratch <[email protected]>
- Loading branch information
Showing
4 changed files
with
35 additions
and
2 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
22 changes: 22 additions & 0 deletions
22
...es/forklift-console-plugin/src/modules/Plans/views/details/utils/hasPipelineCompleted.tsx
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,22 @@ | ||
import { V1beta1PlanStatusMigrationVmsPipeline } from '@kubev2v/types'; | ||
|
||
/** | ||
* Check if a given migration's pipeline step has completed successfully. | ||
* | ||
* @param {V1beta1PlanStatusMigrationVmsPipeline} pipeline - A given migration's pipeline step | ||
* @returns {boolean} - True if the migration step has completed successfully, false otherwise. | ||
*/ | ||
const hasPipelineCompleted = (pipeline: V1beta1PlanStatusMigrationVmsPipeline) => | ||
!pipeline?.error && pipeline?.phase === 'Completed'; | ||
|
||
/** | ||
* Check if the task isn't marked as finished, but its contained pipeline step has completed successfully. | ||
* | ||
* @param {string } taskPhase A given task phase | ||
* @param {V1beta1PlanStatusMigrationVmsPipeline} pipeline - A given migration's pipeline step which includes the task | ||
* @returns {boolean} - Returns True if the task isn't marked as finished, but its contained pipeline step has completed successfully. | ||
*/ | ||
export const isTaskCompletedByItsPipeline = ( | ||
taskPhase: string, | ||
pipeline: V1beta1PlanStatusMigrationVmsPipeline, | ||
) => taskPhase === undefined && hasPipelineCompleted(pipeline); |
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