refactor(command-menu-item): rename Actions to CommandMenuItem (#18489)
actions are being renamed to command menu item, they will be migrated to server and will be served as headless front components --------- Co-authored-by: Raphaël Bosi <71827178+bosiraphael@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
import { type ObjectRecordQueryProgress } from '@/object-record/types/ObjectRecordQueryProgress';
|
||||
|
||||
export const computeProgressText = (
|
||||
progress?: ObjectRecordQueryProgress,
|
||||
): string => {
|
||||
if (
|
||||
!isDefined(progress) ||
|
||||
!isDefined(progress.processedRecordCount) ||
|
||||
progress.processedRecordCount === 0
|
||||
) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (isDefined(progress.totalRecordCount)) {
|
||||
const percentage =
|
||||
progress.totalRecordCount > 0
|
||||
? Math.round(
|
||||
(progress.processedRecordCount / progress.totalRecordCount) * 100,
|
||||
)
|
||||
: 0;
|
||||
|
||||
return ` (${percentage}%)`;
|
||||
}
|
||||
|
||||
return ` (${progress.processedRecordCount})`;
|
||||
};
|
||||
Reference in New Issue
Block a user