Skip to content

Conversation

@aTurmo
Copy link
Contributor

@aTurmo aTurmo commented Nov 19, 2025

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.

ref: #TAPC-5306

Signed-off-by: Adrien Turmo <[email protected]>
ref: #TAPC-5306

Signed-off-by: Adrien Turmo <[email protected]>
@aTurmo aTurmo requested review from a team as code owners November 19, 2025 10:35
@aTurmo aTurmo changed the base branch from feat/TAPC-4416_distant_backup_lot_2_light to epic/TAPC-4378_automatic_volume_backup November 19, 2025 10:39
@aTurmo aTurmo force-pushed the feat/TAPC-5306_refactoring_workflow branch from 8e2956f to 5fb8077 Compare November 19, 2025 10:44
if (enabled) {
return useInstanceSnapshotPricing;
}
return () => ({}) as ReturnType<typeof useInstanceSnapshotPricing>;
Copy link
Contributor

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 = (
Copy link
Contributor

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) =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion
this functions is doing a lot of things, and lean on a mutation on data
Maybe you could cut this function into differnet part sort and filter

Copy link
Contributor Author

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]>
@aTurmo aTurmo requested a review from ppprevost November 21, 2025 10:46
const { id: sortKey, desc } = sorting;

data.sort(defaultCompareFunction(sortKey as keyof Omit<TWorkflow, 'executions'>));
data.sort(defaultCompareFunction(sortKey as WorkflowKeys));
Copy link
Contributor

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(...)
```

Copy link
Contributor Author

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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants