-
Notifications
You must be signed in to change notification settings - Fork 112
feat(pci-worklow): Refactoring workflow to improve genericity #20504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: epic/TAPC-4378_automatic_volume_backup
Are you sure you want to change the base?
feat(pci-worklow): Refactoring workflow to improve genericity #20504
Conversation
ref: #TAPC-5306 Signed-off-by: Adrien Turmo <[email protected]>
ref: #TAPC-5306 Signed-off-by: Adrien Turmo <[email protected]>
ref: #TAPC-5306 Signed-off-by: Adrien Turmo <[email protected]>
… and not an instance ref: #TAPC-5306 Signed-off-by: Adrien Turmo <[email protected]>
ref: #TAPC-5306 Signed-off-by: Adrien Turmo <[email protected]>
ref: #TAPC-5306 Signed-off-by: Adrien Turmo <[email protected]>
ref: #TAPC-5306 Signed-off-by: Adrien Turmo <[email protected]>
8e2956f to
5fb8077
Compare
| if (enabled) { | ||
| return useInstanceSnapshotPricing; | ||
| } | ||
| return () => ({}) as ReturnType<typeof useInstanceSnapshotPricing>; |
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.
question: why a void function ?
| export const isSameResource = (a: TWorkflowResourceId, b: TWorkflowResourceId): boolean => | ||
| a.id === b.id && a.region === b.region; | ||
|
|
||
| export const getResourcePricing = ( |
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.
issue: it is a hook because you call a useInstanceSnapshotPricing which is a hook
| type WorkflowKeys = keyof Omit<TWorkflow, 'executions'>; | ||
| type WorkflowKeys = keyof Omit<TInstanceBackupWorkflow, 'executions'>; | ||
| const keys: WorkflowKeys[] = ['name', 'instanceName', 'cron']; | ||
| return data.filter((workflow) => |
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.
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.
I did something tell me if it's better
ref: #TAPC-5306 Signed-off-by: Adrien Turmo <[email protected]>
ref: #TAPC-5306 Signed-off-by: Adrien Turmo <[email protected]>
| const { id: sortKey, desc } = sorting; | ||
|
|
||
| data.sort(defaultCompareFunction(sortKey as keyof Omit<TWorkflow, 'executions'>)); | ||
| data.sort(defaultCompareFunction(sortKey as WorkflowKeys)); |
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.
it appears that sort has a side effect on data. Maybe you could encapsulate it into a function and then call it before filtering your data
const applySort = (workflow)=> {
const data = [...workflow].sort(defaultCompareFunction(sortKey as WorkflowKeys)
return desc ? data.reverse() : data
}
-->
const data = applySort(workflow)
return data.filter(...)
```
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.
done
ref: #TAPC-5344 Signed-off-by: Adrien Turmo <[email protected]>
ref: #TAPC-5306
Currently the application is too much linked specifically to automatic instance backup and the aim is to break this in order to be able to more easily add another workflow.
This is done in preparation to the new automatic volume backup workflow.
This PR is separated in thematic commits.